Newer Models, Same Advantage

Despite newer architectures, DharmaOCR outperformed Mistral OCR4 and Unlimited-OCR on Brazilian Portuguese through domain specialization and targeted training. This article presents the evidence and the mechanism behind that advantage.
Despite newer architectures, DharmaOCR outperformed Mistral OCR4 and Unlimited-OCR on Brazilian Portuguese through domain specialization and targeted training. This article presents the evidence and the mechanism behind that advantage.
Three months ago, we published a paper on DharmaOCR and open-sourced one of the models. The objective was specific: optical character recognition engineered for Brazilian Portuguese.
The training pipeline was built in two stages. The first was a supervised fine-tuning step, drawing on a broad collection of Portuguese-language files from different sources, formats, and levels of complexity. This stage aligned the model's weights to the specific vocabulary, syntax, and document structures of Brazilian Portuguese — concentrating representational capacity on the target language rather than distributing it across a broader multilingual space. The second stage applied Direct Preference Optimization: rather than training only on correct transcriptions, the model learned from comparative preference data between competing outputs, teaching it to consistently select the better extraction at inference time. This stage addressed a different problem: not accuracy, but stability. By suppressing the failure modes that cause generative models to produce repetitive or incoherent output, DPO reduced inference time and cost, and materially improved the reliability of what the model delivered in production.
The combined result was a model that achieved the highest extraction quality score with the lowest degeneration rate on a Portuguese-focused benchmark. Both stages were necessary. The fine-tuning stage built domain competency; the DPO stage ensured that competency held under the conditions where models tend to fail.
OCR models have been moving quickly. But the gaps that originally motivated DharmaOCR's design (in extraction quality on complex documents and in model stability under production conditions) have not closed. They have, if anything, become more instructive as the field has changed.
The proliferation of multimodal generative models made language model-based OCR widely accessible, and the wave of fine-tuned OCR variants that followed reflects how fast that adoption has moved. That proliferation has not, however, changed the fundamental character of the technology. Every OCR system built on a generative model is probabilistic. Transcription errors are an inherent variable of this probabilistic technology. What differentiates models is how many errors they make and of what kind. That is determined by two things: the structure of the model (its architecture and parameter count) and how those parameters were trained for the task.
Architecture and parameter count establish the ceiling on what a model can learn. Training determines how that capacity is allocated.
This distinction is where specialization becomes a structural question rather than a design preference. When a model is trained on a restricted domain — a single language, a bounded document type, a specific task — All of its parameters are dedicated to that specific task. When a model is trained to cover a broader range of domains — a multilingual model handling N languages, for instance — those same parameters must be distributed across all of them. The distribution is not linear: the neuron superposition principle means individual parameters can encode multiple features simultaneously. But the division is real, and its consequences are real. A model covering more ground commits less to any given part of it.
DharmaOCR was trained to accept that constraint in reverse. The model is not designed to be the best option for other languages, and was never intended to be. In exchange, every parameter available to the network could be oriented toward the specific vocabulary, morphology, and orthographic patterns of Brazilian Portuguese — the most directed possible use of the model's resources for that domain.
That concentration is the structural basis of an inherent advantage over multilingual and broader-domain models. The advantage does not depend on having a larger architecture or a more sophisticated training procedure than competitors use — new architectures and new training techniques improve what any model can do. It depends on where those resources are directed: at one domain rather than spread across many.
Three months later, newer models have arrived. Whether the case for specialization holds when those models are newer and more capable is a different question.
Three months after the DharmaOCR paper appeared, two new OCR models attracted significant attention from the research community: Mistral OCR4 and Unlimited-OCR. Both represent genuine technical advances — new training techniques, new datasets, and strong results across multiple languages on a range of benchmark evaluations. They are the kind of models that raise the competitive standard for what OCR systems are expected to deliver.
When we ran both against the DharmaOCR benchmark — an evaluation designed exclusively around Portuguese — the results were conclusive.
DharmaOCR scored 0.925. Mistral OCR4 scored 0.798. Unlimited-OCR scored 0.7587.
The difference is significant. Mistral OCR4 falls approximately 13 points below DharmaOCR; Unlimited-OCR falls more than 16 points below. Both were released after our model, both backed by substantial research resources. On a task where DharmaOCR's fundamental design decision was to concentrate entirely on Portuguese, the specialization advantage is measurable and significant.
The benchmark is the central finding. What follows illustrates why the gap takes the specific shape it does.
Processing non-trivial Portuguese documents reveals precisely where multilingual models tend to break. ENEM essays (Brazil's national high school examination) combine handwritten text with vocabulary, proper nouns, and cultural references that are specific to Brazilian Portuguese. They are exactly the kind of documents where language-specific training produces a return.
Mistral OCR4, evaluated on documents of this kind, transcribed the name Chico Buarque (one of Brazil's most widely recognized musicians and poets) as "Chico Barque." Unlimited-OCR rendered the same name as "chico bique." Confronted with the phrase "O Brasil não exclui, assimila" ("Brazil does not exclude, it assimilates", a Chico Buarque quotation embedded in the same document) Unlimited-OCR returned: "a dose de chico bique, 'o Brasil no exclu, eliminila.'"
These are not random errors. A model with insufficient exposure to Brazilian Portuguese does not fail arbitrarily — it fails at precisely the vocabulary and proper nouns that distinguish Brazilian Portuguese from the broader multilingual corpus. Chico Buarque is not an obscure reference; the name is nationally recognized. Its systematic corruption across outputs is not an edge case. It is a diagnostic: evidence of where the model's training did not go.
DharmaOCR, evaluated on the same documents, handles these cases correctly. The reason is direct: the model's training was concentrated on this linguistic space, orienting its resources toward the vocabulary and proper noun distributions that characterize Brazilian Portuguese rather than spreading them across many languages at once.
The examples illustrate the benchmark rather than replace it. The benchmark establishes the magnitude of the gap; the examples show why it is concentrated in language-specific recognition rather than in general capability.
Extraction accuracy, however, is only one dimension of production performance. Stability under visual difficulty is another — and operationally, it is the more consequential one to fail on.
When a generative model encounters a document it cannot clearly resolve — small fonts, degraded scan quality, dense handwriting — it faces uncertainty, often leading to hallucinations or repetitive loops. DharmaOCR's DPO stage mitigates this, ensuring stability where others fail.
Source: Hugging Face Blog
















