Retrieval-Augmented Generation
Fetching relevant documents at query time and feeding them into the prompt, so a model answers from retrieved text rather than memory.
Retrieval-Augmented Generation is a pattern where a system searches an external corpus for content relevant to a query, then inserts the retrieved passages into the Prompt before the Large Language Model generates its answer. The name comes from a 2020 paper (Lewis et al., Facebook AI Research), but the technique predates the paper's terminology by however long people had been pasting search results into a prompt by hand.
The point is to let a model answer questions about content it was never trained on, or that changed after training — a company's internal wiki, this week's news, a codebase that didn't exist at training time — without retraining or fine-tuning anything. Retrieval is usually done over an Embedding index stored in a Vector Database, where the query itself gets embedded and compared against stored document embeddings by similarity, though keyword search (BM25) and hybrid approaches are common too, especially where exact term matches matter more than semantic similarity.
RAG's core failure mode is retrieval quality, not generation quality: if the wrong passages get retrieved, the model will often generate a fluent, confident answer built on the wrong material, which reads identically to a correct answer until someone checks the source. This is a different flavor of Hallucination than ungrounded generation — the model isn't inventing facts, it's faithfully summarizing the wrong facts it was handed — and it means RAG system quality lives or dies on retrieval precision, chunking strategy, and reranking, well before the generation step gets involved.
RAG competes conceptually with just widening the Context Window and pasting everything in, and the tradeoff is mostly Token Budget: retrieval costs an indexing pipeline and adds a failure mode, but scales to corpora far larger than any context window, while a big-enough window with no retrieval is simpler until the corpus outgrows it.
See also3
Reranking
Retrieving many candidates cheaply and then reordering a short list with a slower, more accurate model, the standard way search and RAG systems get relevant results into a limited context.
Agents & Language Models9 connections
Web Search Engine
A system that crawls the web, indexes what it finds, and ranks pages in answer to typed queries, the main way people have found things online since the late 1990s and one of the largest advertising businesses ever built.
Web Platform9 connections
In-Context Learning
A language model's ability to pick up a task from examples or instructions in its prompt, without any change to its weights, and the quirks of how it does so.
Agents & Language Models9 connections
Linked from7
- EmbeddingAgents & Language Models
A numeric vector representing a piece of content such that semantic similarity between items becomes geometric distance between vectors.
- Fine-TuningAgents & Language Models
Continuing to train an already-trained model on a narrower dataset to specialize its behavior, instead of prompting the base model.
- In-Context LearningAgents & Language Models
A language model's ability to pick up a task from examples or instructions in its prompt, without any change to its weights, and the quirks of how it does so.
- Precision and RecallAgents & Language Models
The two measures of how well a classifier or search finds what it should, how often its hits are right and how many of the real cases it catches, and why improving one usually costs the other.
- RerankingAgents & Language Models
Retrieving many candidates cheaply and then reordering a short list with a slower, more accurate model, the standard way search and RAG systems get relevant results into a limited context.
- Vector DatabaseAgents & Language Models
A datastore built to find the nearest neighbors of a high-dimensional vector quickly, at a scale exact search can't reach.
- Web Search EngineWeb Platform
A system that crawls the web, indexes what it finds, and ranks pages in answer to typed queries, the main way people have found things online since the late 1990s and one of the largest advertising businesses ever built.