Calculate recall@k for a retrieval system used in RAG pipelines.
Recall@k measures what fraction of all relevant documents appear in the top-k retrieved results. In RAG, high recall@k is critical because any relevant information not retrieved cannot be used by the LLM to generate its answer.
Recall@k
recall@k = |relevant ∩ top_k| / |total_relevant|
Aim for recall@10 > 0.9 or recall@20 > 0.95. If the relevant chunk isn't retrieved, the LLM cannot use it regardless of its reasoning capability.
Use hybrid search (dense + sparse/BM25), re-ranking, query expansion, smaller chunks with overlap, or fine-tuned embedding models trained on your domain.