Granite Docling is a multimodal Image-Text-to-Text model engineered for efficient document conversion. It preserves the core features of Docling while maintaining seamless integration with DoclingDocuments to ensure full compatibility.
Model Summary:
Granite Docling 258M builds upon the IDEFICS3 architecture, but introduces two key modifications: it replaces the vision encoder with siglip2-base-patch16-512 and substitutes the language model with a Granite 165M LLM. Try out our Granite-Docling-258 demo today.
Developed by: IBM Research
Model type: Multi-modal model (image+text-to-text)
Granite-docling-258M is fully integrated into the Docling pipelines, carrying over existing features while introducing a number of powerful new features, including:
🔢 Enhanced Equation Recognition: More accurate detection and formatting of mathematical formulas
🧩 Flexible Inference Modes: Choose between full-page inference, bbox-guided region inference
🧘 Improved Stability: Tends to avoid infinite loops more effectively
🧮 Enhanced Inline Equations: Better inline math recognition
🧾 Document Element QA: Answer questions about a document’s structure such as the presence and order of document elements
🌍 Japanese, Arabic and Chinese support (experimental)
Getting started
The easiest way to use this model is through the 🐥Docling library. It will automatically download this model and convert documents to various formats for you.
Install the latest version of docling through pip, then use the following CLI command:
sh
1# Convert to HTML and Markdown:
2docling --to html --to md --pipeline vlm --vlm-model granite_docling "https://arxiv.org/pdf/2501.17887" # accepts files, urls or directories
34# Convert to HTML including layout visualization:
5docling --to html_split_page --show-layout --pipeline vlm --vlm-model granite_docling "https://arxiv.org/pdf/2501.17887"
6
GraniteDocling result in split page view
You can also set this model up within the Docling SDK:
python
1from docling.datamodel import vlm_model_specs
2from docling.datamodel.base_models import InputFormat
3from docling.datamodel.pipeline_options import(4 VlmPipelineOptions,5)6from docling.document_converter import DocumentConverter, PdfFormatOption
7from docling.pipeline.vlm_pipeline import VlmPipeline
89source ="https://arxiv.org/pdf/2501.17887"1011###### USING SIMPLE DEFAULT VALUES12# - GraniteDocling model13# - Using the transformers framework1415converter = DocumentConverter(16 format_options={17 InputFormat.PDF: PdfFormatOption(18 pipeline_cls=VlmPipeline,19),20}21)2223doc = converter.convert(source=source).document
2425print(doc.export_to_markdown())262728###### USING MACOS MPS ACCELERATOR29# For more options see the compare_vlm_models.py example.3031pipeline_options = VlmPipelineOptions(32 vlm_options=vlm_model_specs.GRANITEDOCLING_MLX,33)3435converter = DocumentConverter(36 format_options={37 InputFormat.PDF: PdfFormatOption(38 pipeline_cls=VlmPipeline,39 pipeline_options=pipeline_options,40),41}42)4344doc = converter.convert(source=source).document
4546print(doc.export_to_markdown())
Alternatively, you can use bare transformers, vllm, onnx or mlx-vlm to perform inference, and docling-core APIs to convert results to variety of output formats (md, html, etc.):
📄 Single page image inference using plain 🤗 tranformers 🤖
1# Prerequisites:2# pip install vllm3# pip install docling_core4# place page images you want to convert into "img/" dir56import time
7import os
8from vllm import LLM, SamplingParams
9from transformers import AutoProcessor
10from PIL import Image
11from docling_core.types.doc import DoclingDocument
12from docling_core.types.doc.document import DocTagsDocument
13from pathlib import Path
1415# Configuration16MODEL_PATH ="ibm-granite/granite-docling-258M"17IMAGE_DIR ="img/"# Place your page images here18OUTPUT_DIR ="out/"19PROMPT_TEXT ="Convert this page to docling."2021messages =[22{23"role":"user",24"content":[25{"type":"image"},26{"type":"text","text": PROMPT_TEXT},27],28},29]303132# Ensure output directory exists33os.makedirs(OUTPUT_DIR, exist_ok=True)3435# Initialize LLM36llm = LLM(model=MODEL_PATH, revision="untied", limit_mm_per_prompt={"image":1})37processor = AutoProcessor.from_pretrained(MODEL_PATH)3839sampling_params = SamplingParams(40 temperature=0.0,41 max_tokens=8192,42 skip_special_tokens=False,43)4445# Load and prepare all images and prompts up front46batched_inputs =[]47image_names =[]4849for img_file insorted(os.listdir(IMAGE_DIR)):50if img_file.lower().endswith((".png",".jpg",".jpeg")):51 img_path = os.path.join(IMAGE_DIR, img_file)52with Image.open(img_path)as im:53 image = im.convert("RGB")5455 prompt = processor.apply_chat_template(messages, add_generation_prompt=True)56 batched_inputs.append({"prompt": prompt,"multi_modal_data":{"image": image}})57 image_names.append(os.path.splitext(img_file)[0])5859# Run batch inference60start_time = time.time()61outputs = llm.generate(batched_inputs, sampling_params=sampling_params)6263# Postprocess all results64for img_fn, output, input_data inzip(image_names, outputs, batched_inputs):65 doctags = output.outputs[0].text
66 output_path_dt = Path(OUTPUT_DIR)/f"{img_fn}.dt"67 output_path_md = Path(OUTPUT_DIR)/f"{img_fn}.md"6869withopen(output_path_dt,"w", encoding="utf-8")as f:70 f.write(doctags)7172# Convert to DoclingDocument and save markdown73 doctags_doc = DocTagsDocument.from_doctags_and_image_pairs([doctags],[input_data["multi_modal_data"]["image"]])74 doc = DoclingDocument.load_from_doctags(doctags_doc, document_name="Document")75 doc.save_as_markdown(output_path_md)7677print(f"Total time: {time.time()- start_time:.2f} sec")78
💻 Local inference on Apple Silicon with MLX: see here
Intended Use
Granite-Docling is designed to complement the Docling library, not replace it. It integrates as a component within larger Docling library, consolidating the functions of multiple single-purpose models into a single, compact VLM.
However, Granite-Docling is not intended for general image understanding. For tasks focused solely on image-text input, we recommend using Granite Vision models, which are purpose-built and optimized for image-text processing.
Evaluations
A comprehensive discussion of evaluation methods and findings has already been presented in our previous publication [citation]. As this model is an update, we refer readers to that work for additional details.
The evaluation can be performed using the docling-eval framework for the document related tasks, and lmms-eval for MMStar and OCRBench.
Layout
MAP ↑
F1 ↑
Precision ↑
Recall ↑
smoldocling-256m-preview
0.23
0.85
0.9
0.84
granite-docling-258m
0.27
0.86
0.92
0.88
Full Page OCR
Edit-distance ↓
F1 ↑
Precision ↑
Recall ↑
BLEU ↑
Meteor ↑
smoldocling-256m-preview
0.48
0.80
0.89
0.79
0.58
0.67
granite-docling-258m
0.45
0.84
0.91
0.83
0.65
0.72
Code Recognition
Edit-distance ↓
F1 ↑
Precision ↑
Recall ↑
BLEU ↑
Meteor ↑
smoldocling-256m-preview
0.114
0.915
0.94
0.909
0.875
0.889
granite-docling-258m
0.013
0.988
0.99
0.988
0.983
0.986
Equation Recognition
Edit-distance ↓
F1 ↑
Precision ↑
Recall ↑
BLEU ↑
Meteor ↑
smoldocling-256m-preview
0.119
0.947
0.959
0.941
0.824
0.878
granite-docling-258m
0.073
0.968
0.968
0.969
0.893
0.927
Table Recognition (FinTabNet 150dpi)
TEDS (structure) ↑
TEDS (w/content) ↑
smoldocling-256m-preview
0.82
0.76
granite-docling-258m
0.97
0.96
Other Benchmarks
MMStar ↑
OCRBench ↑
smoldocling-256m-preview
0.17
338
granite-docling-258m
0.30
500
💻 Local inference on Apple Silicon with MLX: see here
(2) Vision-language connector: pixel shuffle projector (as in idefics3)
(3) Large language model: Granite 165M.
We built upon Idefics3 to train our model. We incorporated DocTags into our LLM’s supervised fine-tuning (SFT) data to help the model become familiar with the format, enabling faster convergence and mitigating issues previously observed with SmolDocling.
The model was trained using the nanoVLM framework, which provides a lightweight and efficient training setup for vision-language models
Training Data: Our training corpus consists of two principal sources: (1) publicly available datasets and (2) internally constructed synthetic datasets designed to elicit specific document understanding capabilities.
In particular, we incorporate:
SynthCodeNet — a large-scale collection of synthetically rendered code snippets spanning over 50 programming languages
SynthFormulaNet — a dataset of synthetic mathematical expressions paired with ground-truth LaTeX representations
SynthChartNet — synthetic chart images annotated with structured table outputs
DoclingMatix — a curated corpus of real-world document pages sampled from diverse domains
Infrastructure: We train granite-docling-258m using IBM's super computing cluster, Blue Vela, which is outfitted with NVIDIA H100 GPUs. This cluster provides a scalable and efficient infrastructure for training our models over thousands of GPUs.
Responsible Use and Limitations Some use cases for Vision Language Models can trigger certain risks and ethical considerations, including but not limited to: bias and fairness, misinformation, and autonomous decision-making.
Although our alignment processes include safety considerations, the model may in some cases produce inaccurate, biased, offensive or unwanted responses to user prompts. Additionally, whether smaller models may exhibit increased susceptibility
to hallucination in generation scenarios due to their reduced sizes, which could limit their ability to generate coherent and contextually accurate responses, remains uncertain. This aspect is currently an active area of research,
and we anticipate more rigorous exploration, comprehension, and mitigations in this domain. We urge the community to use granite-docling-258m in a responsible way and avoid any malicious utilization. We recommend using this model only as part of the Docling library.
More general vision tasks may pose higher inherent risks of triggering unwanted output. To enhance safety, we recommend using granite-docling-258m alongside Granite Guardian. Granite Guardian is a fine-tuned instruct model designed to detect and flag risks in prompts and responses across key dimensions outlined in the IBM AI Risk Atlas.
Its training, which includes both human-annotated and synthetic data informed by internal red-teaming, enables it to outperform similar open-source models on standard benchmarks, providing an additional layer of safety.