Layout-Aware Parsing Architectures That Preserve Column Boundaries and Table Structure in Complex PDFs
Layout-aware parsing recovers table structure that standard OCR alone cannot preserve.

High OCR accuracy can still leave tables that cannot be used. Layout-aware PDF parsing preserves column boundaries by resolving spatial geometry before text recognition, then protecting those relationships through table structure recovery, reading order prediction, and serialization.
Why high OCR scores hide structural failure in PDF table extraction
A table can look correct to a human yet emerge from a parser as a flat, garbled string, with recognized values detached from their headers. The characters survive, but their relationships do not. Standard business PDFs store tables as positioned glyphs on a canvas rather than explicit rows, columns, and cells. Extraction must therefore reconstruct a structure that the file never formally supplied. Sequential OCR can recognize the text while discarding the spatial evidence needed to assign it correctly.
Four document conditions expose this gap most clearly. Borderless tables rely on whitespace that changes with font size, while merged cells break the assumption that the grid is uniform. Multi-page tables require headers to be reassociated across page breaks, and scanned PDFs require text recognition as well as structural reconstruction. These failures propagate beyond the extracted table. Broken structure leads to poor chunking, weak embeddings, irrelevant retrieval, and hallucinations in the downstream RAG chain, making layout fidelity a prerequisite for correctness.
What rule-based and coordinate-based parsers get right and where they break
Coordinate-based parsers are a sound starting point for clean, digitally generated PDFs because the text layer already supplies character positions. Tabula uses those positions and whitespace heuristics to recover columns in documents with consistent alignment. Camelot offers a different choice of evidence. Its Lattice mode traces visible ruling lines, while Stream infers columns from whitespace gaps. For a stable format such as a CSV-to-PDF export with fixed column widths, these approaches can be fast, deterministic, and sufficient.
The limits follow directly from those assumptions. Tabula depends on an available text layer and predictable alignment, so scanned documents and merged cells undermine its column reconstruction. Camelot’s Lattice mode works reliably when borders are present, but Stream requires configuration of column separators and edge tolerances. A new layout variant can invalidate that configuration. The difficulty is not recognizing familiar text but deciding where a cell ends when the visual evidence changes.
pdfplumber gives teams character-level access to PDF coordinates and enough programmability to handle edge cases beyond the other libraries’ built-in approaches. That control comes with a maintenance cost. Each document type requires extraction code, and layout drift across vendor invoices or quarterly reports can force repeated rule changes. None of these libraries has native scanned-PDF recognition or can reliably handle merged cells across different layouts. The case for layout-aware parsing begins where document variety exceeds what per-layout rules can reasonably cover.
How layout detection models resolve table structure before reading any text
Geometry-first architectures reverse the dependency between text and structure. Instead of reading the page into a character stream and then guessing its organization, they identify spatial regions before extracting content. A merged header illustrates the distinction clearly. Sequential extraction can put its words beside the values below without keeping track of which columns the header spans. A layout-aware stack retains the header’s region and alignment so that table structure recognition can recover the span.
The classical pipeline starts with layout detection, which identifies bounding boxes for semantic blocks such as tables, headers, figures, and code. OCR then reads the text within those regions, after which the structure is assembled. Spatial containment constrains how the text is interpreted. At the page level, the detector separates a table from surrounding material, while finer structural analysis resolves row membership, column alignment, and cell adjacency. This division is important because finding a table’s outer boundary does not, by itself, recover its internal grid.
Borderless tables require inference from whitespace, while merged cells require explicit spans. A layout-aware system that maintains structural state can propagate headers across page breaks. Scanned PDFs still need OCR, but it reads text inside detected regions instead of producing a flattened page stream from which the system must work out the structure.
The detector-to-parser handoff as the overlooked failure point in pipeline architectures
Parser-Oriented Structural Refinement for a Stable Layout Interface in Document Parsing, from Unisound AI Technology and the Chinese Academy of Sciences, identifies instability between raw detection and downstream parsing. DETR-style detectors can produce redundant hypothesis pools on dense pages with overlapping regions and ambiguous boundaries. The parser receives a retained, ordered set of instances from that pool, so the selection and ordering process becomes part of the document’s interpretation.
Non-Maximum Suppression, or NMS, makes this selection through a lossy heuristic. It can pass duplicate candidates, producing redundant content and incorrect reading order, or discard a well-localized detection in favor of a worse one. Either choice alters the parser’s available evidence. Once a useful region has been removed, even accurate text recognition cannot bring back the missing detection. Likewise, reading duplicate regions correctly can still leave duplicates in the output.
The refinement paper proposes a lightweight arbitration stage that reasons over the candidate set using query features, semantic cues, box geometry, and visual evidence. It jointly determines which instances to retain, refines their localization, and predicts their parser input order. Its retention-oriented supervision and difficulty-aware ordering objective align selection with the downstream interface. For teams evaluating such pipelines, the relevant questions include how overlapping detections are resolved and how the retained regions become an ordered parser input.
What table structure recognition models do that layout detectors alone cannot
A stable table bounding box locates the table, while recovering its internal cell grid is a separate task. StrucTab treats table parsing as structured optimization and uses intermediate structural supervision to work out row and column counts, merged-cell spans, and the full HTML structure. This distinction becomes decisive in borderless tables and multi-level headers. A detector can locate either table accurately while leaving unresolved the cell boundaries and header hierarchy that determine how its values should be interpreted.
IBM Docling keeps these tasks separate by pairing layout analysis with TableFormer, a model built for table structure recognition. Its layout detector is trained on DocLayNet, while TableFormer is trained on table datasets including PubTabNet and FinTabNet. Marker v2 from DataLab likewise includes a dedicated TableConverter component within a multi-component architecture using Surya VLM, an rf-detr layout detector, and pdftext.
Markdown, HTML, and JSON are not interchangeable containers when a table includes merged cells or hierarchical headers. HTML’s ability to encode explicit cell boundaries and spans beyond the capabilities of flat Markdown pipe syntax makes encoding an architectural choice. A parser may recover the grid internally yet strip away essential relationships when it prepares the table for downstream LLM context, so structural accuracy must be assessed after serialization as well as before it.
How reading order prediction interacts with column boundary preservation
Column boundaries and reading order depend on the same spatial interpretation. A parser can keep the text intact within each region yet put those regions in the wrong order across the page. Local correctness is therefore not enough for fidelity. On a multi-column page with embedded tables, the system must tell the separate text streams apart and put the table regions in the right place in the reading order. Boundary errors change which regions belong together, while ordering errors change the order in which those regions are read.
The refinement paper addresses this coupling through its difficulty-aware ordering objective for structurally complex pages with overlapping layout candidates. Its Reading Order Edit metric captures sequence mismatch that can remain after layout detection. Retaining duplicate candidates changes the sequence that must be produced, while dropping a useful candidate leaves a gap regardless of how well the remaining instances are sorted. This is why a stable interface must resolve the retained set and its order together.
Layout Parser handles page flow by treating columns as separate spatial streams and reading each on its own before merging them. FireRedOCR, HunyuanOCR, and DeepSeekOCR generate structured output directly from page images, bypassing the explicit layout handoff. That removes the particular interface instability of staged detection, but it also removes the controllability and auditability provided by explicit stages. The distinction is not whether reading order is needed, but where its relationship to geometry is resolved and how visible that process remains.
What benchmarks actually measure about structural fidelity and where they leave gaps
Document parsing benchmarks differ in what they treat as a correct result, so a strong aggregate score cannot establish production table fidelity. OmniDocBench, presented at CVPR 2025, evaluates more than recognized characters. It uses NED for text and reading order, and TEDS combined with NED for table structure and content accuracy. Structure is not absent from this evaluation. The limitation is that its document distribution leans toward academic papers rather than the enterprise formats that expose different boundary and header problems.
ParseBench, introduced in April 2026, addresses that enterprise gap with human-verified pages from insurance, finance, and government documents. Its capability dimensions include tables, charts, content faithfulness, semantic formatting, and visual grounding. Borderless invoice tables and multi-level financial statement headers can expose failures that an academic-paper-heavy evaluation does not proportionally represent. As a result, a parser’s performance on one distribution does not establish that its structural assumptions hold on another.
olmOCR-Bench instead checks simple, machine-checkable facts about document pages, making its approach closer to unit tests than a holistic accuracy score. Such checks can be more actionable when teams need to isolate specific failures, and they avoid some penalties that edit-distance metrics assign to valid output variations. Teams should treat their scores as a lower bound on risk rather than a guarantee, then evaluate held-out samples of their own document types. That evaluation should include tests of merged cells, borderless tables, and multi-page continuation.
Which architectural decisions actually determine whether column boundaries survive in production
For production selection, the lesson is to evaluate the surrounding system along with the model at its center. The first decision is whether geometry constrains recognition or must be reconstructed after text has been flattened. That choice sets the pipeline’s starting disadvantage or advantage. A document processing stack built for this task should keep table regions, column streams, and cell relationships intact through clear structural stages, with layout detection kept separate from the work of recovering the internal grid. A table detector is not a substitute for a purpose-trained structure model.
The next decision concerns what crosses each interface. Teams should examine how the pipeline arbitrates overlapping detections, orders retained regions, and encodes recovered tables for downstream use. These interfaces deserve their own evaluation criteria. Set-level reasoning works out what to keep and in what order together, while a serialization format that can represent spans keeps the structure recovered inside the table intact. Flattening a complex grid into Markdown can undo that work before an LLM receives it, even when the earlier stages were correct.
The final decision is how uncertainty becomes visible. Borderless tables, low-contrast scans, and irregular layouts should have per-region confidence signals so downstream systems can see the uncertainty before trusting their structure. Human-in-the-loop routing sends regions the system is unsure of for review. Without that path, downstream agents can still receive structural errors hidden behind readable text. Production acceptance should therefore depend on the serialized table’s preserved relationships and the system’s handling of doubtful regions.


