Memory & RAG
~8 min readUpdated: December 2026

Granite Docling V2 2B: 96.5% 1-NED DocLang Document Parsing & vLLM MTP

IBM Granite Docling V2 2B DocLang Document Agent RAG Architecture in Smoke Monkey

IBM Granite Docling V2 2B (ibm-granite/granite-docling-v2-2b, arXiv:2611.37727) is a 2.48B-parameter Apache 2.0 vision-language model that converts page images into DocLang XML with 512x512 bounding boxes, OTSL tables, and LaTeX math at 96.5% pooled 1-NED across 16,205 pages.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Granite Docling V2 2B: 96.5% 1-NED DocLang Document Parsing & vLLM MTP: IBM Granite Docling V2 2B (ibm-granite/granite-docling-v2-2b, arXiv:2611.37727) is a 2.48B-parameter Apache 2.0 vision-language model that converts page images into DocLang XML with 512x512 bounding boxes, OTSL tables, and LaTeX math at 96.5% pooled 1-NED across 16,205 pages. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Examplegranite-docling-v2-rag-agent.ts
granite-docling-v2-rag-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
const docParserAgent = createAgent({
agentId: 'granite-docling-v2-rag-ingestor',
provider: 'openai-compatible',
model: 'ibm-granite/granite-docling-v2-2b',
baseUrl: 'http://localhost:8000/v1',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
mcpServers: {
docling: {
command: 'python3',
args: ['-m', 'docling_mcp_bridge', '--endpoint', 'http://localhost:8000/v1', '--dpi', '144'],
},
},
});
async function ingestFinancialFiling(pdfPath: string) {
const result = await docParserAgent.run(
`Render ${pdfPath} at 144 DPI, extract <doclang> [<table>, <formula>] via Granite Docling V2 2B with skip_special_tokens=false, deserialize with DocLangDocDeserializer, and emit normalized JSON chunks.`
);
console.log('Ingested RAG Chunks:', result.summary);
}
ingestFinancialFiling('./filings/q3-balance-sheet.pdf').catch(console.error);
Video Guides

Watch: Related Video Guides

Granite Docling (IBM) vs. DeepSeek OCR: The End of AWS Textract

What Is Docling? Transforming Unstructured Data for RAG and AI

What Is Granite Docling V2 2B? Architecture & DocLang Format

IBM Granite Docling V2 2B (ibm-granite/granite-docling-v2-2b) is a 2.48B-parameter vision-language model (2.68B including its three 69M Multi-Token Prediction heads) built on granite-4.0-1b to convert document page images into DocLang, an XML markup vocabulary preserving reading order, 512x512 bounding boxes, OTSL table topology, LaTeX math, and picture captions.

Unlike flat OCR pipelines that strip layout geometry or emit verbose HTML, DocLang represents every structural tag and grid coordinate (x0 y0 x1 y1) as a single special token inside a 133,800-token vocabulary. Tables use OTSL cell primitives (<ched/>, <fcel/>, <nl/>, and merge markers), while DocLangDocDeserializer in docling-core converts the stream losslessly into Markdown, HTML, or structured JSON.

ComponentLayer / Config SpecParameter Count
Vision Encoder27 layers, hidden 1,152, 16 heads, patch 16, 512px, DeepStack [8, 16, 24]468M
Language Decoder24 layers, hidden 2,048, GQA 16Q/4KV, 131,072 max context1,734M
Output HeadUntied classification head (vocab_size=133,800)274M
Base Inference ModelCore VLM (bfloat16 ~6 GB / 8-bit MLX ~4 GB)2.48B
MTP Speculative Heads3 layers (num_mtp_layers=3, 69M each) for self-drafting208M
Total CheckpointBase VLM + MTP heads2.68B

Document Parsing Accuracy & H100 Throughput Benchmarks

Evaluated with greedy decoding (temperature=0.0, <doclang> prompt) against hand-revised DocLang ground truth across 16,205 pages from nine benchmarks, Granite Docling V2 2B achieves 96.5% content 1 - NED, outperforming its 500M sibling (94.9%) and cutting edit distance sixfold relative to Granite-Docling 258M (3.5% vs 20.6%).

Benchmark SuiteGranite Docling V2 2B (2.5B)Granite Docling V2 500M (0.54B)Notes
OmniDocBench 1.696.2%93.6%Multi-layout academic & enterprise PDFs
DocLayNet v1 / v298.1% / 95.8%97.3% / 94.7%High-density layout & multi-column text
Creative Layouts97.6%96.9%Irregular typography and sidebars
MDPBench / ParseBench86.0% / 96.0%82.8% / 94.4%Complex tables, math, and forms
olmOCR-Bench98.4%96.9%Digitized scans and legacy print
RealDocBench / VAREX91.6% / 97.7%87.5% / 95.7%Multilingual & mixed-script pages
Pooled All (16,205 pages)96.5%94.9%6x lower edit distance vs 258M (79.4%)

On a single NVIDIA H100 running vllm serve over 2,078 ParseBench pages with 8–256 pages in flight, enabling the three native MTP heads raises throughput from ~7 pages/sec to ~10 pages/sec with identical output tokens.

Preserve Special Tokens During Decoding

Always pass `skip_special_tokens=False` in Transformers and `extra_body={"skip_special_tokens": False}` in OpenAI-compatible vLLM requests. Stripping special tokens deletes all DocLang XML tags and 512x512 bounding-box coordinates.

Serving Granite Docling V2 2B with vLLM MTP, MLX, and Selective Prompts

For production document ingestion, render PDF pages at 144 DPI (via pypdfium2), keep 64+ single-page requests in flight, and allocate ~32 CPU cores across --api-server-count 8 so image preprocessing does not starve GPU decoding.

bash
# Install vLLM nightly + Transformers 5.23.0 and launch MTP server
pip install -U vllm --pre "transformers==5.23.0" --extra-index-url https://wheels.vllm.ai/nightly

vllm serve ibm-granite/granite-docling-v2-2b \
  --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
bash
# Apple Silicon local quantization (4 GB 8-bit MLX) + speculative drafting (1.9x faster)
mlx_vlm.convert --hf-path ibm-granite/granite-docling-v2-2b --mlx-path ./granite-docling-v2-2b-8bit -q --q-bits 8
mlx_vlm.generate --model ./granite-docling-v2-2b-8bit \
  --draft-model ibm-granite/granite-docling-v2-2b \
  --image page.png --prompt "<doclang> [<table>, <formula>]" --max-tokens 16384 --temperature 0

Granite Docling V2 2B accepts only <doclang> or bracketed task lists built from <ocr>, <table>, <formula>, <picture>, <code>, <layout>, and <detailed> separated strictly by , after a single space. It returns <doclang></doclang> when the requested element is absent and does not answer free-form QA prompts.

Wiring DocLang Outputs into Smoke Monkey Agentic RAG

When paired with Smoke Monkey Harness and docling-core, an ingestion subagent converts raw PDF pages into verifiable DoclingDocument JSON trees containing cell-level table coordinates and figure descriptions. Downstream retrieval tools can cite exact page numbers and bounding-box regions rather than noisy plain-text chunks, eliminating table-row misalignment hallucinations in financial, legal, and scientific RAG workflows.

Google Search Questions & Answers

Frequently Asked Questions

Q:What is the exact model size and license of Granite Docling V2 2B?

The base inference model has 2.48B parameters (468M vision encoder, 1,734M language decoder, 274M output head), plus 208M across three 69M MTP speculative heads (2.68B total), released under the permissive Apache 2.0 license.

Q:Why does Granite Docling V2 2B omit tags when I call vLLM or Transformers?

DocLang element tags and 512x512 bounding-box coordinates are registered as special tokens. You must pass `skip_special_tokens=False` in both Transformers `.decode()` and vLLM `extra_body` parameters.

Q:How fast does Granite Docling V2 2B run on a single H100 or Apple Silicon Mac?

On one H100 with `vllm serve` and 3-token MTP speculative decoding, it processes ~10 pages/sec (vs ~7 pages/sec without MTP). On Apple Silicon via `mlx-vlm`, 8-bit quantization shrinks memory from ~6 GB to ~4 GB and MTP drafting speeds single-page greedy decoding by ~1.9x.

Q:Can I extract only tables or equations instead of parsing the entire page?

Yes. Pass exact task prompts such as `<doclang> [<table>]` or `<doclang> [<table>, <formula>]` so the decoder emits only matching elements, returning `<doclang></doclang>` if none exist.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness