--- language: gpe language_name: Ghanaian Pidgin English language_family: germanic_west_anglofrisian 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-germanic_west_anglofrisian 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.789 - name: best_isotropy type: isotropy value: 0.8645 - name: vocabulary_size type: vocab value: 0 generated: 2026-01-09 --- # Ghanaian Pidgin English - Wikilangs Models ## Comprehensive Research Report & Full Ablation Study This repository contains NLP models trained and evaluated by Wikilangs, specifically on **Ghanaian Pidgin English** 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** | 4.124x | 4.13 | 0.1031% | 720,937 | | **16k** | 4.434x | 4.44 | 0.1108% | 670,476 | | **32k** | 4.661x | 4.66 | 0.1165% | 637,864 | | **64k** | 4.789x 🏆 | 4.79 | 0.1197% | 620,843 | ### Tokenization Examples Below are sample sentences tokenized with each vocabulary size: **Sample 1:** `Institutions Abourso CHPs References insyd Ghana insyd Eastern Region (Ghana) pl...` | Vocab | Tokens | Count | |-------|--------|-------| | 8k | `▁institutions ▁ab ours o ▁ch ps ▁references ▁insyd ▁ghana ▁insyd ... (+13 more)` | 23 | | 16k | `▁institutions ▁ab ours o ▁chps ▁references ▁insyd ▁ghana ▁insyd ▁eastern ... (+12 more)` | 22 | | 32k | `▁institutions ▁ab ours o ▁chps ▁references ▁insyd ▁ghana ▁insyd ▁eastern ... (+12 more)` | 22 | | 64k | `▁institutions ▁ab ours o ▁chps ▁references ▁insyd ▁ghana ▁insyd ▁eastern ... (+12 more)` | 22 | **Sample 2:** `References newspapers media insyd Ghana publish insyd Ghana publish insyd Africa` | Vocab | Tokens | Count | |-------|--------|-------| | 8k | `▁references ▁newspapers ▁media ▁insyd ▁ghana ▁publish ▁insyd ▁ghana ▁publish ▁insyd ... (+1 more)` | 11 | | 16k | `▁references ▁newspapers ▁media ▁insyd ▁ghana ▁publish ▁insyd ▁ghana ▁publish ▁insyd ... (+1 more)` | 11 | | 32k | `▁references ▁newspapers ▁media ▁insyd ▁ghana ▁publish ▁insyd ▁ghana ▁publish ▁insyd ... (+1 more)` | 11 | | 64k | `▁references ▁newspapers ▁media ▁insyd ▁ghana ▁publish ▁insyd ▁ghana ▁publish ▁insyd ... (+1 more)` | 11 | **Sample 3:** `References insyd Ghana insyd Ashanti Region places for Ashanti Region insyd` | Vocab | Tokens | Count | |-------|--------|-------| | 8k | `▁references ▁insyd ▁ghana ▁insyd ▁ashanti ▁region ▁places ▁for ▁ashanti ▁region ... (+1 more)` | 11 | | 16k | `▁references ▁insyd ▁ghana ▁insyd ▁ashanti ▁region ▁places ▁for ▁ashanti ▁region ... (+1 more)` | 11 | | 32k | `▁references ▁insyd ▁ghana ▁insyd ▁ashanti ▁region ▁places ▁for ▁ashanti ▁region ... (+1 more)` | 11 | | 64k | `▁references ▁insyd ▁ghana ▁insyd ▁ashanti ▁region ▁places ▁for ▁ashanti ▁region ... (+1 more)` | 11 | ### Key Findings - **Best Compression:** 64k achieves 4.789x compression - **Lowest UNK Rate:** 8k with 0.1031% 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 | 21,240 | 14.37 | 78,160 | 14.3% | 31.9% | | **2-gram** | Subword | 267 🏆 | 8.06 | 3,973 | 67.1% | 99.4% | | **3-gram** | Word | 53,111 | 15.70 | 117,024 | 7.0% | 18.8% | | **3-gram** | Subword | 2,195 | 11.10 | 30,848 | 25.8% | 72.0% | | **4-gram** | Word | 94,293 | 16.52 | 171,368 | 5.3% | 13.6% | | **4-gram** | Subword | 11,353 | 13.47 | 164,542 | 14.5% | 40.0% | | **5-gram** | Word | 63,802 | 15.96 | 106,259 | 5.8% | 14.6% | | **5-gram** | Subword | 38,013 | 15.21 | 434,778 | 9.2% | 27.0% | ### Top 5 N-grams by Size **2-grams (Word):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `of de` | 20,308 | | 2 | `for de` | 13,045 | | 3 | `insyd de` | 12,862 | | 4 | `wey dey` | 10,251 | | 5 | `na dem` | 7,893 | **3-grams (Word):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `from the original` | 4,522 | | 2 | `archived from the` | 4,424 | | 3 | `the original on` | 4,295 | | 4 | `de university of` | 1,482 | | 5 | `references external links` | 1,398 | **4-grams (Word):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `archived from the original` | 4,424 | | 2 | `from the original on` | 4,295 | | 3 | `at the wayback machine` | 842 | | 4 | `of de national assembly` | 704 | | 5 | `be one of de` | 605 | **5-grams (Word):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `archived from the original on` | 4,199 | | 2 | `national assembly of south africa` | 578 | | 3 | `de national assembly of south` | 560 | | 4 | `of de national assembly of` | 550 | | 5 | `from the original on retrieved` | 523 | **2-grams (Subword):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `e _` | 512,209 | | 2 | `_ d` | 373,324 | | 3 | `d e` | 362,084 | | 4 | `i n` | 287,429 | | 5 | `n _` | 274,000 | **3-grams (Subword):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `_ d e` | 304,465 | | 2 | `d e _` | 147,839 | | 3 | `_ i n` | 103,335 | | 4 | `_ o f` | 102,797 | | 5 | `o f _` | 98,533 | **4-grams (Subword):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `_ d e _` | 134,879 | | 2 | `_ o f _` | 96,992 | | 3 | `_ f o r` | 70,879 | | 4 | `t i o n` | 67,685 | | 5 | `_ i n s` | 65,269 | **5-grams (Subword):** | Rank | N-gram | Count | |------|--------|-------| | 1 | `_ f o r _` | 62,539 | | 2 | `i n s y d` | 58,915 | | 3 | `_ i n s y` | 58,082 | | 4 | `n s y d _` | 53,327 | | 5 | `_ d e n _` | 48,301 | ### Key Findings - **Best Perplexity:** 2-gram (subword) with 267 - **Entropy Trend:** Decreases with larger n-grams (more predictable) - **Coverage:** Top-1000 patterns cover ~27% 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 | 1.0024 | 2.003 | 9.14 | 112,922 | 0.0% | | **1** | Subword | 0.8797 | 1.840 | 6.38 | 1,680 | 12.0% | | **2** | Word | 0.3635 | 1.287 | 2.00 | 1,031,914 | 63.6% | | **2** | Subword | 0.9207 | 1.893 | 5.68 | 10,718 | 7.9% | | **3** | Word | 0.1363 | 1.099 | 1.26 | 2,064,281 | 86.4% | | **3** | Subword | 0.8539 | 1.807 | 4.49 | 60,872 | 14.6% | | **4** | Word | 0.0524 🏆 | 1.037 | 1.08 | 2,589,043 | 94.8% | | **4** | Subword | 0.6904 | 1.614 | 3.06 | 273,196 | 31.0% | ### Generated Text Samples (Word-based) Below are text samples generated from each word-based Markov chain model: **Context Size 1:** 1. `de grand slams for ein birth before he finally establish dis celebration of dakar get one` 2. `of science for di original on retrieved 13 may 7 6 10 of health science report` 3. `for de quarterfinals wer na she participate insyd a quarrel between tropical wey don decide am` **Context Size 2:** 1. `of de prayer hall give students de degree of specialization wey range from 56 for de total` 2. `for de standard entry times oqt oct paris swimming info world aquatics championshipsfukuoka july mol...` 3. `insyd de centuries na dem enact by ordering all of ein permanent campus na de average millennial` **Context Size 3:** 1. `from the original on 27 june on top convention peoples party c p p plus some other arab` 2. `archived from the original on 13 march retrieved 7 march insyd de ghana premier league club al hilal` 3. `the original on 29 september de electoral authority come talk say de cave be de original owners as` **Context Size 4:** 1. `archived from the original on 3 january retrieved 17 may references of education winneba institution...` 2. `from the original on 11 july retrieved 31 july early life den education dem born pravin gordhan on 1...` 3. `at the wayback machine cricketarchive retrieved 2 january elizabeth tracing the journey the vice cha...` ### Generated Text Samples (Subword-based) Below are text samples generated from each subword-based Markov chain model: **Context Size 1:** 1. `_om_oon_o-orof_d` 2. `es_a_fangaplmala` 3. `al,_3_wirintmptt` **Context Size 2:** 1. `e_nes_ber's_beent` 2. `_distrycle_fish_a` 3. `dento_di_clu_bas_` **Context Size 3:** 1. `_dey_dey_for_65._e` 2. `de_politadiye,_buf` 3. `_infor_de_greem),_` **Context Size 4:** 1. `_de_wale,_municipal` 2. `_of_convictories_di` 3. `_for_south_dis_gran` ### Key Findings - **Best Predictability:** Context-4 (word) with 94.8% predictability - **Branching Factor:** Decreases with context size (more deterministic) - **Memory Trade-off:** Larger contexts require more storage (273,196 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 | 53,888 | | Total Tokens | 3,007,969 | | Mean Frequency | 55.82 | | Median Frequency | 4 | | Frequency Std Dev | 1006.84 | ### Most Common Words | Rank | Word | Frequency | |------|------|-----------| | 1 | de | 136,329 | | 2 | of | 97,116 | | 3 | for | 62,865 | | 4 | insyd | 58,595 | | 5 | den | 48,591 | | 6 | dem | 45,328 | | 7 | wey | 45,073 | | 8 | dey | 39,231 | | 9 | be | 34,093 | | 10 | ein | 30,298 | ### Least Common Words (from vocabulary) | Rank | Word | Frequency | |------|------|-----------| | 1 | tɔra | 2 | | 2 | ntebe | 2 | | 3 | principia | 2 | | 4 | malingering | 2 | | 5 | fdis | 2 | | 6 | catlett | 2 | | 7 | modif | 2 | | 8 | outbursts | 2 | | 9 | impulse | 2 | | 10 | excoriation | 2 | ### Zipf's Law Analysis | Metric | Value | |--------|-------| | Zipf Coefficient | 1.1693 | | R² (Goodness of Fit) | 0.988970 | | Adherence Quality | **excellent** | ### Coverage Analysis | Top N Words | Coverage | |-------------|----------| | Top 100 | 41.6% | | Top 1,000 | 69.9% | | Top 5,000 | 87.3% | | Top 10,000 | 92.6% | ### Key Findings - **Zipf Compliance:** R²=0.9890 indicates excellent adherence to Zipf's law - **High Frequency Dominance:** Top 100 words cover 41.6% of corpus - **Long Tail:** 43,888 words needed for remaining 7.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.8634 | 0.3326 | N/A | N/A | | **mono_64d** | 64 | 0.8645 | 0.2673 | N/A | N/A | | **mono_128d** | 128 | 0.8465 | 0.1986 | N/A | N/A | | **aligned_32d** | 32 | 0.8634 | 0.3488 | 0.2620 | 0.6480 | | **aligned_64d** | 64 | 0.8645 🏆 | 0.2624 | 0.4380 | 0.8040 | | **aligned_128d** | 128 | 0.8465 | 0.1961 | 0.5700 | 0.8700 | ### Key Findings - **Best Isotropy:** aligned_64d with 0.8645 (more uniform distribution) - **Semantic Density:** Average pairwise similarity of 0.2677. Lower values indicate better semantic separation. - **Alignment Quality:** Aligned models achieve up to 57.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.460** | 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 | |--------|----------| | `-co` | commendations, consumption, corona | #### Productive Suffixes | Suffix | Examples | |--------|----------| | `-s` | étoiles, ibs, seriesjenifas | | `-es` | étoiles, cinématographiques, bapes | | `-ng` | offsetting, subverting, visiting | | `-on` | koomson, rodinson, consumption | | `-ed` | administered, categorized, overcrowded | | `-ing` | offsetting, subverting, visiting | | `-er` | mulder, turnover, longer | ### 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 | |------|----------|------------------|----------| | `nter` | 1.66x | 48 contexts | unter, inter, enter | | `atio` | 1.56x | 49 contexts | natio, ratio, ratios | | `tion` | 1.44x | 64 contexts | option, lation, notion | | `ment` | 1.51x | 46 contexts | mente, lament, moment | | `ican` | 1.96x | 17 contexts | rican, vatican, pelican | | `ence` | 1.70x | 27 contexts | pence, fence, hence | | `iver` | 1.52x | 35 contexts | hiver, giver, river | | `mber` | 1.74x | 21 contexts | mberi, amber, member | | `ersi` | 1.78x | 19 contexts | persia, versity, version | | `embe` | 1.80x | 18 contexts | embed, lembe, kpembe | | `ieve` | 1.83x | 14 contexts | nieve, thieves, achieve | | `nive` | 2.19x | 8 contexts | niven, nivera, univen | ### 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 | |--------|--------|-----------|----------| | `-co` | `-s` | 39 words | contributes, conservations | | `-co` | `-on` | 16 words | contraception, constitution | | `-co` | `-ed` | 13 words | committed, commanded | | `-co` | `-ng` | 10 words | counselling, connecting | | `-co` | `-ing` | 9 words | counselling, connecting | | `-co` | `-es` | 8 words | contributes, comprises | | `-co` | `-er` | 5 words | contender, colder | ### 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 | |------|-----------------|------------|------| | descended | **`descend-ed`** | 4.5 | `descend` | | assaulted | **`assault-ed`** | 4.5 | `assault` | | requested | **`request-ed`** | 4.5 | `request` | | approaching | **`approach-ing`** | 4.5 | `approach` | | universes | **`univers-es`** | 4.5 | `univers` | | distracted | **`distract-ed`** | 4.5 | `distract` | | encompasses | **`encompass-es`** | 4.5 | `encompass` | | choreographed | **`choreograph-ed`** | 4.5 | `choreograph` | | fermented | **`ferment-ed`** | 4.5 | `ferment` | | reprinted | **`reprint-ed`** | 4.5 | `reprint` | | abstained | **`abstain-ed`** | 4.5 | `abstain` | | transformed | **`transform-ed`** | 4.5 | `transform` | | mistresses | **`mistress-es`** | 4.5 | `mistress` | | reporting | **`report-ing`** | 4.5 | `report` | | entertainer | **`entertain-er`** | 4.5 | `entertain` | ### 6.6 Linguistic Interpretation > **Automated Insight:** The language Ghanaian Pidgin English 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.79x) | | N-gram | **2-gram** | Lowest perplexity (267) | | Markov | **Context-4** | Highest predictability (94.8%) | | 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-09 23:55:27*