A PDF has no table object, only drawing instructions, as we wrote in how to edit a table in a PDF. Papaya PDF must find a table and its rows and columns before you can edit it. We measured whether rules or a model should do that: "both, but not the way we had it".
The old approach
We used to find tables with a few dozen hand-tuned signals: crossing ruling lines form a grid, aligned word edges form a column, numbers sharing a right edge form a value column. Measuring it properly raised the question every team asks of its heuristics: is this the Bitter Lesson again?
The test
We used about 7,500 labeled public pages with 4,650 tables: ICDAR 2013 (government reports), FinTabNet (annual reports), PubTables-1M (scientific papers) and DocLayNet (manuals, filings and tenders). We added a small private set of real statements and bills, because that is what people bring us.
We compared three approaches:
- Rules alone, the engine as it was.
- Rules plus vision, added together: every rules table, plus what Heron, the layout model from IBM's Docling project, finds that the rules missed.
- A learned decision over both: rules and Heron propose, and a small gradient-boosted model trained on the labeled pages picks the real tables.
A table counts as found if it overlaps a labeled table by at least half and Papaya PDF can make it editable.
Rules lose as a detector
| Rules alone | Rules + vision, added together | Learned decision over both | |
|---|---|---|---|
| All public sets | 0.38 | 0.66 | 0.88 |
| Annual reports (FinTabNet) | 0.28 | 0.65 | 0.91 |
| Scientific papers | 0.51 | 0.78 | 0.97 |
| Government reports | 0.75 | 0.82 | 0.94 |
| Our statements and bills | 0.50 | 0.58 | 0.84 |
F1 score: the balance of finding real tables and not inventing fake ones. Higher is better.
On annual reports, the rules proposed a matching candidate for as few as a quarter of tables, and the hand-written logic accepted almost every candidate. It found the wrong things and kept them.
Adding vision finds more tables, but the rules' false tables remain and precision collapses: on our statements, over half its tables are not tables. The third column is what we ship towards.
Why not the vision model alone
Heron only says "there is a table here", not which characters belong to which cell, so it cannot edit anything.
The rules read the PDF's text layer: exact characters, positions and ruling lines. The engine builds cells from the file's real glyphs, so your edit looks like the author made it.
Against Heron's editable boxes alone, the hybrid still won by about a point overall and two on statements:
- Tables only the rules see, usually tightly ruled grids, are kept.
- Heron boxes the rules contradict, with no column alignment or repeating rows inside, are dropped.
Rows and columns
The other half of the job is the grid. Here the vision model is TableFormer, also from Docling, which reads rows, columns and merged cells from an image of the table.

| Engine (digital text) | TableFormer (image) | Better of the two, per table | |
|---|---|---|---|
| Government reports (212 tables) | 0.61 | 0.66 | 0.76 |
| Annual reports (785 tables) | 0.17 | 0.53 | 0.55 |
Share of tables whose grid groups every word into the right row and column.
TableFormer wins on annual reports, but it was trained on FinTabNet, its home turf. On government reports, new to both, they are close and right about different tables, so picking per table adds ten points.
Rules that survive
Annual reports put a lone "$" at the left of a value column, and the engine read it as its own column. Joining a currency symbol to its amount cut tables with extra columns from 74 to 17. That rule survives because it is a fact about typesetting, not a judgment about what is a table.
Statements often shade a column gray. A line placed midway between words, by the engine or TableFormer, lands a few points inside the gray, so the edited column disagrees with the visible one.
The PDF states that edge to a fraction of a point; an image only as finely as its resolution. The engine now snaps each line to a ruling line or shaded-cell edge within that line's own gap, or to the middle of the white seam between two shaded cells.
It never moves a line past its neighbour or through words, so row and column counts cannot change. The models decide how many lines; the file decides where.
What the Bitter Lesson says here
Rich Sutton argued that methods which learn from data, given more compute, beat human cleverness. Our numbers agree about decisions: every hand-tuned "table or not" threshold lost, and we are retiring them.
Much rule code was measuring: ruling lines, shared edges, numeric columns, structure tags. A screenshot cannot know two words are separate runs, or that a block is tagged as a table. Those measurements improve a learned model.
So: vision models propose, the engine measures and builds from the file's glyphs, and a learned model decides using both.
Frontier AI on born-digital tables
In our OCR tests, Claude put 99% of scanned table cells in the right row and column. For born-digital tables we tested 20 public pages with 26 labeled tables. Each Anthropic model got the page image and its words with positions, and was asked for every table's column and row lines.
| Found tables | False tables | Exact grids | Rows right | Columns right | Cost per 1,000 pages (est.) | |
|---|---|---|---|---|---|---|
| Rules alone | 17 of 26 | 11 | 46% | 62% | 79% | free, on device |
| Heron + TableFormer | 26 of 26 | 0 | 54% | 83% | 96% | free, on device |
| Claude Haiku 5.5 | 26 of 26 | 0 | 67% | 96% | 92% | about $1 |
| Claude Sonnet 5.5 | 26 of 26 | 0 | 67% | 96% | 100% | about $17 |
| Claude Opus 5.5 | 26 of 26 | 0 | 67% | 88% | 100% | about $33 |
Costs are estimated from API prices for one call per page: about 3,300 tokens in (the page image and its word list) and about 1,000 out, including the model's reasoning. Batch processing halves them.
All three read grids better than anything else we measured, and Haiku matched Opus at about a fortieth of the price. The models see both picture and exact words, the same evidence our fusion combines.
Haiku on 120 more pages
Twenty pages is small, so we ran Haiku on 100 labeled pages and 20 with no tables.
| Found tables (of 133) | False tables on 20 empty pages | Grid puts every word in the right cell | Editable table exactly right | |
|---|---|---|---|---|
| Rules alone | 66 | 8 | 39% | 38% |
| Heron + TableFormer | 123 | 0 | 61% | 45% |
| Claude Haiku 5.5 | 124 | 0 | 61% | 53% |
On grids alone the lead disappeared. The last column, what users feel, runs each answer through Papaya PDF's table lift, which builds the table from the file's text. Haiku's lines lift better because it sees the words and puts lines in the gaps; TableFormer's, drawn from pixels, sometimes graze a word.
That column also exposed a lift bug. Many annual reports draw a whole row as one text run, and the lift kept each run in one cell. It now splits a run at any space a column line crosses, raising exact tables from 42% to 45% for TableFormer and 47% to 53% for Haiku, as included above.
Giving the model the PDF too
On 40 pages we added the original PDF page to the image and word list.
| Haiku 5.5, 40 pages, before the lift fix | Found tables (of 48) | Exact grids | Rows right | Editable table exactly right |
|---|---|---|---|---|
| Image + words with positions | 47 | 60% | 89% | 47% |
| The same, plus the PDF page | 46 | 49% | 71% | 42% |
It was worse and cost more. The PDF's text has no positions and comes in drawing order, and the model leaned on it over the word list, which is the useful part of the PDF here.
Why frontier AI is not the default
Not price. Privacy: the document would have to leave your device, which Papaya PDF never does by default. And speed and offline use: on-device models answer in a fraction of a second, offline.
Frontier AI has two roles: pre-labeling public training pages for people to check, and, for those who turn it on, breaking ties where the rules and on-device models disagree.
Why the on-device work still matters
- The lead is modest: 53% against 45%, with equal grids and table finding.
- The model needs the engine. Its lines become a table only through the lift, where every source loses the most.
- Most documents should never leave your device. Frontier AI fits as an opt-in proposer and a cheap labeler whose answers train on-device models to close the gap.
On the same 120 pages, without asking any model again, we tried simple votes on each table's row and column counts:
| grid from | Editable table exactly right |
|---|---|
| Rules alone | 38% |
| On-device model alone | 45% |
| Haiku alone | 53% |
| Rules + Haiku | 51% |
| Rules + on-device model + Haiku, two that agree win | 54% |
| Best possible pick of rules and the on-device model | 53% |
| Best possible pick of all three | 63% |
Rules plus Haiku gains nothing: when they agree, Haiku was already right. Finding tables is saturated, since Haiku and Heron miss mostly the same ones.
The gain is in choosing the grid. The best per-table pick of rules and TableFormer would match Haiku on device, and a small trained grid chooser, which we are building next, might make it where a vote cannot.
Learned table evidence fusion
In machine-learning terms, this is late fusion with a stacked model on top.

- Base models propose. Rules, Heron and TableFormer each produce candidate tables and grids.
- Each candidate becomes a row of evidence: ruling lines, aligned edges, numeric columns, repeating row baselines, structure tags, Heron's confidence, whether proposers agree, and whether the engine can read a grid inside.
- Two small models decide. The table finder, a gradient-boosted decision-tree classifier, scores each box and keeps the best non-overlapping ones. The grid chooser picks whose rows and columns to trust. The finder is built and measured; the chooser is in training.
The alternative, early fusion, is one large network over pixels and text, as in LayoutLM. We chose late fusion because:
| Reason | Evidence |
|---|---|
| Parts are replaceable | Swapping Heron for Surya 2.5 on 311 pages: Heron proposed better (0.90 against 0.86 F1), yet fusion trained only with Heron still lifted Surya to 0.87. It learned from the PDF's evidence, not one model's quirks. |
| It runs on your device | Each part is small; the decision model is tiny next to the vision models. |
| It needs few labels | Thousands of labeled tables, not millions. |
Trees handle missing evidence, such as no vision model installed, and show which signals they use. Logistic regression came within a point: the value is in learning the decision at all.
Where the rules still work alone
- Tagged PDFs. A file that states its tables beats any guess.
- No model on hand. Heron and TableFormer are downloads; before they arrive, or where unavailable, the engine's reading is instant.
- Your files stay yours. The vision models also run on device; nothing here needs an upload.
Better labels
A learned decision is only as good as its labels, and public datasets cover papers and annual reports well but everyday documents badly. Our labeling tool outlines what the engine and models think is a table and asks one question at a time: is this one table, are these column lines right, is anything missing?
Verifying is several times faster and far less tiring than drawing, and two people check each page. The answers train the next decision model: rules measure, vision sees, people decide.
All the numbers
On public data unless noted.
| Experiment | Data | Result |
|---|---|---|
| Learned filter over rules' candidates | All public sets, unseen documents | Precision 30-72% → 94-98%; recall capped by rules proposing a match for only 23-78% of tables (Heron 83-100%) |
| Both propose, one decision | 7,482 pages, 4,653 tables | F1: rules 0.38, rules + Heron added 0.66, Heron editable boxes 0.87, learned decision 0.88 |
| Heron vs Surya as vision model | 311 pages | Heron 0.90, Surya 0.86, fusion with Surya 0.87 |
| Grids, engine vs TableFormer | 212 government, 785 annual-report tables | 0.61 vs 0.66 and 0.17 vs 0.53; best per-table pick 0.76 and 0.55 |
| Engine fixes for statements | Same annual-report tables | Joining lone "$" and merging two-line headers: exact grids 0.14 → 0.17, correct column counts 40% → 55% |
| Frontier models | 20 pages, 26 tables | Haiku, Sonnet, Opus 5.5 found every table, 67% of grids exact |
| Haiku at scale | 120 pages, 20 without tables | Exact lifts 53% vs 45% (Heron + TableFormer) and 38% (rules); grids tied at 61%; 0 false tables vs 8 from rules |
| Lift fix | Same tables | Exact lifts 42% → 45% (TableFormer lines), 47% → 53% (Haiku's) |
| Mixing sources | Same tables | Vote of rules, TableFormer, Haiku 54%; best pick of rules + TableFormer 53%, of all three 63% |
| PDF file added to Haiku's input | 40 pages | Exact grids 60% → 49% |