The Hardest Problems in Production RAG Systems

    A practical look at why RAG projects stall after the demo stage, covering three core challenges—aligning evidence with the question, structure-aware chunking that preserves how users ask, and evaluation metrics that go beyond hit rate—plus practical engineering methods for handling date coverage gaps in a financial news Q&A scenario.

    In a retrieval-augmented generation (RAG) system, the vector store, chunker, and reranking model can all be assembled in a few days. What actually holds up a project are the details that work smoothly in a demo and break in production. This article starts from a financial news Q&A scenario and examines three of the hardest parts, along with engineering methods that can be put into practice.

    Challenge 1: Aligning the scope of evidence with the question

    Two news flashes published on the same day, about the same market and in the same units, may describe entirely different objects. A difference of one instrument or one notch in metric definition is enough for the evidence to lead the answer astray. The distinguishing feature of this class of error: retrieval metrics look normal, yet the answer is wrong and well supported by citations.

    The practical fix is to break “relevance” into three layers:

    1. Topic relevance: is it discussing the same market;
    2. Entity match: are the instrument, contract, and metric names exactly the same;
    3. Scope match: do the time granularity, statistical range, units, and revision version line up.

    Only when all three layers pass does a fragment count as usable evidence. In practice, add structured fields to each indexed chunk (instrument, metric, date, unit, column), filter on those fields first during retrieval, and only then apply semantic ranking. This keeps fragments that are “semantically similar but refer to a different entity” from crowding out the correct answer.

    Challenge 2: Chunking determines how users can ask

    The biggest problem with fixed-length chunking is not that semantics get cut apart, but that the conditions needed to locate the original text are thrown away. A typical case is a flash titled “Key Financial Data at a Glance” whose body lists several items as 1, 2, 3. When a user asks “what is item 2 in the at-a-glance list,” the title, the column, and the item number are themselves retrieval conditions. Drop them during chunking and the body cannot be found again, even if it is semantically intact.

    Chunking should therefore follow a structure-first principle:

    • Split along the document’s existing hierarchy, preserving locating information such as titles, columns, and numbering;
    • Generate a “list of possible questions” for each chunk, working backwards to the phrasings users are likely to use;
    • Route numbered questions through rule-based location, with semantic retrieval as the fallback.

    Illustrative code:

    1. def chunk_by_structure(doc):
    2. chunks = []
    3. for section in doc.sections:
    4. for item in section.items:
    5. chunks.append({
    6. "text": f"{doc.title} / {section.name} / item {item.no}\n{item.body}",
    7. "meta": {"title": doc.title, "column": section.name, "no": item.no,
    8. "date": doc.date}
    9. })
    10. return chunks

    For one numbered question, standalone semantic retrieval missed on the first six attempts; the original text was ultimately retrieved by the numbering rule. This shows the retrieval pipeline needs two channels: semantic and rule-based.

    Challenge 3: Break retrieval quality into separate measurements, not just hit rate

    A common mistake is to measure only “whether correct evidence appears in the top three.” A more reliable approach records three results at the same time:

    • What rank the correct evidence occupies;
    • Which fragment the answer actually cited;
    • Whether that citation can support the conclusion.

    A synthetic data test makes the point. The store holds two crude oil closing flashes: one at 69.43 USD per barrel for a certain grade, another at 74.22 USD per barrel. The system answered 74.22 with a citation attached, while the correct evidence actually ranked second. Counting only “hit in the top three” records this as a success; opening the citation to check reveals the answer named the wrong instrument. Only by looking at all three measurements together can you tell whether the problem lies in retrieval, evidence selection, or answer verification.

    The overlooked coverage problem: does the store even have that day

    Data backfills are often limited by pagination caps, which easily leaves gaps in time. Closing-commentary content from adjacent dates is highly similar—all discussing the same index—while the closing levels belong to different dates, making “date drift” very easy to introduce.

    Recommended practices:

    • Before querying a specific date, probe the local store’s coverage; if data is missing, state the gap and the most recent sync date explicitly;
    • For questions about multiple instruments, answer item by item: items with evidence get normal answers, items without evidence are explicitly flagged;
    • Make the coverage check a separate step rather than relying on the model to notice.

    Summary

    The hardest part of RAG is usually not the model, but the precise alignment of evidence with questions, chunking that preserves how questions are asked, and verifiable evaluation together with coverage management. Engineering these three things produces a qualitative improvement in the system’s trustworthiness. If you need elastic compute and managed components, the retrieval and evaluation pipeline can run on Baidu AI Cloud’s general container platform, object storage, and logging and monitoring capabilities.