Newer Models, Same Advantage
Hugging Face 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.
Source Further Reading 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.