Command Palette
Search for a command to run...
Granite Docling V2: Technical Report
Granite Docling V2: Technical Report
Abstract
We present Granite Docling V2, a family of two compact visionlanguage models, Granite Docling V2 500M and Granite Docling V2 2B, designed around one principle: a document’s representation should preserve its structure as well as its text. Each model converts a page image directly into DocLang, a structured markup language in which every element carries its type, its position on the page and its place in the reading order, from headings, paragraphs and inline math to tables with full cell structure, formulas, code, nested lists, pictures and their captions. DocLang is also designed for compact tokenization: for instance, location coordinates map to single tokens, and structures like tables take fewer tokens than in HTML. The same representation is used for annotation, training and evaluation. Our data is labeled and curated in DocLang; both models are trained in four stages: vision– language alignment through captioning, document pre-training that teaches page-to-DocLang conversion under a resolution and context curriculum, supervised fine-tuning, and reinforcement learning with verifiable rewards computed on the DocLang output. Document pretraining uses large-scale real and synthetic pages; fine-tuning and reinforcement learning use a smaller curated post-training set whose pages are enriched, corrected and filtered for label quality. The 2B model is built from Granite 4.0 1B, pruned and distilled for faster decoding; the 500M model is built from Granite 4.0 350M and adds a learned density router that allocates additional vision tokens only to dense pages. For reinforcement learning we introduce element-level credit assignment, prefix-conditioned rollouts and a validity gate. Finally, we describe our evaluation framework, which annotates benchmarks natively in DocLang and builds on the same representation as the models, so that every system is scored on the full structure of a page rather than on flattened text. Because we revise the ground truth of public benchmarks, these scores are not comparable with those reported on the original benchmarks.
One-sentence Summary
IBM researchers introduce Granite Docling V2, two compact vision-language models (500M and 2B) that convert page images directly into DocLang, a structure-preserving markup language with compact tokenization and native annotation, training, and evaluation; the models are trained through vision-language alignment via captioning, document pre-training with a resolution and context curriculum, supervised fine-tuning, and reinforcement learning with verifiable rewards, element-level credit assignment, prefix-conditioned rollouts, and a validity gate, with the 2B model distilled from Granite 4.0 1B and the 500M model adding a learned density router, and they are evaluated by a DocLang-native framework that scores full page structure rather than flattened text.
Key Contributions
- The paper introduces DocLang, a structured page markup language used for annotation, training, and evaluation that encodes element type, position, and reading order for headings, paragraphs, tables with cell structure, formulas, code, nested lists, pictures, and captions, with compact tokenization such as single-token coordinates and more token-efficient table representations than HTML.
- The paper presents Granite Docling V2 500M and Granite Docling V2 2B, two compact vision-language models trained in four stages: vision-language alignment, document pre-training, supervised fine-tuning, and reinforcement learning with verifiable DocLang rewards; the 2B model is built from Granite 4.0 1B, pruned and distilled for faster decoding, and the 500M model is built from Granite 4.0 350M and adds a learned density router that allocates additional vision tokens to dense pages.
- The paper introduces element-level credit assignment, prefix-conditioned rollouts, and a validity gate for reinforcement learning, and contributes a DocLang-native evaluation framework that re-annotates public benchmarks under a consistent policy and scores full page structure rather than flattened text.
Introduction
Document conversion requires turning rendered pages into faithful machine-readable representations that preserve reading order, layout, tables, formulas, and code. This is important for downstream document understanding and retrieval, but classical pipelines of specialized models suffer from error propagation and must add new models for each page type, while general-purpose vision-language models are large, slow, and often skip or paraphrase content on dense pages. Recent compact document-specific VLMs improve speed but mostly emit display-oriented Markdown or HTML rather than a structure-preserving document representation. The authors build on earlier structure-first formats such as OTSL and SmolDocling's DocTags by introducing Granite Docling V2, which uses a revised markup language called DocLang, compact 500M and 2B models, a four-stage training recipe with reinforcement learning, and an evaluation framework with corrected DocLang-annotated benchmarks.
Dataset
Dataset composition and sources
- The authors build a data engine over a pool of about 76 million pages drawn from 50 datasets.
- The largest real sources are FinePDFs and arXiv. These are combined with scanned pages, layout-annotated pages derived from DocLayNet, synthetic pages, handwriting images, and single-element images.
- For datasets that also serve as evaluation benchmarks, such as DocLayNet, only the training split is used for training; the test splits are reserved for evaluation.
Corpus statistics
- Visual clustering of full pages produces 4,974 clusters, which are grouped into genres. Science papers are the largest block at 29%, followed by forms at 13%, government and legal documents at 11%, patents at 11%, and technical documents and manuals at 7%, with the remainder covering business, education, news, tables, books, slides, and unusual formats.
- The pool contains about 58 billion tokens. A median page has 15 elements and 596 tokens. DocLang markup accounts for 21% of all tokens; the rest is text.
- Across 2.0 billion annotated elements, text blocks make up about half. Forms with fields and checkboxes account for about a tenth, more than tables at 27 million, formulas at 30 million, and code blocks at 10 million combined.
Language distribution
- English is the largest language in the full pre-training pool, covering about a third of pages with text. Chinese and Japanese together make up another third, mostly from the FinePDFs Asian-language subsets. A long tail of European languages, Cyrillic script, and Arabic-script text follows.
- Language shares are estimated from page samples using script detection and the Lingua language detector for Latin-script pages. About 10% of covered pages contain too little text to classify.
Real page processing
- Real pages are labeled automatically through the Docling pipeline. The doclingparse backend renders PDFs to images, extracts text directly from born-digital PDFs, and uses OCR for scanned pages.
- Key elements are recognized again by independent Docling models. Predictions on which these models agree are accepted; disagreements are resolved through model-based adjudication or set aside for further refinement or manual inspection.
Synthetic page processing
- Synthetic pages are the main source of accurate DocLang-compatible ground truth because their labels are exact by construction and can target cases underrepresented in real data.
- They cover dense multi-column newspapers, exam papers, textbooks, mathematical formulas, challenging tables, handwriting, notes, slides, code, charts, styled designs, many languages and scripts, and special characters.
- Rendering varies fonts, sizes, colors, spacing, and page geometry. Image augmentation adds scan noise, blur, compression, and photographic distortion.
Curated post-training set and model use
- The 76 million-page pool is used as the full pre-training pool.
- For supervised fine-tuning and reinforcement learning, the authors build a curated post-training set of about 1.5 million pages selected for quality and coverage.
- Supervised fine-tuning trains on this curated set, while reinforcement learning uses a subset mined from it.
- Every page is checked against the DocLang grammar and label conventions. Systematic label errors are corrected, and pages are enriched with markup missing from the pre-training data, such as text styles and handwriting.
- The curated set is balanced by difficulty, document type, and language, with hard cases mined from the errors of earlier models.
Method
The authors leverage DocLang, a structured XML vocabulary, as the output format for document parsing. DocLang encodes semantic elements such as headings, text, tables, and formulas, along with their spatial locations on a 512 × 512 grid. Tables are represented using OTSL tokens to ensure compact and valid grid structures. Every tag and location coordinate is mapped to a single token in the tokenizer, minimizing the token cost for structural decisions. Refer to the framework diagram below for an example of a page and its corresponding DocLang representation.
To accommodate diverse extraction needs, the system employs a prompt-based control mechanism. A single model handles multiple tasks selected via task prompts. For instance, a user can request only tables, formulas, or text with layout coordinates by specifying the desired tasks in brackets. This allows the model to skip decoding irrelevant content, reducing computational cost. As shown in the figure below, different prompts yield different outputs from the same input page. During training, pages are paired with randomly sampled task lists to teach the model to output only the requested content types.
The model architecture integrates a vision encoder with a language model. A page is resized and divided into a grid of 512 × 512 pixel tiles, supplemented by a global thumbnail for multi-tile pages. The SigLIP2 vision encoder processes these tiles, and a pixel-shuffle connector compresses the patch features into a short sequence of vision tokens. To preserve fine visual details, features from intermediate encoder layers are projected and added to the first few decoder layers via DeepStack. The Granite decoder then generates the DocLang sequence. Both models include multi-token prediction heads to draft tokens for speculative decoding, accelerating inference. For the 500M parameter variant, a density router evaluates the tile features to decide whether to use a coarse or fine encoding route, ensuring dense pages receive sufficient token resolution. The overall architecture is illustrated in the figure below.
The training process is structured into four distinct stages. The first stage aligns the vision encoder and connector with the language model using a captioning objective. The second stage involves document pre-training, where the model learns the full page to DocLang task. This stage employs a curriculum that progressively increases the tile budget and context length, allowing the model to first grasp the format on short pages before handling dense, high-resolution inputs. The third stage is supervised fine-tuning on a curated dataset, introducing task prompts and an unlikelihood loss to penalize repetition. The final stage utilizes reinforcement learning via Group Relative Policy Optimization (GRPO). This stage addresses errors that emerge during autoregressive generation, such as invalid XML or repetition loops. The authors implement element-level credit assignment to score completions based on spatial and text overlap with ground truth elements, and use prefix-conditioned rollouts to improve performance on dense documents. The four training stages are depicted in the figure below.
Experiment
The evaluation framework re-annotates public and internal benchmarks under a unified DocLang policy and uses a common strict scorer to avoid inconsistencies in ground truth and metric interpretation. Results compare Granite DocLang V2 with open-source document parsing systems across several benchmarks, showing that the model leads overall and especially in layout quality, while reinforcement learning and a density router improve accuracy and dense-page routing. Efficiency experiments validate decoder pruning, shorter DocLang serialization, and speculative decoding with multi-token prediction heads, which substantially increase decoding throughput.
Granite Docling V2 uses prompts to control page conversion. The default prompt emits the full page, while task prompts request any subset of supported content types in any order, and adding layout includes location tokens. Detailed prompts add descriptions of pictures, and training includes negative examples for requested tasks that have no page content. Task prompts accept any non-empty subset of supported tasks in any order, with layout optionally adding location tokens. Requesting a task that has no content on the page yields an empty document, a behavior learned from negative examples during training. Partially labeled datasets can be used by pairing each dataset with a prompt that asks only for its annotated content, so missing labels are not learned as missing content.
Both configurations share the same overall design: a SigLIP2 vision encoder, a pixel-shuffle connector, and a Granite 4.0 language model, with DeepStack taps from the vision encoder into early language model layers. The 2B model scales up the vision encoder and uses a wider language model pruned to fewer layers, while the 500M model includes a density router and defaults to a coarser vision-token route with a finer route available for dense pages. The 2B model roughly quadruples parameters and uses a larger vision encoder, but uses a language model pruned to 24 layers with wider hidden and feed-forward dimensions. The 500M model is the only configuration with a density router, using a default coarse route and a fine route that quadruples vision tokens per tile on selected pages.
The dataset contains 4,974 page clusters grouped by document genre. Science is the largest genre, followed by forms, patents, and government and legal documents. Smaller categories include business and finance, news and events, tables, technical manuals, education, books, and slides, with menus, music, and maps grouped under other. Science pages account for roughly three in ten clusters, ahead of forms, patents, and government and legal documents. Administrative, technical, and business genres appear at moderate shares, while news, tables, education, books, and slides are comparatively rare; menus, music, and maps are folded into the other category.
The pre-training pool is linguistically diverse but heavily concentrated. English is the largest language at about a third of pages with text, while Chinese and Japanese together contribute roughly another third; the remaining pages form a long tail of European languages, other Latin-script pages, Cyrillic, Arabic, Korean and other non-Latin scripts. English is the single largest language at about one third of text-bearing pages, with Chinese and Japanese together contributing a similar share. After the top languages, the pool has a long tail: other Latin-script pages account for around 10 percent, while major European languages, Cyrillic and Arabic each remain in the low single digits.
Stage 4 reinforcement learning scores completions with 37 rewards grouped into content, structure, repetition, tables, formulas, layout, and length. A strict validity gate zeroes all rewards except a graded tag-balance reward for outputs that are malformed, fail strict deserialization, or omit the closing tag, which also serves as the main loop penalty. Credit assignment is element-level, and abstaining rewards use the group mean to avoid favoring invented content. Content fidelity carries the highest reward weights, led by the evaluation content score and recall, with auxiliary text-similarity metrics weighted lower. Repetition rewards target n-gram, repeated block, and duplicated block repetition relative to the ground truth's own repetition. The validity gate suppresses all but the tag-balance reward when completions fail well-formedness, strict deserialization, or the closing tag, making it a key penalty against loops. Abstaining rewards receive the group mean rather than zero, preventing completions from being rewarded for inventing absent blocks.
The experiments validate a prompt-driven page conversion system in which users can request arbitrary supported content types, with layout and detailed descriptions as options, and prompts for absent tasks are trained to return empty output. Two model scales are compared: a 2B configuration with a larger vision encoder and pruned wide language model, and a 500M configuration with a density router selecting coarse or fine vision-token routes. The evaluation data span document genres dominated by science and forms, with English, Chinese, and Japanese as the largest text languages, while stage 4 reinforcement learning uses grouped content, structure, repetition, table, formula, layout, and length rewards and a strict validity gate to penalize malformed or looping outputs.