Glancelot: a tiny vision model for knowing when to skip document layout analysis
A quick glance before a closer look.

Running a large layout model on every document page can waste compute and slow down extraction. Many pages have simple layouts that do not require the same analysis as pages containing tables, figures, or other complex structures.
Glancelot is a tiny vision model that helps document pipelines decide which pages need more expensive layout analysis. The goal is to reduce unnecessary compute costs while preserving extraction quality.
The 1.53M-parameter classifier takes a 224×224 page thumbnail and answers a focused question: does this page need the larger layout model?
Training data and labels
We use detections from Heron, Docling’s document layout analysis model, to label the presence of eight structural categories: table, picture, formula, code, document index, checkbox, form, and key/value region.
The routing label, needs_layout_analysis, is positive when Heron detects any of those eight structural categories, and negative otherwise. Heron’s other labels (text, headers, footers, titles, lists, footnotes, and captions) do not contribute to Glancelot’s needs_layout_analysis training label.
Titles, captions, and footnotes were excluded after an earlier model’s error audit. At thumbnail resolution, these elements can resemble section headings or page footers, making the distinction difficult for a small vision model. On pages with extractable text, simpler elements can often be handled using text positions and geometric rules.
This gives us supervision at scale without manually labeling every page. The combined dataset contains approximately 1.29M PDF page thumbnails, including pages reserved for evaluation. It spans financial filings, investor-relations materials, research papers, clinical-trial documents, and slides.
Structural presence is a proxy for whether layout analysis will help. Heron can miss structures, and complex text-only layouts may still benefit from analysis. Evaluate routing decisions against downstream extraction quality.
Model architecture and training
Glancelot uses an ImageNet-pretrained MobileNetV3-Small backbone with a nine-output classification head for multi-label prediction. The first eight outputs predict the structural categories defined in the training labels. The ninth output supplies a separately learned layout-routing score, rather than combining the eight structural predictions. All nine outputs contribute to training.
We train with AdamW, cosine learning-rate decay, and binary cross-entropy across all nine outputs. The model has 1,527,081 parameters and is deployed as an approximately 6 MB FP32 ONNX file.
Favoring recall
The two kinds of routing mistakes have different costs. Running layout analysis on a simple page adds computation. Skipping layout analysis on a page containing a table can damage extraction. We therefore choose a conservative threshold that favors recall on pages labeled as needing layout analysis.
Against the routing labels derived from Heron detections, Glancelot achieves 99.002% recall on validation pages labeled as needing layout analysis, identifying nearly all of them at the chosen threshold.
| Validation metric | Value |
|---|---|
| Validation pages | 36,605 |
| Recall on pages labeled as needing layout analysis | 99.002% |
| False-positive rate on pages labeled as not needing layout analysis | 32.074% |
The tradeoff is unnecessary layout analysis: about 32% of pages labeled as not needing layout analysis are still routed to the layout model. On this validation set, the results correspond to 4,782 pages correctly routed to skip layout analysis and 295 pages incorrectly routed to skip layout analysis.
These results measure agreement with the routing labels derived from Heron detections, on the validation split used to select the checkpoint and threshold.
Use in Chowder
Chowder uses Glancelot alongside rule-based checks in read_documents(). This integration chooses between two extraction paths for each non-empty PDF page:
- Fast native-text extraction: Read text already stored in the PDF and organize it using geometric rules, without running layout analysis, OCR, or table models.
- Hybrid extraction: Combine native PDF text with Heron’s layout analysis, using optical character recognition (OCR) where text needs to be recovered from images.
Fast, rule-based checks handle the clear cases first. Empty pages return an empty result. Detected scans and non-empty pages without extractable text go directly to hybrid extraction.
Glancelot evaluates the remaining pages. A score above the threshold selects hybrid extraction; a score at or below the threshold selects fast native-text extraction, skipping the larger layout model.
Layout analysis identifies page structure; OCR recovers text from images. Chowder determines OCR needs separately, so selecting hybrid extraction does not automatically mean running OCR.
Efficiency at the page level
On a Mac mini with an M2 Pro chip (10-core CPU, 16 GB memory), Glancelot runs on CPU in 39.2 ms for a batch of 32 page thumbnails, or approximately 1.22 ms per page when batched. This is the median of 15 inference runs after warmup using ONNX Runtime 1.26; it excludes model loading, thumbnail rendering, and the rest of the extraction pipeline.
Skipping unnecessary layout analysis can reduce compute costs and processing time, but the savings depend on the workload. A collection of mostly text pages offers more opportunities to skip layout analysis than one dominated by tables and figures. The work saved must outweigh the cost of rendering thumbnails and running Glancelot.
The measurements above cover Glancelot’s inference time and agreement with the Heron-derived routing labels. Measuring end-to-end savings requires timing the full pipeline, including PDF parsing, layout analysis, OCR, and assembly, and checking that extraction quality is preserved.
The strategy is to spend a little computation deciding where more computation is needed. Glancelot supplies the layout-routing score; the surrounding pipeline decides how to use the score.
The Glancelot weights are available on Hugging Face under the Apache 2.0 license.