RAG is what you build when you accept that an LLM is a fixed-weight reasoning engine, not a database.
Two problems force RAG into existence:
1. The context window problem. Even a 1M-token context window doesn't hold your enterprise corpus, doesn't refresh as your knowledge changes, and turns "answer one question" into a million-token bill. Stuffing everything into context is economically unviable above ~10MB of source.
2. The hallucination floor. Without grounding, models confabulate. They produce plausible, fluent, wrong answers — and they do it confidently. Confidence calibration on closed-book QA is famously broken (see the original OpenAI TruthfulQA paper, arxiv 2109.07958).
The RAG pattern: at inference time, retrieve a small, relevant slice of your corpus and inject it into the prompt as grounding. The model now reasons over evidence you control instead of over its parametric memory.
Three things matter:
- Recall of retrieval. If the right chunk isn't in your top-K, the model can't answer correctly. This is your single biggest failure mode.
- Faithfulness of generation. Even with the right chunk, the model can ignore it and hallucinate. RAGAS
faithfulnessmeasures this. - Latency. You added an embed → retrieve → re-rank hop in front of generation. Production budgets get tight fast.
The mental model: RAG is a prompt-construction strategy. Everything else (vector DBs, chunking, re-ranking) is infrastructure to make the prompt good.