Getting the right context to the model: hybrid search with reranking, and evaluating RAG pipelines.
Pure dense (vector) retrieval is the default in most RAG tutorials and the wrong default in most real systems. The moment your corpus contains identifiersā¦
RAG systems fail in interesting ways: the retriever returns the wrong chunks, the model ignores the chunks it did get, the model invents citations, theā¦
Retrieval-augmented generation answers questions by fetching relevant passages from your own data and placing them in the prompt. The quality of the answer is bounded by the quality of retrieval: if the right passage is not in the context window, no amount of prompt engineering will produce a grounded answer. This section covers the two halves of getting retrieval right, improving it and measuring it.
Hybrid Search and Reranking combines lexical BM25 scoring, which is strong on exact identifiers, error codes, and rare names, with dense vector similarity, which is strong on paraphrase and meaning. Results are merged, commonly with reciprocal rank fusion, and a cross-encoder reranker then re-scores the top candidates with the query and passage read together. RAG Evaluation with RAGAS defines metrics such as faithfulness, answer relevancy, context precision, and context recall, and shows how to build an evaluation set so changes to chunking, embeddings, or reranking can be compared with numbers rather than impressions.
The two pages are designed to be read together. Retrieval changes are easy to make and hard to judge by eye, because a single impressive answer says little about the hundreds of questions users will actually ask. Evaluation turns each change into a measurable experiment, and the measurements in turn point to which retrieval stage needs work next.
| Situation | Start with |
|---|---|
| Answers miss obvious documents containing exact terms | Hybrid search (add BM25) |
| Right documents retrieved but ranked too low | Reranking |
| Unsure whether a change helped | RAGAS evaluation set |
| Answers contain claims not in the context | RAGAS faithfulness, then prompt and context fixes |
A practical order is: build a small evaluation set first, measure the baseline, then add hybrid retrieval and reranking one at a time. For the storage layer behind retrieval, see the vector databases section, and for the wider LLM application stack see LLM Engineering.