CoolFace
Modelpublic

wikilangs/bar

sourceHugging Facemitupdated 9mo agoView on Hugging Face
0likes
README.md764 linesDownload Raw Back to root
1---2language: bar3language_name: Bavarian4language_family: germanic_west_continental5tags:6  - wikilangs7  - nlp8  - tokenizer9  - embeddings10  - n-gram11  - markov12  - wikipedia13  - feature-extraction14  - sentence-similarity15  - tokenization16  - n-grams17  - markov-chain18  - text-mining19  - fasttext20  - babelvec21  - vocabulous22  - vocabulary23  - monolingual24  - family-germanic_west_continental25license: mit26library_name: wikilangs27pipeline_tag: text-generation28datasets:29  - omarkamali/wikipedia-monthly30dataset_info:31  name: wikipedia-monthly32  description: Monthly snapshots of Wikipedia articles across 300+ languages33metrics:34  - name: best_compression_ratio35    type: compression36    value: 4.00337  - name: best_isotropy38    type: isotropy39    value: 0.843240  - name: vocabulary_size41    type: vocab42    value: 043generated: 2026-01-0344---45 46# Bavarian - Wikilangs Models47## Comprehensive Research Report & Full Ablation Study48 49This repository contains NLP models trained and evaluated by Wikilangs, specifically on **Bavarian** Wikipedia data.50We analyze tokenizers, n-gram models, Markov chains, vocabulary statistics, and word embeddings.51 52## 📋 Repository Contents53 54### Models & Assets55 56- Tokenizers (8k, 16k, 32k, 64k)57- N-gram models (2, 3, 4, 5-gram)58- Markov chains (context of 1, 2, 3, 4 and 5)59- Subword N-gram and Markov chains60- Embeddings in various sizes and dimensions (aligned and unaligned)61- Language Vocabulary62- Language Statistics63 64![Performance Dashboard](visualizations/performance_dashboard.png)65 66### Analysis and Evaluation67 68- [1. Tokenizer Evaluation](#1-tokenizer-evaluation)69- [2. N-gram Model Evaluation](#2-n-gram-model-evaluation)70- [3. Markov Chain Evaluation](#3-markov-chain-evaluation)71- [4. Vocabulary Analysis](#4-vocabulary-analysis)72- [5. Word Embeddings Evaluation](#5-word-embeddings-evaluation)73- [6. Morphological Analysis (Experimental)](#6--morphological-analysis-experimental)74- [7. Summary & Recommendations](#7-summary--recommendations)75- [Metrics Glossary](#appendix-metrics-glossary--interpretation-guide)76- [Visualizations Index](#visualizations-index)77 78---79## 1. Tokenizer Evaluation80 81![Tokenizer Compression](visualizations/tokenizer_compression.png)82 83![Tokenizer Fertility](visualizations/tokenizer_fertility.png)84 85![Tokenizer OOV](visualizations/tokenizer_oov.png)86 87![Total Tokens](visualizations/tokenizer_total_tokens.png)88 89### Results90 91| Vocab Size | Compression | Avg Token Len | UNK Rate | Total Tokens |92|------------|-------------|---------------|----------|--------------|93| **8k** | 3.167x | 3.17 | 0.0430% | 1,042,115 |94| **16k** | 3.477x | 3.48 | 0.0472% | 949,394 |95| **32k** | 3.753x | 3.75 | 0.0509% | 879,530 |96| **64k** | 4.003x 🏆 | 4.00 | 0.0543% | 824,531 |97 98### Tokenization Examples99 100Below are sample sentences tokenized with each vocabulary size:101 102**Sample 1:** `Forstern is a Gmoa im obaboarischn Landkroas Arrdeng. Im Netz Gemeinde Forstern ...`103 104| Vocab | Tokens | Count |105|-------|--------|-------|106| 8k | `▁forst ern ▁is ▁a ▁gmoa ▁im ▁oba boarischn ▁landkroas ▁ar ... (+19 more)` | 29 |107| 16k | `▁forst ern ▁is ▁a ▁gmoa ▁im ▁obaboarischn ▁landkroas ▁arrdeng . ... (+15 more)` | 25 |108| 32k | `▁forst ern ▁is ▁a ▁gmoa ▁im ▁obaboarischn ▁landkroas ▁arrdeng . ... (+13 more)` | 23 |109| 64k | `▁forst ern ▁is ▁a ▁gmoa ▁im ▁obaboarischn ▁landkroas ▁arrdeng . ... (+12 more)` | 22 |110 111**Sample 2:** `Marlboro County. Obgruafa am 22. Feba is a County in South Carolina in da USA. B...`112 113| Vocab | Tokens | Count |114|-------|--------|-------|115| 8k | `▁mar l boro ▁county . ▁obgruafa ▁am ▁ 2 2 ... (+18 more)` | 28 |116| 16k | `▁mar l boro ▁county . ▁obgruafa ▁am ▁ 2 2 ... (+18 more)` | 28 |117| 32k | `▁marl boro ▁county . ▁obgruafa ▁am ▁ 2 2 . ... (+17 more)` | 27 |118| 64k | `▁marlboro ▁county . ▁obgruafa ▁am ▁ 2 2 . ▁feba ... (+16 more)` | 26 |119 120**Sample 3:** `Hill County is a County in Montana in da USA. Beleg Im Netz in Montana`121 122| Vocab | Tokens | Count |123|-------|--------|-------|124| 8k | `▁hill ▁county ▁is ▁a ▁county ▁in ▁montana ▁in ▁da ▁usa ... (+6 more)` | 16 |125| 16k | `▁hill ▁county ▁is ▁a ▁county ▁in ▁montana ▁in ▁da ▁usa ... (+6 more)` | 16 |126| 32k | `▁hill ▁county ▁is ▁a ▁county ▁in ▁montana ▁in ▁da ▁usa ... (+6 more)` | 16 |127| 64k | `▁hill ▁county ▁is ▁a ▁county ▁in ▁montana ▁in ▁da ▁usa ... (+6 more)` | 16 |128 129 130### Key Findings131 132- **Best Compression:** 64k achieves 4.003x compression133- **Lowest UNK Rate:** 8k with 0.0430% unknown tokens134- **Trade-off:** Larger vocabularies improve compression but increase model size135- **Recommendation:** 32k vocabulary provides optimal balance for production use136 137---138## 2. N-gram Model Evaluation139 140![N-gram Perplexity](visualizations/ngram_perplexity.png)141 142![N-gram Unique](visualizations/ngram_unique.png)143 144![N-gram Coverage](visualizations/ngram_coverage.png)145 146### Results147 148| N-gram | Variant | Perplexity | Entropy | Unique N-grams | Top-100 Coverage | Top-1000 Coverage |149|--------|---------|------------|---------|----------------|------------------|-------------------|150| **2-gram** | Word | 27,199 | 14.73 | 109,780 | 13.0% | 31.5% |151| **2-gram** | Subword | 361 🏆 | 8.50 | 7,796 | 60.7% | 98.3% |152| **3-gram** | Word | 40,782 | 15.32 | 128,747 | 12.7% | 26.6% |153| **3-gram** | Subword | 3,796 | 11.89 | 62,893 | 20.6% | 60.9% |154| **4-gram** | Word | 56,976 | 15.80 | 186,218 | 13.7% | 25.1% |155| **4-gram** | Subword | 27,410 | 14.74 | 362,482 | 9.1% | 28.4% |156| **5-gram** | Word | 38,882 | 15.25 | 130,277 | 15.7% | 28.0% |157| **5-gram** | Subword | 124,788 | 16.93 | 1,153,187 | 4.9% | 16.5% |158 159### Top 5 N-grams by Size160 161**2-grams (Word):**162 163| Rank | N-gram | Count |164|------|--------|-------|165| 1 | `vo da` | 26,508 |166| 2 | `is a` | 22,819 |167| 3 | `in da` | 22,392 |168| 4 | `im netz` | 14,484 |169| 5 | `vo de` | 13,424 |170 171**3-grams (Word):**172 173| Rank | N-gram | Count |174|------|--------|-------|175| 1 | `beleg im netz` | 3,530 |176| 2 | `in da usa` | 3,478 |177| 3 | `da beziak hod` | 2,393 |178| 4 | `im netz in` | 2,005 |179| 5 | `sitz vo da` | 1,888 |180 181**4-grams (Word):**182 183| Rank | N-gram | Count |184|------|--------|-------|185| 1 | `beleg im netz in` | 1,575 |186| 2 | `da sitz vo da` | 1,482 |187| 3 | `is a county in` | 1,429 |188| 4 | `in da usa da` | 1,407 |189| 5 | `a katastralgmoa in da` | 1,387 |190 191**5-grams (Word):**192 193| Rank | N-gram | Count |194|------|--------|-------|195| 1 | `flächn ausgwiesn gwesn ende woarn` | 1,385 |196| 2 | `hektar ois laundwiatschoftliche flächn gnutzt` | 1,385 |197| 3 | `forstwirtschaftli gnutzte flächn ausgwiesn gwesn` | 1,385 |198| 4 | `hektar sand ois forstwirtschaftli gnutzte` | 1,385 |199| 5 | `ois laundwiatschoftliche flächn gnutzt und` | 1,385 |200 201**2-grams (Subword):**202 203| Rank | N-gram | Count |204|------|--------|-------|205| 1 | `n _` | 701,951 |206| 2 | `a _` | 667,528 |207| 3 | `c h` | 636,525 |208| 4 | `_ d` | 557,323 |209| 5 | `e _` | 479,658 |210 211**3-grams (Subword):**212 213| Rank | N-gram | Count |214|------|--------|-------|215| 1 | `s c h` | 303,728 |216| 2 | `_ d e` | 253,515 |217| 3 | `_ d a` | 172,902 |218| 4 | `n d _` | 169,557 |219| 5 | `u n d` | 168,298 |220 221**4-grams (Subword):**222 223| Rank | N-gram | Count |224|------|--------|-------|225| 1 | `_ d a _` | 132,086 |226| 2 | `_ d e _` | 130,374 |227| 3 | `u n d _` | 127,939 |228| 4 | `_ u n d` | 119,950 |229| 5 | `i s c h` | 99,379 |230 231**5-grams (Subword):**232 233| Rank | N-gram | Count |234|------|--------|-------|235| 1 | `_ u n d _` | 118,720 |236| 2 | `_ v o _ d` | 44,559 |237| 3 | `_ i n _ d` | 37,539 |238| 4 | `i s c h e` | 33,643 |239| 5 | `_ d e s _` | 31,011 |240 241 242### Key Findings243 244- **Best Perplexity:** 2-gram (subword) with 361245- **Entropy Trend:** Decreases with larger n-grams (more predictable)246- **Coverage:** Top-1000 patterns cover ~17% of corpus247- **Recommendation:** 4-gram or 5-gram for best predictive performance248 249---250## 3. Markov Chain Evaluation251 252![Markov Entropy](visualizations/markov_entropy.png)253 254![Markov Contexts](visualizations/markov_contexts.png)255 256![Markov Branching](visualizations/markov_branching.png)257 258### Results259 260| Context | Variant | Avg Entropy | Perplexity | Branching Factor | Unique Contexts | Predictability |261|---------|---------|-------------|------------|------------------|-----------------|----------------|262| **1** | Word | 0.7076 | 1.633 | 5.17 | 567,851 | 29.2% |263| **1** | Subword | 0.9427 | 1.922 | 6.61 | 3,387 | 5.7% |264| **2** | Word | 0.2111 | 1.158 | 1.52 | 2,930,161 | 78.9% |265| **2** | Subword | 0.9146 | 1.885 | 5.83 | 22,370 | 8.5% |266| **3** | Word | 0.0663 | 1.047 | 1.11 | 4,443,260 | 93.4% |267| **3** | Subword | 0.8673 | 1.824 | 4.66 | 130,496 | 13.3% |268| **4** | Word | 0.0224 🏆 | 1.016 | 1.04 | 4,937,652 | 97.8% |269| **4** | Subword | 0.7772 | 1.714 | 3.53 | 608,299 | 22.3% |270 271### Generated Text Samples (Word-based)272 273Below are text samples generated from each word-based Markov chain model:274 275**Context Size 1:**276 2771. `de gepidn und bbö 178 bukit tinggi 72 canon triplex a 7 hz ws touro college`2782. `da effentlichn stroßn am 9 verletzter blick af de gebietskeapaschoftn in bayern gwen dem meearesspia...`2793. `und alfonso cuarón timothy j nö öbb infra öbb pv tullnerfelder bahn rengschbuach grünthal geografie ...`280 281**Context Size 2:**282 2831. `vo da blaa oim aussa und entschdengan seine wichdigstn litararischn weak da voda vo da gmoa kirchham`2842. `is a kuaza a1 kuaza mit klima b launga und zwoa enklkinda da hoeneß uli z bad`2853. `in da katastralgmoa dobranberg zsammgrechnt 84 bauflächn mit 44 633 m und 58 gärten auf 135 526`286 287**Context Size 3:**288 2891. `in da usa beleg im netz in virginia`2902. `beleg im netz in missouri`2913. `da beziak hod 39 451 eihwohna da sitz vo da vawoitung is leoti da beziak hod 12 786`292 293**Context Size 4:**294 2951. `beleg im netz in nebraska`2962. `da sitz vo da kroasvawoitung vo oanign landkroas liegt außahoib vom landkroas oft in da namasgleichn...`2973. `is a county in wisconsin in da usa beleg im netz in der emilia romagna des europapreises`298 299 300### Generated Text Samples (Subword-based)301 302Below are text samples generated from each subword-based Markov chain model:303 304**Context Size 1:**305 3061. `_w.adaiwenieurio`3072. `a_lidovicröniser`3083. `e_hmbrkum_runís_`309 310**Context Size 2:**311 3121. `n_fc_rein_wieforo`3132. `a_da_oschofferkea`3143. `chr_koi'seybunds_`315 316**Context Size 3:**317 3181. `schburyan_no_san_d`3192. `_dem_scusdecentisc`3203. `_daument_in_und_zu`321 322**Context Size 4:**323 3241. `_da_letztn_de_ameri`3252. `_de_marekd_om_auf_1`3263. `und_botta_200+_maß_`327 328 329### Key Findings330 331- **Best Predictability:** Context-4 (word) with 97.8% predictability332- **Branching Factor:** Decreases with context size (more deterministic)333- **Memory Trade-off:** Larger contexts require more storage (608,299 contexts)334- **Recommendation:** Context-3 or Context-4 for text generation335 336---337## 4. Vocabulary Analysis338 339![Zipf's Law](visualizations/zipf_law.png)340 341![Top Words](visualizations/top20_words.png)342 343![Coverage Curve](visualizations/vocab_coverage.png)344 345### Statistics346 347| Metric | Value |348|--------|-------|349| Vocabulary Size | 212,365 |350| Total Tokens | 5,339,853 |351| Mean Frequency | 25.14 |352| Median Frequency | 3 |353| Frequency Std Dev | 712.67 |354 355### Most Common Words356 357| Rank | Word | Frequency |358|------|------|-----------|359| 1 | de | 136,913 |360| 2 | da | 136,168 |361| 3 | und | 119,185 |362| 4 | in | 101,699 |363| 5 | a | 92,218 |364| 6 | vo | 91,584 |365| 7 | is | 86,664 |366| 8 | im | 70,677 |367| 9 | des | 33,854 |368| 10 | hod | 30,719 |369 370### Least Common Words (from vocabulary)371 372| Rank | Word | Frequency |373|------|------|-----------|374| 1 | mechanisches | 2 |375| 2 | stabilisierungssystem | 2 |376| 3 | voeffentlecht | 2 |377| 4 | innpuls | 2 |378| 5 | buagstej | 2 |379| 6 | nuwenburg | 2 |380| 7 | kulturweges | 2 |381| 8 | spessartprojektes | 2 |382| 9 | terrassnfermig | 2 |383| 10 | tuamhigi | 2 |384 385### Zipf's Law Analysis386 387| Metric | Value |388|--------|-------|389| Zipf Coefficient | 0.9730 |390| R² (Goodness of Fit) | 0.999444 |391| Adherence Quality | **excellent** |392 393### Coverage Analysis394 395| Top N Words | Coverage |396|-------------|----------|397| Top 100 | 34.1% |398| Top 1,000 | 55.0% |399| Top 5,000 | 70.0% |400| Top 10,000 | 76.7% |401 402### Key Findings403 404- **Zipf Compliance:** R²=0.9994 indicates excellent adherence to Zipf's law405- **High Frequency Dominance:** Top 100 words cover 34.1% of corpus406- **Long Tail:** 202,365 words needed for remaining 23.3% coverage407 408---409## 5. Word Embeddings Evaluation410 411![Embedding Isotropy](visualizations/embedding_isotropy.png)412 413![Similarity Matrix](visualizations/embedding_similarity.png)414 415![t-SNE Words](visualizations/tsne_words.png)416 417![t-SNE Sentences](visualizations/tsne_sentences.png)418 419 420### 5.1 Cross-Lingual Alignment421 422![Alignment Quality](visualizations/embedding_alignment_quality.png)423 424![Multilingual t-SNE](visualizations/embedding_tsne_multilingual.png)425 426 427### 5.2 Model Comparison428 429| Model | Dimension | Isotropy | Semantic Density | Alignment R@1 | Alignment R@10 |430|-------|-----------|----------|------------------|---------------|----------------|431| **mono_32d** | 32 | 0.8296 | 0.3402 | N/A | N/A |432| **mono_64d** | 64 | 0.8410 | 0.2581 | N/A | N/A |433| **mono_128d** | 128 | 0.8432 🏆 | 0.1737 | N/A | N/A |434| **aligned_32d** | 32 | 0.8296 | 0.3341 | 0.0920 | 0.3960 |435| **aligned_64d** | 64 | 0.8410 | 0.2543 | 0.1940 | 0.6020 |436| **aligned_128d** | 128 | 0.8432 | 0.1862 | 0.2860 | 0.6780 |437 438### Key Findings439 440- **Best Isotropy:** mono_128d with 0.8432 (more uniform distribution)441- **Semantic Density:** Average pairwise similarity of 0.2578. Lower values indicate better semantic separation.442- **Alignment Quality:** Aligned models achieve up to 28.6% R@1 in cross-lingual retrieval.443- **Recommendation:** 128d aligned for best cross-lingual performance444 445---446## 6.  Morphological Analysis (Experimental)447 448This 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.449 450### 6.1 Productivity & Complexity451 452| Metric | Value | Interpretation | Recommendation |453|--------|-------|----------------|----------------|454| Productivity Index | **5.000** | High morphological productivity | Reliable analysis |455| Idiomaticity Gap | **0.694** | High formulaic/idiomatic content | - |456 457### 6.2 Affix Inventory (Productive Units)458 459These 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.460 461#### Productive Prefixes462| Prefix | Examples |463|--------|----------|464| `-sc` | scharmbeck, schitznvaein, schiaf |465| `-sch` | scharmbeck, schitznvaein, schiaf |466 467#### Productive Suffixes468| Suffix | Examples |469|--------|----------|470| `-n` | şabran, unterwestern, weidesdn |471| `-en` | metallen, theologen, münzen |472| `-ng` | wondering, pisang, umwondlung |473| `-er` | gräberfelder, eichenauer, weydenhammer |474| `-ch` | hoierschbouch, weißabgleich, obergreutschach |475| `-ung` | umwondlung, auflösung, ausbroadung |476 477### 6.3 Bound Stems (Lexical Roots)478 479Bound 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.480 481| Stem | Cohesion | Substitutability | Examples |482|------|----------|------------------|----------|483| `ster` | 2.00x | 209 contexts | aster, ester, stern |484| `schl` | 1.77x | 287 contexts | eschl, ischl, schlau |485| `schr` | 1.99x | 137 contexts | schrit, schrim, schreg |486| `gsch` | 1.77x | 181 contexts | gschai, gschdö, gschmo |487| `uach` | 1.99x | 99 contexts | buach, huach, suach |488| `itsc` | 2.19x | 64 contexts | gitsch, nitsch, kitsch |489| `icht` | 1.54x | 345 contexts | eicht, wicht, richt |490| `atio` | 2.26x | 45 contexts | ratio, natio, nation |491| `nisc` | 1.77x | 126 contexts | nisch, nischn, nischt |492| `reic` | 1.78x | 97 contexts | reich, reichd, reichl |493| `chof` | 2.07x | 50 contexts | schof, schoft, schofn |494| `tion` | 1.73x | 93 contexts | tione, aktion, notion |495 496### 6.4 Affix Compatibility (Co-occurrence)497 498This table shows which prefixes and suffixes most frequently co-occur on the same stems, revealing the 'stacking' rules of the language's morphology.499 500| Prefix | Suffix | Frequency | Examples |501|--------|--------|-----------|----------|502| `-sc` | `-n` | 52 words | schbondan, schbüün |503| `-sc` | `-er` | 16 words | schatzgräber, schweinsteiger |504| `-sc` | `-en` | 13 words | schlampen, screven |505| `-sc` | `-ng` | 11 words | schädlbedeckung, schraubvabindung |506| `-sc` | `-ch` | 10 words | scharlach, schbruch |507| `-sc` | `-ung` | 4 words | schädlbedeckung, schraubvabindung |508 509### 6.5 Recursive Morpheme Segmentation510 511Using **Recursive Hierarchical Substitutability**, we decompose complex words into their constituent morphemes. This approach handles nested affixes (e.g., `prefix-prefix-root-suffix`).512 513| Word | Suggested Split | Confidence | Stem |514|------|-----------------|------------|------|515| schnitzen | **`sch-nitz-en`** | 6.0 | `nitz` |516| enthaltenen | **`enthalt-en-en`** | 6.0 | `enthalt` |517| schwensen | **`sch-wens-en`** | 6.0 | `wens` |518| herrnhausen | **`herrnhaus-en`** | 4.5 | `herrnhaus` |519| schrottenberg | **`sch-rottenberg`** | 4.5 | `rottenberg` |520| heaschafamülien | **`heaschafamüli-en`** | 4.5 | `heaschafamüli` |521| fawoitung | **`fawoit-ung`** | 4.5 | `fawoit` |522| regulären | **`regulär-en`** | 4.5 | `regulär` |523| leitmeritzer | **`leitmeritz-er`** | 4.5 | `leitmeritz` |524| jungfrauen | **`jungfrau-en`** | 4.5 | `jungfrau` |525| gespenster | **`gespenst-er`** | 4.5 | `gespenst` |526| dynastien | **`dynasti-en`** | 4.5 | `dynasti` |527| referenten | **`referent-en`** | 4.5 | `referent` |528| birkenhainer | **`birkenhain-er`** | 4.5 | `birkenhain` |529| rettersheimer | **`rettersheim-er`** | 4.5 | `rettersheim` |530 531### 6.6 Linguistic Interpretation532 533> **Automated Insight:**534The language Bavarian shows high morphological productivity. The subword models are significantly more efficient than word models, suggesting a rich system of affixation or compounding.535 536> **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.537 538---539## 7. Summary & Recommendations540 541![Performance Dashboard](visualizations/performance_dashboard.png)542 543### Production Recommendations544 545| Component | Recommended | Rationale |546|-----------|-------------|-----------|547| Tokenizer | **64k BPE** | Best compression (4.00x) |548| N-gram | **2-gram** | Lowest perplexity (361) |549| Markov | **Context-4** | Highest predictability (97.8%) |550| Embeddings | **100d** | Balanced semantic capture and isotropy |551 552 553---554## Appendix: Metrics Glossary & Interpretation Guide555 556This section provides definitions, intuitions, and guidance for interpreting the metrics used throughout this report.557 558### Tokenizer Metrics559 560**Compression Ratio**561> *Definition:* The ratio of characters to tokens (chars/token). Measures how efficiently the tokenizer represents text.562>563> *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.564>565> *What to seek:* Higher is generally better for efficiency, but extremely high compression may indicate overly aggressive merging that loses morphological information.566 567**Average Token Length (Fertility)**568> *Definition:* Mean number of characters per token produced by the tokenizer.569>570> *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.571>572> *What to seek:* Balance between 2-5 characters for most languages. Arabic/morphologically-rich languages may benefit from slightly longer tokens.573 574**Unknown Token Rate (OOV Rate)**575> *Definition:* Percentage of tokens that map to the unknown/UNK token, indicating words the tokenizer cannot represent.576>577> *Intuition:* Lower OOV means better vocabulary coverage. High OOV indicates the tokenizer encounters many unseen character sequences.578>579> *What to seek:* Below 1% is excellent; below 5% is acceptable. BPE tokenizers typically achieve very low OOV due to subword fallback.580 581### N-gram Model Metrics582 583**Perplexity**584> *Definition:* Measures how "surprised" the model is by test data. Mathematically: 2^(cross-entropy). Lower values indicate better prediction.585>586> *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.587>588> *What to seek:* Lower is better. Perplexity decreases with larger n-grams (more context). Values vary widely by language and corpus size.589 590**Entropy**591> *Definition:* Average information content (in bits) needed to encode the next token given the context. Related to perplexity: perplexity = 2^entropy.592>593> *Intuition:* High entropy means high uncertainty/randomness; low entropy means predictable patterns. Natural language typically has entropy between 1-4 bits per character.594>595> *What to seek:* Lower entropy indicates more predictable text patterns. Entropy should decrease as n-gram size increases.596 597**Coverage (Top-K)**598> *Definition:* Percentage of corpus occurrences explained by the top K most frequent n-grams.599>600> *Intuition:* High coverage with few patterns indicates repetitive/formulaic text; low coverage suggests diverse vocabulary usage.601>602> *What to seek:* Depends on use case. For language modeling, moderate coverage (40-60% with top-1000) is typical for natural text.603 604### Markov Chain Metrics605 606**Average Entropy**607> *Definition:* Mean entropy across all contexts, measuring average uncertainty in next-word prediction.608>609> *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).610>611> *What to seek:* Decreasing entropy with larger context sizes. Very low entropy (<0.1) indicates highly deterministic transitions.612 613**Branching Factor**614> *Definition:* Average number of unique next tokens observed for each context.615>616> *Intuition:* High branching = many possible continuations (flexible but uncertain); low branching = few options (predictable but potentially repetitive).617>618> *What to seek:* Branching factor should decrease with context size. Values near 1.0 indicate nearly deterministic chains.619 620**Predictability**621> *Definition:* Derived metric: (1 - normalized_entropy) × 100%. Indicates how deterministic the model's predictions are.622>623> *Intuition:* 100% predictability means the next word is always certain; 0% means completely random. Real text falls between these extremes.624>625> *What to seek:* Higher predictability for text generation quality, but too high (>98%) may produce repetitive output.626 627### Vocabulary & Zipf's Law Metrics628 629**Zipf's Coefficient**630> *Definition:* The slope of the log-log plot of word frequency vs. rank. Zipf's law predicts this should be approximately -1.631>632> *Intuition:* A coefficient near -1 indicates the corpus follows natural language patterns where a few words are very common and most words are rare.633>634> *What to seek:* Values between -0.8 and -1.2 indicate healthy natural language distribution. Deviations may suggest domain-specific or artificial text.635 636**R² (Coefficient of Determination)**637> *Definition:* Measures how well the linear fit explains the frequency-rank relationship. Ranges from 0 to 1.638>639> *Intuition:* R² near 1.0 means the data closely follows Zipf's law; lower values indicate deviation from expected word frequency patterns.640>641> *What to seek:* R² > 0.95 is excellent; > 0.99 indicates near-perfect Zipf adherence typical of large natural corpora.642 643**Vocabulary Coverage**644> *Definition:* Cumulative percentage of corpus tokens accounted for by the top N words.645>646> *Intuition:* Shows how concentrated word usage is. If top-100 words cover 50% of text, the corpus relies heavily on common words.647>648> *What to seek:* Top-100 covering 30-50% is typical. Higher coverage indicates more repetitive text; lower suggests richer vocabulary.649 650### Word Embedding Metrics651 652**Isotropy**653> *Definition:* Measures how uniformly distributed vectors are in the embedding space. Computed as the ratio of minimum to maximum singular values.654>655> *Intuition:* High isotropy (near 1.0) means vectors spread evenly in all directions; low isotropy means vectors cluster in certain directions, reducing expressiveness.656>657> *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.658 659**Average Norm**660> *Definition:* Mean magnitude (L2 norm) of word vectors in the embedding space.661>662> *Intuition:* Indicates the typical "length" of vectors. Consistent norms suggest stable training; high variance may indicate some words are undertrained.663>664> *What to seek:* Relatively consistent norms across models. The absolute value matters less than consistency (low std deviation).665 666**Cosine Similarity**667> *Definition:* Measures angular similarity between vectors, ranging from -1 (opposite) to 1 (identical direction).668>669> *Intuition:* Words with similar meanings should have high cosine similarity. This is the standard metric for semantic relatedness in embeddings.670>671> *What to seek:* Semantically related words should score > 0.5; unrelated words should be near 0. Synonyms often score > 0.7.672 673**t-SNE Visualization**674> *Definition:* t-Distributed Stochastic Neighbor Embedding - a dimensionality reduction technique that preserves local structure for visualization.675>676> *Intuition:* Clusters in t-SNE plots indicate groups of semantically related words. Spread indicates vocabulary diversity; tight clusters suggest semantic coherence.677>678> *What to seek:* Meaningful clusters (e.g., numbers together, verbs together). Avoid over-interpreting distances - t-SNE preserves local, not global, structure.679 680### General Interpretation Guidelines681 6821. **Compare within model families:** Metrics are most meaningful when comparing models of the same type (e.g., 8k vs 64k tokenizer).6832. **Consider trade-offs:** Better performance on one metric often comes at the cost of another (e.g., compression vs. OOV rate).6843. **Context matters:** Optimal values depend on downstream tasks. Text generation may prioritize different metrics than classification.6854. **Corpus influence:** All metrics are influenced by corpus characteristics. Wikipedia text differs from social media or literature.6865. **Language-specific patterns:** Morphologically rich languages (like Arabic) may show different optimal ranges than analytic languages.687 688 689### Visualizations Index690 691| Visualization | Description |692|---------------|-------------|693| Tokenizer Compression | Compression ratios by vocabulary size |694| Tokenizer Fertility | Average token length by vocabulary |695| Tokenizer OOV | Unknown token rates |696| Tokenizer Total Tokens | Total tokens by vocabulary |697| N-gram Perplexity | Perplexity by n-gram size |698| N-gram Entropy | Entropy by n-gram size |699| N-gram Coverage | Top pattern coverage |700| N-gram Unique | Unique n-gram counts |701| Markov Entropy | Entropy by context size |702| Markov Branching | Branching factor by context |703| Markov Contexts | Unique context counts |704| Zipf's Law | Frequency-rank distribution with fit |705| Vocab Frequency | Word frequency distribution |706| Top 20 Words | Most frequent words |707| Vocab Coverage | Cumulative coverage curve |708| Embedding Isotropy | Vector space uniformity |709| Embedding Norms | Vector magnitude distribution |710| Embedding Similarity | Word similarity heatmap |711| Nearest Neighbors | Similar words for key terms |712| t-SNE Words | 2D word embedding visualization |713| t-SNE Sentences | 2D sentence embedding visualization |714| Position Encoding | Encoding method comparison |715| Model Sizes | Storage requirements |716| Performance Dashboard | Comprehensive performance overview |717 718---719## About This Project720 721### Data Source722 723Models trained on [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) - a monthly snapshot of Wikipedia articles across 300+ languages.724 725### Project726 727A project by **[Wikilangs](https://wikilangs.org)** - Open-source NLP models for every Wikipedia language.728 729### Maintainer730 731[Omar Kamali](https://omarkamali.com) - [Omneity Labs](https://omneitylabs.com)732 733### Citation734 735If you use these models in your research, please cite:736 737```bibtex738@misc{wikilangs2025,739  author = {Kamali, Omar},740  title = {Wikilangs: Open NLP Models for Wikipedia Languages},741  year = {2025},742  doi = {10.5281/zenodo.18073153},743  publisher = {Zenodo},744  url = {https://huggingface.co/wikilangs}745  institution = {Omneity Labs}746}747```748 749### License750 751MIT License - Free for academic and commercial use.752 753### Links754 755- 🌐 Website: [wikilangs.org](https://wikilangs.org)756- 🤗 Models: [huggingface.co/wikilangs](https://huggingface.co/wikilangs)757- 📊 Data: [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly)758- 👤 Author: [Omar Kamali](https://huggingface.co/omarkamali)759- 🤝 Sponsor: [Featherless AI](https://featherless.ai)760---761*Generated by Wikilangs Models Pipeline*762 763*Report Date: 2026-01-03 19:01:37*764