Skip to content

Chowder document parsing

How specialized models and deterministic parsers work together to turn documents into queryable data.

The calico Chowder cat peeking from the left of a document stack with a playfully fierce expression and a raised paw showing pink pads, beside colored annotations for the header, text, table, and footer.

Reading documents is easy for humans but notoriously difficult for machines.

What looks like a single task is actually a collection of very different problems. Text extraction, layout analysis, OCR, table recognition, and visual reasoning each require different capabilities.

And while it is tempting to use a single large vision model to do everything, the one-shot approach often comes with significant tradeoffs in compute, latency, throughput, and determinism.

A better approach is to let specialized models and parsers work as a team, each doing what they do best. This is the approach we take in Chowder, our open-source AI-native SQL engine for multimodal data analytics. Here, we focus on how it parses documents into structured, queryable data.

Different pages need different work

Consider a financial report with a letter to shareholders, pages of financial tables, and a scanned appendix.

The letter may already contain usable text embedded in the PDF. The tables need their rows and columns reconstructed so the numbers stay attached to the right labels. The scanned appendix needs its words read from pixels.

Even one page can require different tools. A paragraph may have embedded text, while the chart beside it has labels that exist only in the image.

Chowder decides how to process each page, then brings in specialists for the regions that need them.

Chowder document pipeline: use page triage to decide whether specialized AI inference is needed; extract text with PDFium and use Heron, TATR, and PP-OCRv5 where needed; assemble tables and text structure, resolve reading order with an XY-Cut++ variant, and return Markdown and ordered blocks as one row per page.

Chowder routes each page and combines the specialists' outputs. Table recognition and OCR run where needed; an XY-Cut++ variant resolves reading order.

Take a glance first

Before running layout analysis or table recognition, Chowder asks whether the text already stored in the PDF can be extracted and organized using rules.

Fast, rule-based PDF checks identify empty pages, scans, and non-empty pages without extractable text. Empty pages produce an empty result. Scans and pages without extractable text go directly to hybrid extraction, which combines PDF text with model-based layout analysis and optical character recognition (OCR) where needed.

For the remaining pages, Glancelot, our tiny page-triage model, examines a thumbnail. Its score determines whether the page takes the native-text fast path or the hybrid path.

The fast path uses PDFium, a PDF rendering and parsing library, to extract embedded text and its positions. Rules handle headings, paragraphs, and reading order. These pages skip layout inference, table recognition, and OCR.

The following stages describe the hybrid path: layout identifies regions, table recognition recovers table structure, and OCR supplies text that must be read from images.

Keep the text the PDF already has

The hybrid path reuses any text already stored in the PDF.

PDFium supplies characters and their positions. Heron, a document layout model, identifies regions such as headings, paragraphs, tables, and pictures. Chowder matches the characters to those regions.

For a section heading, Heron supplies the role and boundary while PDFium supplies the words. The model adds structure to text already present in the document.

If Heron misses a region, Chowder groups the remaining PDF characters into lines and paragraphs. Text recovery does not depend entirely on the layout model finding every region.

Tables need their own specialist

A table's meaning depends on which values belong to which rows and columns. Merged headers and text wrapping across lines make those relationships harder to recover.

Heron locates the table. Microsoft's Table Transformer, or TATR, examines a crop and predicts rows, columns, headers, and cells that span multiple rows or columns.

Chowder combines those predictions with text geometry to build the grid and assign text to cells. Embedded PDF characters supply the contents when available. For image-based tables with insufficient readable text, OCR supplies them instead.

Finding the table, recognizing its structure, and reading its contents are separate jobs. Each contributes to the same result.

Read pixels where needed

OCR has two jobs: finding text in an image and recognizing what it says. Chowder uses PP-OCRv5 detection and recognition models for these tasks.

Fully scanned pages receive full-page OCR. Mixed pages use targeted OCR for regions such as pictures, text regions without native characters, and embedded images missed by layout detection.

Chowder filters OCR results that overlap existing native characters, preferring the PDF text to avoid duplication. For scans and image-based tables, it can also render at a higher resolution to help read small text.

Put the pieces back together

Chowder's assembly algorithms combine the extracted text, layout regions, and table structure into ordered blocks. A variant of XY-Cut++ resolves reading order by recursively splitting regions along gaps and reinserting cross-layout blocks. Rules refine headings and paragraphs, while document-level processing identifies repeated headers and footers.

The read_documents SQL table function exposes the result as one row per page. This query selects the financial-report page shown below:

SELECT
    source,
    page_number,
    content, -- Parsed PDF page in Markdown
    blocks -- Layout regions with text and bounding boxes
FROM read_documents('hf://buckets/chowderai/chowder-demo/pdf/data/att-management-discussion-and-analysis-2020.pdf')
WHERE page_number = 3; -- Inspect the page shown below

content contains the page's rendered Markdown. blocks preserves its regions in reading order, with their content, bounding boxes, and whether OCR contributed text. Flags such as has_table and has_ocr let you filter pages by those properties.

You can inspect the result with chowder.display(df). Keeping source, page_number, and blocks in the DataFrame lets Chowder overlay the regions on the original page.

Actual Chowder display output showing a financial-report page with numbered bounding boxes around two-column prose, a full-width table, a section heading, list items, and page headers and footer.

An actual financial-report page shown by chowder.display(df). Colors distinguish region types; numbered labels show reading order.

Here, the prose flows through two columns, the table spans the page, and a list resumes beneath it. The overlay makes those boundaries and the reading order visible alongside the source document.

Parsing quality

On the 200-PDF OpenDataLoader benchmark, Chowder achieves 0.935 overall, ahead of the recorded baselines below.

The benchmark evaluates reading order on all 200 PDFs, table fidelity on 42 PDFs, and heading structure on 107 PDFs. Scores range from 0 to 1; higher is better. Overall averages each document's applicable metrics, then averages across documents.

Parser and version Overall Reading order Tables Headings
Chowder 0.1.0 0.935 0.958 0.940 0.871
OpenDataLoader hybrid 2.2.1 0.907 0.934 0.928 0.821
Docling 2.84.0 0.882 0.898 0.887 0.824
Marker 1.10.1 0.861 0.890 0.808 0.796
OpenDataLoader 2.2.1 0.831 0.902 0.489 0.739

These results compare extraction quality. The runs were recorded on different dates and hardware, so we do not use them to claim a speed advantage. Exact scores, run details, and benchmark mirror revision f320ff4 are included in the evaluation details.

We also use this corpus during Chowder's development. These results show performance on that benchmark, rather than on an unseen test set.

Where visual reasoning fits

Extracting a chart's labels and explaining its trend are different tasks.

read_documents handles extraction and structure. Visual reasoning is a separate operation, available through infer with image input. A query can ask a vision-language model to interpret a chart or extract structured information from an image.

This lets the extraction pipeline produce reusable content without invoking a generative vision model on every page. Reasoning is requested for the question at hand.

Spend computation where it helps

The savings depend on the documents. Letters with text already stored in the PDF offer more opportunities to skip model work than scanned tables, and routing, rendering, and assembly have costs of their own.

Chowder controls where that work goes: simple pages skip the heavier models, table recognition runs on table crops, and OCR targets content that needs reading from pixels. Models load when first needed, and independent pages can be processed concurrently.

The division also makes errors easier to investigate. A missed layout region, an OCR mistake, and a broken table grid point to different parts of the pipeline.

Document intelligence is a team sport. Specialized models and deterministic algorithms each do a focused job, then work together to turn the document into data.

Get started with document parsing in the docs.

Glancelot page routing