RAG: three levels of understanding
Words made simple
A few useful meanings before you read the explanation.
- RAG
- Find relevant information first, then give it to a model to help answer the question. The answer is only as reliable as the information and checks used.
- API
- A way for one piece of software to ask another for data or an action. A claims API might return the current status of a claim.
- LLM
- A model trained to work with language. It can write or summarize text, but its answer still needs checking against reliable information.
More words from this lesson
- Embedding
- A list of numbers that represents the meaning of some content. Similar meanings can produce nearby lists of numbers.
- Vector
- An ordered list of numbers. An embedding is a vector used to represent content for tasks such as similarity search.
- Retrieval
- Finding and fetching information that is useful for the current question.
- Grounding
- Connecting an answer to supplied evidence, such as a policy document or a verified database result.
- Hallucination
- An answer that sounds convincing but contains invented or unsupported information.
🔴 MUST KNOW · 🟠 SHOULD KNOW for advanced retrieval patterns.
Overview
- RAG stands for retrieval-augmented generation.
- It retrieves relevant external information and provides that information to a model before asking for an answer.
- It connects language generation to a changing knowledge source without retraining the model.
Why this matters
The model does not automatically know your private policy documents, and its learned knowledge may be outdated or inapplicable.
An everyday example
A support employee opens the correct policy handbook before answering a coverage question.
A technical example
Query “What documents do I need?” → retrieve a policy checklist → ask the LLM to explain that checklist with source references.
How it works
- Prepare/search documents offline
- Authenticate request
- Retrieve eligible passages
- Construct evidence context
- Generate grounded answer
- Validate sources and answer
- Respond or abstain.
Architecture and flow
See the two pipelines below.
The insurance assistant example
The assistant explains a fictional policy's reporting instructions using the customer's active policy wording and effective date.
When to use it
Private documents, changing knowledge, source attribution, and domain information absent from the model.
When to avoid it
Translation of supplied text needs no external retrieval. Current claim status usually needs an exact authorized API lookup instead of searching documents.
Interview answer
“RAG retrieves relevant external evidence and gives it to the LLM to produce grounded answers. I evaluate retrieval and generation separately and enforce access before evidence reaches the model.”
Benefits, trade-offs, and production considerations
- RAG reduces some unsupported answers but does not eliminate hallucination.
- Bad parsing, stale sources, weak retrieval, conflicting versions, and prompt injection can all break the result.
- Search-only answers or curated templates are useful alternatives.
Level 1 — Explain Like I'm New
Find the right information first, then ask the model to explain it. If the information is absent, the system should say it cannot confirm the answer.
Level 2 — Developer Understanding
- Create searchable chunks from documents.
- Store each chunk's text, vector, tenant, document ID, version, and page/section.
- At request time, retrieve candidates, optionally rerank, and give selected passages explicit source IDs.
- Return those source IDs with the answer.
Level 3 — Senior Engineer Understanding
- Manage document lifecycle, ACLs, freshness, failed ingestion, answer abstention, and retrieval evaluation.
- Version the parser, chunker, embedding model, index, and prompt.
- A secure index is a derived data store that needs revocation, deletion, recovery, and monitoring just like the primary database.
Preparing the architecture diagram…
Read the full diagram flow
flowchart LR
D[Approved documents] --> P[Parse and clean]
P --> C[Chunk and attach source metadata]
C --> E[Generate embeddings]
E --> I[Publish versioned search index]- Documents are the source of truth.
- Parsing extracts readable content.
- Chunking divides it into useful retrieval units.
- Embeddings encode search features.
- Publishing makes a complete, approved version searchable.
Preparing the architecture diagram…
Read the full diagram flow
flowchart LR
U[Question] --> A[Authenticate and derive permissions]
A --> R[Retrieve eligible evidence]
R --> K[Rerank and build bounded context]
K --> L[LLM answer with source IDs]
L --> V[Validate citations and answer]
V --> O[Answer or abstain and escalate]- The authentication box decides eligible data.
- Retrieval finds candidates.
- Context construction keeps useful evidence within budget.
- Generation explains it.
- Validation checks that references exist and that the response does not exceed the evidence.
Can you explain it without the notes?
RAG: three levels of understanding
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
RAG stands for retrieval-augmented generation. It retrieves relevant external information and provides that information to a model before asking for an answer. It connects language generation to a changing knowledge source without retraining the model.
Turn this concept into a clear answer.
Practice this conceptKeep connecting the ideas.
Next lesson: Document ingestion, PDF processing, and parsingAdapted from 13_AI.MD · “RAG: three levels of understanding”. Examples are study fragments; framework behavior can depend on your version.