Retrieval-Augmented Generation
Retrieval-augmented generation inserts relevant external documents into the prompt so answers are grounded in current or private knowledge.
Advanced Architecture
When to use
Use it for document QA, enterprise knowledge bases, current information, and hallucination reduction.
Prompt example
Task: Apply Retrieval-Augmented Generation to the user's request. Context: describe the input, constraints, target audience, and desired format. Instruction: be explicit, keep the output structured, and state any assumptions.
Output example
Structured answer based on the requested technique. Key result: the model follows the stated task and format. Notes: validate the output before using it in production.
Best practices
- Attach source identifiers to retrieved chunks.
- Limit the number of chunks to the most relevant set.
- Tell the model when to say the answer is not in the sources.
- Evaluate retrieval and generation separately.
Common pitfalls
- Poor retrieval quality limits answer quality.
- Irrelevant chunks distract the model.
- Conflicting sources need explicit resolution rules.