Five Engineering Root Causes of Poor RAG Performance in Production

    Most RAG (Retrieval-Augmented Generation) projects underperform after launch not because of the generation model's limits, but because teams misdiagnose an engineering and data governance problem as a model selection problem. This article breaks down five common failure points in enterprise knowledge base projects—dirty production data, fixed-length chunking that breaks semantics, access control applied after generation, missing evaluation sets, and answers without citations—and outlines practical engineering fixes for each, plus a recommended implementation order.

    Five Engineering Root Causes of Poor RAG Performance in Production

    The conclusion first: most RAG (Retrieval-Augmented Generation) projects underperform after launch, and the main bottleneck is not the upper limit of the generation model. It is that teams misjudge a typical engineering and data governance problem as a model selection problem. As a result, all optimization effort goes into swapping models and tuning prompts, while the things that actually determine success—data quality, chunking strategy, the access control model, evaluation, and traceability—remain missing for a long time.

    In enterprise knowledge base projects, the failure points are highly consistent and can be reduced to five. Each one is covered below, along with engineering practices you can apply directly.

    1. Demos Use Clean Data, Production Faces Dirty Data

    During the demo stage, teams usually pick a dozen well-structured documents and pair them with twenty questions they already know the answers to, so the hit rate naturally looks good. The real environment is tens of thousands of mixed documents: scanned files, spreadsheets, web page snapshots, meeting notes, and ticket conversations. The same policy may exist in several parallel and conflicting versions.

    A demo validates that “the model can read a paragraph.” Production has to solve “the engineering can absorb every anomaly.” So before launch, three things must be done on the corpus side:

    • Clean and structure existing documents; run scanned files through OCR first and spot-check the results manually.
    • Version governance: define the effective date, expiration date, and master version identifier for each document, and resolve conflicts by priority.
    • Quality tiering: keep high-quality policy documents and low-quality fragments in separate stores so low-quality content does not dilute retrieval quality.

    2. Fixed-Length Hard Cutting Breaks Semantics

    The most common mistake is cutting everything at a fixed character count. A complete reimbursement rule gets split into three parts, retrieval hits only one of them, and the answer covers half the rule—while the model has no way of knowing it is missing context.

    A more reliable approach is structured chunking combined with a metadata layer:

    • Split by heading hierarchy and clause numbering to preserve the semantic integrity of the “article–paragraph–item” structure.
    • Keep tables intact as whole blocks and index them separately so row and column relationships are not broken apart.
    • Attach metadata to every chunk: document type, owning department, effective date, version number, and access control tags.
    • Use small-chunk retrieval with large-chunk completion: hit a small fragment first, then trace back to the section it belongs to and inject the whole section as context.

    An illustrative chunk structure looks like this:

    1. {
    2. "chunk_id": "policy-2024-017#3.2",
    3. "text": "Travel accommodation standard: no more than ... per night in tier-1 cities",
    4. "metadata": {
    5. "doc_type": "policy",
    6. "department": "finance",
    7. "effective_date": "2024-01-01",
    8. "version": "v3",
    9. "acl_tags": ["finance", "all-staff"]
    10. },
    11. "parent_section": "Chapter 3 Travel Management"
    12. }

    3. Access Control Is Applied After Generation

    This is the point most likely to cause an incident. If retrieval runs across the whole corpus first and only then decides “should this sentence be said,” the risk of unauthorized disclosure is inevitable, because the sensitive content has already entered the context and the model’s output is no longer controllable.

    The correct order is to move access control ahead of retrieval: first determine the user’s role and the set of documents they can access, have the retrieval request carry the filter conditions directly, label the answer with its source, and mask sensitive fields before ingestion.

    1. def retrieve(query, user):
    2. scope = resolve_scope(user) # role -> visible document set
    3. filters = {
    4. "acl_tags": {"in": scope.acl_tags},
    5. "effective_date": {"lte": today()},
    6. }
    7. return vector_index.search(query, top_k=8, filter=filters)

    One point needs emphasis: RAG without access control can only be tried out on a small scale on an internal network; it cannot be opened up to the business.

    4. No Evaluation Set Means Optimization Is Guesswork

    Before launch, build an evaluation set of at least 50 items covering four categories:

    • 20 high-frequency questions that must be answered correctly;
    • 15 boundary questions where the system must clearly say it does not know when it cannot answer;
    • 10 access control questions where no unauthorized disclosure may occur;
    • 5 adversarial questions where the system must refuse when it is being led to fabricate.

    Every time you change the chunking strategy, the dictionary, the prompt, or the model, run the full set and record three metrics: hit rate, citation accuracy, and refusal rate. Without a baseline, so-called “optimization” is just a subjective impression.

    5. Answers Have No Sources, So the Business Will Not Use Them

    Business users will not trust an answer that merely “reads smoothly.” A usable format is: one conclusion + the basis (document name, section, effective date) + applicable scope and exceptions + a link to the original text. When an answer does not match the source, the user can report the bad case with one click, and operations can then attribute it to chunking, the dictionary, retrieval, or the prompt, closing the loop.

    1. Start with a scenario that has clear boundaries and better document quality, such as policy Q&A or product manuals.
    2. Build a 50-item evaluation set and produce baseline numbers.
    3. Finish the chunking and metadata design before discussing model selection.
    4. Build access control filtering and traceability at the same time; do not add them after the fact.
    5. After launch, run operations weekly and let data decide where to invest next.

    In related work at Baidu AI Cloud, such systems are typically combined with general cloud capabilities like object storage, log services, and monitoring and alerting, so that corpus versions, retrieval logs, and bad case feedback are accumulated in one place. This shifts performance tuning from experience-driven to data-driven.