RAG

Also known as: Retrieval-Augmented Generation

Retrieval-augmented generation (RAG) retrieves relevant documents at query time and conditions the LLM on that context, instead of relying only on parametric memory.

Typical pipeline

  1. Chunk the corpus and embed passages
  2. Index in a vector database (often plus keyword / hybrid search)
  3. Retrieve top-$k$ (dense and/or sparse)
  4. Optional reranking
  5. Prompt the model with selected passages for grounding

Tradeoffs

Improves factual updatability and citation potential; fails when retrieval misses, chunks are wrong, or the model ignores context. CPT/SFT still help the model use retrieved text. Evaluate retrieval and generation separately.

← Back to AI Glossary