RAG Explained
RAG — retrieval-augmented generation — is a simple contract: before the model answers, it reads your documents. It’s the standard fix for “the model doesn’t know our internal docs” and “it hallucinated our pricing.”
The Pipeline
- Chunk your documents into passages that each make sense alone.
- Embed the chunks (see Embeddings Explained) and store the vectors.
- Retrieve the top-k chunks nearest to the user’s question.
- Generate: hand the question plus the retrieved chunks to the model and ask for an answer grounded in them.
Steps 1–3 are search; step 4 is a language model with citations. Most “RAG failures” are actually search failures.
Where Quality Is Won and Lost
- Chunking is the biggest lever. Chunks too small lose context; too large drown the signal. A paragraph that survives being read alone is the right size.
- Retrieval sets the ceiling. If the right passage isn’t in the top-k, no model can recover. Test retrieval separately from generation: 50 real questions, check the passages, not the answers.
- Grounding is a prompt, not a feature. Tell the model to answer only from the passages and to say “not in the documents” otherwise — then verify that behavior with adversarial questions.
- Context budget: chunks share the same context window as conversation history. A long-context model isn’t a license to stuff; relevance still beats volume.
When RAG Is the Wrong Tool
- Structured lookups: if the answer lives in a database row, call the database — tool use beats retrieval for exact facts.
- Tiny static corpora: paste the docs into the prompt and skip the vector store.
- Fresh public web answers: a browsing tool is retrieval too; RAG over your own index won’t help.
Choosing the Models
Two choices, not one: the embedding model (sticky — switching means re-encoding everything) and the generation model (swap freely). The generation side mostly needs strong instruction-following and low hallucination rates — check the cited rows on each model sheet rather than headlines. For self-hosted options, see Open Weights and the servers directory.
Related Reading
- Embeddings Explained — the retrieval engine.
- What Is an AI Model — the generation half.
- Choosing a Model by Use Case — RAG-shaped requirements.
Keep reading
Field reports: what people actually run (usage signals, Nov 2026)
Curated usage-signal reports from public spend and preference data — which models people pay to run, per task, and where the surprises are. Editorial, fully sourced.
Long-Context Retrieval: What MRCR Actually Measures
Multi-Round Co-reference Resolution explains why a 1M-token context window is not the same thing as a 1M-token memory. How to read the MRCR rows on our spec sheets.