Direct Preference Optimization Beyond Chatbots
Adding a DPO stage after supervised fine-tuning reduced text degeneration (repetition loops) in every one of five vision-language model families tested on Brazilian Portuguese structured OCR. The average reduction was 59.4% and the best was 87.6%, with Nanonets-OCR2-3B falling from 1.61% to 0.20%. The key design choice was to keep the SFT model's own degenerate outputs as the rejected examples in preference pairs, rather than filtering them out. An LLM judge scored multiple candidate responses per document across 23,726 documents to pick chosen and rejected outputs. The authors argue that token-level SFT loss cannot penalize completion-level failures like loops, while DPO can, and they outline when the approach should transfer to other structured generation tasks: the failure mode must be a distinct, recognizable class of output.
Related posts
- Newer Models, Same Advantage
Hugging Face easyNoviceDharmaOCR, a Brazilian Portuguese OCR model trained with supervised fine-tuning followed by Direct Preference Optimization, scored 0.925 on a Portuguese-only benchmark, ahead of the newer Mistral OCR4 (0.798) and Unlimited-OCR (0.7587). The gap shows up as misread Brazilian proper nouns and vocabulary in handwritten ENEM essays, and as text degeneration on small-font documents, where generalist models produce output unrelated to the page. SFT focuses the model's parameters on the target language. DPO trains on preferences between complete outputs, which reduces the token-by-token drift that causes repetitive or incoherent transcriptions. The authors argue that specialization will keep an edge even as general models improve.
- Preference Optimization for Vision Language Models
Hugging Face hardMasterTRL now supports direct preference optimization (DPO) for vision language models, trained on chosen/rejected answer pairs rather than fixed labels. A walkthrough fine-tunes Idefics2-8b on the RLAIF-V dataset, formatting image-plus-question prompts with the processor's chat template. Full float32 DPO training would need about 160 GB (policy, reference model, gradients, AdamW states), but bfloat16 plus LoRA cuts trainable parameters to 55M and memory to roughly 32 GB. Batch size 2 with 32 gradient accumulation steps and gradient checkpointing fits activations, and training is judged by rising accuracy and reward margin.
- Generating Human-level Text with Contrastive Search in Transformers 🤗
Hugging Face mediumAdeptContrastive search is a decoding method for neural text generation that picks each token from the model's top-k candidates by balancing model confidence against a degeneration penalty: the maximum cosine similarity between the candidate's hidden representation and those of prior context tokens. Greedy and beam search tend to produce repetitive text, and nucleus sampling tends to lose coherence. Contrastive search avoids both and is available in Hugging Face transformers via `penalty_alpha` and `top_k` in `generate()`. GPT-2 examples (k=4, α=0.6) and token-similarity matrices show it removes the off-diagonal repetition patterns that greedy search produces, and α=0 reduces it to greedy search.
- Training Design for Text-to-Image Models: Lessons from Ablations
Hugging Face hardMasterPhotoroom's ablations on its PRX-1.2B text-to-image model compare recent training-efficiency techniques against a plain Flow Matching baseline: 100k steps at 256×256 on 1M MidJourney images, scored with FID, CMMD, DINO-MMD and throughput. REPA with a frozen DINOv3 teacher cut FID from 18.2 to 14.64 at the cost of throughput (3.95 to 3.46 batches/s), and DINOv2 offered a cheaper middle ground. iREPA's spatial tweaks helped with DINOv2 but hurt with DINOv3, and alignment works best as a temporary scaffold: dropping REPA after about 200K steps sharpened fine detail. The post also covers latent-space alignment (REPA-E, the FLUX.2 AE), training objectives, token routing and sparsification, and data choices.
- Open Preference Dataset for Text-to-Image Generation by the 🤗 Community
Hugging Face easyNoviceData is Better Together released an Apache 2.0 text-to-image preference dataset of 10K pairs, with over 30K annotations from more than 250 community members collected in under two weeks. Imgsys prompts were deduplicated, filtered for NSFW content with text and image classifiers plus manual review, and rewritten with distilabel across style categories and simple versus complex variants. Images came from FLUX.1-dev and Stable Diffusion 3.5 Large. Annotators found FLUX better for anime, manga and 3D, and SD3.5 better for cinematic and art styles. A LoRA fine-tune of FLUX-dev on the chosen samples improved its weaker art and cinematic outputs.