Restores diacritics (accents, tone marks, and special characters) to text that has had them stripped, across 10 languages in a single model: Yorùbá, Igbo, Hausa, Vietnamese, Polish, Turkish, Portuguese, Spanish, French, Italian.
Fine-tuned from google/byt5-base (580M) on 7M sentences of commercially-licensed text.
python
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
23tok = AutoTokenizer.from_pretrained("olaverse/diacnet-1.1")4model = AutoModelForSeq2SeqLM.from_pretrained("olaverse/diacnet-1.1")56text ="<yor> se eranko naa si gbo o?"7inputs = tok(text, return_tensors="pt")8out = model.generate(**inputs, max_new_tokens=512)9print(tok.decode(out[0], skip_special_tokens=True))10# ṣé ẹranko náà sì gbọ́ ọ?
Prefix the input with a language tag — <yor> <ibo> <hau> <vie> <pol> <tur> <por> <spa> <fra> <ita> — or use <auto> to let the model infer the language (costs very little accuracy; see below).
python
1print(gen("<vie> Toi khong biet tieng Viet"))# Tôi không biết tiếng Việt2print(gen("<auto> El nino esta en la casa"))# El niño está en la casa3print(gen("<pol> Lodz jest piekna"))# Łódź jest piękna
Results
Evaluated on diacbench — 1,000 held-out sentences per language, sourced independently of the training corpus. Metrics: DER (diacritic error rate, errors restricted to diacritic-eligible characters), WER, CER, exact sentence match. All figures below use n=300 per language with greedy decoding.
DER by language
lang
DER
WER
CER
exact
DER with <auto>
ita
0.0002
0.10%
0.04%
99.3%
0.0008
por
0.0031
1.39%
0.23%
88.0%
0.0038
fra
0.0053
0.77%
0.18%
94.7%
0.0040
pol
0.0058
2.65%
0.33%
85.3%
0.0070
tur
0.0068
1.50%
0.35%
91.7%
0.0069
spa
0.0081
2.06%
0.35%
83.0%
0.0076
vie
0.0460
11.98%
3.06%
36.0%
0.0518
ibo
0.0508
4.78%
1.29%
41.0%
0.0720
hau
0.0593
2.53%
0.51%
59.7%
0.0439
yor
0.2006
42.18%
14.50%
0.3%
0.2117
Low exact-match on Vietnamese and Yorùbá reflects how many marks those languages carry per sentence — one slip fails the whole sentence. DER is the meaningful metric there.
Versus diacnet-1.0
lang
DER 1.0
DER 1.1
WER 1.0
WER 1.1
verdict
vie
0.1264
0.0460
21.98%
11.98%
1.1 — 2.7× better
tur
0.0447
0.0068
19.20%
1.50%
1.1 — 6.6× better
pol
0.0357
0.0058
15.12%
2.65%
1.1 — 6.2× better
ita
0.0015
0.0002
0.66%
0.10%
1.1 — 7.5× better
por
0.0072
0.0031
1.80%
1.39%
1.1 better
spa
0.0084
0.0081
2.19%
2.06%
~equal
fra
0.0038
0.0053
1.46%
0.77%
mixed
ibo
0.0359
0.0508
8.34%
4.78%
mixed
hau
0.0383
0.0593
8.58%
2.53%
mixed
yor
0.1554
0.2006
27.69%
42.18%
1.0 better
WER by language
Note that DER and WER disagree on ibo/hau/fra: v1.1 makes fewer wrong words but a higher share of diacritic-level errors within them. For Hausa the difference is stark — v1.0 got some detail wrong in almost every sentence (0% exact match), while v1.1 is perfect on 60% of sentences and worse on the rest.
v1.1 is a large improvement on 5 languages and a regression on 3. The cause is measured, not speculative: v1.0 trained on ~2,000 well-tone-marked Yorùbá passages (diacritic density 0.565), while v1.1's much larger web-sourced corpus averages density 0.223 — it contains far more Yorùbá text, but most of it omits tone marks. The model learned to omit them too. More data at lower annotation quality lost to less data at higher quality. Correcting this for yor/ibo/hau is the priority for the next release; if those three languages are your use case, diacnet-1.0 currently scores better.
Versus general-purpose LLMs
Compared against Claude Sonnet 4.5 and GPT-4o-mini on the same sentences, prompted to add diacritics without changing anything else.
Two scorings are reported, and the difference between them is the point.
strict — the model's raw output is scored as returned. An output that paraphrased or translated the sentence scores as a total failure.
fallback — outputs that altered base characters are replaced with the unchanged input before scoring, simulating a pipeline that detects failures and skips them.
For diacnet the two columns are nearly identical, because it almost always returns the input with marks added. For the LLMs they diverge sharply, and that gap is the reliability cost.
DER — strict vs fallback
system
yor
ibo
hau
vie
pol
tur
por
spa
fra
ita
copy-input (floor)
.4358
.1171
.0236
.3062
.0915
.1113
.0476
.0426
.0471
.0333
diacnet-1.0
.1554
.0359
.0383
.1264
.0357
.0447
.0072
.0084
.0038
.0015
diacnet-1.1
.2006
.0508
.0593
.0460
.0058
.0068
.0031
.0081
.0053
.0002
Claude 4.5 — strict
.3353
.2261
.3509
.0278
.0343
.0241
.0172
.0215
.1171
.0005
Claude 4.5 — fallback
.1913
.0427
.0178
.0107
.0035
.0019
.0011
.0040
.0052
.0005
GPT-4o-mini — strict
.4607
.5035
.6368
.0847
.0430
.0261
.0280
.0555
.0341
.0085
GPT-4o-mini — fallback
.2811
.1277
.1432
.0399
.0070
.0038
.0024
.0089
.0023
.0052
Scored strictly, diacnet-1.1 beats Claude on 8 of 10 languages. With fallback scoring, Claude beats diacnet-1.1 on 9 of 10. Same outputs, same benchmark — the only difference is how the rewritten sentences are counted.
Output compliance — share of outputs whose diacritic-stripped form still matches the input (i.e. marks were added, nothing else changed):
system
yor
ibo
hau
vie
pol
tur
por
spa
fra
ita
diacnet-1.1
100%
96.3%
94.7%
99.3%
100%
99.7%
100%
99.7%
99.7%
100%
diacnet-1.0
98.0%
99.0%
98.3%
96.3%
99.3%
100%
99.7%
99.7%
100%
100%
Claude 4.5
74.3%
79.3%
65.7%
97.7%
96.7%
98.0%
97.7%
98.3%
88.3%
100%
GPT-4o-mini
68.0%
57.3%
49.3%
93.7%
96.0%
94.7%
97.7%
97.3%
96.7%
99.7%
Output compliance
WER
system
yor
ibo
hau
vie
pol
tur
por
spa
fra
ita
copy-input (floor)
.8793
.3358
.0800
.8612
.4137
.4324
.2069
.1905
.1910
.1529
diacnet-1.0
.2769
.0834
.0858
.2198
.1512
.1920
.0180
.0219
.0146
.0066
diacnet-1.1
.4218
.0478
.0253
.1198
.0265
.0150
.0139
.0206
.0077
.0010
Claude 4.5
.2813
.1123
.1076
.0204
.0136
.0137
.0098
.0057
.0123
.0020
GPT-4o-mini
.4817
.3514
.7304
.0776
.0250
.0215
.0142
.0104
.0074
.0198
Reading these results honestly:
Claude Sonnet 4.5 is more accurate than diacnet-1.1 on the sentences it handles correctly. That is the fallback column, and it is the fairer measure of raw diacritization skill.
Claude fails to return usable output on a quarter to a third of low-resource sentences — 34% of Hausa, 26% of Yorùbá, 21% of Igbo were rewritten, translated or otherwise altered. GPT-4o-mini altered 51% of Hausa. diacnet stays within 94.7–100%.
On Hausa, the copy-input floor has the lowest DER of any system (.0236). Hausa carries few diacritic-eligible characters, so leaving text untouched scores well per-character while being clearly wrong per-word (floor WER 8.00% vs diacnet-1.1's 2.53%). Judge Hausa on WER, not DER.
diacnet-1.1's Hausa exact-match is 59.7% against diacnet-1.0's 0.0% — v1.0 made at least one error in every Hausa sentence; v1.1 returns 6 in 10 perfectly.
diacnet's case is reliability, zero marginal cost, determinism and offline operation — not being the most accurate system on every language. If you need maximum accuracy on a few sentences and can tolerate retries, a frontier LLM will serve you better. If you need to process a million sentences without a third of them coming back rewritten, that is what this model is for.
Training
Base
google/byt5-base (580M, byte-level)
Data
diacnet-1.1-corpus — 7.02M sentences from FineWeb-2 (ODC-By) + Wikipedia (CC BY-SA), diacritic-density filtered, NFC-normalized, deduplicated
Objective
seq2seq: <lang> stripped text → fully diacritized text
Augmentation
partial stripping (30%), character noise (7%), <auto> tag (12%), optional gloss conditioning (~6%)
Precision
bf16, max 512 bytes
Correction pass
continued training on high-density Yorùbá with 35% replay of other languages, LR 2e-5
All training data is commercially licensed. No non-commercial sources (MENYO-20k, JW300) were used.
Limitations
Yorùbá under-marks tone. The dominant error class is dropped acute/grave marks (ó→o, tí→ti, rẹ̀→rẹ), inherited from under-marked training data. Yorùbá output should not be treated as publication-ready without review.
Some errors are irreducible. Stripping diacritics is lossy. Viaggiò/Viaggio (Italian, 3rd-person past vs 1st-person present) are both valid readings of Viaggio — no model or human can recover the distinction from the stripped text alone. Expect a nonzero floor on every language.
Proper nouns are unreliable. Personal and place names carry marks that context cannot determine (Àlàmú vs Àlámù), and foreign names are sometimes over-nativized (Vietnamese Tom→Tôm).
Gloss conditioning is implemented but unproven. The model accepts an optional [g: word=meaning] hint block; measured effect on diacbench was neutral to slightly negative, so it is documented rather than recommended.
No structural guarantee. Being a seq2seq model, it can alter base characters rather than only adding marks. Measured compliance on diacbench is 94.7–100% depending on language (lowest on Hausa and Igbo), so constrained decoding is advisable for high-stakes pipelines.
Register bias. Trained on web and encyclopedic text; performance on conversational, poetic, or heavily code-switched text is untested.
Benchmark itself contains a small number of defective reference sentences (~1%), which caps measured scores slightly below true performance.
Intended use
Restoring diacritics in scraped or user-typed text, cleaning corpora for downstream NLP, and assisting typing in languages where diacritics are commonly omitted. Best used with human review for Yorùbá, and for any application where a wrong tone mark changes meaning.
Not intended for: text generation, translation, spelling correction, or as a general language model.