BM25 comes from the Okapi system at City University in London, which Stephen Robertson's team presented as Okapi at TREC-3 in 1994. It ranks documents by the query words they contain, and it is the keyword half of hybrid search today.
A RAG pipeline fuses that ranking with one from a dense vector index, then reranks the candidates and passes the survivors to the model. A person scanning ten search results can skip a bad one, and a model reads whatever lands in the prompt as evidence.
Plain hybrid search came last of seven retrievers in the production benchmark the hybrid search guide reports, which is why this topic goes on to the stages after fusion.
Retrieval quality is decided before generation, so each retrieval stage gets measured on its own before the generated answer is judged.
Foundations
- Vector Embeddings: A Guide to the Geometry of Meaning in AI. Explains embeddings with a model run on six short texts, and shows why similarity scores mislead.
- Fine-Tuning vs RAG for Agent Memory: When Each Approach Makes Sense. Decides between fine-tuning and retrieval by which part of the problem each one solves.
Retrieval quality
- Hybrid Search: Combining BM25 and Vector Search. Fuses BM25 and vector retrieval with reciprocal rank fusion in runnable code, and reports a benchmark where plain hybrid search scored last.
- Reranking in RAG: Why Your Top-K Results Are Probably Wrong. Tests a bi-encoder against two cross-encoders on one set of candidates and reports what reranking fixed.
- How Anthropic's Contextual Retrieval Changes RAG Architecture. Covers Anthropic's method of prepending a model-written note to each chunk, with what it measured and what it costs.
Cost
- Semantic Caching: The RAG Optimization Nobody Talks About. Explains how a cache keyed on meaning returns stored responses for similar queries, and where it fails.
Evaluation
- RAG Evaluation Metrics: What Actually Matters. Covers RAGAs along with recall and precision, the metrics for judging a retrieval system.
Benchmarks
- PGlite vs SQLite-vec: Vector Search in the Browser. Compares PGlite and SQLite-vec for vector search in the browser, and says what to measure on real data.
Which stage of a RAG pipeline should be measured first?
Measure retrieval before generation, because a wrong chunk in the prompt reads as evidence. The guide to RAG evaluation covers recall and precision for the retrieved set.
Related topics
Agent memory reuses this retrieval stack for a different job, and the AI agent memory topic covers where the two differ.
A retrieved token costs latency and money like any other, and the LLM inference topic covers that budget.