Granite Docling V2 500M
Half a billion parameters, rich in structure: any page becomes DocLang, with extra vision tokens only where the page needs them.
📄 Technical report · 📊 Benchmark Explorer · 🤗 Demo · 🦆 Docling · 🏆 2B sibling
Granite Docling V2 500M is the small, fast member of the Granite Docling V2 family. It converts a page image into
DocLang, a markup language that records each element's type, position and reading order along with its
content. One generation gives you headings, paragraphs, lists, tables with merged and header cells, LaTeX formulas,
code, pictures with their captions and the text printed inside them, and page headers and footers. You can export the result to Markdown, HTML or JSON
with docling-core. It succeeds SmolDocling and
Granite-Docling 258M, from the Docling team at IBM.
- 🏆 Accuracy above its size: 94.0% content 1 − NED pooled over 20,502 pages from ten benchmarks, ahead of Nemotron 3.5 Parse (0.6B) and Unlimited-OCR 2 (3.3B). The edit distance falls from 23.3% with Granite-Docling 258M to 6.0%, almost four times lower.
- 🔀 Adaptive vision budget: a learned density router reads 64 tokens per tile on ordinary pages and re-encodes dense pages, such as newspapers or small CJK print, at 256 tokens per tile.
- 🧱 Structure is part of the output: every element carries its type and bounding box. Tables keep their full cell structure, and inline math, sub- and superscripts are marked inside the text.
- 🖼️ Pictures are read, not skipped: each picture keeps its type, its caption and the text printed inside it; the
[<detailed>]prompt adds a description. - 🎯 Prompt for only what you need: ask for just the tables, the formulas, or the text with boxes, and the model decodes nothing else.
- 🌍 Multilingual: far stronger than Granite-Docling 258M beyond English, above all on Chinese, Japanese, Korean, Hindi, Russian and Arabic, and on mixed Chinese–English pages.
- ✍️ Handwriting: reads handwritten notes and forms far better than Granite-Docling 258M, though printed text remains more accurate.
- 🚀 Fast and light: about 18.5 pages per second on one H100 with vLLM and MTP speculative decoding, about 14 without. Runs in 🤗 Transformers and vLLM.
Page content 1 − NED (all text on the page, including table cells, formulas and code), pooled over 20,502 pages
from ten benchmarks, against throughput on one H100 (the setup of the Throughput table:
vllm serve, each system with the settings its model card recommends, 2,078 ParseBench pages, peak over
8–256 pages in flight). Granite Docling V2 uses MTP speculative decoding and Nemotron 3.5 Parse its DFlash2 drafter.
The 2B Flash and 500M Flash points have the accuracy of the 2B and 500M and are available in the
IBM watsonx editions of Docling. Bubble area is proportional to
parameter count; a double ring marks two-pass systems.
What is DocLang?
DocLang is an XML vocabulary for documents. Each element opens with its type, then its bounding box as four
location tokens (x0 y0 x1 y1 on a 512 × 512 grid from the top-left corner), then its content. Captions sit
inside the table, picture, code or formula they describe. Tables use
OTSL cell tokens (<ched/> header, <fcel/> filled cell, <nl/> row
break, plus merge tokens). Formulas are LaTeX, and inline formatting such as bold, superscript and handwriting is
marked inside running text.
Every tag and every coordinate is a single token, so a page's full structure costs far fewer tokens than
HTML. A DocLang page converts losslessly into a
DoclingDocument and from there into Markdown, HTML or JSON.
DocLang is the successor of the DocTags format used by
SmolDocling and
Granite-Docling 258M.
DocLang 0.9 specification →
Quick start
🤗 Transformers
pip install "transformers>=5.23.0" torch torchvision pillow docling-core
import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor
model_id = "ibm-granite/granite-docling-v2-500m"
processor = AutoProcessor.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16, device_map="cuda")
image = Image.open("page.png").convert("RGB")
messages = [{"role": "user", "content": [
{"type": "image", "image": image},
{"type": "text", "text": "<doclang>"},
]}]
def prepare(fine_route=False):
return processor.apply_chat_template(
messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt",
processor_kwargs={"fine_route": fine_route},
).to(model.device, dtype=torch.bfloat16)
# The density router scores the page from its vision features: 64 tokens per tile, or 256 for dense pages.
inputs = prepare()
if model.model.predict_fine_route(inputs["pixel_values"], inputs["pixel_attention_mask"])[0]:
inputs = prepare(fine_route=True)
output = model.generate(**inputs, max_new_tokens=16384, do_sample=False)
doclang = processor.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=False)
doclang = doclang.removesuffix(processor.tokenizer.eos_token)
print(doclang)
skip_special_tokens=False. DocLang tags and location tokens are special tokens, and skipping
them leaves bare text.
The router decision costs one pass of the vision encoder. To force a route, call prepare(fine_route=True) or
prepare(fine_route=False) directly. For batched generation, group pages by route.
⚡ vLLM
pip install -U vllm --pre "transformers==5.23.0" \
--extra-index-url https://wheels.vllm.ai/nightly
Server (highest throughput). The model drafts 3 tokens per step with its own multi-token-prediction (MTP)
heads; the output is the same as without them. On one H100 this setup converts about 18.5 pages per second, compared with about 14 without MTP. The client runs the density router and sends each page's route
with the request, which needs --trust-request-mm-kwargs.
vllm serve ibm-granite/granite-docling-v2-500m \
--model-impl transformers \
--max-model-len 32768 \
--max-num-batched-tokens 16384 \
--limit-mm-per-prompt '{"image": 1}' \
--speculative-config '{"method": "mtp", "num_speculative_tokens": 3}' \
--api-server-count 8 \
--gpu-memory-utilization 0.8 \
--trust-request-mm-kwargs
Python client (sends many pages in parallel, runs the density router)
import base64
import io
import threading
from concurrent.futures import ThreadPoolExecutor
import torch
from openai import OpenAI
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
model_id = client.models.list().data[0].id
# Density router: one vision-encoder pass per page picks 64 or 256 tokens per tile.
image_processor = AutoProcessor.from_pretrained(model_id).image_processor
router = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16).model
router.text_model = None # only the vision encoder and the router are needed
router.to("cuda").eval()
gpu = threading.Lock()
def convert(path):
image = Image.open(path).convert("RGB")
inputs = image_processor(images=[[image]], return_tensors="pt") # CPU, runs in parallel
with gpu, torch.inference_mode():
fine = bool(router.predict_fine_route(
inputs["pixel_values"].to("cuda"), inputs["pixel_attention_mask"].to("cuda"))[0])
buffer = io.BytesIO()
image.save(buffer, format="PNG")
response = client.chat.completions.create(
model=model_id,
messages=[{"role": "user", "content": [
{"type": "image_url", "image_url": {"url": "data:image/png;base64," + base64.b64encode(buffer.getvalue()).decode()}},
{"type": "text", "text": "<doclang>"},
]}],
temperature=0.0,
max_tokens=16384,
extra_body={"skip_special_tokens": False, "mm_processor_kwargs": {"fine_route": fine}},
)
return response.choices[0].message.content
pages = ["page-1.png", "page-2.png", "page-3.png"]
with ThreadPoolExecutor(64) as pool: # keep many pages in flight
for page, doclang in zip(pages, pool.map(convert, pages)):
print(page, doclang[:200])
Send one page per request and keep 64 or more in flight. The router's image preprocessing runs in the worker
threads and only its GPU pass is serialized; routing one page after another would cap throughput. --api-server-count 8
spreads the server's image preprocessing over eight processes; give the server about 32 CPU cores.
--gpu-memory-utilization 0.8 leaves room for the router on the same GPU. Without mm_processor_kwargs, every page
takes the 64-token route.
Offline batch (no server)
import torch
from PIL import Image
from transformers import AutoModelForImageTextToText, AutoProcessor
from vllm import LLM, SamplingParams
model_id = "ibm-granite/granite-docling-v2-500m"
def main():
processor = AutoProcessor.from_pretrained(model_id)
prompt = processor.apply_chat_template(
[{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "<doclang>"}]}],
tokenize=False, add_generation_prompt=True,
)
pages = ["page-1.png", "page-2.png", "page-3.png"]
images = [Image.open(p).convert("RGB") for p in pages]
# 1. Density router: one vision-encoder pass per page picks 64 or 256 tokens per tile.
router = AutoModelForImageTextToText.from_pretrained(model_id, dtype=torch.bfloat16).model
router.text_model = None
router.to("cuda").eval()
with torch.inference_mode():
fine = []
for image in images:
x = processor.image_processor(images=[[image]], return_tensors="pt")
fine.append(bool(router.predict_fine_route(x["pixel_values"].to("cuda"), x["pixel_attention_mask"].to("cuda"))[0]))
del router
torch.cuda.empty_cache()
# 2. Generation with vLLM, each page on its route.
llm = LLM(
model=model_id,
model_impl="transformers",
max_model_len=32768,
max_num_batched_tokens=16384,
limit_mm_per_prompt={"image": 1},
speculative_config={"method": "mtp", "num_speculative_tokens": 3},
)
params = SamplingParams(temperature=0.0, max_tokens=16384, skip_special_tokens=False)
requests = [{"prompt": prompt, "multi_modal_data": {"image": image}, "mm_processor_kwargs": {"fine_route": f}}
for image, f in zip(images, fine)]
for page, out in zip(pages, llm.generate(requests, params)):
doclang = out.outputs[0].text
print(page, doclang[:200])
if __name__ == "__main__": # needed because the router uses the GPU before vLLM starts its engine
main()
Run the router before creating the vLLM engine. Without mm_processor_kwargs, every page takes the 64-token route.
For a PDF, render each page to an image (for example with pypdfium2 at 144 DPI) and pass the pages as one batch.
📝 Export to Markdown, HTML or JSON
from docling_core.transforms.deserializer.doclang import DocLangDocDeserializer
document = DocLangDocDeserializer().deserialize_str(doclang)
print(document.export_to_markdown())
document.save_as_markdown("page.md")
document.save_as_html("page.html")
document.save_as_json("page.json")
Prompts
The default prompt <doclang> converts the whole page. A task prompt lists the tasks you want in
square brackets after <doclang>, allowing you to control what the model generates.
The complete list of supported tasks is: <ocr>, <table>, <formula>, <picture>, <code>,
<layout> and <detailed>.
The prompts in the table below are examples only, not an exhaustive list. You can use any combination of the supported tasks, in any order, provided that the exact prompt structure is preserved.
| Prompt | Output |
|---|---|
<doclang> |
The full page: every element with its type, location and content |
<doclang> [<table>] |
Only the tables |
<doclang> [<table>, <formula>] |
Only the tables and formulas |
<doclang> [<ocr>, <layout>] |
Text with location tokens; without <layout> the output has content only |
<doclang> [<detailed>] |
The full page plus a generated description of each picture |
<doclang>, tasks in angle
brackets, separated by , . Other spacing or punctuation lowers quality. The model only takes <doclang>
and these task prompts; it does not follow free-form instructions or answer questions.
Abridged outputs for the page shown above. Small gray numbers are location tokens, shown by their values.
Task prompts also work on crops of a single element.
When the requested content is absent, the model returns an empty <doclang></doclang>.
Model size
| Part | Parameters |
|---|---|
| Vision encoder | 157M |
| Language decoder, with token embeddings (shared with the output head) | 387M |
| Density router | 0.1M |
| Model | 0.54B |
| MTP heads (3 layers, 11M each) | 33M |
| Model + MTP heads | 0.58B |
The MTP heads are stored in the checkpoint and used only for speculative decoding: they draft tokens that the model then checks.
Evaluation
Content 1 − NED (%, higher is better) is the character-level similarity of the whole page's text, weighted
by characters. Missing and invented text count as errors. Greedy decoding with the <doclang> prompt; the router sent 428 of the 1,649
OmniDocBench pages (26%) to the fine route.
| Model | Params | OmniDocBench 1.6 | DocLayNet v1 | DocLayNet v2† | Creative Layouts† | MDPBench | ParseBench | ParseBench v2 | olmOCR-Bench | RealDocBench | VAREX | All (20,502 pages) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Granite Docling V2 500M | 0.54B | 93.6 | 97.3 | 94.8 | 96.9 | 83.3 | 94.5 | 91.1 | 96.9 | 87.5 | 95.7 | 94.0 |
| Granite Docling V2 2B | 2.2B | 95.6 | 98.2 | 95.8 | 97.7 | 92.5 | 96.5 | 92.6 | 98.2 | 91.3 | 97.7 | 95.8 |
| dots.mocr | 3B | 96.0 | 98.6 | 93.8 | 94.9 | 92.4 | 95.6 | 88.3 | 98.3 | 78.8 | 87.8 | 93.5 |
| MinerU 2.5 Pro | 1.2B | 97.2 | 97.6 | 94.7 | 97.1 | 89.6 | 94.9 | 86.8 | 97.8 | 81.5 | 89.3 | 93.0 |
| Nemotron 3.5 Parse | 0.6B | 92.1 | 97.0 | 93.2 | 97.0 | 82.1 | 93.8 | 86.6 | 96.5 | 78.0 | 87.8 | 91.6 |
| Chandra | 5.3B | 91.6 | 97.9 | 93.6 | 91.6 | 67.1 | 88.4 | 83.1 | 97.8 | 77.3 | 77.9 | 88.4 |
| Unlimited-OCR 2 | 3.3B | 84.8 | 96.5 | 90.5 | 97.4 | 58.9 | 87.4 | 85.5 | 95.4 | 77.2 | 86.9 | 88.2 |
| LightOnOCR 3 | 4B | 76.3 | 94.0 | 90.9 | 97.3 | 61.0 | 90.8 | 82.0 | 94.5 | 71.4 | 86.3 | 86.3 |
| LightOnOCR 3 | 0.8B | 66.1 | 93.3 | 88.5 | 97.2 | 50.7 | 91.1 | 80.9 | 96.6 | 79.5 | 84.0 | 84.4 |
| Granite-Docling 258M | 0.26B | 67.6 | 91.6 | 77.6 | 81.8 | 51.3 | 78.3 | 67.4 | 90.2 | 49.0 | 68.4 | 76.7 |
† Internal held-out benchmarks; their pages and ground truth are not released. Pages per benchmark: 1,649 / 4,999 / 2,067 / 1,034 / 673 / 2,023 / 4,297 / 1,403 / 580 / 1,777. Other systems are mapped to DocLang with Docling's public converters. Every system is pooled over all pages, and an output that cannot be read as DocLang scores 0. Scores are from the Explorer snapshot of 26 November 2026.
Throughput
Pages per second on one H100 80GB, end to end, at the best of 8, 64 and 256 pages in flight:
| Model | Params | Pages / s |
|---|---|---|
| Granite Docling V2 2B + MTP (3 draft tokens) | 2.2B | 10.1 |
| Granite Docling V2 2B | 2.2B | 6.8 |
| Granite Docling V2 500M (density router) + MTP (3 draft tokens) | 0.54B | 18.5 |
| Granite Docling V2 500M (density router) | 0.54B | 14.2 |
| Nemotron 3.5 Parse + DFlash2 (16 draft tokens) | 0.6B | 20.4 |
| Granite-Docling 258M | 0.26B | 12.9 |
| LightOnOCR 3 | 0.8B | 9.8 |
| Unlimited-OCR 2 | 3.3B | 6.1 |
| LightOnOCR 3 | 4B | 4.3 |
| dots.mocr | 3B | 3.2 |
| MinerU 2.5 Pro (two passes per page) | 1.2B | 3.1 |
| Chandra | 5.3B | 1.8 |
(The same for every system: one H100 80GB, 32 CPU cores, vllm serve with --api-server-count 8 (SGLang with eight
tokenizer workers for Unlimited-OCR 2, which vLLM cannot load), the same 2,078 ParseBench pages and no prefix or image
caching. Each system uses the server and request settings of its model card or official client, including its own
speculative decoding; Granite Docling V2 uses the commands in the vLLM section above. Timed end to end: image file
read, the system's own preprocessing and every request until the page's final text.)
Citation
@misc{nassar2026granitedoclingv2technical,
title={Granite Docling V2: Technical Report},
author={Ahmed Nassar and Matteo Omenetti and Christoph Auer and Cesar Berrospi Ramis and Michele Dolfi and Said Gürbüz and Viktor Kuropiatnyk and Nikolaos Livathinos and Maksym Lysak and Ingmar Meijer and Tim Strohmeyer and Panos Vagenas and Valery Weber and Ahmetcan Yavuz and Daniel DeAlcala and Peter El Hachem and Vittorio Pippi and Emmanuele Vivoli and Peter Staar},
year={2026},
eprint={2611.37727},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2611.37727},
}
License
Released under the Apache 2.0 license.