Glossary

Retriever

The component of a RAG system that takes a query, searches an indexed collection and returns the passages most likely to answer it.

A retriever is the component of a retrieval-augmented generation system that finds the information a language model needs. It takes a query, searches an indexed collection of documents and returns a short, ranked list of passages, which are then added to the model’s prompt. The retriever decides what the model gets to see, so many wrong or unsupported answers trace back to what it returned rather than to the model itself.

How a retriever works in RAG

In a RAG system the work splits into two stages. Before any query arrives, documents are ingested, split by chunking and indexed. At query time the retriever turns the question into a search: an embedding of the query, a keyword query or both. It scores candidate chunks, returns the best few with their scores, and the generator, the language model, writes an answer grounded in those passages.

In frameworks such as LangChain and LlamaIndex, compared in LangChain vs LlamaIndex, a retriever is also a specific interface: an object that accepts a query string and returns documents, whatever search sits behind it.

Types of retriever

Type

How it matches

Good at

Weak at

Keyword (sparse)

Term overlap, scored with BM25 or TF-IDF

Exact names, codes and rare terms

Paraphrases and synonyms

Dense (vector)

Similarity between embeddings

Meaning and paraphrase

Exact identifiers

Hybrid

Keyword and vector scores combined

Both kinds of query

More settings to tune

Multi-vector

Many vectors per passage, matched token by token

Fine-grained matching

Larger index and cost

Keyword retrievers rank by term overlap, usually with BM25. Dense retrieval compares vectors produced by an embedding model. Hybrid search runs both and merges the two ranked lists, often with reciprocal rank fusion. Dense vs sparse retrieval covers when each one wins.

Retrieval strategies beyond top-k

The simplest retriever returns a fixed number of chunks, known as top-k retrieval. Many systems add steps around it. Query expansion and HyDE rewrite or enrich the query before searching. A reranking stage, often a cross-encoder, rescores candidates more carefully. Parent document retrieval matches small chunks but returns the larger section around them, and multi-hop retrieval searches several times when the answer spans documents. In agentic RAG, the agent decides when to call the retriever and with what query.

Each extra step adds latency and cost, and none of them can recover a passage the first search missed. Why reranking can’t fix a bad first pass makes that case in detail.

How to evaluate a retriever

Retrievers are measured on their own, so a retrieval failure is not mistaken for a model failure. Recall@k checks whether the right passage appears in the top k results, mean reciprocal rank rewards placing it near the top, and NDCG handles graded relevance. RAG evaluation adds context precision and context recall, which ask whether the returned passages were relevant and complete. A few dozen real questions with known answers are usually enough to compare settings.

Retrievers and Exabase

Exabase provides the retrieval layer, so the retriever in a RAG system can be one API call; prompt assembly and answer generation stay in your application. Deep Search searches content stored in a Base using sub-document retrieval and returns, for each hit, the matched chunks with relevance scores, page numbers for documents and timestamp ranges for audio and video. Text queries are hybrid by default, combining semantic search with typo-tolerant keyword matching, and a phrase in double quotes forces an exact match. A precision parameter from 0 to 1, defaulting to 0.3, trades recall for relevance per query, and filters narrow results by kind, folder, tag or date. The search endpoint and the searching resources guide document the options.

Content is indexed when it is stored as Resources, so there is no chunking or embedding pipeline to run. For facts about the user and past conversations, Memory search acts as a second retriever with recency weighting, query expansion and reranking. RAG accuracy explains how this helps when answers match the topic but miss the fact, the RAG pipelines use case shows a full setup, and Exabase vs OpenAI file search compares it with a managed retrieval tool.

FAQs

What is a retriever in RAG?

A retriever is the part of a RAG system that searches an indexed document collection for a query and returns the passages the language model uses to write its answer.

What is the difference between a retriever and a generator?

The retriever finds relevant passages, and the generator is the language model that reads them and writes the answer. They are usually evaluated separately so problems can be traced to the right stage.

What is the difference between a retriever and a vector database?

A vector database stores and searches embeddings. A retriever is the wider component that turns a query into a search, which may use a vector database, a keyword index or both, and returns results the model can use.

What is a dense retriever?

A dense retriever encodes the query and documents as embeddings and returns the passages whose vectors are closest to the query’s. It handles paraphrase well but can miss exact identifiers such as product codes.

What is a hybrid retriever?

A hybrid retriever combines keyword and vector search and merges their rankings, so it finds both exact terms and passages that use different wording. Hybrid search vs vector search compares the two approaches.

How many passages should a retriever return?

Enough to contain the answer and few enough that the model uses it. More passages raise token cost and can bury the right one, so teams often start with three to five and tune against a small evaluation set.

Can Exabase be the retriever in a RAG pipeline?

Yes. Store documents as Resources and call Deep Search with the user’s question; it returns ranked chunks with page numbers or timestamps for citations, ready to add to the prompt.

Related pages: RAG, Agentic RAG, Hybrid search, Reranking, Dense retrieval, Sub-document retrieval, Chunking, Deep Search, RAG accuracy, RAG pipelines use case, HyDE, Sentence window retrieval, Naive RAG, RAG pipeline, Source attribution, Embedding drift.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.