Northern Sotho - Wikilangs Models
Comprehensive Research Report & Full Ablation Study
This repository contains NLP models trained and evaluated by Wikilangs, specifically on Northern Sotho 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.741x | 3.75 | 0.2441% | 110,594 |
| 16k | 3.926x | 3.94 | 0.2562% | 105,380 |
| 32k | 4.058x π | 4.07 | 0.2648% | 101,960 |
Tokenization Examples
Below are sample sentences tokenized with each vocabulary size:
Sample 1: This can be one of several places: Ophondweni, Jozini Ophondweni, Mtubatuba Opho...
| Vocab | Tokens | Count |
|---|---|---|
| 8k | βthis βcan βbe βone βof βseve ral βplaces : βophondweni ... (+8 more) |
18 |
| 16k | βthis βcan βbe βone βof βseveral βplaces : βophondweni , ... (+7 more) |
17 |
| 32k | βthis βcan βbe βone βof βseveral βplaces : βophondweni , ... (+7 more) |
17 |
Sample 2: (MMXIX)) ke ngwaga wa go thoma ka Labobedi ebile ke ngwaga wa boleΕ‘ome wa ngwaga...
| Vocab | Tokens | Count |
|---|---|---|
| 8k | β( mm xix )) βke βngwaga βwa βgo βthoma βka ... (+11 more) |
21 |
| 16k | β( mm xix )) βke βngwaga βwa βgo βthoma βka ... (+10 more) |
20 |
| 32k | β( mmxix )) βke βngwaga βwa βgo βthoma βka βlabobedi ... (+8 more) |
18 |
Sample 3: MmuΕ‘Γ΄gaΓͺ wa Umzumbe ke mmasepala go feta Mmasepala Setereke tΕ‘a Ugu ka moka Afri...
| Vocab | Tokens | Count |
|---|---|---|
| 8k | βmmuΕ‘Γ΄gaΓͺ βwa βum zumbe βke βmmasepala βgo βfeta βmmasepala βsetereke ... (+8 more) |
18 |
| 16k | βmmuΕ‘Γ΄gaΓͺ βwa βumzumbe βke βmmasepala βgo βfeta βmmasepala βsetereke βtΕ‘a ... (+7 more) |
17 |
| 32k | βmmuΕ‘Γ΄gaΓͺ βwa βumzumbe βke βmmasepala βgo βfeta βmmasepala βsetereke βtΕ‘a ... (+7 more) |
17 |
Key Findings
- Best Compression: 32k achieves 4.058x compression
- Lowest UNK Rate: 8k with 0.2441% 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,877 | 10.87 | 8,796 | 35.8% | 68.5% |
| 2-gram | Subword | 175 π | 7.45 | 1,382 | 78.3% | 99.9% |
| 3-gram | Word | 2,747 | 11.42 | 13,343 | 31.7% | 62.0% |
| 3-gram | Subword | 1,000 | 9.97 | 11,137 | 42.2% | 86.0% |
| 4-gram | Word | 4,494 | 12.13 | 23,362 | 26.3% | 55.5% |
| 4-gram | Subword | 3,469 | 11.76 | 44,498 | 26.2% | 64.9% |
| 5-gram | Word | 4,124 | 12.01 | 17,998 | 24.2% | 56.4% |
| 5-gram | Subword | 7,565 | 12.89 | 83,147 | 19.5% | 51.9% |
Top 5 N-grams by Size
2-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | ngwaga wa |
7,528 |
| 2 | afrika borwa |
4,128 |
| 3 | ka moka |
3,009 |
| 4 | yeo e |
2,782 |
| 5 | go feta |
2,753 |
3-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | ka moka afrika |
2,525 |
| 2 | moka afrika borwa |
2,525 |
| 3 | mmasepala setereke tΕ‘a |
2,377 |
| 4 | afrika borwa ditΕ‘hupetΕ‘o |
2,354 |
| 5 | go thoma ka |
2,305 |
4-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | ka moka afrika borwa |
2,525 |
| 2 | wa go thoma ka |
2,264 |
| 3 | moka afrika borwa ditΕ‘hupetΕ‘o |
2,034 |
| 4 | ke nomoro yeo e |
1,953 |
| 5 | nomoro yeo e elego |
1,951 |
5-grams (Word):
| Rank | N-gram | Count |
|---|---|---|
| 1 | ka moka afrika borwa ditΕ‘hupetΕ‘o |
2,034 |
| 2 | ke nomoro yeo e elego |
1,951 |
| 3 | yeo e elego magareng ga |
1,950 |
| 4 | nomoro yeo e elego magareng |
1,950 |
| 5 | ngwaga wa go thoma ka |
1,531 |
2-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | a _ |
147,261 |
| 2 | e _ |
94,060 |
| 3 | o _ |
75,200 |
| 4 | w a |
59,917 |
| 5 | g o |
47,431 |
3-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | w a _ |
27,531 |
| 2 | k a _ |
25,523 |
| 3 | g o _ |
25,104 |
| 4 | l e _ |
24,070 |
| 5 | _ w a |
22,774 |
4-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | _ w a _ |
22,475 |
| 2 | n g w a |
20,389 |
| 3 | g w a g |
19,806 |
| 4 | _ n g w |
19,716 |
| 5 | _ k a _ |
15,852 |
5-grams (Subword):
| Rank | N-gram | Count |
|---|---|---|
| 1 | n g w a g |
19,778 |
| 2 | _ n g w a |
19,683 |
| 3 | g w a g a |
13,412 |
| 4 | k g o l o |
12,563 |
| 5 | a _ w a _ |
8,468 |
Key Findings
- Best Perplexity: 2-gram (subword) with 175
- Entropy Trend: Decreases with larger n-grams (more predictable)
- Coverage: Top-1000 patterns cover ~52% 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.7438 | 1.675 | 4.33 | 27,751 | 25.6% |
| 1 | Subword | 1.1468 | 2.214 | 9.66 | 307 | 0.0% |
| 2 | Word | 0.2865 | 1.220 | 1.70 | 119,289 | 71.4% |
| 2 | Subword | 1.0606 | 2.086 | 6.36 | 2,962 | 0.0% |
| 3 | Word | 0.1248 | 1.090 | 1.23 | 201,609 | 87.5% |
| 3 | Subword | 0.8492 | 1.801 | 3.87 | 18,823 | 15.1% |
| 4 | Word | 0.0569 π | 1.040 | 1.10 | 246,105 | 94.3% |
| 4 | Subword | 0.5827 | 1.498 | 2.38 | 72,828 | 41.7% |
Generated Text Samples (Word-based)
Below are text samples generated from each word-based Markov chain model:
Context Size 1:
wa ngwagakete 1 le a kgomaretΕ‘a afrika borwa ditΕ‘hupetΕ‘o wa ngwagakgolo 5 213 560 860 gommeka difiliming le koranta ya ferguson ya africa gallery then serving only you never gave usgo feta mmuΕ‘Γ΄selegae wa bomasomesenyane senyane ke vredendal wellington ke village wa mmuΕ‘Γ΄gaΓͺ wa ng...
Context Size 2:
ngwaga wa go thoma ka 1 pherekgong 320 ya fela ka morago letΕ‘atΕ‘ing lona leo la sesothoafrika borwa toropo kgolo wa letsemeng go feta mmuΕ‘Γ΄selegae wa fetakgomo tubatse mmasepala setereke ...ka moka porofense gauteng afrika borwa louis trichardt yeo pele e be e le kereke e fa
Context Size 3:
ka moka afrika borwa wepener ke 84 km borwa bodikela la bloemfontein ditΕ‘hupetΕ‘omoka afrika borwa ditΕ‘hupetΕ‘o mmusogae mmusogaemmasepala setereke tΕ‘a nkangala wa porofense mpumalanga ka moka afrika borwa e bontΕ‘ha se 587 154 85...
Context Size 4:
ka moka afrika borwa ditΕ‘hupetΕ‘o mmusogae history ka mokopane e be e bitΕ‘wa yunibesithi ya bophuthat...wa go thoma ka 1 pherekgong ya fela ka 31 manthole ngwagasome o wela ngwagengkgolo wa 12ke nomoro yeo e elego magareng ga sekete makgolosenyane masomeseswai tshela ke nomoro yeo e elego ma...
Generated Text Samples (Subword-based)
Below are text samples generated from each subword-based Markov chain model:
Context Size 1:
_ya_ma_hlego_di,a_maga_ka_fenapaeoladegagwa_gomu
Context Size 2:
a_peditina_to_50se_to_makgole_na_mo_moka_jo_1,_go_w
Context Size 3:
wa_ndlovu_go_feme.ka_bodikete_wa_go_go_thatobo_ngwaga_
Context Size 4:
_wa_ngwaga_wa_boithngwagengkete_2.1_pigwaga_wa_blue_whole
Key Findings
- Best Predictability: Context-4 (word) with 94.3% predictability
- Branching Factor: Decreases with context size (more deterministic)
- Memory Trade-off: Larger contexts require more storage (72,828 contexts)
- Recommendation: Context-3 or Context-4 for text generation
4. Vocabulary Analysis
Statistics
| Metric | Value |
|---|---|
| Vocabulary Size | 12,853 |
| Total Tokens | 414,233 |
| Mean Frequency | 32.23 |
| Median Frequency | 4 |
| Frequency Std Dev | 392.25 |
Most Common Words
| Rank | Word | Frequency |
|---|---|---|
| 1 | wa | 22,490 |
| 2 | ka | 15,960 |
| 3 | go | 15,871 |
| 4 | le | 14,392 |
| 5 | ya | 10,575 |
| 6 | ke | 9,273 |
| 7 | e | 9,250 |
| 8 | ngwaga | 7,952 |
| 9 | a | 7,812 |
| 10 | tΕ‘a | 5,967 |
Least Common Words (from vocabulary)
| Rank | Word | Frequency |
|---|---|---|
| 1 | discipline | 2 |
| 2 | coach | 2 |
| 3 | drills | 2 |
| 4 | mentorship | 2 |
| 5 | accuracy | 2 |
| 6 | leagues | 2 |
| 7 | save | 2 |
| 8 | rekhotso | 2 |
| 9 | uttar | 2 |
| 10 | pradesh | 2 |
Zipf's Law Analysis
| Metric | Value |
|---|---|
| Zipf Coefficient | 1.1658 |
| RΒ² (Goodness of Fit) | 0.993219 |
| Adherence Quality | excellent |
Coverage Analysis
| Top N Words | Coverage |
|---|---|
| Top 100 | 62.1% |
| Top 1,000 | 83.7% |
| Top 5,000 | 94.7% |
| Top 10,000 | 98.6% |
Key Findings
- Zipf Compliance: RΒ²=0.9932 indicates excellent adherence to Zipf's law
- High Frequency Dominance: Top 100 words cover 62.1% of corpus
- Long Tail: 2,853 words needed for remaining 1.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.3848 π | 0.4271 | N/A | N/A |
| mono_64d | 64 | 0.0854 | 0.4240 | N/A | N/A |
| mono_128d | 128 | 0.0110 | 0.4112 | N/A | N/A |
| aligned_32d | 32 | 0.3848 | 0.4278 | 0.0160 | 0.1360 |
| aligned_64d | 64 | 0.0854 | 0.4247 | 0.0140 | 0.1520 |
| aligned_128d | 128 | 0.0110 | 0.4306 | 0.0300 | 0.1500 |
Key Findings
- Best Isotropy: mono_32d with 0.3848 (more uniform distribution)
- Semantic Density: Average pairwise similarity of 0.4242. Lower values indicate better semantic separation.
- Alignment Quality: Aligned models achieve up to 3.0% 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.087 | 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 |
|---|---|
-m |
mural, marope, msukaligwa |
-ma |
marope, mahlo, max |
-di |
dikete, diketekete, diakone |
-b |
balega, baile, barwarre |
-mo |
molato, moeti, mosweu |
-s |
sutherland, syncerus, senyane |
-se |
senyane, sehlare, sedibeng |
-bo |
bophara, botΕ‘a, botala |
Productive Suffixes
| Suffix | Examples |
|---|---|
-a |
balega, latofatΕ‘wa, kgethwa |
-e |
baile, marope, barwarre |
-o |
tiro, do, molato |
-ng |
tΕ‘oanang, kgang, tiriΕ‘ong |
-go |
lemorago, makatΕ‘ago, paletΕ‘wego |
-g |
tΕ‘oanang, kgang, tiriΕ‘ong |
-i |
zweli, moeti, dzanani |
-le |
baile, lepelle, edenville |
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 |
|---|---|---|---|
ditΕ‘ |
1.75x | 14 contexts | ditΕ‘o, ditΕ‘ie, ditΕ‘ong |
nyan |
1.43x | 23 contexts | nyane, nyana, nnyane |
ngwa |
1.33x | 29 contexts | ngwana, ngwale, mongwa |
etΕ‘o |
1.76x | 12 contexts | metΕ‘o, setΕ‘o, letΕ‘o |
thom |
1.49x | 18 contexts | thome, thoma, thomo |
akgo |
1.57x | 15 contexts | akgofa, makgolo, makgomo |
makg |
1.67x | 11 contexts | makga, makgolo, makgabo |
hlan |
1.40x | 16 contexts | hlano, hlangwa, mahlano |
tshe |
1.43x | 14 contexts | tshepo, tshela, tsheko |
enya |
1.31x | 14 contexts | fenya, kenya, senya |
yane |
1.47x | 10 contexts | nyane, moyane, nnyane |
lano |
1.56x | 8 contexts | hlano, mahlano, bohlano |
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 |
|---|---|---|---|
-m |
-a |
176 words | moima, mohlakola |
-di |
-o |
169 words | dihlaloso, ditumelo |
-t |
-o |
143 words | tΕ‘ewego, tshwarelo |
-m |
-e |
133 words | meferefere, molatswanene |
-m |
-o |
128 words | madondo, motsotso |
-m |
-i |
127 words | mesebetsi, mlangeni |
-m |
-g |
113 words | meetsing, madireng |
-m |
-ng |
107 words | meetsing, madireng |
-b |
-o |
107 words | boso, butΕ‘wego |
-b |
-i |
102 words | bofokodi, bisi |
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 |
|---|---|---|---|
| producing | produc-i-ng |
7.5 | i |
| dintlhakgolo | dintlhak-go-lo |
7.5 | go |
| koringberg | koringb-e-rg |
7.5 | e |
| tΕ‘hiΕ‘inyego | tΕ‘hiΕ‘iny-e-go |
7.5 | e |
| sepetlele | sepet-le-le |
7.5 | le |
| riversdale | riversd-a-le |
7.5 | a |
| madingoane | madingo-a-ne |
7.5 | a |
| kolokotela | kolokot-e-la |
7.5 | e |
| bohlabani | bohlab-a-ni |
7.5 | a |
| christiana | christi-a-na |
7.5 | a |
| ditΕ‘habeng | ditΕ‘hab-e-ng |
7.5 | e |
| pherekgong | pherek-go-ng |
7.5 | go |
| bolekgolo | bo-le-kgolo |
7.5 | kgolo |
| lokologile | lokolog-i-le |
7.5 | i |
| fihlellwa | fihlel-l-wa |
7.5 | l |
6.6 Linguistic Interpretation
Automated Insight: The language Northern Sotho 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
Production Recommendations
| Component | Recommended | Rationale |
|---|---|---|
| Tokenizer | 32k BPE | Best compression (4.06x) |
| N-gram | 2-gram | Lowest perplexity (175) |
| Markov | Context-4 | Highest predictability (94.3%) |
| 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-10 16:13:47



















