Three months after releasing DharmaOCR, the model still beats Mistral OCR4 and Unlimited-OCR on Brazilian Portuguese documents. Newer architectures have arrived, but they have not closed the gap created by domain specialization and targeted training.
In this article
The original approach
The initial release focused on a single goal: optical character recognition for Brazilian Portuguese. The training pipeline used two distinct steps to achieve this.
First, supervised fine-tuning aligned the model with a broad collection of Portuguese files. This concentrated the model’s capacity on the vocabulary, syntax, and document structures of the target language rather than spreading it across a wider multilingual space.
Second, Direct Preference Optimization addressed stability. Instead of training only on correct transcriptions, the model learned from comparative data between competing outputs. This taught the system to select the better extraction at inference time. By suppressing failure modes that cause generative models to produce repetitive or incoherent output, DPO reduced inference time and cost while improving reliability 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.
Why newer models still lose
OCR models have moved quickly. The gaps that originally motivated DharmaOCR’s design have not closed. They have, if anything, become more instructive as the field has changed.
The rise of multimodal generative models made language model-based OCR widely accessible. The wave of fine-tuned 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 the structure of the model 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, all of its parameters are dedicated to that specific task. When a model is trained to cover a broader range of domains, those same parameters must be distributed across all of them. 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. 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. 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. 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, the results were conclusive.
DharmaOCR scored 0.925. Mistral OCR4 scored 0.798. Unlimited-OCR scored 0.7587.
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.
The benchmark is the central finding. What follows illustrates why the gap takes the specific shape it does.
Specific failures on Portuguese documents
Processing non-trivial Portuguese documents reveals precisely where multilingual models tend to break. ENEM essays 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 as “Chico Barque.” Unlimited-OCR rendered the same name as “chico bique.” Confronted with the phrase “O Brasil não exclui, assimila”, 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. 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.
Extraction accuracy is only one dimension of production performance. Stability under visual difficulty is another. When a generative model encounters a document it cannot clearly resolve, 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 becomes 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.
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. 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, 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 mechanism behind the stability
In DharmaOCR, the answer is the DPO stage.
Supervised fine-tuning concentrates the model’s resources on the target domain. 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. It teaches the model 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 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 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.
What it means
For people making things, the choice is between breadth and depth. A general model can handle many languages but will struggle with the specific vocabulary of Brazilian Portuguese or fail completely when a document is degraded. A model trained specifically for one domain uses every parameter to understand that domain. It extracts text correctly and does not drift into nonsense when the input is difficult. Specialization remains the most reliable way to ensure the output is usable.




