nrl-ai/vn-diacritic-vit5-base — Vietnamese diacritic restoration (ViT5 fine-tune)
0
9 commits
2 repos using this model
1 linked in READMEs
updated Aug 16, 2026
Restores diacritics on Vietnamese text written without them
(Toi yeu Viet Nam → Tôi yêu Việt Nam). Fine-tuned from
VietAI/vit5-base on a register-balanced mix of Vietnamese Wikipedia (CC-BY-SA-4.0) and Vietnamese news (tmnam20/Vietnamese-News-dedup, CC-BY-4.0, NFC-normalized).
Adoption gate: ✅ passed.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("nrl-ai/vn-diacritic-vit5-base")
model = AutoModelForSeq2SeqLM.from_pretrained("nrl-ai/vn-diacritic-vit5-base").eval()
text = "Toi yeu Viet Nam"
out = model.generate(**tok(text, return_tensors="pt"), max_length=256)
print(tok.decode(out[0], skip_special_tokens=True))
# Tôi yêu Việt Nam
For the full pipeline (with rule-based + LLM fallbacks), use the
nom-vn Python package:
from nom.text.diacritic_models import HFDiacriticModel
restorer = HFDiacriticModel(model_id="nrl-ai/vn-diacritic-vit5-base")
restorer("Toi yeu Viet Nam") # 'Tôi yêu Việt Nam'
Measured against Toshiiiii1/Vietnamese_diacritics_restoration_5th
(public SOTA at the time of training). Word accuracy after Unicode NFC
| Register | Sents | Word acc | Δ vs Toshiiiii1 | Mean ms/sent |
|---|---|---|---|---|
| Formal / legal-prose (UDHR, public domain) | 72 | 99.52 % | +1.38 pp | 273 |
| Modern business / contracts / news (CC0) | 55 | 96.14 % | -1.67 pp | 146 |
| Conversational (Tatoeba, CC-BY 2.0 FR) | 300 | 94.16 % | +0.22 pp | 102 |
| Classical literary (UD-VTB, CC-BY-SA-4.0) | 800 | 89.97 % | +0.57 pp | 157 |
Each eval corpus is open-license and reproducible from the
nom-vn repo:
benchmarks/data/diacritic_eval_v0.txt (CC0)benchmarks/data/ud_vi_vtb/test.conllu (CC-BY-SA-4.0)benchmarks/data/tatoeba_vi/diacritic_eval_300.txt (CC-BY 2.0 FR)benchmarks/data/udhr_vi/diacritic_eval_udhr.txt (public domain)Where this model sits in the public Vietnamese diacritic-restoration landscape — same 4-register grid for every measured row. Bold = best in column. Cells marked "—" weren't run on that register.
| Model | Family | Params | License | formal_72 | business_55 | conv_300 | literary_800 |
|---|---|---|---|---|---|---|---|
Toshiiiii1/...5th | public | 200 M | Apache 2.0 | 98.14 | 97.81 | 93.94 | 89.40 |
this → nrl-ai/vn-diacritic-vit5-base | ours | 220 M | Apache 2.0 | 99.52 | 96.14 | 94.16 | 89.97 |
nrl-ai/vn-diacritic-small | ours | 115 M | Apache 2.0 | 91.51 | 94.44 | 90.68 | 86.33 |
qthuan2604/ViT5_Restore_Diacritics_Vietnamese | public | 220 M | MIT | — | 90.59 | — | — |
qthuan2604/BARTPho_Syllable_Restore_Diacritics_Vietnamese | public | 115 M | MIT | — | 83.92 | — | — |
| OpenAI gpt-4o-mini (cloud) | external | proprietary | proprietary | — | 95.37 | — | — |
rule-based (nom.text.fix_diacritics) | ours | 0 | Apache 2.0 | — | 41.06 | — | — |
VietAI/vit5-base (MIT license)tmnam20/Vietnamese-News-dedup, CC-BY-4.0, NFC-normalized).
Eval-leak guarded against the held-out nrl-ai/vn-diacritic-eval slices.cosine schedule, 500 warmup stepseval_lossHung → Hùng / Hưng / Hứng). The model picks
the most-likely-in-training, which may not match a specific person's name.This fine-tune is released under Apache 2.0.
Base model: VietAI/vit5-base by VietAI, MIT
license. Cite both this fine-tune and the base model:
@misc{vit5_2022,
title={ViT5: Pretrained Text-to-Text Transformer for Vietnamese Language Generation},
author={Long Phan and Hieu Tran and Hieu Nguyen and Trieu H. Trinh},
year={2022},
note={NAACL-SRW}
}
@misc{nom_vn_diacritic_2026,
title={Vietnamese Diacritic Restoration — register-balanced ViT5 fine-tune},
author={Nguyen, Viet-Anh and {Neural Research Lab}},
year={2026},
howpublished={\url{https://huggingface.co/nrl-ai/vn-diacritic-vit5-base}}
}
Training corpus license: CC-BY-SA-4.0 (Wikipedia). Output text from this model is therefore best treated as CC-BY-SA-4.0 if you want to be safe about derivative-rights propagation, even though the model weights themselves are Apache 2.0.
nrl-ai/vn-diacritic-vit5-base — Vietnamese diacritic restoration (ViT5 fine-tune)
0
9 commits
2 repos using this model
1 linked in READMEs
updated Aug 16, 2026
Restores diacritics on Vietnamese text written without them
(Toi yeu Viet Nam → Tôi yêu Việt Nam). Fine-tuned from
VietAI/vit5-base on a register-balanced mix of Vietnamese Wikipedia (CC-BY-SA-4.0) and Vietnamese news (tmnam20/Vietnamese-News-dedup, CC-BY-4.0, NFC-normalized).
Adoption gate: ✅ passed.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tok = AutoTokenizer.from_pretrained("nrl-ai/vn-diacritic-vit5-base")
model = AutoModelForSeq2SeqLM.from_pretrained("nrl-ai/vn-diacritic-vit5-base").eval()
text = "Toi yeu Viet Nam"
out = model.generate(**tok(text, return_tensors="pt"), max_length=256)
print(tok.decode(out[0], skip_special_tokens=True))
# Tôi yêu Việt Nam
For the full pipeline (with rule-based + LLM fallbacks), use the
nom-vn Python package:
from nom.text.diacritic_models import HFDiacriticModel
restorer = HFDiacriticModel(model_id="nrl-ai/vn-diacritic-vit5-base")
restorer("Toi yeu Viet Nam") # 'Tôi yêu Việt Nam'
Measured against Toshiiiii1/Vietnamese_diacritics_restoration_5th
(public SOTA at the time of training). Word accuracy after Unicode NFC
| Register | Sents | Word acc | Δ vs Toshiiiii1 | Mean ms/sent |
|---|---|---|---|---|
| Formal / legal-prose (UDHR, public domain) | 72 | 99.52 % | +1.38 pp | 273 |
| Modern business / contracts / news (CC0) | 55 | 96.14 % | -1.67 pp | 146 |
| Conversational (Tatoeba, CC-BY 2.0 FR) | 300 | 94.16 % | +0.22 pp | 102 |
| Classical literary (UD-VTB, CC-BY-SA-4.0) | 800 | 89.97 % | +0.57 pp | 157 |
Each eval corpus is open-license and reproducible from the
nom-vn repo:
benchmarks/data/diacritic_eval_v0.txt (CC0)benchmarks/data/ud_vi_vtb/test.conllu (CC-BY-SA-4.0)benchmarks/data/tatoeba_vi/diacritic_eval_300.txt (CC-BY 2.0 FR)benchmarks/data/udhr_vi/diacritic_eval_udhr.txt (public domain)Where this model sits in the public Vietnamese diacritic-restoration landscape — same 4-register grid for every measured row. Bold = best in column. Cells marked "—" weren't run on that register.
| Model | Family | Params | License | formal_72 | business_55 | conv_300 | literary_800 |
|---|---|---|---|---|---|---|---|
Toshiiiii1/...5th | public | 200 M | Apache 2.0 | 98.14 | 97.81 | 93.94 | 89.40 |
this → nrl-ai/vn-diacritic-vit5-base | ours | 220 M | Apache 2.0 | 99.52 | 96.14 | 94.16 | 89.97 |
nrl-ai/vn-diacritic-small | ours | 115 M | Apache 2.0 | 91.51 | 94.44 | 90.68 | 86.33 |
qthuan2604/ViT5_Restore_Diacritics_Vietnamese | public | 220 M | MIT | — | 90.59 | — | — |
qthuan2604/BARTPho_Syllable_Restore_Diacritics_Vietnamese | public | 115 M | MIT | — | 83.92 | — | — |
| OpenAI gpt-4o-mini (cloud) | external | proprietary | proprietary | — | 95.37 | — | — |
rule-based (nom.text.fix_diacritics) | ours | 0 | Apache 2.0 | — | 41.06 | — | — |
VietAI/vit5-base (MIT license)tmnam20/Vietnamese-News-dedup, CC-BY-4.0, NFC-normalized).
Eval-leak guarded against the held-out nrl-ai/vn-diacritic-eval slices.cosine schedule, 500 warmup stepseval_lossHung → Hùng / Hưng / Hứng). The model picks
the most-likely-in-training, which may not match a specific person's name.This fine-tune is released under Apache 2.0.
Base model: VietAI/vit5-base by VietAI, MIT
license. Cite both this fine-tune and the base model:
@misc{vit5_2022,
title={ViT5: Pretrained Text-to-Text Transformer for Vietnamese Language Generation},
author={Long Phan and Hieu Tran and Hieu Nguyen and Trieu H. Trinh},
year={2022},
note={NAACL-SRW}
}
@misc{nom_vn_diacritic_2026,
title={Vietnamese Diacritic Restoration — register-balanced ViT5 fine-tune},
author={Nguyen, Viet-Anh and {Neural Research Lab}},
year={2026},
howpublished={\url{https://huggingface.co/nrl-ai/vn-diacritic-vit5-base}}
}
Training corpus license: CC-BY-SA-4.0 (Wikipedia). Output text from this model is therefore best treated as CC-BY-SA-4.0 if you want to be safe about derivative-rights propagation, even though the model weights themselves are Apache 2.0.