Document Parsing with End-to-End Multimodal LLMs: Architecture, Evolution, and Deployment

    This article breaks down why document parsing is hard for traditional multi-module pipelines and how end-to-end multimodal large models replace them with a single generation step. It covers the decoupled coarse-to-fine architecture, two version-evolution curves showing gains from architecture and from data engineering, three reusable lessons on why small models win, production pipeline design on the cloud, and common pitfalls with selection guidance.

    1. Why Document Parsing Is Hard

    In enterprise digitalization, PDFs, scanned files, and image-based documents are both the most common and the hardest data formats to handle. A traditional pipeline splits the work into independent modules: layout analysis first segments regions such as titles, body text, tables, formulas, and figure captions; each region is then sent to a dedicated model for text recognition, table structure reconstruction, or formula recognition; finally, a rule engine stitches everything together in reading order and applies post-processing.

    The problem with this chained design is that errors amplify at every stage. If a layout box is off by a few pixels, the cropped table loses columns; if the reading order is judged incorrectly, every downstream structured result is misaligned; and while each module is optimized in isolation, no one owns the global objective. More modules also mean a longer engineering chain, so maintenance cost, version alignment cost, and fault localization cost all rise together.

    An end-to-end multimodal large model takes a different approach: it merges “look at the page, understand it, and emit structure” into a single generation pass. The input is the page image plus a task instruction, and the output is directly a structured text sequence—for example, a markup language describing title hierarchy, paragraphs, tables, and formulas. This avoids information loss in intermediate representations and leaves the system with only one object to train, evaluate, and iterate on.

    2. Core Architecture: Decoupled Coarse-to-Fine

    The key difficulty of an end-to-end approach is that document pages are high-resolution and text-dense. Encoding a full page into a large number of visual tokens and generating everything in one pass is computationally expensive, and fine detail tends to blur. The widely accepted practice is a two-stage coarse-to-fine design that decouples the two capabilities.

    The first stage is global coarse reading. The model quickly scans the whole page at low resolution and identifies the overall layout skeleton—where the two-column regions are, where table blocks are, where illustrations sit—producing region-level localization and a processing plan. This stage prioritizes coverage and recall, so imprecise localization is acceptable.

    The second stage is local fine reading. Using the region coordinates from the coarse pass, each region is re-sampled at its original clarity and recognized one by one, producing exact text, cell contents, and formula symbols. This stage prioritizes precision; with a small field of view and high resolution, it handles small fonts, subscripts, and complex table borders much better.

    Decoupling matters because the two capabilities have different requirements for model capacity and data distribution. Modeled separately, each can be optimized and evaluated on its own, so one objective does not drag down the other. In engineering practice, a shared visual encoder and task instruction templates are usually added, with prompts distinguishing “localize” from “recognize”.

    The call logic can be abstracted schematically as:

    1. def parse_page(image, model, prompt_layout, prompt_ocr):
    2. # Coarse pass: low-resolution global planning, outputs regions and reading order
    3. regions = model.generate(image.resize((1024, 1024)), prompt_layout)
    4. blocks = []
    5. for r in regions: # Fine pass: recognize each block at original resolution
    6. crop = image.crop(r.bbox)
    7. text = model.generate(crop, prompt_ocr)
    8. blocks.append({"type": r.type, "bbox": r.bbox, "text": text})
    9. return sort_by_reading_order(blocks)

    3. Two Curves in Version Evolution

    The end-to-end route has recently shown two notable version milestones, representing two different optimization directions.

    The first is the architecture dividend. An earlier generation, at roughly 1.2B parameters, outperformed general-purpose multimodal LLMs that were one to two orders of magnitude larger on public document understanding benchmarks. This shows that on a vertical task, the match between structural priors and the training objective often determines the ceiling more than parameter count does.

    The second is the data dividend. A newer generation keeps exactly the same parameter count and network architecture, and improves the aggregate metric from about 92.98 to 95.69 purely through systematic data engineering. The signal here is clear: once the architecture converges, data mix, annotation consistency, hard-example mining, and synthetic data quality become the main levers for further gains.

    Taken together, the two curves support a pragmatic judgment: do not chase a bigger model from the start—build the data loop and the evaluation system first.

    4. Why Small Models Win: Three Reusable Lessons

    First, task priors matter more than general capability. General-purpose LLMs excel at open-domain question answering, but the output space of document parsing is highly constrained, with a fixed set of element categories and strong structural regularities, so training a small model against a constrained output space converges more easily.

    Second, resolution allocation sets the ceiling on detail. Spending compute where the page actually needs to be read clearly, rather than spreading it evenly across the full page, is the most cost-effective design.

    Third, the evaluation set determines the iteration direction. Document parsing needs layered evaluation: overall edit distance, table structure accuracy, formula recognition accuracy, and reading order accuracy tracked separately—only then can you tell which link is holding things back.

    5. Engineering Deployment and a Cloud Pipeline

    Putting the model into a production system requires surrounding capabilities. A typical chain uses object storage to hold source documents and parsing artifacts; a message queue for peak shaving and task decoupling; a container platform to host inference services and scale on demand; and a logging service with monitoring and alerting to track latency, failure rate, and backlogs of very long documents.

    Three things are recommended on the inference side: first, per-page concurrency—split long documents into pages, process them in parallel, then merge; second, caching—reuse results directly for pages with identical content hashes; third, tiered fallback—when a page times out, fall back to the traditional recognition chain to preserve availability.

    On Baidu AI Cloud, these capabilities map to general-purpose product categories used in combination: object storage, message queue, container platform, logging service, and monitoring and alerting, together with the Baidu AI Cloud Qianfan large model platform for model serving integration and performance tuning, forming an observable, rollback-capable document intelligence pipeline.

    6. Common Pitfalls and Selection Guidance

    Pitfall one: assuming bigger parameters always mean better results. On vertical tasks, a 1B-class model with good data often beats a much larger model that has not been optimized for the task.

    Pitfall two: ignoring annotation consistency. When the labeling standard for the same kind of table border is inconsistent, the model learns conflicting signals.

    Pitfall three: looking only at the aggregate score, not the per-item breakdown. An aggregate score hides weak spots; only per-item metrics guide data collection.

    On selection: if the document layout is stable, volume is high, and low latency is required, prefer a small-model end-to-end approach; if layouts are extremely diverse and demands on tables and formulas are strict, adopt a dual-track strategy that is primarily end-to-end with dedicated modules as a fallback.