
Newer Models, Same Advantage
Quick Answer
DharmaOCR outperformed Mistral OCR4 and Unlimited-OCR on Brazilian Portuguese with a score of 0.925, demonstrating significant advantages through domain specialization and targeted training.
Quick Take
DharmaOCR outperformed Mistral OCR4 and Unlimited-OCR on Brazilian Portuguese with a score of 0.925, demonstrating significant advantages through domain specialization and targeted training. Despite newer models, the specialization in training led to a 13-point and 16-point performance gap, respectively.
Key Points
- DharmaOCR achieved the highest extraction quality score on a Portuguese benchmark.
- The model utilized a two-stage training pipeline for domain specialization.
- Mistral OCR4 and Unlimited-OCR lagged significantly behind DharmaOCR in performance.
- DharmaOCR's design focused entirely on Brazilian Portuguese, enhancing its effectiveness.
- The results highlight the importance of specialization in OCR model training.
📖 Reader Mode
~11 min readDespite 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.
Figure 1: ENEM essay manuscript used in benchmark evaluation with outputs of the each model. Misreads marked in red.
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 in its input signal. Models trained primarily on next-token prediction objectives face a specific vulnerability here: when the visual signal becomes ambiguous, the model can continue generating from prior learned patterns rather than from the source document. The result is text degeneration — output that is repetitive, incoherent, and semantically disconnected from the page.
Presented with a document with small fonts, Mistral OCR4 produces output with no connection to what is written.
Figure 2: small-font document
Figure 3: DharmaOCR output and Mistral OCR4 degenerated output
This is not a low-quality transcription of the source. It is a failure of an entirely different category.
The operational consequence is distinct from that of a transcription error. An incorrect transcription is wrong in a recoverable way — it stands in a relationship to the source document, and the error can in principle be identified and corrected. Degenerated output has no such relationship. It cannot be corrected because there is nothing to correct toward. For downstream processes that depend on structured OCR output — document classification, information extraction, compliance workflows — degenerated output is not inaccurate data. It is structurally unusable data. The efficiency that automation was meant to deliver is negated at precisely the point where output stops being information.
Mistral OCR4 and Unlimited-OCR are good models with significant technical advances behind them. The degeneration behavior described here does not define them; it identifies a specific failure condition that their current training has not addressed for this domain. The question is what a training pipeline designed to address it looks like.
---
In DharmaOCR, the answer is the DPO stage.
Supervised fine-tuning concentrates the model's resources on the target domain — the stage that builds the linguistic alignment described above. But SFT trains on individual token predictions: the model learns to produce the correct next token given the context preceding it. Under visual complexity, this creates the condition that produces degeneration. If an early token in the output diverges from the source document, each subsequent prediction is conditioned on that divergent state, and the output continues to drift. Repetition loops and incoherent sequences are an inherent characteristic in this context — they are the predictable result of an objective optimized step by step without accounting for the coherence of the full extraction.
DPO trains against a different signal. Where SFT trains token by token, DPO trains the model against the quality of complete outputs — teaching it to discriminate between competing responses based on the coherence of the full extraction rather than the accuracy of individual predictions. The effect is stabilizing: on documents where visual complexity would otherwise trigger drift, the model is less likely to commit to a divergent path, because its training penalized outputs that lost coherence at the extraction level.
The result is what the original benchmark demonstrated: lower degeneration rates alongside higher extraction accuracy, on the same documents where models without this training stage lose coherence.
The benchmark establishes what is true today. It is less precise about what will be true in two years.
It is possible — and likely — that newer models will eventually outperform the current DharmaOCR even in Brazilian Portuguese. Architectures will improve. Training techniques will advance. Datasets will expand. The field moves toward higher capability at every level, and there is no reason to expect that trajectory to stop. This is expected, and it is welcome.
What changes with each architectural generation is the ceiling on absolute performance. What does not change is the structural logic that determines which systems come closest to their ceiling in a given domain.
Available resources — compute, parameters, training data — are finite. They must be directed somewhere. A system that directs them at a single domain will extract more from them in that domain than a system distributing the same resources across many. This relationship holds regardless of how capable the generalist model has become. The gap between specialist and generalist may evolve as architectures improve. The structural dynamic does not reverse. We explored this principle in more depth in an earlier piece on why specialization continues to produce an advantage as AI systems advance (Why Specialization Is Inevitable).
This is what shapes how Dharma approaches what comes next. The objective is not to defend the current model's benchmark position. It is to remain at the frontier of emerging techniques — new architectures, new training methods, new approaches to alignment and evaluation — and adapt them toward the same end: a specialized system for Brazilian Portuguese OCR that makes the best possible use of available resources, at the lowest possible cost and the shortest possible inference time.
Better tools do not work against specialization. They expand what it can achieve.
Three months ago, we showed that concentrating a model's training on a specific domain produces a measurable advantage over generalist systems, including ones that are newer and better-resourced. That advantage held. The same principle will determine how DharmaOCR continues to evolve — not by staying fixed, but by applying whatever progress the field makes to a domain that remains fixed.
Source
- Cardoso, Gabriel Pimenta de Freitas, et al. "DharmaOCR: Specialized Small Language Models for Structured OCR that outperform Open-Source and Commercial Baselines." arXiv preprint arXiv:2604.14314 (2026).
Further Reading
- Why Specialization Is Inevitable — The structural and theoretical foundation for the specialization argument. Optimization theory, evolutionary biology, competitive markets, and machine learning all converge on the same prediction: under finite resources and selection pressure, fit beats breadth.
- Specialization Beats Scale: A Strategic Variable Most AI Procurement Decisions Overlook — The empirical and strategic complement to this article. Where the No Free Lunch theorem establishes why specialization is structurally predicted, this piece examines the evidence that it outperforms in practice — and why it remains underweighted in most AI procurement decisions.
- Text Degeneration: A Production Failure Mode That Most Benchmarks Do Not Track — A documented failure mode that emerges when language models operate outside the boundaries of their effective domain.
- Direct Preference Optimization Beyond Chatbots — How preference optimization techniques extend into specialized domains beyond conversational AI — a concrete instantiation of the domain focus strategy this article argues is structurally predicted.
---
Explore Dharma AI on Hugging Face to try our interactive demos, download our open-source models, and discover how specialized AI systems outperform general-purpose models in real enterprise applications.
— Originally published at huggingface.co
Want this in your inbox every morning?
Daily brief at your local 8am — bilingual EN/中文, free.
More from Hugging Face
See more →
From Hugging Face to Amazon SageMaker Studio in one click
Hugging Face has launched a deep-link integration with Amazon SageMaker Studio, allowing developers to seamlessly transition from model discovery to deployment with a single click. This integration streamlines the process by pre-configuring permissions and providing GPU quota visibility, significantly reducing the time from model selection to experimentation.



