Retrieval-Augmented Generation (RAG)
Also known as: Retrieval-Augmented Generation, Retrieval Augmented Generation
Fetch relevant docs at inference time and stuff them into the prompt so the model can answer from real data.
A pattern that augments an LLM with an external retrieval step: relevant documents are fetched from a knowledge base and injected into the prompt context, reducing hallucination and grounding responses in real data.
In practice
Default architecture for LLM apps that need fresh or domain-specific knowledge. Expect deep questions on chunking, retrieval quality, and the read-vs-write trade-off versus fine-tuning.
How it compares
RAG injects context at inference time without changing weights; fine-tuning bakes knowledge into the weights.
Comparisons that include Retrieval-Augmented Generation (RAG)
Related topics
Practice questions
Related terms
AI System Design
End-to-end design of production LLM systems: ingestion, retrieval, serving, eval, monitoring.
BM25
Classical TF-IDF-style lexical scoring: a surprisingly strong baseline, still the first stage of many hybrid RAG pipelines.
Chunking
Cutting documents into retrievable pieces before embedding them.
Context Engineering
Deciding what makes it into the model's context window (prompt + RAG + history + memory), and why.
Context Rot
Long-running chats degrade: early instructions get forgotten, and tool calls become less reliable.
Context Window
The max number of tokens a model can attend to at once.