What is retrieval in AI? Definition and examples
On this page
Retrieval is the step where an AI system searches a document collection for the passages most likely to answer a question, before a model writes the answer.
How it works
Retrieval is the "R" in retrieval-augmented generation (RAG)Retrieval-augmented generation (RAG) is a technique where an AI system first looks up relevant documents, then writes its answer using what it found.. The 2020 paper that named RAG paired a language model with a "non-parametric memory": an index of documents searched by a neural retriever, so the model could look facts up instead of relying only on what it learned in training (Lewis et al.).
A typical retrieval pipeline has two halves.
Before any question: documents are split into short passages by chunkingChunking is splitting long documents into smaller passages before indexing, so an AI system can retrieve just the part of a page that answers a question.. Each passage is indexed twice in many systems: as a vector embeddingA vector embedding is one fixed-length list of numbers that a model produces for a piece of content, placing it near other content with a similar meaning. for search by meaning, and in a keyword index such as BM25 for exact words.
When a question arrives:
- The question is embedded and compared with the stored vectors to find the closest passages.
- A keyword search runs in parallel, which catches exact terms like product codes or error messages.
- The two result lists are merged, and a rerankingReranking is a second search step in which a model reorders a shortlist of retrieved passages by how well each one actually answers the user's question. model may reorder them.
- The top few passages go to the language model with the question.
Small improvements here matter. Anthropic reported that adding a short, generated context line to each chunk before indexing cut the rate of failed top-20 retrievals by 35% with embeddings alone, 49% when combined with keyword search, and 67% with reranking added, on its test sets. The same article notes that a knowledge base under about 200,000 tokens can sometimes skip retrieval and go into the prompt whole (Anthropic).
Why it matters for your website
An AI assistant on your site can only be as good as its retrieval. If the right passage is not found, the model either answers from the wrong one or, if it is well built, says it does not know. Many "wrong answers" are retrieval failures, not model failures.
You can help retrieval with your content:
- Give each section one topic and a heading that says what it is.
- Repeat the subject in the passage ("The Team plan includes SSO"), not just "It includes SSO".
- Put facts in text, not only in images, scanned PDFs or tabs that load late.
- Use the words visitors use alongside your product names.
Example
A visitor asks, "Do you support single sign-on on the Team plan?" Keyword search finds the security page passage that mentions "SAML". Search by meaning finds the pricing passage "Team: SSO with Okta and Azure AD". Both go to the model, which answers "Yes, on the Team plan" and links the pricing page. Without the second passage, the model would only know that SSO exists, not which plan includes it.
Related terms
- Retrieval-augmented generation (RAG): the pattern retrieval is part of.
- Semantic search: finding passages by meaning.
- Vector embedding: the representation that makes meaning searchable.
- Reranking: a second pass that reorders retrieved passages.
- Chunking: how documents are split before indexing.
- Knowledge base: the collection retrieval searches.
Sources
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (Lewis et al., 2020) — accessed October 21, 2026
- Introducing Contextual Retrieval (Anthropic, September 2024) — accessed October 21, 2026