🇰🇷 한국어 카드: MODEL_CARD.ko.md
ThakiOCR-JA-v1 is a research release of a Japanese OCR model: PaddleOCR-VL-1.6 (0.9B) with one LoRA adapter (r 16, α 32, 600 steps, plain cross-entropy SFT) merged into the original weights. It reads single text-line images cut from horizontal printed Japanese documents. "v1" marks the first research release; it is not a statement of production readiness.
On 2,000 lines from 30 Japanese government white-paper PDFs it is non-inferior to the base model (pre-registered margins) and better than a rotation-augmented sibling. It is not shown to be better than the base model, and it has one confirmed regression: it writes the variant glyph 齡 where modern text uses 齢. Read §4 before using it.
Requirements: vllm (verified on 0.28.0), pillow. The remote code from the base model is included
(trust_remote_code=True). Decoding is greedy with prompt OCR:; these settings are the ones measured below.
python inference.py line1.png line2.png --model ThakiCloud/ThakiOCR-JA-v1 --kind line --orientation upright
from huggingface_hub import snapshot_download
from inference import ThakiOCRJA # inference.py from this repository
model_dir = snapshot_download("ThakiCloud/ThakiOCR-JA-v1")
ocr = ThakiOCRJA(model_dir)
res = ocr.recognize(["line.png"], kind="line", orientation="upright")
print(res[0]["raw_text"]) # model output, never modified
res = ocr.recognize(["line.png"], kind="line", orientation="upright", normalize_mode="modern_ja")
print(res[0]["raw_text"], res[0]["text"]) # text = raw_text with 齡→齢 and ·→・ only
The model does not detect orientation. The caller states it:
orientation |
Meaning | What the script does |
|---|---|---|
upright (default) |
the line is in reading orientation | nothing |
rot_ccw90 |
a vertical line stored rotated 90° counter-clockwise | rotates 90° clockwise before OCR |
unknown |
no metadata | nothing, and the result is flagged orientation_unverified: true — no accuracy is claimed |
Every result has raw_text (the model's greedy output) and text. With the default normalize_mode="raw"
they are identical. normalize_mode="modern_ja" maps exactly two characters in text:
齡 (U+9F61) → 齢 (U+9F62) and · (U+00B7) → ・ (U+30FB). raw_text is never changed. The default is
raw because in historical documents and proper nouns the variant form can be the correct transcription.
| ✅ Supported | Line images from horizontal printed Japanese documents; orientation supplied by the caller (upright / rot_ccw90) |
| ⚠️ Unverified | Images without orientation metadata (unknown) — no performance guarantee |
| ❌ Not claimed | Full vertical-page Japanese OCR · automatic orientation detection · Korean or English OCR · document layout parsing · exact digit/symbol accuracy · general superiority over PaddleOCR-VL-1.6 · production readiness |
2,000 text lines from 30 PDFs of 5 public sources (Cabinet Office ageing-society and disability white papers, Ministry of the Environment, MEXT science & technology, MIC information & communications white papers, FY2024 editions); 931 lines contain digits. Character error rate after NFKC with whitespace removed. Digit precision, recall and F1 match digit spans (runs of digits; 1,463 in the ground truth); digit hallucination is the share of the 1,069 digit-free lines where the model output any digit. 95% CIs come from a paired cluster bootstrap over the 30 PDFs (B = 1000, seed 20261118). All three models use the same decoding.
| Model | CER | Digit F1 | Digit precision | Digit recall | Digit hallucination (line rate) |
|---|---|---|---|---|---|
| PaddleOCR-VL-1.6 (base) | 0.0118 | 0.9956 | 0.9925 | 0.9986 | 0.0075 |
| ThakiOCR-JA-v1 | 0.0094 | 0.9973 | 0.9973 | 0.9973 | 0.0009 |
| sibling B (rotation-augmented SFT, not released) | 0.0148 | 0.9908 | 0.9884 | 0.9932 | 0.0009 |
| Comparison (Δ = ours − other) | CER Δ [95% CI] | Digit F1 Δ [95% CI] |
|---|---|---|
| vs base | −0.0024 [−0.0060, +0.0008] | +0.0017 [−0.0025, +0.0068] |
| vs sibling B | −0.0054 [−0.0110, −0.0016] |
| Source | Lines | Base | Ours | Δ [95% CI] | Digit F1 base → ours |
|---|---|---|---|---|---|
| MEXT science & technology | 306 | 0.0188 | 0.0067 | −0.0121 [−0.0243, +0.0009] | 0.9712 → 0.9926 |
| MIC information & communications | 404 | 0.0157 | 0.0099 | −0.0058 [−0.0084, −0.0035] | 1.0000 → 0.9944 |
| Ministry of the Environment | 454 | 0.0096 | 0.0089 | −0.0007 [−0.0034, +0.0013] | 1.0000 → 1.0000 |
| Cabinet Office, disability | 403 | 0.0122 | 0.0105 | −0.0017 [−0.0122, +0.0058] | 0.9983 → 0.9983 |
| Cabinet Office, ageing society | 433 | 0.0042 | 0.0100 | +0.0058 [+0.0020, +0.0099] | 1.0000 → 1.0000 |
The ageing-society source is a confirmed regression (the CI excludes 0). In the MIC source CER improves but digit F1 drops slightly (0.9944 vs 1.0000).
| Set | Lines | Base CER | Ours CER |
|---|---|---|---|
| NDL part 2 (all part-2 books excluded from training) | 1,500 | 0.1194 | 0.0460 |
| JSSODa test | 400 | 0.0495 | 0.0061 |
The ground truth comes from the PDF text layer. A pixel-level audit (no model outputs used) first found that 5.6% of lines did not match their crop — mostly table rules, shaded boxes and neighbouring-line bleed inside the crop, plus footnote marks (※5, *23) present in the image but missing from the text. The audit failed its own pre-set threshold, so the first evaluation was declared inconclusive.
The repair was rule-based and blind to model names and predictions: recover glyphs the font's ToUnicode map dropped (2 lines), merge short footnote marks that sit on the same line (27), and redact vector decoration or neighbouring glyph pixels outside the line's own characters (90; a guard aborts the edit if a real glyph would be removed). Only characters actually present in the image enter the ground truth. No line was removed or replaced; the 2,000 lines and the source mix are unchanged; 2 lines whose text is covered by later fills were kept with their original label and counted as audit failures.
| Audit (same thresholds) | Before | After |
|---|---|---|
| Lines passing | 0.944 | 0.979 (pass threshold 0.95) |
| Worst source | 0.871 | 0.943 (threshold 0.90) |
| Failing lines | 112 | 42 = 40 extra-ink + 2 covered-text (no overlap) |
Repair changed 93 images and 29 ground-truth strings; 43 candidate image edits were aborted by the guard and left as they were. Effect on scores (repaired vs original ground truth; changed images re-run through each model): CER base −0.0002, ours −0.0017, sibling B +0.0005, every CI includes 0. Digit F1 rose by about +0.003 for all three models (CIs exclude 0), so the repair moved digit F1 equally and did not change the comparisons.
modern_ja normalization is a workaround, not a fix. It is off by default. Measured
separately on the same evaluation set (report-only, not part of the registered result): see §5. Because
the two mappings were chosen after seeing errors on this set, that measurement is optimistic and does not
show the regression is solved on other documents.rot_ccw90). The model has no orientation detector.modern_ja applied to our predictions only, base and sibling B left raw, same set and bootstrap:
| CER | Δ vs base [95% CI] | |
|---|---|---|
| ThakiOCR-JA-v1, raw (registered result) | 0.0094 | −0.0024 [−0.0060, +0.0008] |
ThakiOCR-JA-v1 + modern_ja |
0.0075 | −0.0043 [−0.0077, −0.0015] |
Ageing-society source with modern_ja: CER 0.0035 vs base 0.0042, Δ −0.0008 [−0.0040, +0.0022]. 189 of 2,000
predicted lines change. Digit F1 is unchanged (0.9973). If the same mapping is also applied to the base and
sibling B outputs, the base CER becomes 0.0115 and the overall Δ is −0.0040 [−0.0073, −0.0013].
This is a post-hoc measurement on the same set that revealed the substitutions, so it is optimistic. It is not a registered result, it does not replace §2, and it does not show the regression is solved on other documents.
llm-jp/JSSODa, revision cbe246e8, CC BY 4.0; arXiv:2511.15059).| Base | PaddlePaddle/PaddleOCR-VL-1.6 @ 132c45f52c0a26ed5a6b2f6bd8e3985794cc27dd |
| Adapter (merged) | LoRA r 16, α 32, 290 modules, step 600, sha256 e17c8f0cdeb2df562337d14bb5875f99e241e11b902c7d570e6ef451ef7688fe |
model.safetensors |
1,917,255,968 bytes, sha256 5927af2cce698f7ef8fb12d09302357beaf61835c852f55b3f78759018fc5d8c |
| Engine | vLLM 0.28.0, greedy, prompt OCR:, max tokens 256 (line) / 4096 (page), max pixels 1280·28·28 |
| Package check | this merged package reproduced the pre-packaging predictions on a 1,500-line set in both orientations (row match 1.000, ΔCER 0) |
THAKI_MANIFEST.json lists every file's sha256. Files other than model.safetensors, README.md,
MODEL_CARD.ko.md, inference.py, NOTICE and THAKI_MANIFEST.json are the base model's files unchanged.
Apache-2.0, the same as the base model. See LICENSE and NOTICE (changes from the base model and data
attribution).