ld.← ALL FIELD NOTESTHE RELATED CASE STUDY ↗
FIELD NOTES / 02RETRIEVAL   ·   RETRIEVAL & RAG

Why dense and sparse search work together.

I used to think of retrieval as searching a vector database. Working on a real pipeline showed me how much more there is to it.

Two ways to find relevance

Dense retrieval looks for semantic similarity. A query like “how to make an API faster” can surface a useful result about reducing latency, even if the wording is different.

Sparse retrieval focuses on lexical signals: the actual terms in a query. That makes it useful when specific names, abbreviations, or technical words carry meaning that a semantic match might miss.

TWO COMPLEMENTARY SIGNALS
01 / DENSEMeaning

“make an API faster”
↳ “reduce latency”

02 / SPARSEExact terms

Names, abbreviations,
and technical language.

Better together

In our pipeline, dense and sparse retrieval run as complementary ways to find candidates. Reciprocal Rank Fusion combines their ranked results, and a reranker then takes a closer look at the candidates.

The goal is not to declare one search method the winner. It is to use different signals to improve the chance that the right context reaches the LLM.

THE RETRIEVAL PIPELINE
QueryDense + sparseRRFRerankLLM

Continue the conversation

KEEP READING / 01Production RAG is a retrieval problem.

Another note from the notebook.