davanstrien/diffusiongemma-ocr-correction
22
1---2title: DiffusionGemma vs Gemma-4 — Post-OCR Correction3emoji: 📰4colorFrom: yellow5colorTo: red6sdk: gradio7sdk_version: "6.17.3"8app_file: app.py9pinned: false10license: apache-2.011short_description: Diffusion vs autoregressive LLM on historical OCR cleanup12models:13 - google/diffusiongemma-26B-A4B-it14 - google/gemma-4-E4B-it15---16 17# DiffusionGemma vs Gemma-4: post-OCR correction18 19A pragmatic first-pass comparison of Google's **experimental diffusion LLM**20[DiffusionGemma-26B-A4B-it](https://huggingface.co/google/diffusiongemma-26B-A4B-it)21(released 2026-06-10; 26B MoE, 3.8B active; generates 256-token blocks by iterative22denoising) against an autoregressive baseline,23[Gemma-4-E4B-it](https://huggingface.co/google/gemma-4-E4B-it) (~4.5B effective),24on **post-OCR correction of 19th-century English newspaper text**.25 26**Hypothesis**: a diffusion LM treats correction as denoising, so it may be27(a) faster and (b) less prone to *over-correction* — rewriting text that was28already correct — than an autoregressive model, possibly at some accuracy cost.29 30## Method (v1, pragmatic)31 32- 75 passages from [BLN600](https://doi.org/10.15131/shef.data.25439023)33 (19th-c British Library newspapers, aligned OCR + human gold transcription),34 align-trimmed to ≤220 Gemma tokens so outputs fit DiffusionGemma's single35 256-token block. Identical prompt for both models; thinking mode off; bf16;36 batch size 1; A100-80GB.37- Gemma-4 decodes greedily. DiffusionGemma uses its generation-config default38 entropy sampler (**no greedy equivalent exists** for the diffusion sampler —39 this is an unavoidable asymmetry, not a tuning choice).40- **Over-correction rate**: of input characters that were already correct41 (per input↔gold character alignment), the fraction the model changed42 (per input↔output alignment). **Fix rate**: of input characters that were43 wrong, the fraction the model changed. Text NFC-normalized, whitespace44 collapsed, before all metrics. CER/WER via jiwer.45 46## Limitations47 48n=75, single prompt, one run (no seeds/significance testing), 256-token block49caps passage length, tokens/sec for DiffusionGemma is computed over denoising50the whole block, DiffusionGemma is experimental and one day old at benchmark51time. Live demo examples are from ICDAR2019 post-OCR (CC-BY-4.0) because52BLN600's CC-BY-NC license doesn't permit redistribution here; benchmark passage53texts are likewise not republished — only per-passage metrics.54 