How are Recall and Precision metrics calculated in the context of document retrieval?
Asked at
AI answer
Document search is usually evaluated against relevant documents labeled for each query:
- Precision = number of retrieved relevant documents / total number of retrieved documents. It shows what proportion of the results are relevant.
- Recall = number of retrieved relevant documents / total number of relevant documents in the collection. It shows what proportion of all relevant documents were found.
For example, if the system returns 10 documents, 8 of which are relevant, and there are 20 relevant documents in total, then Precision = 8/10 = 0.8 and Recall = 8/20 = 0.4. For ranked results, Precision@k, Recall@k, MAP, or nDCG are often used as additional metrics. Calculating these metrics requires ground-truth relevance labels for a set of test queries.
Also asked at Т1 Иннотех
- What enables the OpenSearch engine to return results quickly across a huge database (what algorithm is it based on)?
- How would you build a system for evaluating the quality of a RAG pipeline and agents, including comparing versions when chunking changes and finding facts without using LLM-as-a-judge?
- Design an architecture for an enterprise GPT (a chat with an LLM and document uploads for RAG) for 5,000 users per week.
- How would you organize load testing for the designed service: what baseline scenarios, signs of degradation, and Kubernetes container metrics should be monitored?
- Give an example from your experience (resume) of a task similar to the asynchronous pipeline being designed.