Kashubian - Wikilangs Models
Comprehensive Research Report & Full Ablation Study
This repository contains NLP models trained and evaluated by Wikilangs, specifically on Kashubian Wikipedia data. We analyze tokenizers, n-gram models, Markov chains, vocabulary statistics, and word embeddings.
π Repository Contents
Models & Assets
- Tokenizers (8k, 16k, 32k, 64k)
- N-gram models (2, 3, 4, 5-gram)
- Markov chains (context of 1, 2, 3, 4 and 5)
- Subword N-gram and Markov chains
- Embeddings in various sizes and dimensions (aligned and unaligned)
- Language Vocabulary
- Language Statistics
Analysis and Evaluation
- 1. Tokenizer Evaluation
- 2. N-gram Model Evaluation
- 3. Markov Chain Evaluation
- 4. Vocabulary Analysis
- 5. Word Embeddings Evaluation
- 6. Morphological Analysis (Experimental)
- 7. Summary & Recommendations
- Metrics Glossary
- Visualizations Index
1. Tokenizer Evaluation
Results
| Vocab Size | Compression | Avg Token Len | UNK Rate | Total Tokens |
|---|---|---|---|---|
| 8k | 3.576x | 3.58 | 0.1685% | 179,827 |
| 16k | 3.912x | 3.92 | 0.1843% | 164,376 |
| 32k | 4.229x | 4.24 | 0.1993% | 152,042 |
| 64k | 4.520x π | 4.53 | 0.2130% | 142,258 |
Tokenization Examples
Below are sample sentences tokenized with each vocabulary size:
Sample 1: MΓ²rzebΓ³b abΓ² lΓ«sy Γ²gΓ³n (Lycopodium clavatum L.) - to je wielelatnΓ΄ roscΓ«na z rod...
| Vocab | Tokens | Count |
|---|---|---|
| 8k | βmΓ²rze b Γ³b βabΓ² βlΓ« sy βΓ²gΓ³n β( ly co ... (+29 more) |
39 |
| 16k | βmΓ²rze b Γ³b βabΓ² βlΓ« sy βΓ²gΓ³n β( ly copo ... (+26 more) |
36 |
| 32k | βmΓ²rze b Γ³b βabΓ² βlΓ« sy βΓ²gΓ³n β( lycopo dium ... (+22 more) |
32 |
| 64k | βmΓ²rze b Γ³b βabΓ² βlΓ« sy βΓ²gΓ³n β( lycopodium βcla ... (+21 more) |
31 |
Sample 2: NiemieckΓ΄ Karznica (pΓ²l. Karzniczka) - to je wies w pΓ²mΓ²rsczim wΓ²jewΓ³dztwie, w s...
| Vocab | Tokens | Count |
|---|---|---|
| 8k | βniemie ckΓ΄ βka rz nica β( pΓ²l . βka rz ... (+19 more) |
29 |
| 16k | βniemieckΓ΄ βkarz nica β( pΓ²l . βkarz niczka ) β- ... (+16 more) |
26 |
| 32k | βniemieckΓ΄ βkarznica β( pΓ²l . βkarz niczka ) β- βto ... (+15 more) |
25 |
| 64k | βniemieckΓ΄ βkarznica β( pΓ²l . βkarzniczka ) β- βto βje ... (+14 more) |
24 |
Sample 3: WΓ«darzenia PΓ²lsczi krΓ³l WΕadisΕΓ΄w I Herman wΓ«dΓ΄Ε rozkΓ΄z spΓ΄leniΓ΄ gardΓ³w w GduΕsc...
| Vocab | Tokens | Count |
|---|---|---|
| 8k | βwΓ«darzenia βpΓ²lsczi βkrΓ³l βwΕadisΕΓ΄w βi βher man βwΓ«dΓ΄Ε βroz kΓ΄z ... (+6 more) |
16 |
| 16k | βwΓ«darzenia βpΓ²lsczi βkrΓ³l βwΕadisΕΓ΄w βi βher man βwΓ«dΓ΄Ε βroz kΓ΄z ... (+6 more) |
16 |
| 32k | βwΓ«darzenia βpΓ²lsczi βkrΓ³l βwΕadisΕΓ΄w βi βherman βwΓ«dΓ΄Ε βroz kΓ΄z βspΓ΄ ... (+5 more) |
15 |
| 64k | βwΓ«darzenia βpΓ²lsczi βkrΓ³l βwΕadisΕΓ΄w βi βherman βwΓ«dΓ΄Ε βrozkΓ΄z βspΓ΄leniΓ΄ βgardΓ³w ... (+3 more) |
13 |
Key Findings
- Best Compression: 64k achieves 4.520x compression
- Lowest UNK Rate: 8k with 0.1685% unknown tokens
- Trade-off: Larger vocabularies improve compression but increase model size
- Recommendation: 32k vocabulary provides optimal balance for production use
2. N-gram Model Evaluation
Results
| N-gram | Variant | Perplexity | Entropy | Unique N-grams | Top-100 Coverage | Top-1000 Coverage |
|---|---|---|---|---|---|---|
| 2-gram | Word | 1,947 | 10.93 | 6,180 | 31.4% | 68.7% |
| 2-gram | Subword | 457 π | 8.84 | 2,749 | 53.5% | 98.1% |
| 3-gram | Word | 2,094 | 11.03 | 7,716 | 31.5% | 69.0% |
| 3-gram | Subword | 3,953 | 11.95 | 22,499 | 18.9% | 58.2% |
| 4-gram | Word | 3,732 | 11.87 | 15,312 | 28.0% | 59.5% |
| 4-gram | Subword | 18,873 | 14.20 | 102,765 | 10.0% | 33.1% |
| 5-gram | Word | 3,059 | 11.58 | 12,171 | 29.4% | 62.6% |
| 5-gram | Subword | 46,114 | 15.49 | 210,801 | 7.4% | 25.0% |
Top 5 N-grams by Size
2-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | to je |
2,500 |
| 2 | bΓΉtnowΓ© lΓ«nczi |
1,440 |
| 3 | ΓΉrodzΓ«lΓ« sΓ£ |
991 |
| 4 | w gminie |
982 |
| 5 | m jin |
870 |
3-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | wΓ«darzenia ΓΉrodzΓ«lΓ« sΓ£ |
849 |
| 2 | ΓΉrodzΓ«lΓ« sΓ£ ΓΉmarlΓ« |
814 |
| 3 | w pΓ²mΓ²rsczim wΓ²jewΓ³dztwie |
642 |
| 4 | p p p |
601 |
| 5 | pΓ²mΓ²rsczim wΓ²jewΓ³dztwie w |
543 |
4-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | wΓ«darzenia ΓΉrodzΓ«lΓ« sΓ£ ΓΉmarlΓ« |
753 |
| 2 | p p p p |
566 |
| 3 | w pΓ²mΓ²rsczim wΓ²jewΓ³dztwie w |
537 |
| 4 | i jinΓ«ch sΕowiaΕsczich krajΓ³w |
489 |
| 5 | krΓ³lestwa i jinΓ«ch sΕowiaΕsczich |
489 |
5-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | p p p p p |
532 |
| 2 | pΓ²lsczΓ©gΓ² krΓ³lestwa i jinΓ«ch sΕowiaΕsczich |
489 |
| 3 | krΓ³lestwa i jinΓ«ch sΕowiaΕsczich krajΓ³w |
489 |
| 4 | sΕowΓ΄rzu pΓ²lsczΓ©gΓ² krΓ³lestwa i jinΓ«ch |
488 |
| 5 | geΓ²graficznym sΕowΓ΄rzu pΓ²lsczΓ©gΓ² krΓ³lestwa i |
487 |
2-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | c z |
39,727 |
| 2 | a _ |
38,964 |
| 3 | _ w |
38,073 |
| 4 | . _ |
33,276 |
| 5 | _ p |
32,909 |
3-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | c z i |
17,503 |
| 2 | _ w _ |
16,830 |
| 3 | s c z |
14,512 |
| 4 | _ p Γ² |
12,375 |
| 5 | n a _ |
10,995 |
4-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | s c z i |
9,919 |
| 2 | c z i _ |
8,412 |
| 3 | _ j e _ |
7,786 |
| 4 | Γ© g Γ² _ |
7,710 |
| 5 | _ n a _ |
6,352 |
5-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | _ k a s z |
5,271 |
| 2 | k a s z Γ« |
4,572 |
| 3 | a s z Γ« b |
4,569 |
| 4 | s c z i _ |
4,317 |
| 5 | z Γ© g Γ² _ |
4,004 |
Key Findings
- Best Perplexity: 2-gram (subword) with 457
- Entropy Trend: Decreases with larger n-grams (more predictable)
- Coverage: Top-1000 patterns cover ~25% of corpus
- Recommendation: 4-gram or 5-gram for best predictive performance
3. Markov Chain Evaluation
Results
| Context | Variant | Avg Entropy | Perplexity | Branching Factor | Unique Contexts | Predictability |
|---|---|---|---|---|---|---|
| 1 | Word | 0.5411 | 1.455 | 2.97 | 80,925 | 45.9% |
| 1 | Subword | 1.0139 | 2.019 | 7.32 | 979 | 0.0% |
| 2 | Word | 0.1312 | 1.095 | 1.25 | 237,972 | 86.9% |
| 2 | Subword | 0.9776 | 1.969 | 6.00 | 7,156 | 2.2% |
| 3 | Word | 0.0409 | 1.029 | 1.07 | 295,594 | 95.9% |
| 3 | Subword | 0.8837 | 1.845 | 4.13 | 42,873 | 11.6% |
| 4 | Word | 0.0202 π | 1.014 | 1.03 | 312,105 | 98.0% |
| 4 | Subword | 0.6519 | 1.571 | 2.59 | 176,892 | 34.8% |
Generated Text Samples (Word-based)
Below are text samples generated from each word-based Markov chain model:
Context Size 1:
w drΓ«dΕΌich wΓ«stΔ piwo nacygnieniΓ© i bΓΉtnowΔ z eΓΉropejsczΓ©gΓ² partnerstwa pΓ²rtΓ« to ekΓ²nomicznΓ΄ rzΓ΄dzΓ«zn...je w geΓ²graficznym sΕowΓ΄rzu pΓ²lsczΓ©gΓ² krΓ³lestwa i pierre bourdieu francΓ«sczi jΓ£zΓ«k to bΓ«Εo jich rozm...i jedzeniΓ© wedle wielΓ«nΓ« lΓ«dztwa z kaszΓ«bsczΓ©gΓ² krΓ΄jΓ²braznΓ©gΓ² parkΓΉ Γ²n bΓ©Ε wΓ«rΓ«ti Γ²n pisΓ΄Ε m jin
Context Size 2:
to je susk z rodzΓ«znΓ« swiniowatΓ«ch suidae na kaszΓ«bach ten ΕΓ«zgΓ΄cz ΕΌΓ«wi sΓ£ roscΓ«namabΓΉtnowΓ© lΓ«nczi picus viridis to je roscΓ«na z rodzΓ«znΓ« cyperaceae Γ²n rosce m jin w gardze dΓ©rowaΕëùrodzΓ«lΓ« sΓ£ ΓΉmarlΓ« gregΓ²riaΕsczi kalΓ£dΓ΄rz zaczΔ Ε bΓ«c ΓΉΕΌiwΓ³ny dopiΓ©rze w na zΓ΄czΔ tkΓΉ leno w niechtΓ«rn...
Context Size 3:
wΓ«darzenia ΓΉrodzΓ«lΓ« sΓ£ ΓΉmarlΓ« przΓ«sΕowia barbara swiΓ£tΓ΄ Γ² rΓ«bΓ΄kach pamiΓ£tΓ΄ jak na barbarΓ£ mrΓ³z schΓ²w...ΓΉrodzΓ«lΓ« sΓ£ ΓΉmarlΓ« augΓΉstin dominik chtΓ«ren napisΓ΄Ε m jin ΕΌe kaszΓ«bi cassubiorum gΓ΄dajΔ pΓ² wandalskΓΉ...w pΓ²mΓ²rsczim wΓ²jewΓ³dztwie w bΓ«towsczim krΓ©zu w pΓ²mΓ²rsczim wΓ²jewΓ³dztwie tu je paΕac a w nim klΓ΄sztΓ³r ...
Context Size 4:
wΓ«darzenia ΓΉrodzΓ«lΓ« sΓ£ ΓΉmarlΓ« przΓ«sΕowiΓ© w stΓ΄rim piΓ©ckΓΉ diabeΕ pΓ΄lip p p p p p p p p p p p p p p swiΓ£ta Γ« ΓΉroczΓ«znΓ« midzΓ«nΓ΄rodnΓ©w pΓ²mΓ²rsczim wΓ²jewΓ³dztwie w kartΓ«sczim krΓ©zu w gminie kartuzΓ« tu ΓΉrodzyΕ sΓ£ gerard labΓΉda niedalek Γ²...
Generated Text Samples (Subword-based)
Below are text samples generated from each subword-based Markov chain model:
Context Size 1:
_jeczΔ cz_wierΓ«nea_xycok_w_sΕowini_pΓ²_aromstΓ«_adz
Context Size 2:
cz_gmik_47_iniewΓ²a_z_pΓ²zwΓ«bski)_na_w_rok_drΓ³lotam_p
Context Size 3:
czim_jΓ£zΓ«kΓ£._strzΓ©_w_pΓ²zwa_Β«lucjonalsczi_kaszΓ«bsczΓ©gΓ²_
Context Size 4:
sczi)._wiesΕowie_hoczi_lΓ«dztwa_kaszΓ«bs_je_w_tim_cΓ©lu_gduΕ
Key Findings
- Best Predictability: Context-4 (word) with 98.0% predictability
- Branching Factor: Decreases with context size (more deterministic)
- Memory Trade-off: Larger contexts require more storage (176,892 contexts)
- Recommendation: Context-3 or Context-4 for text generation
4. Vocabulary Analysis
Statistics
| Metric | Value |
|---|---|
| Vocabulary Size | 28,419 |
| Total Tokens | 363,789 |
| Mean Frequency | 12.80 |
| Median Frequency | 3 |
| Frequency Std Dev | 147.85 |
Most Common Words
| Rank | Word | Frequency |
|---|---|---|
| 1 | w | 17,269 |
| 2 | je | 7,835 |
| 3 | i | 6,858 |
| 4 | na | 6,665 |
| 5 | z | 4,968 |
| 6 | to | 4,725 |
| 7 | sΓ£ | 3,705 |
| 8 | do | 3,388 |
| 9 | rok | 3,182 |
| 10 | a | 2,483 |
Least Common Words (from vocabulary)
| Rank | Word | Frequency |
|---|---|---|
| 1 | krakowska | 2 |
| 2 | wΕΓ£czΓ«ne | 2 |
| 3 | ΡΠΎΡΠ· | 2 |
| 4 | eliminowaniΓ© | 2 |
| 5 | pΓ²liticznich | 2 |
| 6 | pΓ΄Εna | 2 |
| 7 | kΓ²ntrola | 2 |
| 8 | ΓΉmΓ²wΓ£ | 2 |
| 9 | stalinizm | 2 |
| 10 | fssr | 2 |
Zipf's Law Analysis
| Metric | Value |
|---|---|
| Zipf Coefficient | 0.9915 |
| RΒ² (Goodness of Fit) | 0.995964 |
| Adherence Quality | excellent |
Coverage Analysis
| Top N Words | Coverage |
|---|---|
| Top 100 | 36.1% |
| Top 1,000 | 63.4% |
| Top 5,000 | 80.0% |
| Top 10,000 | 87.6% |
Key Findings
- Zipf Compliance: RΒ²=0.9960 indicates excellent adherence to Zipf's law
- High Frequency Dominance: Top 100 words cover 36.1% of corpus
- Long Tail: 18,419 words needed for remaining 12.4% coverage
5. Word Embeddings Evaluation
5.1 Cross-Lingual Alignment
5.2 Model Comparison
| Model | Dimension | Isotropy | Semantic Density | Alignment R@1 | Alignment R@10 |
|---|---|---|---|---|---|
| mono_32d | 32 | 0.7585 | 0.3620 | N/A | N/A |
| mono_64d | 64 | 0.5824 | 0.3234 | N/A | N/A |
| mono_128d | 128 | 0.1382 | 0.3213 | N/A | N/A |
| aligned_32d | 32 | 0.7585 π | 0.3595 | 0.0200 | 0.1880 |
| aligned_64d | 64 | 0.5824 | 0.3217 | 0.0600 | 0.2480 |
| aligned_128d | 128 | 0.1382 | 0.3200 | 0.1040 | 0.3580 |
Key Findings
- Best Isotropy: aligned_32d with 0.7585 (more uniform distribution)
- Semantic Density: Average pairwise similarity of 0.3347. Lower values indicate better semantic separation.
- Alignment Quality: Aligned models achieve up to 10.4% R@1 in cross-lingual retrieval.
- Recommendation: 128d aligned for best cross-lingual performance
6. Morphological Analysis (Experimental)
This section presents an automated morphological analysis derived from the statistical divergence between word-level and subword-level models. By analyzing where subword predictability spikes and where word-level coverage fails, we can infer linguistic structures without supervised data.
6.1 Productivity & Complexity
| Metric | Value | Interpretation | Recommendation |
|---|---|---|---|
| Productivity Index | 5.000 | High morphological productivity | Reliable analysis |
| Idiomaticity Gap | 1.504 | High formulaic/idiomatic content | - |
6.2 Affix Inventory (Productive Units)
These are the most productive prefixes and suffixes identified by sampling the vocabulary for global substitutability patterns. A unit is considered an affix if stripping it leaves a valid stem that appears in other contexts.
Productive Prefixes
| Prefix | Examples |
|---|---|
-pr |
przednik, przistΓ£pnΔ , prowincΓ«jΓ£ |
-pΓ² |
pΓ²zycji, pΓ²kΓ²rΓ«, pΓ²dΓ΄wΓ΄ |
Productive Suffixes
| Suffix | Examples |
|---|---|
-a |
gdΓΉΕska, chΓ²robama, tradycja |
-ch |
griphenberch, bΕΓ£dnΓ«ch, pΓ²dwΓ²rzach |
-zi |
czedrowsczi, krΓ«szczi, amerikansczi |
-czi |
czedrowsczi, krΓ«szczi, amerikansczi |
-Γ³w |
ΓΉrzΔ dzeniΓ³w, wΓ«dΓ΄wkΓ³w, dzΓ©lΓ«kΓ³w |
6.3 Bound Stems (Lexical Roots)
Bound stems are high-frequency subword units that are semantically cohesive but rarely appear as standalone words. These often correspond to the 'core' of a word that requires inflection or derivation to be valid.
| Stem | Cohesion | Substitutability | Examples |
|---|---|---|---|
tΓ«rn |
1.98x | 29 contexts | chtΓ«rny, chtΓ«rno, chtΓ«rnΓ« |
chtΓ« |
2.02x | 27 contexts | chtΓ«rΓ«, sΓ«chtΓ«, zΓ«chtΓ« |
htΓ«r |
2.06x | 23 contexts | chtΓ«rΓ«, chtΓ«re, chtΓ«rΓ΄ |
szΓ«b |
2.02x | 22 contexts | kaszΓ«b, kaszΓ«bΔ , kaszΓ«bΓ£ |
sczi |
1.43x | 67 contexts | bΓΉsczi, Εasczi, bΓ²sczi |
zeni |
1.61x | 32 contexts | zenice, grzenia, ΓΉczeniΓ΄ |
odzΓ« |
1.76x | 23 contexts | rodzΓ«c, rodzΓ«nΓ«, rodzΓ«cΓ« |
stol |
1.81x | 20 contexts | stolp, stole, stolpe |
rodz |
1.40x | 45 contexts | rodzΔ , rodzy, rodze |
aszΓ« |
1.93x | 14 contexts | kaszΓ«b, kaszΓ«bΔ , kaszΓ«bΓ£ |
sczΓ© |
1.44x | 30 contexts | rusczΓ©, nisczΓ©, wΔ sczΓ© |
zΓ«bs |
2.09x | 9 contexts | kaszΓ«bsko, kaszΓ«bsce, kaszΓ«bskΓΉ |
6.4 Affix Compatibility (Co-occurrence)
This table shows which prefixes and suffixes most frequently co-occur on the same stems, revealing the 'stacking' rules of the language's morphology.
| Prefix | Suffix | Frequency | Examples |
|---|---|---|---|
-pr |
-Γ³w |
23 words | prawΓ³w, przezeblΓ΄kaΕcΓ³w |
-pr |
-a |
20 words | procesama, praha |
-pΓ² |
-a |
14 words | pΓ²sΕΓ«ga, pΓ²lsczima |
-pΓ² |
-ch |
13 words | pΓ²ΕΔ czeniach, pΓ²dwΓ²dnΓ«ch |
-pΓ² |
-Γ³w |
9 words | pΓ²zwΓ³w, pΓ²spΓ³lnotΓ³w |
-pr |
-ch |
7 words | prawach, prezidencczich |
-pΓ² |
-zi |
6 words | pΓ²lszczi, pΓ²merΓ©nczi |
-pΓ² |
-czi |
6 words | pΓ²lszczi, pΓ²merΓ©nczi |
-pr |
-zi |
6 words | prΓ«czkΓ²wsczi, prasczi |
-pr |
-czi |
4 words | prΓ«czkΓ²wsczi, prasczi |
6.5 Recursive Morpheme Segmentation
Using Recursive Hierarchical Substitutability, we decompose complex words into their constituent morphemes. This approach handles nested affixes (e.g., prefix-prefix-root-suffix).
| Word | Suggested Split | Confidence | Stem |
|---|---|---|---|
| paΕstwΓ²wich | paΕstwΓ²wi-ch |
4.5 | paΕstwΓ²wi |
| mΓ²dlΓ«twΓ³w | mΓ²dlΓ«tw-Γ³w |
4.5 | mΓ²dlΓ«tw |
| przebendowsczich | pr-zebendows-czi-ch |
4.5 | zebendows |
| czerΓ«nkΓ³w | czerΓ«nk-Γ³w |
4.5 | czerΓ«nk |
| gΓ²spΓ²darztwach | gΓ²spΓ²darztwa-ch |
4.5 | gΓ²spΓ²darztwa |
| kΓ²mpΓΉtrach | kΓ²mpΓΉtra-ch |
4.5 | kΓ²mpΓΉtra |
| chternych | chterny-ch |
4.5 | chterny |
| instrumentΓ³w | instrument-Γ³w |
4.5 | instrument |
| wiΓ©rztczi | wiΓ©rzt-czi |
4.5 | wiΓ©rzt |
| etnicznych | etniczny-ch |
4.5 | etniczny |
| kΓ²nkΓΉrsΓ³w | kΓ²nkΓΉrs-Γ³w |
4.5 | kΓ²nkΓΉrs |
| wΓ²jskΓ²wich | wΓ²jskΓ²wi-ch |
4.5 | wΓ²jskΓ²wi |
| miemiecczich | miemiec-czi-ch |
3.0 | miemiec |
| pΓ²legΕΓ«ch | pΓ²-legΕΓ«-ch |
3.0 | legΕΓ« |
| programach | pr-ograma-ch |
3.0 | ograma |
6.6 Linguistic Interpretation
Automated Insight: The language Kashubian shows high morphological productivity. The subword models are significantly more efficient than word models, suggesting a rich system of affixation or compounding.
Note on Idiomaticity: The high Idiomaticity Gap suggests a large number of frequent multi-word expressions or formulaic sequences that are statistically distinct from their component parts.
7. Summary & Recommendations
Production Recommendations
| Component | Recommended | Rationale |
|---|---|---|
| Tokenizer | 64k BPE | Best compression (4.52x) |
| N-gram | 2-gram | Lowest perplexity (457) |
| Markov | Context-4 | Highest predictability (98.0%) |
| Embeddings | 100d | Balanced semantic capture and isotropy |
Appendix: Metrics Glossary & Interpretation Guide
This section provides definitions, intuitions, and guidance for interpreting the metrics used throughout this report.
Tokenizer Metrics
Compression Ratio
Definition: The ratio of characters to tokens (chars/token). Measures how efficiently the tokenizer represents text.
Intuition: Higher compression means fewer tokens needed to represent the same text, reducing sequence lengths for downstream models. A 3x compression means ~3 characters per token on average.
What to seek: Higher is generally better for efficiency, but extremely high compression may indicate overly aggressive merging that loses morphological information.
Average Token Length (Fertility)
Definition: Mean number of characters per token produced by the tokenizer.
Intuition: Reflects the granularity of tokenization. Longer tokens capture more context but may struggle with rare words; shorter tokens are more flexible but increase sequence length.
What to seek: Balance between 2-5 characters for most languages. Arabic/morphologically-rich languages may benefit from slightly longer tokens.
Unknown Token Rate (OOV Rate)
Definition: Percentage of tokens that map to the unknown/UNK token, indicating words the tokenizer cannot represent.
Intuition: Lower OOV means better vocabulary coverage. High OOV indicates the tokenizer encounters many unseen character sequences.
What to seek: Below 1% is excellent; below 5% is acceptable. BPE tokenizers typically achieve very low OOV due to subword fallback.
N-gram Model Metrics
Perplexity
Definition: Measures how "surprised" the model is by test data. Mathematically: 2^(cross-entropy). Lower values indicate better prediction.
Intuition: If perplexity is 100, the model is as uncertain as if choosing uniformly among 100 options at each step. A perplexity of 10 means effectively choosing among 10 equally likely options.
What to seek: Lower is better. Perplexity decreases with larger n-grams (more context). Values vary widely by language and corpus size.
Entropy
Definition: Average information content (in bits) needed to encode the next token given the context. Related to perplexity: perplexity = 2^entropy.
Intuition: High entropy means high uncertainty/randomness; low entropy means predictable patterns. Natural language typically has entropy between 1-4 bits per character.
What to seek: Lower entropy indicates more predictable text patterns. Entropy should decrease as n-gram size increases.
Coverage (Top-K)
Definition: Percentage of corpus occurrences explained by the top K most frequent n-grams.
Intuition: High coverage with few patterns indicates repetitive/formulaic text; low coverage suggests diverse vocabulary usage.
What to seek: Depends on use case. For language modeling, moderate coverage (40-60% with top-1000) is typical for natural text.
Markov Chain Metrics
Average Entropy
Definition: Mean entropy across all contexts, measuring average uncertainty in next-word prediction.
Intuition: Lower entropy means the model is more confident about what comes next. Context-1 has high entropy (many possible next words); Context-4 has low entropy (few likely continuations).
What to seek: Decreasing entropy with larger context sizes. Very low entropy (<0.1) indicates highly deterministic transitions.
Branching Factor
Definition: Average number of unique next tokens observed for each context.
Intuition: High branching = many possible continuations (flexible but uncertain); low branching = few options (predictable but potentially repetitive).
What to seek: Branching factor should decrease with context size. Values near 1.0 indicate nearly deterministic chains.
Predictability
Definition: Derived metric: (1 - normalized_entropy) Γ 100%. Indicates how deterministic the model's predictions are.
Intuition: 100% predictability means the next word is always certain; 0% means completely random. Real text falls between these extremes.
What to seek: Higher predictability for text generation quality, but too high (>98%) may produce repetitive output.
Vocabulary & Zipf's Law Metrics
Zipf's Coefficient
Definition: The slope of the log-log plot of word frequency vs. rank. Zipf's law predicts this should be approximately -1.
Intuition: A coefficient near -1 indicates the corpus follows natural language patterns where a few words are very common and most words are rare.
What to seek: Values between -0.8 and -1.2 indicate healthy natural language distribution. Deviations may suggest domain-specific or artificial text.
RΒ² (Coefficient of Determination)
Definition: Measures how well the linear fit explains the frequency-rank relationship. Ranges from 0 to 1.
Intuition: RΒ² near 1.0 means the data closely follows Zipf's law; lower values indicate deviation from expected word frequency patterns.
What to seek: RΒ² > 0.95 is excellent; > 0.99 indicates near-perfect Zipf adherence typical of large natural corpora.
Vocabulary Coverage
Definition: Cumulative percentage of corpus tokens accounted for by the top N words.
Intuition: Shows how concentrated word usage is. If top-100 words cover 50% of text, the corpus relies heavily on common words.
What to seek: Top-100 covering 30-50% is typical. Higher coverage indicates more repetitive text; lower suggests richer vocabulary.
Word Embedding Metrics
Isotropy
Definition: Measures how uniformly distributed vectors are in the embedding space. Computed as the ratio of minimum to maximum singular values.
Intuition: High isotropy (near 1.0) means vectors spread evenly in all directions; low isotropy means vectors cluster in certain directions, reducing expressiveness.
What to seek: Higher isotropy generally indicates better-quality embeddings. Values > 0.1 are reasonable; > 0.3 is good. Lower-dimensional embeddings tend to have higher isotropy.
Average Norm
Definition: Mean magnitude (L2 norm) of word vectors in the embedding space.
Intuition: Indicates the typical "length" of vectors. Consistent norms suggest stable training; high variance may indicate some words are undertrained.
What to seek: Relatively consistent norms across models. The absolute value matters less than consistency (low std deviation).
Cosine Similarity
Definition: Measures angular similarity between vectors, ranging from -1 (opposite) to 1 (identical direction).
Intuition: Words with similar meanings should have high cosine similarity. This is the standard metric for semantic relatedness in embeddings.
What to seek: Semantically related words should score > 0.5; unrelated words should be near 0. Synonyms often score > 0.7.
t-SNE Visualization
Definition: t-Distributed Stochastic Neighbor Embedding - a dimensionality reduction technique that preserves local structure for visualization.
Intuition: Clusters in t-SNE plots indicate groups of semantically related words. Spread indicates vocabulary diversity; tight clusters suggest semantic coherence.
What to seek: Meaningful clusters (e.g., numbers together, verbs together). Avoid over-interpreting distances - t-SNE preserves local, not global, structure.
General Interpretation Guidelines
- Compare within model families: Metrics are most meaningful when comparing models of the same type (e.g., 8k vs 64k tokenizer).
- Consider trade-offs: Better performance on one metric often comes at the cost of another (e.g., compression vs. OOV rate).
- Context matters: Optimal values depend on downstream tasks. Text generation may prioritize different metrics than classification.
- Corpus influence: All metrics are influenced by corpus characteristics. Wikipedia text differs from social media or literature.
- Language-specific patterns: Morphologically rich languages (like Arabic) may show different optimal ranges than analytic languages.
Visualizations Index
| Visualization | Description |
|---|---|
| Tokenizer Compression | Compression ratios by vocabulary size |
| Tokenizer Fertility | Average token length by vocabulary |
| Tokenizer OOV | Unknown token rates |
| Tokenizer Total Tokens | Total tokens by vocabulary |
| N-gram Perplexity | Perplexity by n-gram size |
| N-gram Entropy | Entropy by n-gram size |
| N-gram Coverage | Top pattern coverage |
| N-gram Unique | Unique n-gram counts |
| Markov Entropy | Entropy by context size |
| Markov Branching | Branching factor by context |
| Markov Contexts | Unique context counts |
| Zipf's Law | Frequency-rank distribution with fit |
| Vocab Frequency | Word frequency distribution |
| Top 20 Words | Most frequent words |
| Vocab Coverage | Cumulative coverage curve |
| Embedding Isotropy | Vector space uniformity |
| Embedding Norms | Vector magnitude distribution |
| Embedding Similarity | Word similarity heatmap |
| Nearest Neighbors | Similar words for key terms |
| t-SNE Words | 2D word embedding visualization |
| t-SNE Sentences | 2D sentence embedding visualization |
| Position Encoding | Encoding method comparison |
| Model Sizes | Storage requirements |
| Performance Dashboard | Comprehensive performance overview |
About This Project
Data Source
Models trained on wikipedia-monthly - a monthly snapshot of Wikipedia articles across 300+ languages.
Project
A project by Wikilangs - Open-source NLP models for every Wikipedia language.
Maintainer
Citation
If you use these models in your research, please cite:
@misc{wikilangs2025,
author = {Kamali, Omar},
title = {Wikilangs: Open NLP Models for Wikipedia Languages},
year = {2025},
doi = {10.5281/zenodo.18073153},
publisher = {Zenodo},
url = {https://huggingface.co/wikilangs}
institution = {Omneity Labs}
}
License
MIT License - Free for academic and commercial use.
Links
- π Website: wikilangs.org
- π€ Models: huggingface.co/wikilangs
- π Data: wikipedia-monthly
- π€ Author: Omar Kamali
- π€ Sponsor: Featherless AI
Generated by Wikilangs Models Pipeline
Report Date: 2026-01-03 20:55:59



















