Retriever

A retriever is the component of a system that takes a query and returns a set of passages judged relevant to it — defined by that interface rather than by any particular algorithm or data structure inside it.

The word names a role. What sits behind it may be a vector index, a keyword engine, a database query, a web search API, or several of these with a merge step and a reranking pass. All of them are retrievers if they accept a query and hand back candidate text.

Naming the role is useful because it marks the boundary in a retrieval-augmented system where the search half ends and the generation half begins. Everything upstream of that boundary decides which text is available; everything downstream decides what to do with it. The two are tuned, measured, and fail separately.

The term arrived with the neural-retrieval literature and was cemented by the frameworks, most of which expose a retriever as a named abstraction with a single method. In those settings it is a class as well as a concept, which is why the word is heard more often in code than in papers.

In practice

A retriever in a working system is usually a small pipeline rather than one lookup. The stages that appear inside it are:

Query preparation. The incoming text may be embedded, tokenised, expanded, rewritten, or split into several queries. See query rewriting.

Candidate generation. One or more indexes are searched, each returning its own ranked list.

Merging. Where more than one method ran, the lists are combined into one. See hybrid search.

Filtering. Metadata conditions — date, source, and above all permission — remove candidates the caller may not see.

Reordering. A second, more accurate scoring pass may reorder what survives. See reranking.

All of that is hidden behind the same interface as a bare index lookup, which is what makes the abstraction worth having and also what makes a retriever hard to reason about from the outside. Two systems described identically as “using a retriever” may differ by every stage above.

Two properties hold regardless of the internals. A retriever returns a fixed number of results rather than however many are relevant, so it always returns something for an out-of-scope query. And it cannot return what the corpus does not contain, which makes its ceiling a property of ingestion rather than of search. See top-k and corpus.

Commonly confused with

Vector index. A data structure a retriever commonly uses. The index answers nearest-neighbour queries over vectors; the retriever answers “what should be read to respond to this question,” which may involve no vectors at all. See vector index.

Vector database. A system offering storage, an index, filtering, and an API. It can be the whole of a retriever’s implementation, but the retriever is the caller’s abstraction over it, and typically adds the embedding step and the query handling that the database does not perform.

Search engine. Broadly the same function with a different audience. A search engine’s output is read by a person and its interface includes ranking, snippets, and pagination. A retriever’s output is consumed by another program, usually a language model, and its result set is sized to a token budget rather than to a page.

RAG. The whole pattern, of which retrieval is one half. A retriever returns passages; a RAG system returns a generated answer. See semantic search.

Reranker. A component that reorders a candidate list. It may sit inside a retriever, but on its own it cannot search a collection — it only reorders what it is given.

Usage notes

In the frameworks it is a concrete type, not a concept. A named retriever class carries opinions about defaults, about how many results are returned, and about what happens on failure. Documentation slides between the general role and one library’s implementation of it without marking the change.

The word is also used for the model rather than the component. In research writing on dense retrieval, “the retriever” often means the encoder that produces the vectors, contrasted with “the reader” or “the generator.” Engineering writing means the whole search component. Both usages are current, and which is meant is usually clear only from context.

“Retriever” carries no commitment to a mechanism. A system that fetches rows by an identifier has a retriever. The word says that a query goes in and passages come out, and nothing about whether the matching is semantic, lexical, structured, or hard-coded.

Where permission filtering happens is a property of the retriever and frequently unstated. A retriever that filters after ranking returns fewer results than requested for a restricted reader; one that filters before searching may return different results for two readers asking the same question. Both behaviours are described the same way from outside.

See also

Vector index · Hybrid search · Reranking · Corpus