Chandra OCR 2: The Open-Source Model That Reads What Others Can’t
From the publisher’s feed, collected in the ZeroLabs newsroom.
How a 5-Billion Parameter Model Is Quietly Beating GPT-4o, Gemini, and Every Other OCR System at Its Own GameImagine handing a stack of documents to an assistant — some typed neatly, some scrawled by hand, some packed with equations and tables, some in Japanese or Arabic or Bengali — and asking them to turn it all into clean, structured, machine-readable text. Not just the words, but the structure: the columns, the table cells, the headers, the footnotes, the checkboxes ticked in a form.For most of computing history, this has been a frustratingly unsolved problem. The technology for reading documents — called OCR, or Optical Character Recognition — has existed for decades, but traditional OCR tools were brittle. They’d flatten a two-column newspaper article into a single chaotic stream of text. They’d mangle a handwritten form. They’d completely abandon ship when confronted with a math equation.Chandra OCR 2, released in March 2026 by a company called Datalab, is a different kind of answer to this problem. And the benchmark numbers suggest it may genuinely be the best open-source document-reading model in the world right now.First, What Even Is OCR — And Why Is It So Hard?Before diving into what makes Chandra 2 special, it helps to understand why “reading a document” is hard for computers in the first place.When you take a photo of a page or scan a PDF, what your computer sees is just pixels — millions of tiny colored dots. There’s no inherent meaning in those dots. Turning them back into text, tables, and structure that a computer can process is the job of an OCR system.Traditional OCR worked in a very mechanical way: detect characters one by one, compare them to known templates, output the best match. This worked tolerably well on clean, printed, standardized text. But it fell apart completely on:Handwritten text, because no two people write the same letter the same wayComplex layouts like multi-column magazine spreads, where you need to know which text column continues into whichTables, where the structure (rows, columns, merged cells) carries as much meaning as the words insideMathematical notation, where symbols have precise positional relationships (subscripts, superscripts, fractions)Scanned old documents, where ink has faded, paper has yellowed, and text is slightly rotatedNon-Latin scripts like Arabic, Hindi, or Chinese, which traditional engines were often simply not trained onModern AI-powered OCR — including tools like GPT-4o’s vision capabilities and Google’s Gemini — has greatly improved on this. But most still have blind spots. And until recently, there was no open-source option that could match the accuracy of commercial APIs.Chandra 2 changes that.What Is Chandra OCR 2?Chandra OCR 2 is an open-source AI model built specifically for document understanding. It was created by Datalab, the same team behind the widely-used Marker document processing library.At its core, Chandra 2 takes an image — a scanned page, a screenshot of a PDF, a photograph of a document — and converts it into structured text output. Not just raw text, but structured output in your choice of Markdown, HTML, or JSON, with the original layout faithfully reconstructed.The model has 5 billion parameters. To put that in perspective: it is significantly smaller than GPT-4o (which is estimated at over a trillion parameters in its mixture-of-experts form) and smaller than its own predecessor, Chandra 1, which had 9 billion parameters. Yet it outperforms both on most benchmarks. Fewer parameters, better results — this is the hallmark of a well-designed, task-specific model trained on carefully curated data.Under the hood, Chandra 2 is built on top of Qwen 3.5, a vision-language model from Alibaba’s research lab. Think of Qwen 3.5 as a very capable general-purpose AI that can understand both images and text. Datalab then fine-tuned this foundation model extensively on document-specific tasks — OCR, layout reconstruction, form parsing, multilingual text recognition — turning a general model into a specialist.The Core Problem It SolvesThe fundamental issue Chandra 2 addresses is what you might call the gap between documents and data.The world runs on documents — invoices, contracts, academic papers, government forms, medical records, bank statements, handwritten notes. But virtually all modern software — databases, AI pipelines, search engines, analytics tools — works with structured data, not images of paper.Bridging this gap has historically required either paying for expensive proprietary APIs or accepting mediocre accuracy from open-source alternatives. Chandra 2 is specifically designed to close this gap with:Full-page understanding rather than piecemeal parsing. Most traditional OCR tools process a document in chunks — they look at small regions independently. Chandra 2, like a human reader, processes the entire page at once and uses context from the whole page to understand each part. This is why it handles complex layouts so well: it “knows” that a page has two columns before it starts reading either one.Structure preservation. Rather than outputting a flat wall of text, Chandra 2 preserves — and marks up — the logical structure of the page. A table stays a table in the output. A section header becomes a Markdown ## heading. A form checkbox is noted as checked or unchecked. A figure caption is labeled as such. This makes the output immediately useful for downstream tasks like feeding documents into a retrieval-augmented generation (RAG) pipeline, a database, or an AI assistant.Source: https://www.datalab.to/blog/chandra-2Layout block recognition. The model can label every region of a page with a semantic type: text, section-header, caption, footnote, table, form, list-group, image, figure, diagram, equation-block, code-block, chemical-block, bibliography, table-of-contents, page-header, page-footer, or complex-block. This granularity is rare even in commercial tools.What It’s Specifically Good AtHandwritten TextThis is perhaps Chandra 2’s most impressive capability, and the hardest for traditional OCR systems. The model was explicitly trained to handle handwriting well, and it shows. It can read cursive writing, handwritten notes, filled-in paper forms — even older historical manuscripts. A famous informal test of Chandra 1 involved running a photograph of a handwritten letter by the mathematician Ramanujan from 1913 through the model. It read it correctly.Chandra 2 takes this further with “excellent handwriting support” per the official documentation. It can handle handwritten math, handwritten forms, and mixed documents where some regions are typed and others are handwritten — treating each appropriately.Source: https://www.datalab.to/blog/chandra-2Tables and FormsTables are notoriously difficult for OCR systems because understanding a table requires understanding spatial relationships, not just individual characters. A cell’s meaning depends on knowing which row and column it belongs to, and merged cells or nested structures add further complexity.Chandra 2 reconstructs tables accurately in its output, including financial tables with many columns, statistical distribution tables, and complex multi-level headers. On the olmOCR benchmark’s dedicated table evaluation, it scores 89.9 — higher than every competing model tested, including the Datalab hosted API (which uses additional post-processing on top of Chandra 2).For forms — the paper kind, with fill-in boxes and checkboxes — Chandra 2 can detect and accurately represent whether checkboxes are checked or unchecked, and it preserves the semantic structure of the form rather than just outputting a stream of text.Source: https://www.datalab.to/blog/chandra-2Mathematical NotationMath has always been an OCR nightmare. Subscripts, superscripts, fractions, integrals, Greek letters, summations — traditional character recognition has no model for the spatial grammar of mathematical notation.Chandra 2 was explicitly trained on mathematical documents, including textbook pages and handwritten math problems. On the olmOCR benchmark, it scores 90.2 on the ArXiv (academic math papers) category and 89.3 on the “Old Scans Math” category — both among the highest scores of any model tested.Source: https://www.datalab.to/blog/chandra-2Image Captions and DiagramsOne thing that often gets overlooked in document processing is what to do with the non-text content. Chandra 2 doesn’t just skip past images and diagrams — it extracts them and generates captions and structured descriptions. This includes charts (bar charts, line charts, pie charts), where it can extract the actual data values, categories, and axis labels — turning a visual chart back into structured data. It also converts flowcharts and process diagrams into Mermaid diagram format, which is a text-based notation that can be rendered back into a visual diagram.Messy, Low-Quality ScansOld documents, faded photocopies, pages with smudged ink or uneven lighting — these are where many OCR tools give up. Chandra 2 handles them with varying success: it scores 49.8 on the “Old Scans” category of the olmOCR benchmark, which is actually quite competitive (most models hover in the 30s to 50s range on this notoriously hard category, since the scans are genuinely degraded).Multi-Column LayoutsAcademic papers, newspapers, legal documents — many real-world documents use multiple columns. Getting the reading order right (finish column 1 before starting column 2, but don’t cross a column boundary mid-sentence) requires understanding layout, not just reading pixels. Chandra 2 scores 83.5 on multi-column benchmarks, on par with the best competing models.Language Support: 90+ LanguagesThis is one of the most striking aspects of Chandra 2, and represents a major leap from Chandra 1 (which supported around 40 languages).Chandra 2 supports over 90 languages, covering scripts ranging from Latin alphabets (English, German, French, Spanish, Portuguese, and dozens more) to Cyrillic (Russian, Ukrainian, Serbian), to Arabic and Persian (right-to-left scripts), to South and Southeast Asian scripts (Hindi, Bengali, Tamil, Telugu, Malayalam, Kannada, Thai, Javanese), to East Asian scripts (Chinese, Japanese, Korean), to even classical languages like Latin and Sanskrit.Arabic (RTL)Japanese (CJK)Hindi (Devanagari)On the benchmark of the 43 most common languages tested, Chandra 2 achieves an average accuracy of 77.8% — compared to 69.4% for Chandra 1 (a 12% improvement), 67.6% for Google’s Gemini 2.5 Flash, and 60.5% for OpenAI’s GPT-5 Mini. On the expanded 90-language benchmark, Chandra 2 averages 72.7% versus Gemini 2.5 Flash at 60.8%.Some specific highlights from the language benchmarks include German (94.8%), Italian (94.1%), French (93.7%), Portuguese (95.2%), Serbian (90.3%), and Chinese (88.7%). The largest improvements over Chandra 1 came in South Asian scripts: Bengali improved by 27 percentage points, Tamil by 27, Kannada by 43, Malayalam by 46, and Telugu by 39. These languages — spoken by hundreds of millions of people — were severely underserved by previous open-source OCR tools. Chandra 2 still trails in some scripts (Arabic, Urdu, Sanskrit remain challenging), but the trajectory of improvement is remarkable.Right-to-left languages also improved substantially:Benchmark Results: The Numbers That MatterThe standard benchmark for evaluating document OCR models is the olmOCR benchmark, created by the Allen Institute for AI (the same organization behind olmOCR, one of Chandra’s main competitors). It tests models on eight distinct document categories: ArXiv academic papers, old scanned math documents, tables, old scans, headers and footers, multi-column layouts, long documents with tiny text, and a baseline category.Here’s how Chandra 2 compares to the main alternatives:Chandra 2 tops the overall benchmark, outperforming not only commercial APIs from OpenAI (GPT-4o), Google (Gemini Flash 2), and Mistral, but also specialized open-source competitors like olmOCR and DeepSeek OCR. This is particularly notable because GPT-4o and Gemini represent hundreds of billions or trillions of parameters — vastly larger models — being beaten on a document-specific task by a focused 5-billion parameter specialist.The one area where Chandra 2 doesn’t lead is the “old scans” category (49.8), where Chandra 1 (50.4) holds a slight edge — suggesting that some capability was traded off in the architectural changes, though the gap is negligible and the overall improvement is clear.How Was It Trained?The training approach reflects a philosophy increasingly common in production AI: start with a strong general-purpose foundation model, then fine-tune intensively on task-specific data.The base model is Qwen 3.5, a vision-language model from Alibaba’s Qwen team. Qwen 3.5 is designed to take in both images and text and reason over them — it’s the kind of model that can look at a picture and answer questions about it. This provides the “perception backbone” that Chandra 2 builds on.Datalab then fine-tuned this model on a large dataset of documents spanning many categories — academic papers, handwritten forms, tables, multi-language documents, old scans, and more. The fine-tuning was specifically oriented toward the goal of accurate layout-preserving OCR, not just character recognition. This specialization is what gives Chandra 2 its edge: it’s not a general model trying to do OCR, it’s a model that has internalized what documents look like and how to reconstruct them faithfully.The model outputs in three modes (Markdown, HTML, JSON) using special prompt types during inference. The ocr_layout prompt type is the standard mode for layout-preserving document extraction, and it's what the benchmarks are evaluated on.How to Run ItGetting Chandra 2 running is relatively straightforward. The simplest path is:pip install chandra-ocrThis installs the base package. From there, you have two inference backends to choose from.The vLLM backend (recommended for production) runs a local inference server optimized for throughput. You start the server with chandra_vllm, then process documents via the CLI or Python API:chandra input.pdf ./outputThe HuggingFace backend is more portable and works directly with the Transformers library, suitable for development and experimentation:pip install chandra-ocr[hf]chandra input.pdf ./output --method hfIn Python, the HuggingFace interface looks like this:from transformers import AutoModelForImageTextToText, AutoProcessorfrom chandra.model.hf import generate_hffrom chandra.model.schema import BatchInputItemfrom chandra.output import parse_markdownfrom PIL import Imageimport torch# Load the model (downloads ~10GB of weights on first run)model = AutoModelForImageTextToText.from_pretrained( "datalab-to/chandra-ocr-2", dtype=torch.bfloat16, # BFloat16 for memory efficiency device_map="auto", # Automatically places on GPU if available)model.eval()model.processor = AutoProcessor.from_pretrained("datalab-to/chandra-ocr-2")model.processor.tokenizer.padding_side = "left"# Run OCR on a document imagebatch = [ BatchInputItem( image=Image.open("document.png"), prompt_type="ocr_layout" # The standard layout-preserving mode )]result = generate_hf(batch, model)[0]markdown = parse_markdown(result.raw)print(markdown)The model weights are stored in BFloat16 format (a compressed floating-point representation commonly used in modern AI inference), which means the full model requires roughly 10–12GB of GPU memory. An NVIDIA GPU with at least 16GB of VRAM (such as an RTX 3090, 4090, or any A100/H100 in a cloud environment) is recommended for local deployment.For throughput: on a single NVIDIA H100 GPU using the vLLM backend with 96 concurrent sequences, Chandra 2 processes about 1.44 pages per second on the difficult olmOCR benchmark set. On more typical real-world documents, Datalab estimates roughly 2 pages per second — so a 100-page document would take around a minute.If you don’t want to run it locally at all, Datalab offers a hosted API with a free playground for small-scale use. The hosted “Datalab API” mode in the benchmarks above actually scores slightly higher than the standalone Chandra 2 model (86.7 vs 85.9), because it adds extra post-processing enhancements on top of the base model.License: What You Can and Can’t Do With ItThis is an important detail that’s worth understanding clearly, because Chandra 2 uses a dual licensing structure.The code (the chandra-ocr Python library, the inference wrapper, the CLI tools) is licensed under Apache 2.0 — one of the most permissive open-source licenses. You can use it, modify it, build on it, and deploy it commercially without restriction.The model weights (the actual trained parameters — the 5 billion numbers that make the model work) use a modified OpenRAIL-M license. This is a type of “responsible AI” license designed to allow broad use while restricting specific harmful applications.Under this license, the model weights are free for:Research and academic usePersonal projectsStartups with under $2 million in funding or revenueThe key restriction is that you cannot use the model weights competitively against Datalab’s own hosted API. In other words, you can’t take Chandra 2’s weights and build a competing paid OCR API service that directly substitutes for Datalab’s commercial offering.For broader commercial use beyond these terms, Datalab offers commercial licensing — details are on their pricing page.This kind of licensing is increasingly common in the open-source AI space (similar to what you see with Meta’s Llama models, for example), where the creators want to enable research and developer adoption while protecting the commercial viability that funds continued development.Why Should You Care?If you’re a developer building anything that touches documents — invoice processing, contract analysis, academic paper extraction, form digitization, multilingual document pipelines — Chandra 2 represents a significant step forward in what’s achievable with open-source tooling.Before models like this existed, you had two choices: pay for a commercial API (with the cost, latency, and data-privacy concerns that come with it) or accept the accuracy limitations of older open-source OCR tools like Tesseract. Chandra 2 opens a third option: a model you can run locally, on your own hardware, with accuracy that rivals or exceeds the commercial alternatives.For AI engineers specifically, the integration story is clean. The chandra-ocr library provides a straightforward Python interface, the outputs are structured and machine-readable, and the model runs on standard vLLM or HuggingFace Transformers infrastructure. It fits naturally into document processing pipelines, RAG architectures, and data extraction workflows.For non-engineers, the existence of a free playground means you can experiment with it immediately without writing any code — upload a document and see what comes back.Looking at the Bigger PictureThe release of Chandra 2 is part of a broader trend that’s been accelerating over the last couple of years: open-source AI models closing the gap with, and in some cases surpassing, proprietary commercial systems on specific, well-defined tasks.The reason is intuitive once you think about it. A large general model like GPT-4o has to be excellent at everything from writing poetry to solving math problems to reading documents. A purpose-built specialist like Chandra 2 only has to be excellent at one thing, and it can devote all of its capacity — and all of its training data — to that one task.The fact that a 5-billion parameter model can beat a multi-trillion parameter general model on document OCR isn’t a fluke. It’s a demonstration of what focused specialization, quality training data, and careful fine-tuning can achieve.Where to Go From HereIf you want to explore Chandra 2:Try the playground (no installation required): datalab.to/playgroundInstall the library: pip install chandra-ocrRead the model card: huggingface.co/datalab-to/chandra-ocr-2View the GitHub repo: github.com/datalab-to/chandraSee the full 90-language benchmark: linked in the GitHub repo’s FULL_BENCHMARKS.mdThe world produces an enormous amount of information locked inside documents — historical archives, scientific literature, legal records, administrative files. Models like Chandra 2 are part of how we unlock that information and make it legible to the software systems that increasingly help us understand and act on it.Chandra OCR 2: The Open-Source Model That Reads What Others Can’t was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.