lad / README.md
omarkamali's picture
Upload all models and assets for lad (latest)
2fb58da verified
---
language: lad
language_name: Ladino
language_family: semitic_hebrew
tags:
- wikilangs
- nlp
- tokenizer
- embeddings
- n-gram
- markov
- wikipedia
- feature-extraction
- sentence-similarity
- tokenization
- n-grams
- markov-chain
- text-mining
- fasttext
- babelvec
- vocabulous
- vocabulary
- monolingual
- family-semitic_hebrew
license: mit
library_name: wikilangs
pipeline_tag: text-generation
datasets:
- omarkamali/wikipedia-monthly
dataset_info:
name: wikipedia-monthly
description: Monthly snapshots of Wikipedia articles across 300+ languages
metrics:
- name: best_compression_ratio
type: compression
value: 4.557
- name: best_isotropy
type: isotropy
value: 0.8013
- name: vocabulary_size
type: vocab
value: 0
generated: 2026-01-10
---
# Ladino - Wikilangs Models
## Comprehensive Research Report & Full Ablation Study
This repository contains NLP models trained and evaluated by Wikilangs, specifically on **Ladino** 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
![Performance Dashboard](visualizations/performance_dashboard.png)
### Analysis and Evaluation
- [1. Tokenizer Evaluation](#1-tokenizer-evaluation)
- [2. N-gram Model Evaluation](#2-n-gram-model-evaluation)
- [3. Markov Chain Evaluation](#3-markov-chain-evaluation)
- [4. Vocabulary Analysis](#4-vocabulary-analysis)
- [5. Word Embeddings Evaluation](#5-word-embeddings-evaluation)
- [6. Morphological Analysis (Experimental)](#6--morphological-analysis-experimental)
- [7. Summary & Recommendations](#7-summary--recommendations)
- [Metrics Glossary](#appendix-metrics-glossary--interpretation-guide)
- [Visualizations Index](#visualizations-index)
---
## 1. Tokenizer Evaluation
![Tokenizer Compression](visualizations/tokenizer_compression.png)
![Tokenizer Fertility](visualizations/tokenizer_fertility.png)
![Tokenizer OOV](visualizations/tokenizer_oov.png)
![Total Tokens](visualizations/tokenizer_total_tokens.png)
### Results
| Vocab Size | Compression | Avg Token Len | UNK Rate | Total Tokens |
|------------|-------------|---------------|----------|--------------|
| **8k** | 3.622x | 3.62 | 0.1235% | 455,180 |
| **16k** | 3.981x | 3.98 | 0.1357% | 414,144 |
| **32k** | 4.311x | 4.31 | 0.1470% | 382,411 |
| **64k** | 4.557x ๐Ÿ† | 4.56 | 0.1553% | 361,808 |
### Tokenization Examples
Below are sample sentences tokenized with each vocabulary size:
**Sample 1:** `La komarka de Pinares es una komarka de la provinsia de Soria en la junta de Kas...`
| Vocab | Tokens | Count |
|-------|--------|-------|
| 8k | `โ–la โ–komarka โ–de โ–pin ares โ–es โ–una โ–komarka โ–de โ–la ... (+20 more)` | 30 |
| 16k | `โ–la โ–komarka โ–de โ–pin ares โ–es โ–una โ–komarka โ–de โ–la ... (+19 more)` | 29 |
| 32k | `โ–la โ–komarka โ–de โ–pinares โ–es โ–una โ–komarka โ–de โ–la โ–provinsia ... (+17 more)` | 27 |
| 64k | `โ–la โ–komarka โ–de โ–pinares โ–es โ–una โ–komarka โ–de โ–la โ–provinsia ... (+17 more)` | 27 |
**Sample 2:** `La Wilaya de Tebesa es una wilaya arjelina. Su kapital es Tebesa. de Arjelia`
| Vocab | Tokens | Count |
|-------|--------|-------|
| 8k | `โ–la โ–wilaya โ–de โ–te b esa โ–es โ–una โ–wilaya โ–arjelina ... (+10 more)` | 20 |
| 16k | `โ–la โ–wilaya โ–de โ–te b esa โ–es โ–una โ–wilaya โ–arjelina ... (+10 more)` | 20 |
| 32k | `โ–la โ–wilaya โ–de โ–te besa โ–es โ–una โ–wilaya โ–arjelina . ... (+8 more)` | 18 |
| 64k | `โ–la โ–wilaya โ–de โ–tebesa โ–es โ–una โ–wilaya โ–arjelina . โ–su ... (+6 more)` | 16 |
**Sample 3:** `Loeches es un belediye del Komunidad de Madrid. Ver endemas Komunidad Otonoma de...`
| Vocab | Tokens | Count |
|-------|--------|-------|
| 8k | `โ–lo e ches โ–es โ–un โ–belediye โ–del โ–komunidad โ–de โ–madrid ... (+15 more)` | 25 |
| 16k | `โ–lo e ches โ–es โ–un โ–belediye โ–del โ–komunidad โ–de โ–madrid ... (+15 more)` | 25 |
| 32k | `โ–lo eches โ–es โ–un โ–belediye โ–del โ–komunidad โ–de โ–madrid . ... (+14 more)` | 24 |
| 64k | `โ–lo eches โ–es โ–un โ–belediye โ–del โ–komunidad โ–de โ–madrid . ... (+14 more)` | 24 |
### Key Findings
- **Best Compression:** 64k achieves 4.557x compression
- **Lowest UNK Rate:** 8k with 0.1235% 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
![N-gram Perplexity](visualizations/ngram_perplexity.png)
![N-gram Unique](visualizations/ngram_unique.png)
![N-gram Coverage](visualizations/ngram_coverage.png)
### Results
| N-gram | Variant | Perplexity | Entropy | Unique N-grams | Top-100 Coverage | Top-1000 Coverage |
|--------|---------|------------|---------|----------------|------------------|-------------------|
| **2-gram** | Word | 4,604 | 12.17 | 16,752 | 25.6% | 52.0% |
| **2-gram** | Subword | 248 ๐Ÿ† | 7.96 | 3,814 | 71.5% | 98.6% |
| **3-gram** | Word | 9,419 | 13.20 | 23,823 | 17.0% | 38.9% |
| **3-gram** | Subword | 1,904 | 10.89 | 23,591 | 30.3% | 75.0% |
| **4-gram** | Word | 17,892 | 14.13 | 39,193 | 13.5% | 30.2% |
| **4-gram** | Subword | 9,391 | 13.20 | 97,361 | 15.8% | 45.6% |
| **5-gram** | Word | 13,967 | 13.77 | 27,943 | 13.4% | 32.0% |
| **5-gram** | Subword | 27,847 | 14.77 | 203,110 | 9.7% | 31.4% |
### Top 5 N-grams by Size
**2-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `de la` | 8,391 |
| 2 | `en la` | 3,733 |
| 3 | `la sivdad` | 3,206 |
| 4 | `de los` | 3,045 |
| 5 | `en el` | 2,358 |
**3-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `kon grafia ladina` | 2,216 |
| 2 | `la sivdad de` | 1,675 |
| 3 | `del estado de` | 1,012 |
| 4 | `referensias atamientos eksternos` | 997 |
| 5 | `grafia ladina katฤ“ggorรญa` | 907 |
**4-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `kon grafia ladina katฤ“ggorรญa` | 907 |
| 2 | `eksternos kon grafia ladina` | 858 |
| 3 | `atamientos eksternos kon grafia` | 819 |
| 4 | `es la sivdad de` | 759 |
| 5 | `referensias atamientos eksternos kon` | 642 |
**5-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `atamientos eksternos kon grafia ladina` | 819 |
| 2 | `referensias atamientos eksternos kon grafia` | 642 |
| 3 | `eksternos kon grafia ladina katฤ“ggorรญa` | 509 |
| 4 | `kapitala es la sivdad de` | 449 |
| 5 | `kon grafia ladina katฤ“ggorรญa belediyes` | 303 |
**2-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `a _` | 136,043 |
| 2 | `e _` | 108,724 |
| 3 | `s _` | 99,726 |
| 4 | `d e` | 96,629 |
| 5 | `_ e` | 96,324 |
**3-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `_ d e` | 78,766 |
| 2 | `d e _` | 60,667 |
| 3 | `_ l a` | 41,480 |
| 4 | `e l _` | 39,777 |
| 5 | `l a _` | 39,678 |
**4-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `_ d e _` | 56,438 |
| 2 | `_ l a _` | 31,063 |
| 3 | `_ e l _` | 20,949 |
| 4 | `_ e n _` | 19,353 |
| 5 | `a _ d e` | 16,872 |
**5-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `_ d e _ l` | 14,247 |
| 2 | `_ d e l _` | 12,864 |
| 3 | `o _ d e _` | 12,483 |
| 4 | `a _ d e _` | 12,025 |
| 5 | `s _ d e _` | 11,131 |
### Key Findings
- **Best Perplexity:** 2-gram (subword) with 248
- **Entropy Trend:** Decreases with larger n-grams (more predictable)
- **Coverage:** Top-1000 patterns cover ~31% of corpus
- **Recommendation:** 4-gram or 5-gram for best predictive performance
---
## 3. Markov Chain Evaluation
![Markov Entropy](visualizations/markov_entropy.png)
![Markov Contexts](visualizations/markov_contexts.png)
![Markov Branching](visualizations/markov_branching.png)
### Results
| Context | Variant | Avg Entropy | Perplexity | Branching Factor | Unique Contexts | Predictability |
|---------|---------|-------------|------------|------------------|-----------------|----------------|
| **1** | Word | 0.7341 | 1.663 | 4.31 | 80,061 | 26.6% |
| **1** | Subword | 1.1710 | 2.252 | 8.23 | 1,285 | 0.0% |
| **2** | Word | 0.2459 | 1.186 | 1.59 | 344,604 | 75.4% |
| **2** | Subword | 0.9119 | 1.882 | 4.98 | 10,579 | 8.8% |
| **3** | Word | 0.0977 | 1.070 | 1.17 | 547,473 | 90.2% |
| **3** | Subword | 0.7442 | 1.675 | 3.49 | 52,668 | 25.6% |
| **4** | Word | 0.0388 ๐Ÿ† | 1.027 | 1.06 | 640,118 | 96.1% |
| **4** | Subword | 0.5699 | 1.484 | 2.45 | 183,606 | 43.0% |
### Generated Text Samples (Word-based)
Below are text samples generated from each word-based Markov chain model:
**Context Size 1:**
1. `de su chika komunidad djudia 6 de 1 de un numero 1 11 de querรฉtaro es`
2. `la turkiya antika esnoga i aztekos el fin de hongos la mรกale antika fragua mas visitadas`
3. `el grup de territorio denantes de la sigunda i afrikanos malgrado munchos se topa al sudeste`
**Context Size 2:**
1. `de la libertad san francisco por 51 payises dempuรฉs de la india kon grafia ladina katฤ“ggorรญa zionism...`
2. `en la feria istoria en el 7 de ogusto de el al en ebreo ื›ืœื›ืœื™ืกื˜ un portmanto`
3. `la sivdad espanyola en meksiko referensias atamientos eksternos kon grafia ladina kon varias grafias...`
**Context Size 3:**
1. `kon grafia ladina katฤ“ggorรญa belediyes del estado de washington es uno de los 125 belediyes del esta...`
2. `la sivdad de meksiko en la repuvlika popular kina kon mas de 10 000 a aรฑosa c jeografia`
3. `del estado de veracruz kultura veracruz es una delas mรกs pobladas dela rusia endagora egziste un enl...`
**Context Size 4:**
1. `kon grafia ladina katฤ“ggorรญa departamentos de guatemala`
2. `eksternos kon grafia ladina katฤ“ggorรญa istorya de kina`
3. `atamientos eksternos kon grafia ladina de madrid de madrid kon mas de 1 000 moradores kon asentamien...`
### Generated Text Samples (Subword-based)
Below are text samples generated from each subword-based Markov chain model:
**Context Size 1:**
1. `_dejurlaya_bamoj`
2. `a:la_s_tiko_e_e_`
3. `espe_duvdon_tun_`
**Context Size 2:**
1. `a_en_de_i_audisha`
2. `e_la_kolde_las_ch`
3. `s_en_ritot_oy_chi`
**Context Size 3:**
1. `_de_los_fraguatl_o`
2. `de_โ€“_worldโ€™s_way._`
3. `_la_carle_de_se_in`
**Context Size 4:**
1. `_de_termistion,_gin`
2. `_la_ser_for_tresรฉnd`
3. `_el_tresendiya_ay_u`
### Key Findings
- **Best Predictability:** Context-4 (word) with 96.1% predictability
- **Branching Factor:** Decreases with context size (more deterministic)
- **Memory Trade-off:** Larger contexts require more storage (183,606 contexts)
- **Recommendation:** Context-3 or Context-4 for text generation
---
## 4. Vocabulary Analysis
![Zipf's Law](visualizations/zipf_law.png)
![Top Words](visualizations/top20_words.png)
![Coverage Curve](visualizations/vocab_coverage.png)
### Statistics
| Metric | Value |
|--------|-------|
| Vocabulary Size | 32,887 |
| Total Tokens | 724,627 |
| Mean Frequency | 22.03 |
| Median Frequency | 3 |
| Frequency Std Dev | 442.51 |
### Most Common Words
| Rank | Word | Frequency |
|------|------|-----------|
| 1 | de | 56,587 |
| 2 | la | 31,911 |
| 3 | el | 21,691 |
| 4 | en | 20,558 |
| 5 | i | 17,448 |
| 6 | del | 12,991 |
| 7 | kon | 11,057 |
| 8 | es | 10,781 |
| 9 | los | 9,929 |
| 10 | ke | 7,038 |
### Least Common Words (from vocabulary)
| Rank | Word | Frequency |
|------|------|-----------|
| 1 | radia | 2 |
| 2 | syon | 2 |
| 3 | radiasyon | 2 |
| 4 | cygnus | 2 |
| 5 | yoshlar | 2 |
| 6 | qashqadaryolik | 2 |
| 7 | ibrat | 2 |
| 8 | farzandlari | 2 |
| 9 | oสปzbekcha | 2 |
| 10 | karluka | 2 |
### Zipf's Law Analysis
| Metric | Value |
|--------|-------|
| Zipf Coefficient | 1.0211 |
| Rยฒ (Goodness of Fit) | 0.997834 |
| Adherence Quality | **excellent** |
### Coverage Analysis
| Top N Words | Coverage |
|-------------|----------|
| Top 100 | 48.4% |
| Top 1,000 | 69.1% |
| Top 5,000 | 84.5% |
| Top 10,000 | 90.6% |
### Key Findings
- **Zipf Compliance:** Rยฒ=0.9978 indicates excellent adherence to Zipf's law
- **High Frequency Dominance:** Top 100 words cover 48.4% of corpus
- **Long Tail:** 22,887 words needed for remaining 9.4% coverage
---
## 5. Word Embeddings Evaluation
![Embedding Isotropy](visualizations/embedding_isotropy.png)
![Similarity Matrix](visualizations/embedding_similarity.png)
![t-SNE Words](visualizations/tsne_words.png)
![t-SNE Sentences](visualizations/tsne_sentences.png)
### 5.1 Cross-Lingual Alignment
![Alignment Quality](visualizations/embedding_alignment_quality.png)
![Multilingual t-SNE](visualizations/embedding_tsne_multilingual.png)
### 5.2 Model Comparison
| Model | Dimension | Isotropy | Semantic Density | Alignment R@1 | Alignment R@10 |
|-------|-----------|----------|------------------|---------------|----------------|
| **mono_32d** | 32 | 0.8013 ๐Ÿ† | 0.3223 | N/A | N/A |
| **mono_64d** | 64 | 0.6133 | 0.3071 | N/A | N/A |
| **mono_128d** | 128 | 0.1352 | 0.2792 | N/A | N/A |
| **aligned_32d** | 32 | 0.8013 | 0.3333 | 0.0580 | 0.2520 |
| **aligned_64d** | 64 | 0.6133 | 0.3150 | 0.0740 | 0.3240 |
| **aligned_128d** | 128 | 0.1352 | 0.2795 | 0.1260 | 0.4300 |
### Key Findings
- **Best Isotropy:** mono_32d with 0.8013 (more uniform distribution)
- **Semantic Density:** Average pairwise similarity of 0.3061. Lower values indicate better semantic separation.
- **Alignment Quality:** Aligned models achieve up to 12.6% 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 | **0.020** | Low formulaic 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 |
|--------|----------|
| `-a` | ashana, afektados, asyatika |
| `-s` | syeklo, self, soldiers |
| `-m` | montalvo, mode, mediterrรกneo |
| `-k` | kuantos, kolleksioner, kuvrirse |
| `-t` | tradiciรณn, tersio, tributo |
| `-p` | plano, pearce, polrec |
| `-b` | beijing, burn, bordj |
| `-ma` | marks, malayali, martรญn |
#### Productive Suffixes
| Suffix | Examples |
|--------|----------|
| `-s` | chafarinas, viejas, afektados |
| `-a` | ashana, goa, estaba |
| `-o` | plano, montalvo, mediterrรกneo |
| `-os` | afektados, espozos, kuantos |
| `-n` | occupation, tradiciรณn, divisiรณn |
| `-es` | estatales, iguales, miques |
| `-as` | chafarinas, viejas, venideras |
| `-on` | occupation, foundation, emigration |
### 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 |
|------|----------|------------------|----------|
| `ensi` | 1.69x | 66 contexts | pensi, kensi, sensia |
| `ient` | 1.69x | 46 contexts | siente, orient, viento |
| `ento` | 1.75x | 34 contexts | lento, vento, tento |
| `asio` | 1.67x | 40 contexts | nasio, dasio, lasio |
| `djud` | 1.94x | 20 contexts | djudo, djudรญa, adjudo |
| `tado` | 1.50x | 48 contexts | matado, metado, estado |
| `tern` | 1.77x | 25 contexts | stern, shtern, eterna |
| `iona` | 1.73x | 26 contexts | lisiona, adisiona, mensiona |
| `eren` | 1.89x | 19 contexts | keren, serena, ferenc |
| `ntos` | 1.90x | 17 contexts | santos, pontos, puntos |
| `graf` | 1.70x | 23 contexts | grafia, grafos, grafรญa |
| `entr` | 1.51x | 34 contexts | entre, entry, entrรณ |
### 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 |
|--------|--------|-----------|----------|
| `-a` | `-s` | 136 words | antikos, ankontrados |
| `-p` | `-s` | 131 words | pons, puerporasiones |
| `-a` | `-o` | 130 words | ameyalco, adisionado |
| `-a` | `-a` | 121 words | ailuropoda, aa |
| `-m` | `-s` | 119 words | malvinas, materials |
| `-k` | `-s` | 119 words | konsejos, kolores |
| `-e` | `-s` | 118 words | establesidas, empieses |
| `-k` | `-a` | 104 words | kaskadya, kateggoriya |
| `-e` | `-a` | 104 words | editora, esmirna |
| `-p` | `-a` | 92 words | preistorya, pionera |
### 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 |
|------|-----------------|------------|------|
| respublika | **`re-s-publika`** | 7.5 | `publika` |
| estatales | **`estat-al-es`** | 7.5 | `al` |
| ensinyansas | **`ensinyan-s-as`** | 7.5 | `s` |
| organisar | **`organi-s-ar`** | 7.5 | `s` |
| entenderse | **`entender-s-e`** | 7.5 | `s` |
| preistoria | **`p-re-istoria`** | 7.5 | `istoria` |
| lavoraron | **`lavor-ar-on`** | 7.5 | `ar` |
| valenzuela | **`valenzu-e-la`** | 7.5 | `e` |
| tempranas | **`tempr-an-as`** | 7.5 | `an` |
| espozaron | **`espoz-ar-on`** | 7.5 | `ar` |
| kolonialo | **`koloni-al-o`** | 7.5 | `al` |
| apropriado | **`apropri-a-do`** | 7.5 | `a` |
| parinacota | **`parinac-o-ta`** | 7.5 | `o` |
| universalo | **`univers-al-o`** | 7.5 | `al` |
| israelitas | **`israeli-ta-s`** | 7.5 | `ta` |
### 6.6 Linguistic Interpretation
> **Automated Insight:**
The language Ladino shows high morphological productivity. The subword models are significantly more efficient than word models, suggesting a rich system of affixation or compounding.
---
## 7. Summary & Recommendations
![Performance Dashboard](visualizations/performance_dashboard.png)
### Production Recommendations
| Component | Recommended | Rationale |
|-----------|-------------|-----------|
| Tokenizer | **64k BPE** | Best compression (4.56x) |
| N-gram | **2-gram** | Lowest perplexity (248) |
| Markov | **Context-4** | Highest predictability (96.1%) |
| 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
1. **Compare within model families:** Metrics are most meaningful when comparing models of the same type (e.g., 8k vs 64k tokenizer).
2. **Consider trade-offs:** Better performance on one metric often comes at the cost of another (e.g., compression vs. OOV rate).
3. **Context matters:** Optimal values depend on downstream tasks. Text generation may prioritize different metrics than classification.
4. **Corpus influence:** All metrics are influenced by corpus characteristics. Wikipedia text differs from social media or literature.
5. **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](https://huggingface.co/datasets/omarkamali/wikipedia-monthly) - a monthly snapshot of Wikipedia articles across 300+ languages.
### Project
A project by **[Wikilangs](https://wikilangs.org)** - Open-source NLP models for every Wikipedia language.
### Maintainer
[Omar Kamali](https://omarkamali.com) - [Omneity Labs](https://omneitylabs.com)
### Citation
If you use these models in your research, please cite:
```bibtex
@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](https://wikilangs.org)
- ๐Ÿค— Models: [huggingface.co/wikilangs](https://huggingface.co/wikilangs)
- ๐Ÿ“Š Data: [wikipedia-monthly](https://huggingface.co/datasets/omarkamali/wikipedia-monthly)
- ๐Ÿ‘ค Author: [Omar Kamali](https://huggingface.co/omarkamali)
- ๐Ÿค Sponsor: [Featherless AI](https://featherless.ai)
---
*Generated by Wikilangs Models Pipeline*
*Report Date: 2026-01-10 10:17:28*