LlamaIndex-style RAG for docs Q&A
When retrieval beats bigger context, practical notes on LlamaIndex-style RAG for documentation Q&A.
RAG (retrieval augmented generation) in the LlamaIndex style answers questions from your documents without stuffing an entire corpus into context. Bigger context windows removed some pressure, but retrieval still wins for large or changing knowledge bases.
The trap is building “RAG with citations” without measuring faithfulness. You get confident answers with footnotes that do not actually support the claims.
Decide: big context, RAG, or an API?

Build
Use RAG when:
- The docs are too large or too dynamic for context stuffing
- You need citations back to passages to earn trust
- You must search across multiple sources with permissions and metadata
Skip RAG when the best answer is not in documents. If the source of truth is a database or an API, call it directly and generate an explanation from structured results.
Fix before you trust it: golden set, chunking, citations, refresh
RAG quality comes from process, not framework choice:
- Golden question set. 30 to 100 questions with expected doc IDs or expected passages.
- Chunk by structure. Headings and tables are meaning. Fixed-size chunks often break it.
- Metadata and ACLs. Version, date, product area, permissions tags.
- Cite or refuse. If the answer is not supported, the bot should say “not in docs”.
- Refresh pipeline. Stale indexes are silent failures.
Do not tune ANN parameters before you have good chunks and a golden set. You will optimize the wrong thing.
Three failure modes that matter in production

Failure modes to catch early
- Citation laundering. Footnotes exist, but the sentence is unsupported. Fix: faithfulness scoring and strict cite checks.
- Permission leaks. Retrieval returns chunks the user should not see. Fix: enforce ACLs at retrieval time, not after generation.
- Stale indexes. Post-migration answers describe old UI. Fix: refresh jobs with alerts and ownership.
A weekly loop that keeps answers grounded
Once a week, sample failures and add them to the golden set. Re-chunk the worst sections and fix source docs that keep failing retrieval. RAG does not replace documentation work. It surfaces where the docs are weak.
Bottom line

When this fits vs when it does not
LlamaIndex-style RAG earns its place when retrieval, citations, and evals are first-class. Big context alone is not a strategy. Ground answers, measure them, and keep the index as fresh as your docs.
Related: LangChain (or not) for orchestration choices, and LangSmith tracing to debug tool and retrieval runs.
Share