Research · Published August 21, 2026

PDF field detection: What broke across 23 real forms

This is a technical look at our work on pdf2fill's field detector: what broke across 23 real PDF forms, what we learned, and which fixes held up under measurement. The detector found 1,644 of 2,130 annotated fields. The average hides a much messier result: one document scored 0.9944 F1, another scored 0.0526, and the government and tax subset landed at 0.5557.

Who ran this test: pdf2fill built the detector being measured. Several official PDFs in the corpus originally contained AcroForm fields. We deliberately flattened them to exercise the fallback path used on flat digital PDFs. These scores don't measure AcroForm extraction or the named forms exactly as distributed.
Abstract PDF pages with detected fields, missed boxes, and an overlap measurement

0.8288 micro F1, with a 0.7018 document average

Across 23 documents, the answer key contains 2,130 fields. The detector returned 1,837 predictions: 1,644 true positives, 193 false positives, and 486 false negatives. A match required at least 0.50 intersection over union (IoU) on the same page.

Precision0.89491,644 / 1,837 predictions matched
Recall0.77181,644 / 2,130 annotated fields found
Micro F10.8288harmonic mean from pooled counts
Macro F10.7018mean of 23 per-document F1 scores

Micro F1 pools every field, so a 356-field document can move it sharply. Macro F1 gives each document equal weight. The 0.1270 gap between them is the warning label: performance varies more by document than the headline number suggests.

What counted as a detected field

We drew a rectangle around each fillable region on the pages a user would complete. Instruction-only pages weren't annotated. The evaluator paired predictions and truth rectangles one to one on the same page, then counted a pair as a match when its IoU reached 0.50.

Two overlapping rectangles showing their intersection and union for an IoU match
IoU is the overlapping area divided by the combined area. A detection can be in roughly the right place and still miss when its rectangle is too large, too small, or split differently.

The score is geometry-only. Field type is ignored, and F1 is the harmonic mean of precision and recall. We omit type accuracy because eight documents still carry generic, unreviewed type labels.

The corpus is a committed regression set rather than an unseen test. 20 documents are development documents. The other three form a committed validation subset, which means they are visible to the test gate. A separate unseen holdout exists outside the repository, but it hasn't been scored for this article.

Several official PDFs were flattened before annotation. In normal use, pdf2fill reads existing AcroForm fields directly when they are present. This benchmark removes that easier path and measures only the fallback detector for digital pages made from text, lines, vector shapes, and embedded raster elements.

A blank line can use six visual primitives

A person sees a place to type. A PDF may encode that place as underscores, a horizontal rule, a bordered rectangle, nine adjacent comb cells, a box nested inside a larger border, or a font glyph that only looks like a checkbox.

Purpose-drawn examples of a ruled blank, nested checkbox, glyph checkbox, and comb field
Four abstract field geometries from the test work. These drawings contain no source-form text or imagery.

Rules and underscores were the easy half

The original detector was strongest on underscore runs and ordinary ruled blanks. Documents built around those marks commonly scored from the high 0.70s into the 0.90s. That success didn't transfer cleanly to bordered cells and combs.

Some checkboxes were hidden inside bigger contours

An early contour pass kept only the outside edge of a connected shape. Small checkboxes nested inside a form border disappeared before classification. Reading the contour hierarchy recovered 46 true positives on the development documents, with no new false positives, in a round that moved overall F1 from 0.7312 to 0.7510.

Higher resolution couldn't turn a diamond into a square

One 356-field patient intake document contained 251 checkbox annotations. The raster checkbox pass found none at 150, 225, 300, or 450 DPI. At 300 DPI, an isolated diamond covered 60.9% of its bounding box, below the square detector's 85% extent floor. Of the 251 checkbox annotations, 248 sat on lozenge characters in the text layer.

An allow-listed glyph pass later recovered all 251 on that targeted document, plus 32 more across two other documents. The full-corpus change added 283 true positives and four false positives, with no per-document F1 regression. That document was a development case, so it isn't independent evidence of generalization.

Comb fields forced an annotation decision

A row of nine character cells can be annotated as nine boxes or as one field with nine positions. The product needs the second version: one place to type the full value. We changed the answer-key convention to one field per contiguous comb run, even though the detector still emitted individual cells. That made the answer key more useful and made the weak score more visible.

Labels can live inside the box

Some intake forms print a caption inside the same bordered area where the answer belongs. A filter designed to reject boxes containing text then rejects the input itself. The geometry alone can't reliably tell whether the text is a label, a filled answer, or ordinary table content.

Two plausible fixes failed measurement

Rendering the 4-page patient document at higher DPI raised peak memory from 147 MB at 150 DPI to 582 MB at 450 DPI. Checkbox recall stayed at zero. The problem was shape, so extra pixels only made the same mistake more expensive.

We also widened the accepted band for long labelled rules. The broad variant found six more true fields and added 23 false positives, reducing overall F1 from 0.7510 to 0.7474 with regressions on five documents. A left-label-only variant added one true positive and one false positive, barely moving F1 to 0.7511. Both variants were dropped.

A correct box can fail against a wrong rectangle

On an anonymized bank direct-deposit form, nine drawn checkboxes measured 9.24 by 9.24 points. The hand-drawn truth rectangles measured 16.50 by 14.00 points, 170.6% more area. The actual vector box reached only 0.3696 IoU against that truth, so a geometrically correct detector couldn't cross the 0.50 match threshold.

We corrected those nine rectangles from the PDF's vector content, not from detector output. The unmodified engine's score stayed exactly the same because it had missed all nine boxes before and after. A second mechanical audit later snapped 34 noisy checkbox annotations on another development form. Its IoU-0.50 score stayed unchanged, while its stricter IoU-0.75 F1 moved from 0.38 to 0.78.

That audit matters because tuning against a hand-labelled corpus can optimize both the detector and the mistakes in its answer key. Corrections need an independent geometric source and a before-and-after score for the untouched engine.

The biggest win was also the most targeted

Patient intake form A contributes 356 annotated fields, 16.7% of the whole corpus. We diagnosed its checkbox glyphs directly and built the glyph pass against that failure. Its final score is 0.9944 F1.

Removing that one document leaves 22 documents and 1,774 annotated fields. Micro F1 falls from 0.8288 to 0.7924. We publish both figures because the lower one better shows how much the headline depends on a targeted development case.

Results, worst first

Small documents move in coarse steps. IR330 has eight annotated fields, so one match changes recall by 0.125. Private and restricted sources use neutral labels throughout this page and the public data file.

Geometry-only results at IoU 0.50, ordered by F1 from lowest to highest. Scroll horizontally for all metrics.
DocumentCategoryFieldsPrecisionRecallF1
Patient intake form CMedical intake710.40000.02820.0526
New Zealand IR330Government and tax80.08330.25000.1250
Bank direct-deposit form BBanking131.00000.07690.1429
France Cerfa 13750Government and tax1380.91890.24640.3886
IRS W-9Government and tax230.37500.52170.4364
HMRC Starter ChecklistGovernment and tax450.42030.64440.5088
Bank direct-deposit form ABanking390.68750.56410.6197
Deposit receiptBusiness form300.61360.90000.7297
Canada TD1Government and tax310.79310.74190.7667
Patient intake form DMedical intake630.97620.65080.7810
Bid proposalBusiness form1040.97300.69230.8090
Residential leaseReal estate2290.89290.76420.8235
IRS W-4Government and tax480.86360.79170.8261
Contractor invoiceBusiness form1250.91740.80000.8547
Power of attorneyAgreement410.84090.90240.8706
Car rental agreementAgreement830.93150.81930.8718
U.S. Court AO 240Government and tax311.00000.77420.8727
Patient intake form BMedical intake1760.97930.80680.8847
Investor agreementAgreement1120.92520.88390.9041
Independent contractor agreementAgreement1350.96750.88150.9225
Work-for-hire agreementAgreement1200.99140.95830.9746
Collaboration agreementAgreement1090.99070.97250.9815
Patient intake form AMedical intake3560.98891.00000.9944

Download the public benchmark data (JSON). Ground-truth SHA-256: c67439f5fc9013cbdbbf283b4a2e29623bd20a52af501e622fab6ad563b5d9b4.

What these numbers don't cover

  • The corpus is private. Its committed hashes, counts, evaluator, and derived results are auditable, but outside readers can't reproduce the benchmark without the source PDFs.
  • The benchmark measures the flat-digital fallback. It doesn't measure AcroForm extraction, OCR, image-only scans, or PDFs outside these 23 documents.
  • The documents weren't sampled randomly. The set grew from available forms and known failure styles. Twenty documents were used for development, and the three committed validation documents are visible to the regression suite.
  • Field types aren't scored here. Eight documents use generic, unreviewed type annotations, so a geometry match doesn't prove the correct input type.
  • IoU 0.50 forgives some edge error. IoU 0.75 is more sensitive to small cross-platform coordinate shifts, so we use the threshold where all three committed platform floors agree exactly.

The failures are now specific enough to work on

The next detector work is specific: merge comb cells into usable inputs, handle labels inside bordered cells, and distinguish long write-in rules from table furniture without reopening the false-positive flood.

The benchmark also changed how we judge improvements. A corpus score needs its per-document distribution, development history, annotation corrections, and rejected experiments beside it. Without those, 0.8288 looks more settled than it is.

If you have a flat digital form and want to see where the current detector succeeds or misses, you can try the PDF form filler. Manual field placement remains available when the fallback gets the geometry wrong.