Purpose and development
What document understanding preserves
Optical character recognition, or OCR, recovers written characters from images. It can make a scanned page searchable by adding recognized text behind the visible image. Document understanding recovers the organization needed to interpret that content: paragraphs, tables, headings and relationships. Field extraction then selects information for a particular task, such as an invoice number or delivery date.
Field extraction must recover the relationship that makes a value answer the request. An invoice can show a total, a deposit and a remaining balance. Recognizing each amount correctly does not tell the system which one to return; it must associate the amount with the relevant label and context. A valid numeric field can therefore contain the wrong amount.
Source fidelity means agreement with the document, including its qualifications and omissions. It does not establish that the document's assertions are true. Provenance records where information originated and how it was derived. Together, these ideas determine the system's job: recover the required information, preserve its meaning, and make its origin inspectable.
Must-know turning points
Document recognition developed around changing assumptions about the input. Early systems constrained printing; later recognizers accommodated varied typefaces and imperfect scans. Digital formats created a parallel opportunity to recover encoded content directly. Learned document models added methods for interpreting relationships across a page. These approaches continue to serve different inputs and tasks.
Changing inputs, expanding document understanding
1956Farrington character readerFarrington commercially sold a reader that recognized printed numbers on tabulating cards and punched the information into those cards.
Contributors: Farrington; the Smithsonian traces the earlier reader to David Shepard and Harvey Cook.
What changed: Connected human-readable credit-sales records to punched-card processing, though the machine did not sell widely.
1960sOCR-A & OCR-BOCR-A and OCR-B were developed as fonts for optical recognition, constraining the character shapes presented to readers.
Contributors: OCR-A and OCR-B development efforts in the United States and Europe.
What changed: Made the printed input part of the recognition design; subsequent standards specified character shapes and printing tolerances.
January 1976Kurzweil Reading MachineThe announced reading machine combined a flatbed scanner, omnifont recognition and speech synthesis.
Contributors: Ray Kurzweil and the Kurzweil Computer Products team.
What changed: Enabled blind readers to hear ordinary printed material without requiring one specialized typeface.
1984–1994 development; 2005 open-source releaseTesseractHP developed Tesseract for scanner applications. Its historical engine grouped components into lines and words, then used successful first-pass words to adapt recognition of uncertain cases.
Contributors: HP's Tesseract team, described by Ray Smith.
What changed: Addressed imperfect print through segmentation and adaptation; the later release made the engine available as open source.
1991Camelot → PDFWarnock's Camelot proposal addressed document interchange across systems where application files and fonts did not transfer reliably.
Contributors: John Warnock; Peter Hibbard and Richard Cohen are identified as architects of the resulting PDF format.
What changed: Established a parallel document path built around explicit pages and packaged content, rather than recognition from scans.
2006 CTC; 2013 printed OCR applicationCTC → LSTM OCRCTC learned label sequences without a manually aligned label at every input position. Its original experiment used speech; Breuel and colleagues later applied it to normalized printed text lines.
Contributors: Alex Graves, Santiago Fernández, Faustino Gomez and Jürgen Schmidhuber; Breuel and colleagues for printed OCR.
What changed: Reduced reliance on character-segmented training data while retaining the need for suitable line inputs and normalization.
2015CRNNCRNN joined convolutional image features, bidirectional recurrent processing and CTC transcription in one trainable recognizer.
Contributors: Baoguang Shi, Xiang Bai and Cong Yao.
What changed: Enabled transcription of cropped scene words without individual character boxes; locating suitable recognition regions remained a separate requirement.
KDD 2020 publicationLayoutLMLayoutLM pretrained representations using recognized text and two-dimensional layout, with separately obtained image features added for downstream tasks.
Contributors: Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei and Ming Zhou.
What changed: Made page relationships available beyond a plain word sequence. Its form results evaluated semantic labeling, not entity linking.
2021 publicationLayoutLMv2LayoutLMv2 combined image features, recognized text and layout during pretraining, adding spatial relationships and text-image alignment and matching objectives.
Contributors: Yang Xu and colleagues.
What changed: Connected text and imagery during representation learning while continuing to consume upstream OCR.
November 2021 preprint; ECCV 2022 publicationDonutDonut encoded document images and generated token sequences that could be converted into structured information without an external OCR result.
Contributors: Geewook Kim and the NAVER team.
What changed: Removed a separate OCR dependency while still learning to read. Resolution and selecting the correct visible value remained consequential.
September 17, 2025Granite-DoclingGranite-Docling-258M was released with instructions for page, region and table conversion, generating DocTags for conversion into DoclingDocument.
Contributors: IBM.
What changed: Consolidated several specialized conversion functions within a model component while retaining a surrounding library for document handling and exports.
Inputs and representation
Inspect the available content
A born-digital document contains content encoded by its authoring software. A scan records page appearance as an image. A mixed document contains both, potentially on the same page. A PDF may also contain a hidden OCR layer. Inspect pages and regions before choosing an extraction path: usable encoded text can be retained while additional image text is recognized.
Visible text does not prove that native extraction works. A glyph is a font's visible character shape; its mapping to Unicode text is a separate operation. A PDF can display correctly yet copy or search incorrectly when those mappings disagree. Compare extracted text with rendered appearance, especially identifiers and amounts. Existing text should be treated as an available representation to inspect, rather than automatic proof that recognition is unnecessary.
Route by available content
ExampleOne page may need native extraction, recognition or both.
Read the diagram as text
- Inspect page or region. Compare encoded content with rendered appearance.
- Extract native content.
- Recognize image text.
- Combine native text and OCR. Retain their source locations.
- Resolve input disagreement. Inspect conflicting or unreadable representations.
- Inspect page or region → Extract native content: Usable native content covers target.
- Inspect page or region → Recognize image text: Target text available only as image.
- Inspect page or region → Combine native text and OCR: Native content plus image text.
- Inspect page or region → Resolve input disagreement: Representations disagree or are unreadable.
Office documents can expose more native structure. WordprocessingML directly encodes paragraphs and text runs, where a run groups text with shared formatting properties. Headers, footnotes and comments can occupy separate package parts. Extracting only the main body can therefore omit material even when no OCR is needed. Native structure saves inference work only when the relevant parts are actually read.
Reprocessing also changes information. OCRmyPDF distinguishes skipping existing text, replacing recognized text and rasterizing everything; replacement can invalidate structural tags. Its release notes document a defect that stacked duplicate OCR layers. Preserve the input snapshot, record the page inventory, and distinguish unsupported or unreadable pages from successful extraction. Source provenance explains the broader retention and identity decisions.
Retain document relationships
Before exporting strings or records, retain an intermediate document representation: identified content items connected by explicit relationships. A page contains regions; a paragraph contains lines; a caption describes a figure or table. A bounding box locates an item with a rectangle in a specified coordinate system. That rectangle supplies geometry, while a role such as heading or caption supplies an interpretation.
DoclingDocument separates content items from structural trees. Ordered children in the body express reading order; separate page furniture includes surrounding material such as headers and footers. Items can carry geometry and provenance when conversion supplies them. Its internal references identify items within that representation, rather than promising persistent identity across every regeneration.
Containment is one relationship
ExampleA document item can participate in containment, scope and association.
Read the diagram as text
- Page.
- Heading.
- Paragraph.
- Table.
- Caption.
- Page → Heading: contains.
- Page → Paragraph: contains.
- Page → Table: contains.
- Page → Caption: contains.
- Heading → Paragraph: scopes.
- Caption → Table: describes.
Established formats make different choices. hOCR embeds recognized text and spatial metadata in HTML; its boxes use pixel coordinates from the image's top-left corner. ALTO provides XML layout and text metadata, including explicit ordering and processing references. These capabilities matter only when producers populate them.
Treat plain text, Markdown and CSV as projections for particular consumers. Plain text imposes a sequence; Markdown expresses selected structure; CSV represents a rectangular table. None inherently retains all geometry, associations or processing states. Keep original content, normalized derivatives and interpretation separately addressable. The local conversion demonstrated in Structuring the Unstructured illustrates the benefit: table objects remain available for inspection and export instead of disappearing into one text stream.
Text and page structure
Prepare images and preserve coordinates
Rasterization renders a page into pixels. Preparation then addresses specific defects: orientation correction turns an upside-down page, deskewing straightens tilted lines, and cropping removes irrelevant surroundings. Binarization separates foreground from background; dewarping straightens curved page content. These operations change what recognition sees. Aggressive cleanup can remove meaningful marks, so compare the processed image with its source.
Coordinate mappings
Page coordinates and image coordinates are different address systems. PDF page geometry uses points, while rendered images use pixels. Crop settings, rotation and origin conventions affect the mapping. PyMuPDF, for example, distinguishes the full MediaBox, visible CropBox and rotated page rectangle. Use the actual page transforms when moving locations between them; a generic vertical-axis flip is insufficient.
One region in two coordinate frames
ExampleThe same source content receives different coordinates after cropping, resizing and padding.
Source image
The dashed rectangle is the crop from (100, 200) to (250, 300). R is fully inside it.
- 1. Crop boundary
- 2. Region R
Read coordinates and regions as data
X: 0–400 pixels; Y: 0–400 pixels, increasing down. Equal scale on both axes.
(100, 200); (250, 200); (250, 300); (100, 300); (100, 200)
(140, 230); (200, 230); (200, 260); (140, 260)
Source origin: (0, 0): (10, 20)
Crop origin: (100, 185)
R: (170, 245)
Processed image
The crop becomes 300 by 200 pixels. Twenty pixels of padding on every side produce a 340 by 240 image.
- 1. Processed image boundary
- 2. Crop boundary
- 3. Region R
Read coordinates and regions as data
X: 0–400 pixels; Y: 0–400 pixels, increasing down. Equal scale on both axes.
(0, 0); (340, 0); (340, 240); (0, 240); (0, 0)
(20, 20); (320, 20); (320, 220); (20, 220); (20, 20)
(100, 80); (220, 80); (220, 140); (100, 140)
R: (160, 110)
20 px padding around the resized crop: (20, 270)
For a small example, crop an image at origin (100, 200), double its size, then add 20 pixels of left and top padding. A source region from (140, 230) to (200, 260) becomes (100, 80) to (220, 140). To map a recognized box back, remove padding, divide by two and restore the crop origin. Both corners must undergo the mapping.
Rotation may require mapping all corners and retaining a quadrilateral; curved-page correction can require a nonlinear remapping. Retain the transformation actually used. Interpolation changes image samples, and an inverse coordinate map cannot restore cropped-away content. Coordinates and target validity develops the general geometry.
More preparation is not automatically better. The DewarpNet implementation reports character error rates of 0.3136 with an added blur operation and 0.249 without it for its own method. This comparison used 25 images, Tesseract 4.1.0 with default configuration and PyTesseract 0.2.6. It demonstrates a harmful transformation under those conditions, rather than a universal rule against blur.
Recognize character sequences
Text detection locates suitable regions; recognition transcribes them. A recognizer configured for a word, line or full page makes different segmentation assumptions. The detection chapter explains region finding more generally. For documents, the immediate concern is whether each recognition input contains the intended text without combining unrelated content.
The historical Tesseract engine grouped connected image components into lines and words, then recognized words in two passes. Satisfactory first-pass words trained an adaptive classifier used to revisit uncertain cases. This exposed a recurring difficulty: mistakes in character segmentation could constrain recognition before the classifier made its final decision.
A blank preserves a repeated letter
ExampleCollapsing adjacent repetitions before removing blanks preserves the two O characters.
Keep the blank as a distinct label.
Read the diagram as text
- B B O O ∅ O K K. Position labels; ∅ denotes blank.
- B O ∅ O K.
- BOOK. Final transcript.
- B B O O ∅ O K K → B O ∅ O K: Collapse adjacent repetitions.
- B O ∅ O K → BOOK: Remove blank.
- Position labels. Keep the blank as a distinct label. Active: B B O O ∅ O K K. New: B B O O ∅ O K K.
- Collapse repetitions. The blank keeps the O groups separate. Active: B B O O ∅ O K K, B O ∅ O K. New: B O ∅ O K.
- Remove blank. Both O characters survive. Active: B B O O ∅ O K K, B O ∅ O K, BOOK. New: BOOK.
Alignment without character boxes
Sequence recognition reduces dependence on individual character boundaries. Shi, Bai and Yao's convolutional recurrent neural network, or CRNN, introduced in 2015, computes visual features—numerical descriptions of image regions—and processes their columns as a sequence. Information travels along the sequence in both directions, supplying neighboring context for transcription. Its experiments used cropped scene words: recognition still required suitable regions. Breuel and colleagues' 2013 printed-text work similarly retained line normalization.
Connectionist Temporal Classification, or CTC, trains with transcript sequences without requiring a label aligned to every input position. Positions predict characters plus a blank symbol. A path becomes text by collapsing adjacent repeated labels, then removing blanks. Training sums over paths compatible with the transcript; the figure shows only one possible path. A separating blank allows two identical letters to survive.
Decoding assumptions also matter. A lexicon restricts outputs to permitted strings; ordinary-word dictionaries can be inappropriate for identifiers or price lists. Blur and unfamiliar fonts affect recognition inputs, while handwriting and mixed scripts require suitable model coverage. Tesseract's printed-text orientation, for example, does not establish handwriting competence. Context can help resolve ambiguity, but a familiar-looking correction must still agree with the page.
Find regions and their roles
Layout analysis identifies page regions and their organization. Finding a rectangle and assigning it a role are different operations: a large region might be a paragraph, table or picture. Whitespace, alignment and typography suggest grouping; learned models can assign categories. A merge across two columns changes what later stages receive even when every character remains readable.
Top-down partitioning starts with a page and divides it. Ha, Haralick and Phillips's 1995 recursive X-Y cut splits at sufficiently large horizontal or vertical gaps. A projection profile summarizes occupied positions along one axis; their method projects connected-component boxes rather than individual pixels. Recursion creates nested rectangular regions, but complex layouts can leave unrelated content in one unsplit leaf. A spatial hierarchy alone supplies neither roles nor reading order.
Bottom-up grouping builds larger regions from smaller nearby components. Mao and Kanungo's 2001 implementation study contrasts Docstrum with X-Y cut: the approaches accommodate different geometric arrangements. It identifies difficulties for Docstrum with nontext regions, irregular spacing and sparse characters. Their own evaluation used deskewed pages, so it did not test their implementation's orientation robustness.
Learned layout analysis needs explicit annotation conventions. Pfitzmann and colleagues at IBM introduced DocLayNet in 2022 with 80,863 manually annotated pages and 11 region classes, broadening coverage beyond scientific articles. Annotators still disagreed over some groupings of subfigures and list items. Preserve pictures, mathematics and unknown regions even when their detailed interpretation is outside the current task; discarded regions cannot support later inspection.
Recover reading order and continuity
Reading order specifies meaningful sequence or precedence among document elements. Reading across two columns line by line can interleave unrelated sentences; completing the first column before the second preserves a different sequence. W3C's PDF reading-order guidance illustrates this failure. Tagged PDFs encode logical order, but conversion can produce incorrect tags, particularly around sidebars, tables and footnotes.
Some documents have several legitimate paths. A partial order specifies required precedence without ordering every pair of items. Two independent magazine articles each have a paragraph sequence, but neither article must precede the other. Clausner and colleagues' 2013 study models this distinction. PAGE XML represents ordered and unordered groups separately from physical regions.
Independent reading paths
ExampleLocal sequence does not require an order between independent articles.
Read the diagram as text
- A: first paragraph.
- A: second paragraph.
- B: first paragraph.
- B: second paragraph.
- Note for A.
- A: first paragraph → A: second paragraph: precedes.
- B: first paragraph → B: second paragraph: precedes.
- Note for A → A: second paragraph: qualifies.
Character direction is another layer. Arabic or Hebrew text can contain left-to-right digits and Latin words. Unicode's bidirectional algorithm distinguishes logical character order from display order; uniformly traversing visible glyphs left to right does not reconstruct every intended string. That specification governs text display, rather than deciding which page region follows another.
Logical structure can also cross page boundaries. Tagged PDF can represent one paragraph through content on two pages. Keep continuation separate from repeated headers, and retain caption and note associations without forcing them into the main sequence. Dehyphenation joins a word split at a line boundary; because it changes the text, the joined word needs a retained correspondence to its original fragments.
Traceability
Locate supporting source material
A source location addresses content in a particular document version. An evidence span identifies the text or regions supporting an extraction. These are related but different: locating a number does not identify every header or note needed to interpret it. Preserve multiple supporting regions when the explanation depends on separated content.
| Address | Required context |
|---|---|
| Document and page | Source version and page index. Optional labels are display aids, not unique identifiers. |
| Image region | Image identity, dimensions, coordinate origin, units, crop and rotation history. |
| Text span | Named text representation, counting unit, start position and end convention. |
| Recognized item | Item identifier within an identified extraction result; a model token index addresses a different sequence. |
Trace a normalized field
ExampleDerivation, text correspondence and spatial location are different links.
Read the diagram as text
- Extracted date.
- Normalized text span.
- Literal text spans.
- Date region.
- Interpretation context.
- Identified source snapshot.
- Extracted date → Normalized text span: derived from.
- Normalized text span → Literal text spans: text correspondence.
- Literal text spans → Date region: located in.
- Extracted date → Interpretation context: interpretation supported by.
- Date region → Identified source snapshot: region within.
- Interpretation context → Identified source snapshot: region within.
Page labels can use Roman numerals, prefixes or restarted numbering, and need not be unique. PyMuPDF's example labels page index 6 as A-10 and page index 10 as 1. Label metadata can also differ from numbering visibly printed on the page. Retain the actual page index and source version when constructing a review link.
Alignment through transformations
Text transformations change addresses too. Expanding a ligature—a glyph combining multiple characters—or joining line fragments changes string length; reordering paragraphs changes their positions. ICU edit maps retain source and destination spans. They can identify which source span became a replacement without locating each character inside that replacement. Reordered segments need their own mappings. Keep normalization separate from correction, as explained in Meaning-preserving cleaning.
W3C's annotation model provides position selectors and text-plus-context selectors; positions become brittle when the representation changes. Source offsets explains counting units and end-exclusive ranges. Google Document AI separately represents text anchors and page anchors, including multiple regions. Such addresses make checking possible. A model-emitted location still needs to be checked against the page and the field's interpretation.
Document architectures
Combine text, layout and images
A modular route exposes intermediate results that can be inspected separately. The original Docling pipeline obtains native PDF text with coordinates and renders page images. Layout analysis identifies regions and roles; TableFormer recovers table structure. Assembly adds reading order and caption associations. Table cells are matched to available PDF text rather than necessarily retranscribed.
Document models can learn relationships from those inputs. LayoutLM adds two-dimensional positions to recognized words. Its original text-and-layout pretraining is distinct from the image features added for downstream tasks. Pretraining learns reusable representations before task adaptation; Pretraining and Midtraining explains that process. LayoutLM's form experiments assessed semantic labeling: assigning roles to text spans. Recovering which labeled spans belong together is a separate linking task that those results did not evaluate.
Inputs to modular document assembly
Native text supplies content while image analysis supplies structural predictions.
Read the diagram as text
- PDF.
- Native words and coordinates.
- Rendered page image.
- Layout analysis.
- Table structure analysis.
- Typed document assembly.
- PDF → Native words and coordinates: extract text and geometry.
- PDF → Rendered page image: render pixels.
- Rendered page image → Layout analysis: page pixels.
- Layout analysis → Table structure analysis: table regions.
- Rendered page image → Table structure analysis: table pixels.
- Native words and coordinates → Typed document assembly: words and coordinates.
- Layout analysis → Typed document assembly: regions and roles.
- Table structure analysis → Typed document assembly: cells and structure.
Yang Xu and colleagues' LayoutLMv2, published in 2021, includes images during pretraining alongside OCR text and layout. It learns relative spatial relationships and adds training tasks that connect text lines to image regions and check whether text and imagery correspond. The paper tested these additions on DocVQA, a document question-answering benchmark. Using its base-sized models and one pass through the same pretraining corpus, the comparisons showed improved validation results when visual information and the additional training tasks were included. The model still consumes upstream OCR.
The practical advantage of explicit interfaces is diagnostic: inspect the transcript, region assignments and assembled structure before changing downstream extraction. Their cost is that errors can cross interfaces too. The OpenRAG implementation discussion illustrates a configurable choice between focused conversion stages and a document vision-language model. Optional stages add processing work and should be chosen for the information the task requires.
Generate structure from page images
A vision-language model processes images and language together. In an image-to-structure route, an encoder turns page pixels into numerical features. A generator uses those features to emit tokens, units representing text or structural markers, which are converted into fields or document elements. Reading and interpretation thus happen within one model. See Visual features in language responses and Multimodal Models and Applications for the general mechanisms.
Donut removes the separate OCR dependency, while still learning to read. Larger input resolution helped tiny-text questions at greater computational cost. One published failure selected the wrong visible number. Its attention weights indicated which image features the generator used, offering clues to location rather than validated field coordinates.
IBM's Granite-Docling-258M, released September 17, 2025, illustrates a later conversion component. It generates DocTags that can become a DoclingDocument, with instructions for full pages, specified regions and tables. The model remains part of a surrounding conversion library; generating document structure does not remove the need to manage files, preserve provenance and inspect outputs.
Interfaces can also combine native text and imagery. Google's document-processing documentation describes visual PDF processing and, for Gemini 3, supplying extracted native PDF text. Other accepted document types follow a text-only path. Choose an architecture by the information it receives and returns: input detail, inspectable intermediates, supported structure, source locations and processing work. A shorter external pipeline is not itself evidence of better extraction.
Tables and records
Recover table meaning
Table structure consists of rows, columns, cells and spanning relationships. A spanning cell covers more than one row or column. Recovering that structure differs from detecting the table, transcribing its contents and assigning functional roles such as header or row label. A header hierarchy lets a broad heading qualify several subordinate columns. Consequently, a correctly read value can still acquire the wrong meaning through incorrect cell membership.
Microsoft's Table Transformer separates table detection from structure recognition and uses separately supplied OCR or native text to populate exports. Its initial project release was in June 2021; the full PubTables-1M dataset followed that October. The work also addressed inconsistent splitting of spanning headers in reference annotations. Structure models can recover borderless arrangements; visible ruling lines are useful cues, not a requirement that every cell have four drawn sides.
What gives a cell meaning
ExampleThe value depends on headers and qualifications outside its rectangle.
Read the diagram as text
- Cell: 3*.
- Inspection.
- Observed.
- Processing time (days).
- Includes one nonworking day.
- Cell: 3* → Inspection: row label.
- Cell: 3* → Observed: column header.
- Observed → Processing time (days): qualified by spanning header.
- Cell: 3* → Includes one nonworking day: asterisk links qualification.
Meaning outside the cell
| Stage | Planned | Observed |
|---|---|---|
| Inspection | 2 | 3* |
The string 3* becomes useful through several relationships: Inspection identifies the row, Observed identifies the measure, the spanning heading supplies days, and the note qualifies the interval. W3C's multi-level header guidance represents multiple header associations explicitly. JATS table notes demonstrate units inherited from a spanning header and qualifications linked from outside the grid.
Across pages, retain a table's identity while distinguishing repeated headers from new data. Microsoft's template guidance labels a continuing table as one table across pages and calls for representative variations; that is not proof of reliable continuation detection on unfamiliar layouts. Preserve empty cells when they express structure. CSV can carry expanded header names or companion metadata, but the basic grid does not directly express spanning cells, linked notes or source geometry.
Extract fields with context
Key-value association binds a label or semantic role to its value. Proximity helps, but repeated labels, sections and nested records can change which value belongs where. Textract expresses containment through CHILD relationships and key-value association through VALUE relationships. These are different links: being on the same page does not make an address belong to a particular party.
Repeated records add a grouping problem. DocILE, introduced in 2023, distinguishes locating application fields from assigning descriptions, quantities and prices to the correct line item. Selection marks need context too: a checked box in a rating table belongs to both a row question and a response column. Textract records selected and not-selected states, but an undetected mark is neither of those observations.
Literal and interpreted values
Keep observation separate from transformation. Google's published receipt examples retain the literal date 11/12/2022 while normalizing it to 2022-12-11 using French context. Another example supplies a full address through external knowledge although that address is not printed on the receipt. Normalization changes representation under an interpretation rule; enrichment adds information from elsewhere. Neither should silently replace the observed text.
Dates, decimal separators and units require explicit interpretation. For example, treating 1,25 as 1.25 needs an established decimal convention. Computing a balance from a total and deposit adds a calculation with two input dependencies. Preserve the literal values, contextual support and applied rule; preserve ambiguity when that context is insufficient. Meaning-preserving cleaning distinguishes normalization from correcting an erroneous reading.
Large extraction requests can be divided without separating dependent fields. In Building an Agentic Platform, Box describes keeping contract parties and their addresses together when splitting field sets across calls. The general design rule is to partition work around relationships: independently extracting several names and several addresses leaves an association task that still has to be solved.
Check records against their sources
A schema specifies permitted fields, types and constraints. Structural validation checks that representation; semantic validation checks specified relationships, such as date order or compatible units. Check meaning and current state develops these concepts. For document extraction, the additional obligation is to compare the accepted record with the source material it claims to represent.
Peppol rule BR-CO-13 supplies a concrete consistency check: the invoice total excluding value-added tax must equal line net amounts minus document allowances plus document charges. Its executable test compares supplied monetary fields. It does not inspect the page, so passing cannot establish that those fields were faithfully transcribed or correctly associated.
| Check | What it establishes | What can remain wrong |
|---|---|---|
| Schema validation | The amount has an accepted representation. | It came from the wrong row. |
| Reconciliation | Supplied amounts satisfy the chosen equation. | An omitted item also disappeared from a recomputed total. |
| Source association | The value agrees with its identified label and region. | Another required record was omitted. |
| Completeness inspection | Expected pages and source records were accounted for. | Individual interpretations still need checking. |
Model agreement provides another signal, not source confirmation. Box describes checking OCR against page images and sometimes comparing multiple vendors' answers. Agreement can prioritize a candidate, but the models may share the same mistaken association. Inspect the label, value and qualifying context that establish the requested field.
Use distinct information states when they change consumer behavior: absent means the relevant source was inspected without finding the field; illegible means a reading cannot be recovered; conflicting means incompatible candidates remain; not applicable means the field does not apply; processing failure means inspection did not finish. Missing-information contracts should preserve these distinctions. The historical TEI transcription guidelines offer a useful precedent by separating gaps, uncertain readings and text supplied by an editor.
Quality and recovery
Measure the required fidelity
Transcription
Measure the output property the task needs. Character error rate, CER, and word error rate, WER, compare a transcription with a reference through edit alignment. They count substitutions, deletions and insertions rather than comparing identical positions in two strings. Their denominator is the reference length in the chosen unit.
State how text is normalized before scoring. Lowercasing or removing punctuation changes which errors count; removing punctuation is inappropriate when decimal points matter. Word segmentation also changes WER, particularly across languages. Tools such as JiWER expose transformations and alignments so the scoring contract can be inspected.
Beyond recognized strings
| Target | Measurement and interpretation |
|---|---|
| Reading order | Compare predecessor, successor and unordered relationships after accounting for region splits and merges. |
| Table fidelity | Grid Table Similarity, or GriTS, separately compares topology, cell content and location while retaining two-dimensional order. |
| Field values | Precision is matched predictions divided by all predictions; recall is matched reference values divided by all required reference values. Define the matching rule. |
| Localization and grouping | Check the supporting region and line-item assignment separately. DocILE's main localization measures do not establish transcription or normalization accuracy. |
| Completeness | Account for expected pages, regions and records, including failures and unprocessed material. |
With exact field-value matching, one wrong value creates both an unmatched prediction and a missed reference value. Abstention removes a prediction but does not remove the required reference field. Report matching rules, aggregation and coverage together; otherwise an apparent gain can come from evaluating fewer outputs.
Whole-document readiness
References should cover the intended layouts, scripts, capture conditions and unfamiliar templates. Keep related pages together when testing transfer to new documents: DocLayNet's controlled experiment obtained higher layout scores when pages from the same documents crossed training and evaluation than when whole documents were separated. DocILE likewise distinguishes unseen layouts from layouts represented during training. Workload coverage explains the general design.
Finally, measure the work remaining. In the CHICA pediatric-clinic pilot, digit recognition accuracy was 98.6%, but only 125 of 221 scanned forms required no verification before data entry. The forms used constrained templates and barcode linkage. High character accuracy and whole-form readiness were different outcomes; neither number alone describes correction effort on arbitrary documents.
Choose what to accept
Extraction confidence is a score intended to indicate reliability for a specified prediction. Word recognition, key-value association and whole-document readiness are different targets. Confidently recognized words can still be attached to the wrong field. A generated self-assessment also needs evaluation against the outcome it claims to predict; its wording does not supply that evaluation.
Calibration asks whether predictions assigned a confidence such as 0.9 are correct about 90% of the time under the evaluated conditions. It differs from accuracy and from ranking useful candidates. An acceptance score may rank reliable cases well without expressing calibrated probabilities. What calibrated confidence means develops this distinction.
Coverage is accepted cases divided by all eligible cases. Selective risk is error among accepted cases; it is undefined when none are accepted. Raising an acceptance threshold can reduce reported error by selecting less work, without improving the extractor. Choose the unit—field, line item or document—and report both quantities. Review capacity and the consequences of wrong acceptance belong in the policy, as explained in Deferral, risk and review capacity.
Basware's 2023 study trained an auxiliary estimator for joint correctness of five invoice fields: number, date, subtotal, tax and total. It calibrated separately without retraining the extractor. On 24,000 test invoices, estimated automation coverage increased from 65.6% to 73.2% at the production system's undisclosed target precision. These were single-page, machine-readable invoices with known templates; unknown templates and multipage invoices were excluded. The result was a test-set estimate, not demonstrated live improvement.
Low scores are not the only reason to inspect a document. AWS's documented Textract review integration distinguishes word confidence, key-value confidence, missing important keys and sampling regardless of confidence. This illustrates targeted review plus auditing of apparently reliable cases; the A2I service is closed to new customers. Source ambiguity remains a separate state: when two interpretations are genuinely supported, retain alternatives rather than treating a high score as resolution.
Recover incomplete and disputed results
Recovery starts by identifying where the required information became unavailable or incorrect. OCRmyPDF can retain the rendered input, the image actually sent to OCR and recognized text. Comparing those artifacts separates rendering, preparation and recognition failures. A better scan addresses inadequate capture; revised segmentation addresses merged regions; neither resolves a genuinely ambiguous label.
Also distinguish unfinished processing from unfinished retrieval. Textract's GetDocumentAnalysis exposes job status and page warnings separately from NextToken, which indicates more result blocks to fetch. API result pages are not document pages. Receiving some fields therefore establishes neither complete retrieval nor successful processing of every source page.
Match recovery to the failure
ExampleUseful recovery changes the missing information, failed transformation or unresolved interpretation.
Read the diagram as text
- Inspect incomplete or disputed result.
- Fetch remaining result blocks. Complete result retrieval.
- Request a better source. Replace inadequate capture.
- Start a targeted new attempt. Revise preparation or segmentation for the affected region.
- Request interpretation. Present candidates with source context.
- Retain explicit partial output. Apply the consumer's eligibility contract.
- Inspect incomplete or disputed result → Fetch remaining result blocks: More result blocks remain.
- Inspect incomplete or disputed result → Request a better source: Required detail absent from capture.
- Inspect incomplete or disputed result → Start a targeted new attempt: Preparation or grouping lost usable detail.
- Inspect incomplete or disputed result → Request interpretation: Visible content supports competing readings.
- Inspect incomplete or disputed result → Retain explicit partial output: Unresolved after available recovery.
Review and correction
A useful review record contains the source version, page and region, surrounding context, candidate values and reason for referral. Vanderbilt's paper-form study placed recognition overlays beside an editable form; selecting a field highlighted the corresponding source location. Its reported review time also changed when handwritten-comment transcription was removed from the task. Review effort therefore depends on scope as well as recognition quality.
Adjudication resolves or records disagreement. Let reviewers distinguish a corrected reading from a supplied interpretation, with the original still available. Review meaningful changes covers the interaction. Record a correction as a derived revision, rerun affected checks, and retain unresolved page, region and field states. A targeted retry should name what changed and terminate with a new result or explicit deferral.
Downstream use
Deliver context with the records
The output contract should let another system interpret the result without silently reconstructing missing document relationships. Deliver values or document elements with source identity and version, locations, required context, interpretation rules and completion state. Partial output eligibility depends on the consumer: an independently supported field may be usable while a document-wide calculation still requires complete coverage.
| Isolated output | Interpretable handoff |
|---|---|
| Inspection, 2, 3 | Stage: Inspection; planned processing time: 2 days; observed processing time: 3 days. |
| Asterisk omitted | Qualification: observed interval includes one nonworking day. |
| Source URL alone | Identified source version plus locations for the row, headers and note; extraction and review state. |
A chunk is a bounded retrieval unit; an index is a derived lookup structure. Searchable units and identity explains their design. Docling's chunking interface works from its structured document and carries metadata such as headings and captions. Table chunks can repeat headers, although configuration can omit them. A small chunk is useful only if it retains the context its consumer needs.
Lineage records derivation relationships. Keep mappings from corrected document elements to affected records and chunks, then explicitly replace, invalidate or reinspect those derivatives. A lineage link does not perform the update; Corrections and withdrawals explains that responsibility. Carry required source permissions and handling metadata into the handoff, while enforcing access through the controls described in Privacy and Data Governance.
Open questions
Reliable acceptance on unfamiliar layouts remains difficult because the relationships used by an extractor and its confidence estimator can change together. Progress would demonstrate joint field correctness and useful coverage on held-out templates and multipage documents, rather than transfer thresholds from familiar single-page invoices.
Cross-page table continuity remains a demanding interpretation problem: repeated headers, empty cells and continuation rows can support competing groupings. Progress would preserve and evaluate these links on unfamiliar documents, including uncertainty when the source permits several readings.
Review policies need evidence about the work they actually remove. Faster review can reflect narrower transcription requirements, and source-linked interfaces still depend on human judgment. Progress would compare equal task scopes while measuring residual errors, correction time and reviewer disagreement.












