Algimantas/kirtis-v2
XLM-RoBERTa-large token classifier for Lithuanian accentuation (kirčiavimas): for every word it predicts the stressed syllable and its accent mark (37 classes). Fine-tuned from kristijonas/banano-kirtis-v2 as part of the Algiras/kirtis toolkit.
Training
- Base checkpoint:
kristijonas/banano-kirtis-v2(CC-BY-4.0). 100.8M of 558.9M parameters were trained; the lower layers stayed frozen. - Sentences: 35,986 deduplicated sentences from rows below 98,000 of
meldynamics/lt-stressed-corpus, 1,057 of them converted to ALL-CAPS; 1,500 dev sentences from rows 98,000 to 99,999. The stress layer of that corpus was produced automatically and is not hand-verified. 302 of 414,195 stressed words were left out because their marks could not be mapped to a legal label. - Isolated words: 12,000 extra examples holding 143,684 isolated word forms, sampled from 306,197 forms for which the kirtis lexicon has exactly one stress pattern. The form inventory comes from Assessment Data of the Dictionary of Modern Lithuanian versus Joint Corpora (V. Dadurkevičius, CLARIN-LT, hdl 20.500.11821/36, CC BY 4.0), which has no stress marks; the stress labels are the lexicon's. Five percent of lemmas were held out of this word list, with all their forms, as a word dev set; those forms can still occur in the training sentences (see below).
- Schedule: 3,000 steps over 2 epochs; the checkpoint kept is the one at step 3,000, chosen on the mean of sentence-dev and word-dev token accuracy.
| Checkpoint | Sentence dev tokens | Sentence dev sentences | ECE | Word dev (lemmas held out of the word list) |
|---|---|---|---|---|
kristijonas/banano-kirtis-v2 before training |
17,033/17,220 (98.91%) |
1,324/1,500 (88.27%) |
0.0097 | 4,324/4,795 (90.18%) |
| Kept checkpoint (step 3,000) | 17,183/17,220 (99.79%) |
1,465/1,500 (97.67%) |
0.0018 | 4,419/4,795 (92.16%) |
The word dev set is not unseen vocabulary. It is held out of the word list only: 3,539 of its 15,707 forms (22.5%) also occur in the 36,000 training sentences, and their stress labels come from a lexicon built largely from the same corpus. Of the 4,800 forms scored, 1,080 occur in those sentences.
Scored separately (standalone argmax, 12 isolated words per input; this count includes a few words the training script's own dev metric leaves out):
| System | All scored forms | Forms that occur in the training sentences | Forms that do not |
|---|---|---|---|
| Banano-kirtis-v2 | 4,324/4,800 (90.08%) |
1,048/1,080 (97.04%) |
3,276/3,720 (88.06%) |
| kirtis-v1 | 4,307/4,800 (89.73%) |
1,053/1,080 (97.50%) |
3,254/3,720 (87.47%) |
| kirtis-v2 | 4,419/4,800 (92.06%) |
1,055/1,080 (97.69%) |
3,364/3,720 (90.43%) |
Rows from 100,000 on (Suite 2 below) and the hand-stressed reference (Suite 3) were not used for training or for choosing the checkpoint.
Training script: training/train_kirtis_v1.py.
Measurements
All systems in a table were run on the same tokens in one pass of benchmarks/runner.py. Intervals are Wilson 95% intervals; paired comparisons use the exact McNemar test and a sentence-cluster bootstrap, and their p-values are not adjusted for the number of comparisons. kirtis Ensemble is the toolkit's lexicon + two-model fusion; the name in brackets is the backbone it uses.
Agreement with the corpus stress layer (Suite 2)
7,138 sentences / 80,222 word tokens from 5 documents: every eligible row from 100,000 on of meldynamics/lt-stressed-corpus. The reference is that corpus's automatic stress layer, the same kind of labels the model was trained on, so this measures how well the model reproduces that annotation on unseen documents of one genre (parliamentary transcripts). It is agreement, not accuracy.
| System | Token agreement | 95% CI | Errors | Whole sentences | 95% CI | ECE |
|---|---|---|---|---|---|---|
| Lexicon-Only | 78,058/80,222 (97.30%) |
97.19–97.41 | 2,164 | 5,406/7,138 (75.74%) |
74.73–76.72 | 0.0514 |
| LitLat-BERT ONNX | 71,788/80,222 (89.49%) |
89.27–89.70 | 8,434 | 2,609/7,138 (36.55%) |
35.44–37.67 | 0.0701 |
| Banano-kirtis-v2 | 78,628/80,222 (98.01%) |
97.91–98.11 | 1,594 | 5,740/7,138 (80.41%) |
79.48–81.32 | 0.0169 |
| kirtis-v1 (standalone) | 79,909/80,222 (99.61%) |
99.56–99.65 | 313 | 6,840/7,138 (95.83%) |
95.34–96.27 | 0.0020 |
| kirtis-v2 (standalone) | 79,909/80,222 (99.61%) |
99.56–99.65 | 313 | 6,838/7,138 (95.80%) |
95.31–96.24 | 0.0019 |
| kirtis Ensemble | 79,882/80,222 (99.58%) |
99.53–99.62 | 340 | 6,814/7,138 (95.46%) |
94.95–95.92 | 0.0061 |
| kirtis Ensemble (kirtis-v1) | 79,949/80,222 (99.66%) |
99.62–99.70 | 273 | 6,872/7,138 (96.27%) |
95.81–96.69 | 0.0045 |
| kirtis Ensemble (kirtis-v2) | 79,947/80,222 (99.66%) |
99.61–99.70 | 275 | 6,869/7,138 (96.23%) |
95.76–96.65 | 0.0044 |
By token class and lexicon stratum (agreement %, count in the header):
| System | Regular words (79,031) | ALL-CAPS (87) | Unmarked (1,104) | Homographs (6,650) | Not in lexicon (2,500) |
|---|---|---|---|---|---|
| Lexicon-Only | 97.38 | 88.51 | 92.66 | 88.71 | 51.92 |
| LitLat-BERT ONNX | 89.80 | 0.00 | 74.18 | 85.85 | 73.56 |
| Banano-kirtis-v2 | 98.10 | 0.00 | 99.55 | 99.55 | 93.12 |
| kirtis-v1 (standalone) | 99.72 | 0.00 | 99.55 | 99.62 | 93.36 |
| kirtis-v2 (standalone) | 99.72 | 0.00 | 99.46 | 99.59 | 93.48 |
| kirtis Ensemble | 99.64 | 93.10 | 95.83 | 99.43 | 93.56 |
| kirtis Ensemble (kirtis-v1) | 99.72 | 95.40 | 95.74 | 99.44 | 93.72 |
| kirtis Ensemble (kirtis-v2) | 99.72 | 94.25 | 95.83 | 99.47 | 93.96 |
Paired comparisons (difference = first minus second):
| System | Versus | Only the first is right | Only the second is right | Difference (pp) | 95% CI (pp) | McNemar p |
|---|---|---|---|---|---|---|
| kirtis-v2 (standalone) | kirtis-v1 (standalone) | 19 | 19 | +0.00 | -0.01 to +0.02 | 1.000 |
| kirtis Ensemble (kirtis-v2) | Banano-kirtis-v2 | 1,418 | 99 | +1.64 | +1.55 to +1.74 | 2e-299 |
| kirtis Ensemble (kirtis-v2) | kirtis-v1 (standalone) | 135 | 97 | +0.05 | +0.01 to +0.09 | 0.015 |
| kirtis Ensemble (kirtis-v2) | kirtis-v2 (standalone) | 123 | 85 | +0.05 | +0.01 to +0.08 | 0.010 |
| kirtis Ensemble (kirtis-v2) | kirtis Ensemble | 100 | 35 | +0.08 | +0.05 to +0.11 | 2e-8 |
| kirtis Ensemble (kirtis-v2) | kirtis Ensemble (kirtis-v1) | 21 | 23 | -0.00 | -0.02 to +0.01 | 0.880 |
Accuracy against hand-placed stress (Suite 3)
3,619 sentences / 42,793 word tokens of fiction and poetry from Kirčiuotų tekstų chrestomatija. Lietuvių poezija ir proza (ed. Vidas Kavaliauskas, 2014), stressed by hand. The text is all rights reserved and is not redistributed; it is used for evaluation only. Its vocabulary and genre differ from the training corpus, and 4,056 of its tokens are absent from the kirtis lexicon.
| System | Token accuracy | 95% CI | Errors | Whole sentences | 95% CI | Right letter, any mark | ECE |
|---|---|---|---|---|---|---|---|
| Lexicon-Only | 39,111/42,793 (91.40%) |
91.13–91.66 | 3,682 | 1,649/3,619 (45.57%) |
43.95–47.19 | 92.97% | 0.0732 |
| LitLat-BERT ONNX | 38,939/42,793 (90.99%) |
90.72–91.26 | 3,854 | 1,576/3,619 (43.55%) |
41.94–45.17 | 92.55% | 0.0396 |
| Banano-kirtis-v2 | 41,492/42,793 (96.96%) |
96.79–97.12 | 1,301 | 2,652/3,619 (73.28%) |
71.81–74.70 | 97.28% | 0.0246 |
| kirtis-v1 (standalone) | 41,521/42,793 (97.03%) |
96.86–97.18 | 1,272 | 2,658/3,619 (73.45%) |
71.98–74.86 | 97.33% | 0.0194 |
| kirtis-v2 (standalone) | 41,555/42,793 (97.11%) |
96.94–97.26 | 1,238 | 2,672/3,619 (73.83%) |
72.38–75.24 | 97.41% | 0.0174 |
| kirtis Ensemble | 41,642/42,793 (97.31%) |
97.15–97.46 | 1,151 | 2,739/3,619 (75.68%) |
74.26–77.05 | 97.60% | 0.0217 |
| kirtis Ensemble (kirtis-v1) | 41,656/42,793 (97.34%) |
97.19–97.49 | 1,137 | 2,745/3,619 (75.85%) |
74.43–77.22 | 97.59% | 0.0172 |
| kirtis Ensemble (kirtis-v2) | 41,679/42,793 (97.40%) |
97.24–97.54 | 1,114 | 2,759/3,619 (76.24%) |
74.82–77.59 | 97.65% | 0.0158 |
By token class and lexicon stratum (accuracy %, count in the header):
| System | Regular words (42,733) | ALL-CAPS (5) | Unmarked (55) | Homographs (2,992) | Not in lexicon (4,056) |
|---|---|---|---|---|---|
| Lexicon-Only | 91.47 | 80.00 | 30.91 | 79.91 | 31.90 |
| LitLat-BERT ONNX | 91.08 | 0.00 | 34.55 | 81.95 | 69.13 |
| Banano-kirtis-v2 | 97.02 | 0.00 | 58.18 | 92.41 | 85.70 |
| kirtis-v1 (standalone) | 97.10 | 0.00 | 52.73 | 92.38 | 85.77 |
| kirtis-v2 (standalone) | 97.18 | 0.00 | 50.91 | 92.05 | 86.42 |
| kirtis Ensemble | 97.37 | 100.00 | 49.09 | 92.65 | 86.00 |
| kirtis Ensemble (kirtis-v1) | 97.41 | 100.00 | 45.45 | 92.91 | 86.34 |
| kirtis Ensemble (kirtis-v2) | 97.47 | 100.00 | 41.82 | 92.88 | 86.74 |
Paired comparisons (difference = first minus second):
| System | Versus | Only the first is right | Only the second is right | Difference (pp) | 95% CI (pp) | McNemar p |
|---|---|---|---|---|---|---|
| kirtis Ensemble (kirtis-v2) | Banano-kirtis-v2 | 399 | 212 | +0.44 | +0.32 to +0.55 | 3e-14 |
| kirtis Ensemble (kirtis-v2) | kirtis-v1 (standalone) | 283 | 125 | +0.37 | +0.28 to +0.47 | 3e-15 |
| kirtis Ensemble (kirtis-v2) | kirtis-v2 (standalone) | 209 | 85 | +0.29 | +0.21 to +0.37 | 3e-13 |
| kirtis Ensemble (kirtis-v2) | kirtis Ensemble | 214 | 177 | +0.09 | -0.01 to +0.18 | 0.069 |
| kirtis Ensemble (kirtis-v2) | kirtis Ensemble (kirtis-v1) | 117 | 94 | +0.05 | -0.02 to +0.12 | 0.130 |
| kirtis Ensemble (kirtis-v1) | kirtis-v2 (standalone) | 224 | 123 | +0.24 | +0.15 to +0.33 | 6e-8 |
| kirtis Ensemble | kirtis-v2 (standalone) | 265 | 178 | +0.20 | +0.11 to +0.30 | 4e-5 |
| kirtis-v2 (standalone) | Banano-kirtis-v2 | 255 | 192 | +0.15 | +0.04 to +0.24 | 0.003 |
| kirtis-v2 (standalone) | kirtis-v1 (standalone) | 136 | 102 | +0.08 | +0.01 to +0.15 | 0.032 |
Curated regression suites
Small hand-written suites from Algimantas/kirtis-benchmarks. They were written while developing the ensemble's rules, so they are regression checks, not an estimate of accuracy on new text.
| System | Suite 1 tokens | 95% CI | Suite 1 sentences | Suite 1 pairs | Suite 5 pairs | 95% CI | Suite 5 tokens |
|---|---|---|---|---|---|---|---|
| Lexicon-Only | 189/204 |
88.2–95.5 | 7/15 |
0/13 |
2/29 |
1.9–22.0 | 49/50 |
| LitLat-BERT ONNX | 192/204 |
90.0–96.6 | 6/15 |
10/13 |
11/29 |
22.7–56.0 | 47/50 |
| Banano-kirtis-v2 | 203/204 |
97.3–99.9 | 14/15 |
10/13 |
28/29 |
82.8–99.4 | 49/50 |
| kirtis-v1 (standalone) | 201/204 |
95.8–99.5 | 13/15 |
10/13 |
28/29 |
82.8–99.4 | 49/50 |
| kirtis-v2 (standalone) | 201/204 |
95.8–99.5 | 13/15 |
10/13 |
28/29 |
82.8–99.4 | 49/50 |
| kirtis Ensemble | 204/204 |
98.2–100.0 | 15/15 |
13/13 |
29/29 |
88.3–100.0 | 49/50 |
| kirtis Ensemble (kirtis-v1) | 203/204 |
97.3–99.9 | 14/15 |
13/13 |
29/29 |
88.3–100.0 | 49/50 |
| kirtis Ensemble (kirtis-v2) | 203/204 |
97.3–99.9 | 14/15 |
13/13 |
29/29 |
88.3–100.0 | 49/50 |
kirtis Ensemble — Suite 4 invariants: all pass; Suite 6 hard tokens
59/61(95% CI 88.8–99.1), watchlist checks: pass; misses:iškelta→iškeltà,šventajai→šveñtajaikirtis Ensemble (kirtis-v1) — Suite 4 invariants: all pass; Suite 6 hard tokens
58/61(95% CI 86.5–98.3), watchlist checks: pass; misses:iškelta→iškeltà,minčių→mìnčių,šventajai→šveñtajaikirtis Ensemble (kirtis-v2) — Suite 4 invariants: all pass; Suite 6 hard tokens
58/61(95% CI 86.5–98.3), watchlist checks: pass; misses:iškelta→iškeltà,minčių→mìnčių,šventajai→šveñtajai
What these numbers do not show
- Suite 2 cannot tell a model error from a reference error, and covers one genre.
- Suite 3 is one anthology of fiction and poetry. Of this model's 1,238 standalone errors there, 551 are on words absent from the kirtis lexicon and 238 on lexicon homographs.
- Speed is not reported: the benchmark reuses cached model outputs between systems, so its timings are not comparable.
Usage
With kirtis, standalone or as the backbone of the ensemble:
from kirtis import KirtisEngine
from kirtis.backends import BananoBackend
backend = BananoBackend(model_id="Algimantas/kirtis-v2")
preds = backend.predict_tokens(["Trečias", "namo", "aukštas", "švietė", "."])
engine = KirtisEngine(banano_model="Algimantas/kirtis-v2")
print(engine.accentuate("Trečias namo aukštas švietė šiltai.").text)
With transformers:
import torch
from transformers import AutoModelForTokenClassification, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Algimantas/kirtis-v2")
model = AutoModelForTokenClassification.from_pretrained("Algimantas/kirtis-v2").eval()
words = ["Trečias", "namo", "aukštas", "švietė", "šiltai", "."]
enc = tokenizer([words], is_split_into_words=True, return_tensors="pt")
with torch.no_grad():
logits = model(**enc).logits[0]
# 37 classes: 0 = no stress mark; 1..36 = 1 + syllable_index * 3 + accent_index,
# accent_index 0 = grave (short), 1 = acute, 2 = tilde.
License and acknowledgements
Derived from kristijonas/banano-kirtis-v2 (CC-BY-4.0) and meldynamics/lt-stressed-corpus (CC-BY-4.0); released under CC-BY-4.0. Sources of the kirtis lexicon and the word-form inventory are listed in DATA_LICENSES.md. The kirtis code is MIT-licensed.
- Downloads last month
- -
Model tree for Algimantas/kirtis-v2
Base model
FacebookAI/xlm-roberta-large