Recognizing the words on a page does not establish which words belong together. A document pipeline also decides where paragraphs begin, which heading governs a rule and which exception modifies it. Retrieval-augmented generation, or RAG, searches those derived passages and gives selected evidence to a model. If a passage already asserts a relationship the document never made, a fluent answer with a page citation can repeat that error faithfully.

Consider a hypothetical policy page. The left column says that product A has a 30-day refund window and that opened items are excluded. At the same vertical position, the right column says that product B has a 14-day window and that a recalled item remains refundable after opening. A line sorter can produce “product A, 30 days, recalled items refundable after opening.” Every word appears on the page, yet that product-specific rule does not. Character recognition accuracy would miss the failure because the lost information is the relationship between text regions.

Keep the failed answer, exact evidence supplied to the model and source version before rerunning the pipeline. Then compare three intermediate artifacts against the rendered page: recognized words with bounding boxes, ordered paragraph or clause regions, and final retrieval chunks. A bounding box records where a word or region sits on the page. It lets an engineer connect a derived sentence back to the physical source instead of relying on a text dump that may already have lost its structure. Include the heading and exception, rather than inspecting only the sentence quoted in the answer.

These comparisons separate different repairs. If the words are correct but the parser's ordered regions alternate between columns, reading-order reconstruction failed. If those regions keep each column intact but a fixed-length chunk concatenates an unrelated exception, the chunker lost clause boundaries. If the stored chunk is correct but the model's supplied evidence joins excerpts under the wrong heading, the fault is in evidence assembly. Replaying each stage from its saved input identifies the first incorrect relationship. It also avoids paying for a new OCR engine when downstream code discarded structure the existing parser already supplied.

Check whether OCR was needed at all. A PDF may contain usable embedded text, a scanned image or both. A hidden OCR text layer can disagree with the visible image. Compare the actual uploaded version and extraction path, without assuming that embedded text is authoritative or that another OCR pass will restore layout. OmniDocBench treats layout and reading order separately from text recognition. Document AI's layout parser guidance describes preserving structural relationships. Neither establishes that a particular service fixes this page without a test.

Repair the stage that first changed the meaning. Keep stable region identifiers, page coordinates, source revision and heading membership through chunking. The unit of evidence should preserve a rule with its applicable product, conditions and exception. A token budget may require splitting a long clause, but the children need an explicit link to the governing clause and authorized parent context. A reranker can reject some suspicious passages, but it cannot reliably recover relationships that extraction erased. Merely asking the answer model to cite a page leaves the original ambiguity intact.

Before replacing the index, replay a small, deliberately difficult document set. Include the example above, a genuine exception spanning several lines, a one-column control, tables, footnotes and an amended policy version. Check the ordered region IDs and chunk memberships as well as the final answer. An effective assertion is that no chunk presents product B's exception as governing product A. Another checks that a real exception remains attached, so a repair that discards every exception does not appear successful. Track unsupported policy relationships separately from word recognition and retrieval recall.

Build the corrected chunks under a new ingestion generation, a separate version of the derived index, with the parser and chunker versions recorded. Validate that generation before switching retrieval to it, and ensure an answer cannot combine a new chunk with an old citation or cached passage from the affected source. Retire those stale derived artifacts under the existing serving contract. Reindexing without changing the corrupt representation just reproduces the failure. Replacing it without controlling version mixing can make an otherwise correct repair appear intermittent.

Some pages remain ambiguous, particularly when a side note could qualify several nearby clauses. Preserve that uncertainty and request a crop-based or human review rather than inventing the attachment. A vision model can assist, but its result still needs validation against the same relationship-level examples. The companion PDF reading-order design question develops the geometric ordering algorithm. This investigation asks where the meaning first changed and what evidence demonstrates that the repaired pipeline preserves it.