By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A policy assistant answered well for six weeks. On a Friday the content team republished the employee handbook: same words, new layout, two merged sections, and a new version number on every page.
On Monday it cited the 2024 policy and quoted a clause that no longer existed. The team rewrote the prompt. The cause was in the index: old chunks were still there, new chunks had no version, and the retriever could not tell them apart.
Retrieval-augmented generation (RAG) means fetching passages from your own corpus into the prompt. When quality drops after a content change, check retrieval and indexing first.
A chunk is the unit you retrieve and cite. Its size follows the document's shape, because the boundary decides what can be quoted as a complete answer.
| Data shape | Chunk by | Why it fits | What to watch |
|---|---|---|---|
| Policies and contracts | Section, with its heading path | A clause survives whole | Renamed headings break stable ids |
| Support tickets | Whole ticket, not single messages | The resolution stays with the problem | Long threads exceed the context budget |
| Tables and spreadsheets | A row group with the header repeated | The header is needed to read a number | Totals lose the rows they were computed from |
| Call transcripts | A window of speaker turns | Meaning spans turns | Overlap shows one passage as two sources |
A good chunk is readable on its own, fits several to a context, and traces to one place in one version. Overlap is a tax: 20% overlap duplicates context and makes one passage look like two sources.
Metadata is the retrieval contract. If you do not store it at ingest, you cannot filter on it later, and you cannot invalidate it when a document changes.
{
"chunk_id": "policy-fy26-4.2-007",
"source_id": "policy/fy26/expenses",
"doc_version": "2026-11-04",
"effective_from": "2026-11-04",
"section": "4.2",
"anchor": "page=7#receipts",
"text": "Receipts are required for any expense over 75 USD.",
"acl": ["finance", "audit"]
}Derive chunk_id from structure: document path, section, ordinal. A random id gives you no way to replace the old chunk.
Three question shapes need three methods. Using one for all three is the most common error.
Hybrid search costs an extra index and a merge step. It earns that cost whenever users type identifiers.
Run these checks in order. Each eliminates a layer, and the first three need no model call.
Ask a question whose answer you can find by exact string search. If the string is in the corpus but never retrieved, indexing is the problem. If it is retrieved and the answer is still wrong, generation is.
A citation is a contract with the reader: document, version, and a locator they can open. The system must produce it from retrieved metadata, not from the model's memory.
When no chunk clears the threshold, refuse or escalate. A refusal that names what was searched beats a confident answer.
You inherit 40,000 supplier contracts, a 50,000-ticket archive and a pricing table that changes weekly.
A strong answer chunks contracts by clause, tickets whole, and prices by row group, ships doc_version and acl, and queries the price table directly.
Key takeaways
Chunk boundaries decide what can be quoted as a complete answer, so they follow the data shape.
Metadata is the retrieval contract: version, locator, effective date and access labels.
Match the retrieval method to the question shape, and add keyword search when users type identifiers.
After a content refresh, diagnose indexing and retrieval before the prompt or the model.
Re-embed only after you delete the old version, or both versions compete in the index.
Citations come from retrieved metadata, and no qualifying chunk means refuse or escalate.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.