Docling DocumentFigureClassifier v2.5
Docling's figure classifier: an EfficientNet-B0 that sorts a figure cropped from a document page into 26 kinds (bar chart, flow chart, logo, map, signature and so on). MIT weights.
stable Fork of https://huggingface.co/docling-project/DocumentFigureClassifier-v2.5@f859dfb · backends: portable, kernels
- Paper DocumentFigureClassifier-v2.5 Model card · first released 23 Mar 2026
- Paper EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks ICML 2019 · first released 28 May 2019
Checkpoint docling-figure-classifier-v2.5
Paper 2026 Added in 0.4.0
Use it
pip install fastforks Lean install with only what this model needs: pip install "fastforks-core[timm]"
from fastforks import classification
model = classification.load("docling-figure-classifier-v2.5") # fastest backend that runs here
result = model("photo.jpg")
# result fields: logits
logits = result.logits # a torch tensor
arrays = result.numpy() # the tensor fields as NumPy arrays: arrays["logits"]
result.backend # what ran: mode, device, dtype
Other ways to run it
- Backend:
classification.load("docling-figure-classifier-v2.5", mode="kernels") # or "portable", "auto" (default) - Precision:
classification.load("docling-figure-classifier-v2.5", dtype="float32") # full precision: slower, portable only
fastforks bench docling-figure-classifier-v2.5 Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
| Backend | dtype | Time per call (ms) | vs original fp32 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32original default fp32 (HF EfficientNetForImageClassification) | fp32 | 6.98 | – | 61 MiB/70 MiB | 0.4 | 0.01 |
| Original fp16.half() on 1 modules, fp16 inputs | fp16 | 7.73 | 0.90× | 47 MiB/66 MiB | 0.1 | 0.01 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | 4.92 | 1.4× | 46 MiB/70 MiB | 0.1 | 0.01 | |
| Kernels | 2.90 | 2.4× | 46 MiB/70 MiB | 0.2 | 0.00 | |
| Portable + torch.compile | 5.47 | 1.3× | 78 MiB/94 MiB | 11 (build) | – | |
| TensorRT fp16 | fp16 | 0.537 | 13× | 38 MiBenginenot comparable | 20 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-28. Median of 5 after 3 warm-up, uint8 CUDA input, card defaults; peak = max over the first call and the timed calls. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Load / first call (s) | Output vs reference | Input |
|---|---|---|---|---|---|---|---|
| Apple silicon runs on macOS | |||||||
| Apple M1 Pro 16 GB (MLX, fp16) MLX, torch 2.14.1, 2026-11-30 | Portable | fp16 | 5.36 | 383 MiB process | 1.5 / 0.3 | skip | 224x224 |
| Portable | fp32 | 4.42 | 402 MiB process | 1.6 / 0.5 | skip | 224x224 | |
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0
- Weights
- MIT source
- Training data
Our reading of the licences, not legal advice.
Weights
docling-figure-classifier-v2.5.safetensors 16.4 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download docling-figure-classifier-v2.5).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
Accuracy not measured for docling-figure-classifier-v2.5.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output logits).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 | 0.00231 |
| GPU default dtypes, p99 |diff| | ≤ 0.25 | 0.00996 |
Recorded for docling-figure-classifier-v2.5 on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-28, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3
Details
docling's classifier for figures cut out of documents: EfficientNet-B0 fine-tuned on FinePDFs figures into 26 classes (charts, tables, logos, signatures, maps, QR codes, ...).
- Input / output
- Input: one RGB image. Output: ImageNet-1k class logits.
- Input size
- fixed 224x224: the input is resized (short side 224) and centre-cropped to it; tested up to 224x224 (46 MiB allocated)
- Outputs
logits- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)fvm_convfused convolutions for image classifiersfvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)fvm_r3further fused classifier blocks
- Apple (MPS)
- fp32, fp16
Limitations
- The classes are rough: the card reports 0.91 accuracy but only 0.69 balanced accuracy on its held-out FinePDFs split (rare classes such as calendar, crossword puzzle or stamp have recall below 0.45).
- The image is stretched to 224 x 224 without keeping its aspect ratio, as the original pipeline does.
Full reference, generated from the repository
Docling's figure classifier: an EfficientNet-B0 that sorts a figure cropped from a document page into 26 kinds (bar chart, flow chart, logo, map, signature and so on). MIT weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
docling-figure-classifier-v2.5 | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 6.98 7.73 4.92 2.90 5.47 0.537 | 61 / 70 47 / 66 46 / 70 46 / 70 78 / 94 79 / 92 |
Details
- Original code: https://huggingface.co/docling-project/DocumentFigureClassifier-v2.5 at
f859dfbff5c9 - Code licence: Apache-2.0 (permissive); files:
- Weights licence: MIT
- Licence evidence: https://huggingface.co/docling-project/DocumentFigureClassifier-v2.5/blob/f859dfbff5c9916cd996942d4b0db7fa25808220/README.md
- Training data: ImageNet-1k (ILSVRC 2012 classification), Figures of the FinePDFs documents (Hugging Face HuggingFaceFW/finepdfs), labelled by docling-project; the base network was ImageNet-1k pretrained
- Kernel libraries:
cudnn_hacc,fvm_conv,fvm_extra,fvm_mb,fvm_r3 - Variants:
docling-figure-classifier-v2.5 - Outputs: logits; label_set:
document-figure-26 - Input size: fixed 224x224: the input is resized (short side 224) and centre-cropped to it
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
docling-figure-classifier-v2.5224x224 (0.0 GiB peak allocated, 0.1 reserved) docling-figure-classifier-v2.5224x224, first call: portable + torch.compile 11 s (cold Inductor cache), TensorRT fp16 20 s (ONNX + engine).docling-figure-classifier-v2.5original (fp32) 224x224: original default fp32 (HF EfficientNetForImageClassification)docling-figure-classifier-v2.5original 224x224: .half() on 1 modules, fp16 inputsdocling-figure-classifier-v2.5load / first call: original 0.09 s / 0.008 s, portable 0.15 s / 0.006 s, kernels 0.2† s / 0.003 s- † measured after the portable load or an earlier input in the same process.
- Protocol, median of 5 after 3 warm-up, uint8 CUDA input, card defaults; peak = max over the first call and the timed calls
Parity
CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 and p99 <= 0.25 (absolute error of the output logits).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
docling-figure-classifier-v2.5 | 0.00231 / 0.00996 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120 |
Limitations
- The classes are rough: the card reports 0.91 accuracy but only 0.69 balanced accuracy on its held-out FinePDFs split (rare classes such as calendar, crossword puzzle or stamp have recall below 0.45).
- The image is stretched to 224 x 224 without keeping its aspect ratio, as the original pipeline does.
Example output
No example rendered for this checkpoint yet.