Granite Docling 2stage is a multimodal Image-Text-to-Text model engineered for efficient document conversion. It is finetuned on top of Granite Docling, preserving the core features of Docling while maintaining seamless integration with
DoclingDocuments
to ensure full compatibility.
Model Summary
:
Granite Docling 2stage builds upon the Granite Docling, but introduces a key modifications: it builds a dynamic prompt that precomputes layout objects found within a page, making it more robust on out of distribution data. Try out our
Granite-Docling-258
demo today.
Developed by
: IBM Research
Model type
: Multi-modal model (image+text-to-text)
Granite-docling-2stage 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:
# Convert to HTML and Markdown:
docling --to html --to md --pipeline vlm --vlm-model granite_docling "https://arxiv.org/pdf/2501.17887"# accepts files, urls or directories# Convert to HTML including layout visualization:
docling --to html_split_page --show-layout --pipeline vlm --vlm-model granite_docling "https://arxiv.org/pdf/2501.17887"
You can also set this model up within the Docling SDK:
from docling.datamodel import vlm_model_specs
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import (
VlmPipelineOptions,
)
from docling.document_converter import DocumentConverter, PdfFormatOption
from docling.pipeline.vlm_pipeline import VlmPipeline
from docling.experimental.pipeline.threaded_layout_vlm_pipeline import (
ThreadedLayoutVlmPipeline,
)
from docling.experimental.datamodel.threaded_layout_vlm_pipeline_options import (
ThreadedLayoutVlmPipelineOptions,
)
source = "https://arxiv.org/pdf/2501.17887"###### USING SIMPLE DEFAULT VALUES# - GraniteDocling model# - Using the transformers framework
converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(
pipeline_cls=ThreadedLayoutVlmPipeline,
),
}
)
doc = converter.convert(source=source).document
print(doc.export_to_markdown())
###### USING MACOS MPS ACCELERATOR# For more options see the compare_vlm_models.py example.
pipeline_options = ThreadedLayoutVlmPipelineOptions(
vlm_options=vlm_model_specs.GRANITEDOCLING_MLX,
)
converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(
pipeline_cls=VlmPipeline,
pipeline_options=pipeline_options,
),
}
)
doc = converter.convert(source=source).document
print(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 🤖
💻 Local inference on Apple Silicon with MLX:
see here
ℹ️ If you see trouble running granite-docling with the codes above, check the troubleshooting section at the bottom ⬇️.
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
granite-docling-2stage_258m
0.31
0.90
0.93
0.92
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
granite-docling-2stage_258m
0.27
0.85
0.92
0.83
0.70
0.79
💻 Local inference on Apple Silicon with MLX:
see here
We finetune
granite-docling-258M
by dynamically building a prompt using docling-layout-heron. 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 GraniteDocling.
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.
You receive
AttributeError: 'LlamaModel' object has no attribute 'wte'
when launching the model through VLLM.
With current versions of VLLM (including 0.10.2), support for tied weights as used in granite-docling is limited and breaks. We provide a version with untied weights on the
untied
branch of this model repo.
To use the untied version, please pass the
revision
argument to VLLM:
# Serve the model through VLLM
$> vllm serve ibm-granite/granite-docling-258M --revision untied
# If using the VLLM python SDK:from vllm import LLM
...
llm = LLM(model=MODEL_PATH, revision="untied", limit_mm_per_prompt={"image": 1})
The model outputs only exclamation marks (i.e. "!!!!!!!!!!!!!!!").
This is seen on older NVIDIA GPUs, such as the T4 GPU available in Google Colab, because it lacks support for
bfloat16
format.
You can work around it by setting the
dtype
to
float32
.
# Serve the model through VLLM
$> vllm serve ibm-granite/granite-docling-258M --revision untied --dtype float32
# If using the VLLM python SDK:from vllm import LLM
...
llm = LLM(model=MODEL_PATH, revision="untied", limit_mm_per_prompt={"image": 1}, dtype="float32")
Runs of docling-project granite-docling-2stage-258m on huggingface.co
543
Total runs
0
24-hour runs
44
3-day runs
128
7-day runs
226
30-day runs
More Information About granite-docling-2stage-258m huggingface.co Model
More granite-docling-2stage-258m license Visit here:
granite-docling-2stage-258m huggingface.co is an AI model on huggingface.co that provides granite-docling-2stage-258m's model effect (), which can be used instantly with this docling-project granite-docling-2stage-258m model. huggingface.co supports a free trial of the granite-docling-2stage-258m model, and also provides paid use of the granite-docling-2stage-258m. Support call granite-docling-2stage-258m model through api, including Node.js, Python, http.
granite-docling-2stage-258m huggingface.co is an online trial and call api platform, which integrates granite-docling-2stage-258m's modeling effects, including api services, and provides a free online trial of granite-docling-2stage-258m, you can try granite-docling-2stage-258m online for free by clicking the link below.
docling-project granite-docling-2stage-258m online free url in huggingface.co:
granite-docling-2stage-258m is an open source model from GitHub that offers a free installation service, and any user can find granite-docling-2stage-258m on GitHub to install. At the same time, huggingface.co provides the effect of granite-docling-2stage-258m install, users can directly use granite-docling-2stage-258m installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
granite-docling-2stage-258m install url in huggingface.co: