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
- Chunk the corpus and embed passages
- Index in a vector database (often plus keyword / hybrid search)
- Retrieve top-$k$ (dense and/or sparse)
- Optional reranking
- 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.