Sinhala - Wikilangs Models

Comprehensive Research Report & Full Ablation Study

This repository contains NLP models trained and evaluated by Wikilangs, specifically on Sinhala 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

Analysis and Evaluation


1. Tokenizer Evaluation

Tokenizer Compression

Tokenizer Fertility

Tokenizer OOV

Total Tokens

Results

Vocab Size Compression Avg Token Len UNK Rate Total Tokens
8k 3.460x 3.46 0.0794% 1,490,772
16k 3.888x 3.89 0.0892% 1,326,900
32k 4.268x 4.27 0.0979% 1,208,595
64k 4.567x 🏆 4.57 0.1047% 1,129,426

Tokenization Examples

Below are sample sentences tokenized with each vocabulary size:

Sample 1: බක් අව අටවක තිථියට අනුරූපී පෝය දවස බක් අව අටවක පෝය නම් වේ. මූලාශ්‍ර අටවක ඇ.1

Vocab Tokens Count
8k ▁බක් ▁අව ▁අටවක ▁තිථියට ▁අනුරූප ී ▁පෝය ▁දවස ▁බක් ▁අව ... (+10 more) 20
16k ▁බක් ▁අව ▁අටවක ▁තිථියට ▁අනුරූපී ▁පෝය ▁දවස ▁බක් ▁අව ▁අටවක ... (+9 more) 19
32k ▁බක් ▁අව ▁අටවක ▁තිථියට ▁අනුරූපී ▁පෝය ▁දවස ▁බක් ▁අව ▁අටවක ... (+9 more) 19
64k ▁බක් ▁අව ▁අටවක ▁තිථියට ▁අනුරූපී ▁පෝය ▁දවස ▁බක් ▁අව ▁අටවක ... (+9 more) 19

Sample 2: උපත් පිලිප් රජතුමා යනු බෙල්ජියමේ රජතුමා වේ. බෙල්ජියමේ රජ පවුල

Vocab Tokens Count
8k ▁උපත් ▁පිලිප් ▁රජතුමා ▁යනු ▁බෙල්ජිය මේ ▁රජතුමා ▁වේ . ▁බෙල්ජිය ... (+3 more) 13
16k ▁උපත් ▁පිලිප් ▁රජතුමා ▁යනු ▁බෙල්ජියමේ ▁රජතුමා ▁වේ . ▁බෙල්ජියමේ ▁රජ ... (+1 more) 11
32k ▁උපත් ▁පිලිප් ▁රජතුමා ▁යනු ▁බෙල්ජියමේ ▁රජතුමා ▁වේ . ▁බෙල්ජියමේ ▁රජ ... (+1 more) 11
64k ▁උපත් ▁පිලිප් ▁රජතුමා ▁යනු ▁බෙල්ජියමේ ▁රජතුමා ▁වේ . ▁බෙල්ජියමේ ▁රජ ... (+1 more) 11

Sample 3: වසාවාසි () යනු කුළු බඩු විශේෂයකි. මූලාශ්‍ර ආශ්‍රිත සගන්ධ තෙල් සාදික්කා බඩු

Vocab Tokens Count
8k ▁වස ාවා සි ▁() ▁යනු ▁කු ළු ▁බ ඩු ▁විශේෂයකි ... (+12 more) 22
16k ▁වස ාවා සි ▁() ▁යනු ▁කුළු ▁බඩු ▁විශේෂයකි . ▁මූලාශ්‍ර ... (+8 more) 18
32k ▁වසාවාසි ▁() ▁යනු ▁කුළු ▁බඩු ▁විශේෂයකි . ▁මූලාශ්‍ර ▁ආශ්‍රිත ▁සග ... (+4 more) 14
64k ▁වසාවාසි ▁() ▁යනු ▁කුළු ▁බඩු ▁විශේෂයකි . ▁මූලාශ්‍ර ▁ආශ්‍රිත ▁සගන්ධ ... (+3 more) 13

Key Findings

  • Best Compression: 64k achieves 4.567x compression
  • Lowest UNK Rate: 8k with 0.0794% 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

N-gram Unique

N-gram Coverage

Results

N-gram Variant Perplexity Entropy Unique N-grams Top-100 Coverage Top-1000 Coverage
2-gram Word 91,979 16.49 262,122 6.4% 17.0%
2-gram Subword 2,119 🏆 11.05 50,624 32.0% 72.3%
3-gram Word 150,233 17.20 288,151 3.5% 11.6%
3-gram Subword 20,524 14.33 333,353 10.5% 33.2%
4-gram Word 393,476 18.59 561,828 2.2% 6.9%
4-gram Subword 119,419 16.87 1,506,827 5.6% 18.0%
5-gram Word 312,338 18.25 419,011 2.5% 7.2%
5-gram Subword 385,462 18.56 3,075,495 3.4% 11.6%

Top 5 N-grams by Size

2-grams (Word):

Rank N-gram Count
1 වන අතර 18,056
2 කරන ලදී 14,152
3 කරන ලද 12,560
4 වූ අතර 10,420
5 අතර එය 8,750

3-grams (Word):

Rank N-gram Count
1 වන අතර එය 2,889
2 කරන ලද අතර 2,759
3 කර ඇති අතර 1,579
4 බවට පත් විය 1,565
5 ප්‍රාදේශීය ලේකම් කොට්ඨාසය 1,405

4-grams (Word):

Rank N-gram Count
1 සඳහා ප්‍රතිඵල අපේක්ෂකයාපක්ෂයසංකේතයඡන්ද සංඛ්‍යාව 919
2 පාර්ලිමේන්තු මැතිවරණයෙහි මෙම මැතිවරණ 914
3 ඡන්ද ඡන්ද ඡන්දදායක භාවිත 819
4 ඡන්ද ඡන්ද ඡන්ද ඡන්දදායක 819
5 ලංකාවේ ප්‍රාදේශීය ලේකම් කොට්ඨාස 649

5-grams (Word):

Rank N-gram Count
1 ඡන්ද ඡන්ද ඡන්ද ඡන්දදායක භාවිත 819
2 ඡන්ද ඡන්ද ඡන්දදායක භාවිත කිරීමේ 555
3 on wikidata using gadget wikiminiatlas 428
4 ta m 1 5 3 418
5 බැඳිය විසින් මුළු දින දසුන 415

2-grams (Subword):

Rank N-gram Count
1 ය _ 775,809
2 න් _ 649,429
3 . _ 564,248
4 _ අ 537,926
5 න _ 506,185

3-grams (Subword):

Rank N-gram Count
1 _ ස හ 149,125
2 _ ප්‍ ර 144,256
3 _ ක ර 142,975
4 ස හ _ 136,850
5 ව න _ 132,647

4-grams (Subword):

Rank N-gram Count
1 _ ස හ _ 136,177
2 _ අ ත ර 100,547
3 _ ව න _ 79,031
4 අ ත ර _ 68,009
5 _ ලෙ ස _ 64,807

5-grams (Subword):

Rank N-gram Count
1 _ අ ත ර _ 67,941
2 _ ක ර න _ 50,645
3 _ t h e _ 50,119
4 _ ස ඳ හා _ 46,525
5 _ වි සි න් _ 43,861

Key Findings

  • Best Perplexity: 2-gram (subword) with 2,119
  • Entropy Trend: Decreases with larger n-grams (more predictable)
  • Coverage: Top-1000 patterns cover ~12% of corpus
  • Recommendation: 4-gram or 5-gram for best predictive performance

3. Markov Chain Evaluation

Markov Entropy

Markov Contexts

Markov Branching

Results

Context Variant Avg Entropy Perplexity Branching Factor Unique Contexts Predictability
1 Word 0.8654 1.822 8.35 622,772 13.5%
1 Subword 0.9820 1.975 12.62 11,028 1.8%
2 Word 0.2799 1.214 1.70 5,190,673 72.0%
2 Subword 0.7847 1.723 5.98 139,154 21.5%
3 Word 0.0782 1.056 1.14 8,825,385 92.2%
3 Subword 0.5783 1.493 3.73 832,002 42.2%
4 Word 0.0239 🏆 1.017 1.03 9,999,542 97.6%
4 Subword 0.4793 1.394 2.50 3,101,075 52.1%

Generated Text Samples (Word-based)

Below are text samples generated from each word-based Markov chain model:

Context Size 1:

  1. සහ සැමුවෙල් බේකර් ඇල්ල හා මිනිස් ඇසුරින් මෙහිදී ඩිජිටල් අධ්‍යාපන අමාත්‍යාංශයේ නියෝජිතායතනයක් ද ඇගේ ක...
  2. අතර සංකීර්ණ ක්‍රම නිර්වචනය වන්නේ ඒවායේ කොටස් වලින් මෙම ද්විමණ්ඩල පාර්ලිමේන්තුව මත තීන්ත ඒවා සමහරක් ඇ...
  3. වන ඔහු අභියාචනාධිකරණයට අභියාචනා අධිකරණය විසින් නොවැම්බර් 21 උප්පත්තියෙන්ම ලබන පගසම් pagasam එකකි ඓති...

Context Size 2:

  1. වන අතර මුස්ලිම් සංස්කෘතිය මාලදිවයිනේ පැලපදියම් වීමට නම් එය ලිංගික ප්‍රදේශ ස්පර්ශ කිරීමක් වීම ද සිදු ...
  2. කරන ලදී එහෙත් ඔඩිසි සහ ඉලියඩ් සඳහා පෙළඹීමද වූ බව පැවසේ එවක පැවති ඉංග්‍රීසි පාලකයන්ට විරුද්ධව අරගලයක
  3. කරන ලද වඩාත් අභිලාෂකාමී මූර්ති උත්සාහ කර ඇත එම සංකේතනය මඟින් අන්තර්ගතය පිටපත් කිරීම පිලිබඳ ජාතික කමි...

Context Size 3:

  1. වන අතර එය මුලින් අයිරෝ වීල් ගුවන් වීල් සහ රොන් දණ්ඩ ලෙසද හැඳින්වේ රෝද නිර්මාණය විශාල රෝදය සමාන්තරව
  2. කරන ලද අතර එය මගින් ප්‍රාරම්භක අවස්ථාවේ අවහිර කරන ලද ගීතයන් ජර්මනියේ යූ ටියුබ් ප්‍රේක්ෂකයින්ට අලෙවි ...
  3. කර ඇති අතර සමාගම්වල ප්‍රතිලාභී හිමිකාරිත්ව තොරතුරු සත්‍යාපනය කර ඇති අතර එසේ වුවද ආණ්ඩුක්‍රම ව්‍යවස්ථ...

Context Size 4:

  1. සඳහා ප්‍රතිඵල අපේක්ෂකයාපක්ෂයසංකේතයඡන්ද සංඛ්‍යාව ඒ එම් මොහමඩ් ජලාල්දීන්එක්සත් ජාතික කනගරත්නම්දෙමළ එක්...
  2. පාර්ලිමේන්තු මැතිවරණයෙහි මෙම මැතිවරණ කොට්ඨාසය සඳහා ප්‍රතිඵල අපේක්ෂකයාපක්ෂයසංකේතයඡන්ද සංඛ්‍යාව එම් සී...
  3. ඡන්ද ඡන්ද ඡන්ද ඡන්දදායක භාවිත කිරීමේ පාර්ලිමේන්තු මහා මැතිවරණය 5 අප්‍රේල් සහ 10 අප්‍රේල් කාලය අතරතුර...

Generated Text Samples (Subword-based)

Below are text samples generated from each subword-based Markov chain model:

Context Size 1:

  1. _bsto_එහිමිදුසුවභාවර_
  2. යම,_සමාද්‍ය_පාසහඳු_ca
  3. වය"_nin_ත_සයි._රක්

Context Size 2:

  1. ය_සමාන_ලබා_ඇත්තේ_සල්වැසි
  2. න්_සම_ක්‍රමය:_hows_m
  3. ._වෙනත්_(හෙක්ටර්_ලාක්_සාග

Context Size 3:

  1. _සහ_කවි_ඔට්ජොසොන්_අස්_වූ_
  2. _ප්‍රදේශයේ_ජයග්‍රහලෝකයක්_ලැ
  3. _කරනු_ලැබේ._එසේ_පිහිටුවීමේ_

Context Size 4:

  1. _සහ_සංවර්ධනය_දෙසැම්බර්_15
  2. _අතර,_ඊජිප්තුවේ_දෙවන_චීන_
  3. _වන_අතර,_කාලාන්තරය._ආර්

Key Findings

  • Best Predictability: Context-4 (word) with 97.6% predictability
  • Branching Factor: Decreases with context size (more deterministic)
  • Memory Trade-off: Larger contexts require more storage (3,101,075 contexts)
  • Recommendation: Context-3 or Context-4 for text generation

4. Vocabulary Analysis

Zipf's Law

Top Words

Coverage Curve

Statistics

Metric Value
Vocabulary Size 264,267
Total Tokens 10,742,411
Mean Frequency 40.65
Median Frequency 4
Frequency Std Dev 643.07

Most Common Words

Rank Word Frequency
1 සහ 137,360
2 අතර 95,187
3 වන 79,704
4 ලෙස 67,370
5 හා 59,489
6 වූ 53,884
7 the 52,310
8 විය 51,836
9 කරන 50,957
10 මෙම 50,905

Least Common Words (from vocabulary)

Rank Word Frequency
1 වොජික් 2
2 ස්ලැට්කොයිච් 2
3 ග්‍රැඩිස්කා 2
4 ග්‍රැඩිෂ්කා 2
5 ටෙසාන්ජ් 2
6 bsp 2
7 gdnp 2
8 මිකොයාන් 2
9 දැවිතෙල් 2
10 ditwah 2

Zipf's Law Analysis

Metric Value
Zipf Coefficient 0.9861
R² (Goodness of Fit) 0.991091
Adherence Quality excellent

Coverage Analysis

Top N Words Coverage
Top 100 22.3%
Top 1,000 47.8%
Top 5,000 69.0%
Top 10,000 77.2%

Key Findings

  • Zipf Compliance: R²=0.9911 indicates excellent adherence to Zipf's law
  • High Frequency Dominance: Top 100 words cover 22.3% of corpus
  • Long Tail: 254,267 words needed for remaining 22.8% coverage

5. Word Embeddings Evaluation

Embedding Isotropy

Similarity Matrix

t-SNE Words

t-SNE Sentences

5.1 Cross-Lingual Alignment

Alignment Quality

Multilingual t-SNE

5.2 Model Comparison

Model Dimension Isotropy Semantic Density Alignment R@1 Alignment R@10
mono_32d 32 0.8352 0.3629 N/A N/A
mono_64d 64 0.8359 0.2849 N/A N/A
mono_128d 128 0.7985 0.2254 N/A N/A
aligned_32d 32 0.8352 0.3678 0.0600 0.2940
aligned_64d 64 0.8359 🏆 0.2739 0.1220 0.4500
aligned_128d 128 0.7985 0.2241 0.2100 0.5660

Key Findings

  • Best Isotropy: aligned_64d with 0.8359 (more uniform distribution)
  • Semantic Density: Average pairwise similarity of 0.2898. Lower values indicate better semantic separation.
  • Alignment Quality: Aligned models achieve up to 21.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.378 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
-ස සිරගතකර, සැදුවේ, සාමාජිකයෙකුගෙන්
-ක කුසලතාපූර්ණ, කෙටවීම, කරණලදී
-ප පරිනත, පමුණවා, ප්‍රමාණන
-ම මෙතර්ඩ්, මොංගල්වරු, මැතිනියට
-ව වුඞ්බරි, විලගෙදර, විචාරයෙන්
-අ අනුප්‍රාණේ, අපහසුම, අපසාරී
-බ බ්‍රහස්පති, බෝයගනේ, බාජන
-න නයිස්, නොපිළිගනී, නංවා

Productive Suffixes

Suffix Examples
-ය ලෝකාන්තය, නොයෙදවිය, කෙරුනේය
-ට දෙවියාට, නිවෙසට, කොලොනියකරණයට
-s australias, chandras, wetas
-ව රජතුමන්ව, එක්ව, නාගමුව
-ම අපහසුම, කෙටවීම, කාව්‍යම
-e fertile, licence, clandestine
-ක ක‍්‍රමික, කුළුණක, කොයික
-a yulia, taifa, nacaduba

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
ther 3.40x 70 contexts ether, thera, other
nter 3.32x 49 contexts unter, inter, enter
atio 3.27x 50 contexts ratio, ratios, ration
inte 3.27x 38 contexts intel, inter, cintec
stor 3.25x 36 contexts stork, store, story
ctio 3.34x 30 contexts action, sectio, auction
pres 3.23x 32 contexts presl, press, preset
ical 3.42x 25 contexts comical, topical, musical
sion 3.38x 26 contexts fusion, vision, passion
indi 3.29x 27 contexts indii, indie, india
mber 3.33x 24 contexts amber, bomber, member
ence 3.27x 23 contexts pence, fence, sence

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
-ප -ය 60 words පුමානය, පීතෘවංශීය
-ප -ට 47 words පතිකුලයට, පීඩාවලට
-ස -ය 47 words ස්තූපය, සුභය
-ස -ට 43 words සුර්යාට, සංස්ලේෂණයට
-ව -ට 41 words විබෙදීමට, වාදයට
-ව -ය 41 words වුල්ෆ්ය, විශිෂ්ටය
-අ -ය 36 words අසබඩය, අභ්‍යන්තරාවරණය
-ක -ය 34 words කිරිමටය, කේතලය
-අ -ට 31 words අශ්වයන්ට, අභිචාරයන්ට
-ක -ට 29 words කලිමන්තන්ට, කවුන්සිලයට

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
ප්‍රදානවල ප්‍රදා-න-වල 7.5
අනුපිළිවෙලටම අනුපිළිවෙල-ට-ම 7.5
ති‍්‍රපිටක ති‍්‍රපි-ට-ක 7.5
ජර්මනියටය ජර්මනි-යට-ය 6.0 ජර්මනි
සොයාගත්තේය සොයාගත්තේ-ය 4.5 සොයාගත්තේ
ව්‍යාපෘතිය ව්‍යාපෘති-ය 4.5 ව්‍යාපෘති
භූමිප්‍රදේශයන්ද භූමිප්‍රදේශයන්-ද 4.5 භූමිප්‍රදේශයන්
සංවේදකයකට සංවේදකයක-ට 4.5 සංවේදකයක
doctorate doctorat-e 4.5 doctorat
එරිත්‍රියාවට එරිත්‍රියාව-ට 4.5 එරිත්‍රියාව
ක්‍රමලේඛය ක්‍රමලේඛ-ය 4.5 ක්‍රමලේඛ
යුරේසියාවට යුරේසියාව-ට 4.5 යුරේසියාව
හදුනාගනීම හදුනාගනී-ම 4.5 හදුනාගනී
colombians colombian-s 4.5 colombian
parliamentarians parliamentarian-s 4.5 parliamentarian

6.6 Linguistic Interpretation

Automated Insight: The language Sinhala 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

Production Recommendations

Component Recommended Rationale
Tokenizer 64k BPE Best compression (4.57x)
N-gram 2-gram Lowest perplexity (2,119)
Markov Context-4 Highest predictability (97.6%)
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 - a monthly snapshot of Wikipedia articles across 300+ languages.

Project

A project by Wikilangs - Open-source NLP models for every Wikipedia language.

Maintainer

Omar Kamali - Omneity Labs

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


Generated by Wikilangs Models Pipeline

Report Date: 2026-01-10 21:32:02

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train wikilangs/si