Table of contents
Large language models know a lot, but they do not know your documents, your policies or anything that happened after training. Retrieval-augmented generation fixes that by fetching relevant context at question time.
The pipeline
Chunking
Split documents into passages that preserve meaning. Chunk by structure (headings, clauses) where possible rather than by fixed character counts.
Retrieval
select id, content
from chunks
order by embedding <=> $1
limit 5;Generation
Give the model the retrieved passages and instruct it to answer only from them — and to cite which passage supports each claim.
Evaluating RAG
- Retrieval recall — did we fetch the right passages?
- Faithfulness — is the answer supported by them?
- Relevance — does it actually answer the question?
Get the next article in your inbox
Insights for AI builders. Unsubscribe anytime.