ModelRefs / Retrieval Pipeline — AI Glossary
Retrieval Pipeline — AI Glossary
The end-to-end process of transforming a user query into retrieved documents: query processing, indexing, search, reranking, and filtering.
Overview
A complete retrieval pipeline includes: query normalization and expansion, vector/sparse search, metadata filtering, cross-encoder reranking, context compression, and result deduplication. Each stage can be tuned independently. LlamaIndex, LangChain, Haystack, and Weaviate provide pipeline-as-code abstractions.
Reference details
| Topic | rag |
|---|---|
| Last reviewed | 2026-06-24 |
Related terms
How it works
- The query is normalised and often rewritten or expanded, since the text a user typed and the text that retrieves well are frequently not the same string.
- One or more retrievers produce a candidate set — dense vector search, sparse lexical search, or both with their scores fused into a single ranking.
- Metadata filters are applied to restrict candidates by permission, recency or document type, and whether this happens before or after the vector search changes both recall and latency.
- A cross-encoder reranker then scores each surviving candidate against the query jointly, which is more accurate than vector similarity and too slow to run over the whole corpus.
- Survivors are compressed or deduplicated to fit the context budget, which is the last stage at which content is discarded.
- Every stage only ever narrows the set, so recall is non-increasing from one end to the other: a document dropped at filtering cannot be recovered by reranking, which is why the stages must be measured in order rather than from the output backwards.
Example: Where quality is actually lost
A pipeline is query rewriting → search → filter → rerank → compress → generate. When answers are poor, the instinct is to change the model, but the loss is usually upstream: chunks split mid-sentence, a metadata filter excluding valid documents, or reranking absent so the model reads whatever the index ranked first. Measure each stage before touching the last one.
Commonly confused with
The pipeline is not the vector database. The database is one stage — storage and nearest-neighbour search. Chunking, query processing, filtering, reranking and compression sit around it, and most retrieval quality problems live in those stages rather than in the index.
When to use it
Reach for it when:
- Retrieval quality is inconsistent and you need to isolate which stage is failing
- You are combining several retrieval strategies and need one order
- Different document types need different chunking or filtering
Reach for something else when:
- The corpus is small and simple — stages add latency and failure modes
- You are adding stages without measuring each one; complexity hides the real fault
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Retrieval Pipeline — AI Glossary.
Frequently asked questions
What is Retrieval Pipeline?
The end-to-end process of transforming a user query into retrieved documents: query processing, indexing, search, reranking, and filtering.
What concepts are related to Retrieval Pipeline?
Closely related concepts include indexing pipeline, advanced rag, modular rag.