Document, Diagram, and Interface Understanding › The Modern Stack: OCR-Free and OCR-Based
Language AI HandbookAll chapters An OCR-based pipeline exposes a separate detector and recognizer before structured layout processing. Those intermediate observations can help a reviewer see where a downstream error entered the data. An OCR-free document model can generate a task output directly from pixels without a separate exposed OCR stage. The absence of an intermediate text stream changes which evidence is readily available for inspection. It does not decide whether grounding can be produced or externally verified. A system that offers evidence regions can be assessed for localization and factual correctness regardless of whether its recognizer is an explicit component.
A hybrid architecture can use recognized text for many fields while consulting pixels to read charts, locate checkboxes or disambiguate a suspected text error. The adaptation policy matters. Specify how the system chooses which inputs to consult and what it does when the two disagree. In this chapter the raster and the emulated text layer are deliberately distinct. Reading only perfect boxes and corrupted text is an evaluation of that exposed interface. Correcting the corrupt value by reading its actual glyph would be a different experiment.
Resolution, crop strategy and context budget
A square image of side length 1,024 pixels contains 4,096 patches if it is covered by nonoverlapping 16-by-16 patches. At 2,048 pixels with the same stride, it contains 16,384. This is a geometric patch count under the stated tiling. Some model architectures pool, resample or otherwise change the number of representations before sending them to a language model. Others use overlapping crops, padding or variable image sizes. State which convention you count before inferring inference cost or context use from the original resolution.
Cropping can preserve a small detail at higher resolution while reducing the rest of the image seen by the model. A region proposal that cuts off a nearby header can increase recognition quality and reduce the ability to interpret the recognized text. A useful evaluation compares a full-page representation, a tested crop policy and explicit cropped-context failures. When a task relies on associations across the page, recording both page-level context and targeted local evidence can be more revealing than reporting average image scale alone.
The patch budget in that square-grid example can be reproduced without invoking any model.
PythonIn [29]Expand
patch_edge = 16
for image_edge in (1024, 2048):
side_patches, remainder = divmod(image_edge, patch_edge)
assert remainder == 0
print(f"{image_edge} px square: {side_patches**2} patches")ConsoleOut [29]Expand
1024 px square: 4096 patches 2048 px square: 16384 patches
Doubling both spatial dimensions quadruples the count under this tiling rule. Compare that change with the evidence missing from the smaller image before deciding whether to raise resolution or target a crop.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!