Hugging FaceErick Lachmann, Gabriel Pimenta de Freitas Cardoso, Francisco de Almeida Rocha AlvesExplainer
Direct Preference Optimization Beyond Chatbots
Summary
DharmaOCR applies Direct Preference Optimization (DPO) beyond chat alignment to reduce text degeneration in structured OCR, where outputs are either acceptable transcriptions or failure loops. In a benchmark of Brazilian Portuguese structured-document OCR, vanilla degeneration rates among open-source model families ranged from below 1% to above 33%, while supervised fine-tuning (SFT) did not consistently reach production-acceptable levels. After SFT, the pipeline generated multiple candidates for 23,726 documents, used an automated LLM judge to score them, and retained the model’s degenerate outputs as rejected examples paired with chosen outputs. DPO reduced degeneration in every tested family, by 59.4% on average and up to 87.6%, without reducing extraction quality according to the benchmark; applicability is presented as dependent on failures being categorically identifiable, reliably scoreable, and sufficiently numerous.
Context
Structured OCR models can produce text degeneration, in which output enters a repetition loop. The benchmark found vanilla degeneration rates ranging from below 1% to above 33% among tested open-source families, while SFT did not consistently reduce the failure to production-acceptable levels. The article attributes the limitation to SFT’s lack of an objective that explicitly penalizes completion-level degeneration.
Approach / What changed
After SFT, DharmaOCR generated multiple candidate responses for each of 23,726 training documents and used an automated LLM judge to score them against four task-specific criteria. Correct outputs became chosen examples, while the SFT model’s own degenerate outputs were deliberately retained as rejected examples for DPO rather than filtered as noise.
Takeaways
SFT optimizes token-level likelihood and does not explicitly penalize completion-level repetition loops, so its effect on degeneration was inconsistent.
The DPO dataset used multiple SFT-generated candidates from 23,726 documents and an automated LLM judge; degenerate outputs were preserved as rejected examples.
DPO reduced degeneration in every tested model family, with a 59.4% average reduction and an 87.6% best case; one reported rate fell from 1.61% to 0.20%.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.