TextVerifier

TextVerifier is a target-conditioned verifier for structural Chinese glyph rendering errors. Given a character crop and the character it is supposed to depict, it decides whether the glyph is structurally correct, catching missing, extra, broken, merged, split, distorted, or misplaced strokes and components.

Text-to-image models increasingly produce Chinese text that is perfectly readable yet locally wrong. OCR and general vision-language models are trained to be invariant to exactly those deviations, so they read the intended character and report success. TextVerifier instead conditions on the target character and asks whether the rendering matches it, which makes it usable for quality inspection of generated images and as a per-character reward signal for post-training.

This repository holds the released model weights. Inference and evaluation code live in the GitHub repository below.

Resources

Resource Location
Code (inference, evaluation, benchmark converter) github.com/ATH-MaaS/TextVerifier
Model weights ATH-MaaS/TextVerifier-CJK-CLIP (this repository)
Benchmark dataset ATH-MaaS/TextRenderBench-ZH
Paper arXiv:2610.19551

How it works

The model is a dual encoder that maps a glyph crop and its target character into a shared embedding space.

  • Image encoder — ViT-L/16 operating on the character crop.
  • Text encoder — DeBERTa-v2 that reads the character's Ideographic Description Sequence (IDS) rather than a single-character token, so the text side carries explicit stroke and component structure.
  • Verification — instead of a single text embedding, each supported character owns a small set of learned visual prototypes for correctly rendered instances. A crop is scored by its cosine distance to the nearest prototype of its target character, and a fixed threshold turns that score into a binary decision.

Comparing against prototypes of normal renderings, rather than against an anomaly model, is what keeps the verifier sensitive to structural deviation while staying insensitive to font, style, color, and background variation.

Files

File Description
textverifier_stage3.pth Verifier checkpoint (final training stage).
textverifier_k10_q90.pt Per-character visual prototypes, character-to-index mapping, decision threshold.
prototype_metadata.json Architecture, prototype shape, threshold, and scoring rule.
manifest.sha256 SHA-256 checksums for the three files above.

Download all four at the same immutable revision:

huggingface-cli download ATH-MaaS/TextVerifier-CJK-CLIP \
  textverifier_stage3.pth \
  textverifier_k10_q90.pt \
  prototype_metadata.json \
  manifest.sha256 \
  --local-dir assets

Place them in an assets/ directory at the root of the cloned code repository, then verify the checksums and assets with:

python -m textverifier.verify_release --root . --check-checkpoint

Usage

Full installation and evaluation instructions are in the code repository README. The short version:

from textverifier.inference import TextVerifier

verifier = TextVerifier(device="cuda", dtype="bfloat16")
result = verifier.score_image("crop.png", "北")
# {"char": "北", "scored": True, "error_score": ..., "threshold": ..., "pred_render_error": False}

Batch inference and benchmark evaluation are available through python -m textverifier.inference and python -m textverifier.evaluate.

Character coverage

Prototypes exist for the set of characters the model was trained on, which covers the common Han characters used in generated Chinese text. A character outside that set cannot be scored: the verifier reports it as unscored rather than guessing, and treats it as normal by default. Coverage over a given input is reported alongside evaluation results, so unsupported characters are visible rather than silently absorbed.

Intended use

  • Inspecting Chinese text rendered by text-to-image and image-editing models.
  • Character-level filtering of generated images.
  • A per-character reward or preference signal for post-training text rendering.
  • Assisting human review of glyph correctness.

The model judges structural correctness of a glyph against a target character. It is not an OCR system and does not return recognized text; it must be told what the character should be. Stylistic variation such as font choice, calligraphy, color, and background is deliberately not treated as an error.

Training

Training proceeds in three stages: large-scale crop-to-IDS contrastive alignment over real-world Chinese text images, absolute discrimination of correct versus structurally corrupted glyphs built from font rendering and stroke-vector manipulation, and relative quality ordering learned from early-versus-late samples of the same character and position taken from a text-region inpainting model's training trajectory. Training images, third-party fonts, and third-party source data are not part of this release; only code, weights, and the independent TextRenderBench-ZH benchmark are released.

Citation

@article{chen2026textverifier,
  title   = {TextVerifier: Seeing Beyond Recognition to Verify Chinese Text Rendering},
  author  = {Chen, Yiyang and Wang, Guo-Hua and Liu, Yaoli and Chen, Qing-Guo and Xu, Zhao and Luo, Weihua and Ma, Xiujun},
  journal = {arXiv preprint arXiv:2610.19551},
  year    = {2026},
  url     = {https://arxiv.org/abs/2610.19551}
}

License

Apache License 2.0. See LICENSE.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train ATH-MaaS/TextVerifier-CJK-CLIP

Paper for ATH-MaaS/TextVerifier-CJK-CLIP