Retrieval-Augmented Generation (RAG)
An approach that grounds an LLM's responses in retrieved documents — the model searches a document set first, then generates its answer based on what it actually found, reducing hallucination.
Retrieval-augmented generation (RAG) is a technique that combines a language model with a document retrieval system. Instead of generating an answer purely from memory (training data), the model first searches a document set — a database of papers, a corpus of lab notes, a set of PDFs — retrieves relevant passages, and then generates its response based on those retrieved passages.
The practical effect is that the model’s output is grounded in actual source material rather than pattern-matched from training. This substantially reduces hallucination for factual questions, because the model is working from retrieved text rather than reconstructing facts from memory.
How it works:
- A query (your question or prompt) is encoded as a vector
- The system searches a vector database for passages with similar embeddings
- Retrieved passages are included in the prompt sent to the LLM
- The LLM generates a response using those passages as context
- The response can cite specific passages, making it verifiable
Research applications:
- Asking questions across a corpus of papers you’ve uploaded (what NotebookLM does)
- Querying internal lab documentation or literature collections
- Systematic review tools that retrieve specific papers before synthesizing findings
Limitations: RAG is only as good as its retrieval step. If the retrieval system doesn’t surface the right documents, the generation step has no good material to work from. It also requires that the relevant information exists in the document set — RAG can’t answer questions that aren’t covered by the uploaded documents.
Related terms: Hallucination (AI), Prompt Engineering
Related tools: NotebookLM, Elicit