OCR edit gate (full, with log-prob features) - SJF7/ocr-edit-gate-qwen3-0.6b-gate

Improved using Qwen. The gate's training labels were computed on edit blocks that include outputs of Qwen2.5-72B-Instruct (Qwen LICENSE AGREEMENT, Copyright (c) Alibaba Cloud).

LICENSE: CC BY-NC-SA 4.0 (NON-COMMERCIAL TRAINING DATA). These weights were fine-tuned on HIPE-OCRepair-2026 train data, several parts of which are licensed for non-commercial use only (CC BY-NC / CC BY-NC-SA 4.0, overproof: research use only), including impresso-nzz (CC BY-NC 4.0). Whether trained weights are an adaptation of their training data is legally unsettled. The authors release these weights under CC BY-NC-SA 4.0 (non-commercial, share-alike) because of these training-data licenses.

What it is

A binary edit gate: given one edit block (OCR span vs. rewriter replacement, with context) it outputs P(helpful), the probability that applying the block lowers the unit's character error rate. Architecture: Qwen/Qwen3-0.6B encoder (HF snapshot c1899de289a04d12100db370d81485cdf75e47ca), last-token pooling, bf16, head Linear(1024+15 -> 256) + GELU + Dropout(0.1) + Linear(256 -> 1); max_len 256; checkpoint = epoch 1 (best on held-out train). Full gate: 15 numeric features include the rewriter's token log-probs, so the rewriter must be served with logprobs on. Frozen threshold (rule global): P(helpful) >= 0.37570643424987793. Inside the ensembles, per-agreement-level thresholds replace it (P3: 0.7786493301391602 / 0.3098590523004532 / 0.011687257327139378 for n = 1 / 2 / >= 3 families).

Files:

  • model.safetensors (recommended format). The fine-tuned encoder and head, with tensors identical to model.pt (same 314 keys, dtypes and shapes, torch.equal for every tensor). It was converted on CPU after the freeze with scripts/gate_to_safetensors.py. Its sha256 is in frozen/post_freeze_safetensors_hashes.tsv of the code repo (see also SAFETENSORS_NOTE.md).
  • model.pt: the original frozen checkpoint (a PyTorch state_dict; load with torch.load(..., weights_only=True)). It is kept so the files can be checked against the frozen hash table frozen/p2_frozen_hashes.tsv.
  • gate.json: feature standardisation, stored threshold and training metadata.
  • rules.json: decision rules; the frozen rule is global.

gate.json, rules.json and model.pt are the exact frozen files of the paper. ocrgate.gate.load_gate loads model.safetensors when present and falls back to model.pt. Use them with the ocrgate package: python -m ocrgate.gate_apply --gate <this folder> --rule global ... (see the code README). Run on GPU in bf16, as in the paper.

Training data and licenses

Edit blocks (OCR span vs. rewriter replacement) labelled against the ground truth, from the HIPE-OCRepair-2026 train files below (data repo tag v0.9.5 = commit bd463f7). All 13 train cells were used, including impresso-nzz. Fitting used every unit except role gate_heldout of configs/p2_split.json. Checkpoint and threshold selection used the 360 gate_heldout units. 12 units whose ground truth also occurs in dev were dropped. No dev or test data. Blocks came from six rewriters: zero-shot Qwen3-8B, Qwen3-32B, Mistral-Small-24B-Instruct-2501 and Qwen2.5-72B-Instruct on all train units, plus LoRA-24B and LoRA-32B (epoch 2) on the 721 LoRA-held-out train units (370,049 fit / 91,340 held-out blocks). Licenses were checked in the data repo at that commit (participation guidelines table and per-dataset cards).

train subset (cell) units (fit / heldout_fit / gate_heldout) license (guidelines table) license (dataset card: benchmark version / original source)
icdar2017_v1.1_train_en 319 / 68 / 68 CC BY-NC-SA 4.0 CC BY-NC-SA 4.0 / CC BY-NC-SA 4.0
icdar2017_v1.1_train_fr 274 / 59 / 58 CC BY-NC-SA 4.0 CC BY-NC-SA 4.0 / CC BY-NC-SA 4.0
impresso-snippets_v1.0_train_en / fr / de 35/7/8, 35/7/8, 35/7/8 CC BY-NC-SA 4.0 CC BY-NC-SA 4.0
overproof-combined_v1.0_train_en 101 / 21 / 24 Research use only CC BY-NC-SA 4.0 (structured format) / not stated, likely public domain
dta19-l0 / l1 / l2 _v0.1_train_de 132/29/28 each (+1 dev-overlap unit each) CC BY-NC 4.0 CC BY-SA 4.0 / CC BY 4.0
dta19-l0 / l1 / l2 _v0.1_train-unmatched_de 126/27/27, 126/27/27, 126/28/26 CC BY-NC 4.0 CC BY-SA 4.0 / CC BY 4.0
impresso-nzz_v1.1_train_de 105 / 23 / 22 CC BY-NC 4.0 CC BY-NC 4.0 / CC BY-NC 4.0

Non-commercial and share-alike subsets. The gate saw CC BY-NC-SA 4.0 (icdar2017, impresso-snippets), CC BY-NC 4.0 (impresso-nzz; dta19 per the guidelines) and "research use only" (overproof) data. Whether trained weights are an adaptation of their training data is legally unsettled. This artifact is therefore released under CC BY-NC-SA 4.0. Its training blocks also include Qwen2.5-72B-Instruct rewrites, which triggers the Qwen LICENSE AGREEMENT's display requirement (section 5b): Improved using Qwen.

Results (official HIPE-OCRepair-2026 scorer; weighted cMER, lower is better / pref)

system dev test source
LoRA-24B + this gate 0.0112 / 0.930 0.0086 / 0.9169 FINAL_REPORT_P2.md, FINAL_REPORT_TEST_P3.md
LoRA-32B + this gate 0.0110 / 0.949 0.0088 / 0.8980 FINAL_REPORT_P2.md, FINAL_REPORT_TEST_P3.md
LoRA-72B + this gate 0.0099 / 0.969 0.0085 / 0.8944 FINAL_REPORT_P3.md, FINAL_REPORT_TEST_P3.md
Qwen3.8-27B LoRA + this gate (secondary, 3rd test look) 0.0089 / 0.976 0.0071 / 0.9250 FROZEN_CONFIG_P4.md, FINAL_REPORT_TEST_P4.md
P3 primary 4-family ensemble (uses this gate) 0.0084 / 0.971 0.0069 / 0.9282 FINAL_REPORT_P3.md, FINAL_REPORT_TEST_P3.md
no correction (OCR) - 0.0226 / 0.0000 FINAL_REPORT_TEST_P3.md

Dev covers 7 of the 8 official cells (no icdar2017-fr dev file); test numbers are on the 8 official cells. The project scored the test split three times (all disclosed in the paper); nothing was tuned on test.

Intended use

Research on post-OCR correction of historical documents (HIPE-OCRepair-2026 benchmark). It is not meant for production or commercial use (see the license notice above), and not for languages or domains far from the training data (19th-20th c. newspapers and books in en/fr/de). Outputs can still introduce errors; the method only edits spans the gate accepts, and every other character is copied from the OCR input.

License

These weights are released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license (CC BY-NC-SA 4.0, https://creativecommons.org/licenses/by-nc-sa/4.0/), because they were trained on HIPE-OCRepair-2026 training data distributed under non-commercial and share-alike terms.

Training data (HIPE-OCRepair-Bench v0.9, train split; https://github.com/hipe-eval/HIPE-OCRepair-2026-data): icdar2017 (CC BY-NC-SA 4.0), impresso-snippets (CC BY-NC-SA 4.0), overproof (CC BY-NC-SA 4.0 per its data card; listed as "research use only" in the HIPE guidelines), dta19 (listed as CC BY-NC 4.0 in the HIPE guidelines and CC BY-SA 4.0 in its data card; derived from GT4HistOCR / Deutsches Textarchiv), impresso-nzz (CC BY-NC 4.0). No development or test data was used for training.

Please use these weights for non-commercial research only, as the overproof terms ask. This is a request that reflects the data provider's terms, not an additional license condition.

Base model: Qwen/Qwen3-0.6B (Apache-2.0). This repository contains a fine-tuned copy of the base model; obtain and use the base model under its own license.

Modified from Qwen/Qwen3-0.6B (Apache-2.0; license text included as LICENSE-APACHE).

Improved using Qwen. The gate's training labels were computed on edit blocks that include outputs of Qwen2.5-72B-Instruct (Qwen LICENSE AGREEMENT, Copyright (c) Alibaba Cloud).

Citation

@misc{ocreditgate2026,
  title  = {Rewrite, Then Veto: Rewriter-Agnostic Edit Gating for LLM-Based Post-OCR Correction},
  author = {Fonseca Cacho, Jorge Ram{\'o}n},
  year   = {2026},
  eprint = {2611.05539},
  archivePrefix = {arXiv},
  primaryClass = {cs.CL}
}

Paper: Rewrite, Then Veto: Rewriter-Agnostic Edit Gating for LLM-Based Post-OCR Correction, by Jorge Ramón Fonseca Cacho, Department of Computer Science, University of Nevada, Las Vegas. arXiv: arXiv:2611.05539 Code: https://github.com/SniperJF/ocr-edit-gate-release.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
0.6B params
Tensor type
F32
·
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for SJF7/ocr-edit-gate-qwen3-0.6b-gate

Finetuned
Qwen/Qwen3-0.6B
Finetuned
(1,450)
this model

Paper for SJF7/ocr-edit-gate-qwen3-0.6b-gate