On this page
What does RAG solve—and what does it leave unsolved?
RAG retrieves application-specific or changing text at request time and supplies it to the model. This can help with provenance and document updates, but incorrect retrieval can still lead to incorrect answers. A citation link does not establish support for every sentence either. Frequently changing stock quantities may need an authorised API query rather than document search. The distinction between document knowledge and live records determines RAG’s role in the application.
Why is ingestion a critical production component?
PDFs, Word files, HTML and scanned documents have very different extraction failure modes. Incorrect table reading order or repeated page headers can damage retrieval. Track extraction quality, language, section hierarchy, version and permissions for every file. Cleaning should preserve headings and material footnotes. Change detection, reindexing and deletion belong to ingestion just as much as initial upload. A “submit document” button is not a production ingestion pipeline. Basic validation reports should catch missing pages, empty chunks and duplicate versions early.
How should chunking be chosen?
Fixed-size chunks are predictable but can separate a procedure's prerequisite from its conclusion. Heading-aware, semantic or table-aware segmentation may help preserve structure. Larger passages retain context but can weaken matching and increase generation cost. Smaller passages improve retrieval granularity yet lose neighboring context. Compare chunk length and overlap using real queries and ground-truth source matches. Overlap is not a universal repair: duplicated evidence also consumes context and may crowd out other relevant passages.
Retrieval, filtering and reranking order
The user's identity and permission scope should be known before retrieval starts. Permission-filtered lexical and vector retrieval produce candidates; a reranker can then score query–passage relevance more precisely. Finally, diverse evidence fitting the token budget is selected. A reranker cannot recover a relevant passage absent from the first-stage candidate pool, so candidate count and first-stage recall must be evaluated together. Applying data permissions only inside prompts or after response generation puts the security boundary in the wrong place.
Which evidence belongs in the generation prompt?
Evidence carrying document identity, section and version is easier to trace. When two sources state different conditions, the question is which version or business unit applies, not how creatively the model can reconcile them. Asking the prompt to use authorised evidence helps, but does not replace access control. Separately checking the link between claims and sources makes it possible to explain where a plausible answer actually came from.
RAG evaluation needs three separate layers
A convincing final response can hide three failures: missing the right document, misusing retrieved evidence or making the wrong business decision. Retrieval recall and ranking address the first, grounding the second, and task-outcome checks the third. Outdated versions, fabricated citations and access violations are therefore distinct failures. Expert-labelled questions provide a common reference; model judges contribute to the extent that their agreement with that reference is understood.
Access control and multi-tenant data
Different users may correctly receive different answers to the same question because their accessible documents differ. Tenant, department, role and document permissions define retrieval scope. An answer cache independent of that context can expose correctly generated content to the wrong person. Indexes and traces may hold sensitive text too. Retention and deletion therefore concern the retrieval and observability layers as well as the original file store.
Cost, latency and fallback design
Embedding, search, reranking and generation contribute different portions of a RAG request's latency. Measuring only the LLM call hides what users experience. If retrieval fails, a grounded assistant may need to say that suitable evidence was not found rather than inventing a confident answer from general knowledge. A lexical fallback can be useful during vector-index outages, but must be evaluated as a separate quality path. Caching saves repeated work only when version and authorization consistency are maintained.
Failures that easy questions do not expose
A document assistant can handle definitions well while confusing two similar procedures. Outdated versions, table exceptions, inaccessible documents and unanswerable questions expose different weaknesses. An incorrect response may originate in extraction, candidate retrieval or the interpretation of otherwise correct evidence. Without that distinction, every failure looks like a model problem. A more expensive generator still cannot read a document that never entered its candidate context.
Different access to purchasing and warehouse documents
Illustrative scenario; not a measured project result.
Imagine an ERP environment in which procurement staff query contract terms while warehouse workers ask about stock procedures. Sharing a vector store does not mean every document is visible to everyone. Authorization must constrain retrieval, the current document version must be selected, claims should point back to source passages, and missing evidence must be acknowledged. This ERP example is illustrative, not a claim about a deployed system.
Where an incorrect answer originates
When a purchasing assistant cites the wrong contract term, the language model is not always the first suspect. The document may be outdated, an exception may have been separated during chunking, or the relevant section may never have entered the candidate set. Each cause needs a different response. RAG makes it possible to trace an answer back to its evidence; keeping only the final response loses much of that advantage.
Frequently asked questions
Does RAG replace fine-tuning?
Not always. RAG is usually suited to fresh, cited facts; fine-tuning may suit behavior or structured-output patterns.
Does RAG eliminate hallucinations?
No. Incorrect retrieval, unsupported reasoning and outdated documents can still cause false answers.
Is a vector database mandatory for RAG?
No. Small systems can start with lexical retrieval or simpler indexes, then add vectors if needed.