en / RESEARCH_REPORT.md
omarkamali's picture
Upload all models and assets for en (latest)
395ebaa verified
# English — Full Ablation Study & Research Report
Detailed evaluation of all model variants trained on **English** Wikipedia data by [Wikilangs](https://wikilangs.org).
👈 [Back to README](README.md)
## 📋 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.837x | 3.84 | 0.1338% | 6,415,993 |
| **16k** | 4.221x | 4.22 | 0.1472% | 5,832,191 |
| **32k** | 4.511x | 4.51 | 0.1573% | 5,458,111 |
| **64k** | 4.699x 🏆 | 4.70 | 0.1638% | 5,239,573 |
### Tokenization Examples
Below are sample sentences tokenized with each vocabulary size:
**Sample 1:** `Albrecht Achilles may refer to: Albrecht III Achilles, Elector of Brandenburg Al...`
| Vocab | Tokens | Count |
|-------|--------|-------|
| 8k | `▁alb recht ▁ach illes ▁may ▁refer ▁to : ▁alb recht ... (+27 more)` | 37 |
| 16k | `▁alb recht ▁ach illes ▁may ▁refer ▁to : ▁alb recht ... (+26 more)` | 36 |
| 32k | `▁albrecht ▁achilles ▁may ▁refer ▁to : ▁albrecht ▁iii ▁achilles , ... (+17 more)` | 27 |
| 64k | `▁albrecht ▁achilles ▁may ▁refer ▁to : ▁albrecht ▁iii ▁achilles , ... (+16 more)` | 26 |
**Sample 2:** `Alexander V may refer to: Alexander V of Macedon (died 294 BCE) Antipope Alexand...`
| Vocab | Tokens | Count |
|-------|--------|-------|
| 8k | `▁alexander ▁v ▁may ▁refer ▁to : ▁alexander ▁v ▁of ▁maced ... (+20 more)` | 30 |
| 16k | `▁alexander ▁v ▁may ▁refer ▁to : ▁alexander ▁v ▁of ▁macedon ... (+18 more)` | 28 |
| 32k | `▁alexander ▁v ▁may ▁refer ▁to : ▁alexander ▁v ▁of ▁macedon ... (+15 more)` | 25 |
| 64k | `▁alexander ▁v ▁may ▁refer ▁to : ▁alexander ▁v ▁of ▁macedon ... (+15 more)` | 25 |
**Sample 3:** `Two antipopes used the regnal name Victor IV: Antipope Victor IV Antipope Victor...`
| Vocab | Tokens | Count |
|-------|--------|-------|
| 8k | `▁two ▁antip op es ▁used ▁the ▁reg nal ▁name ▁victor ... (+8 more)` | 18 |
| 16k | `▁two ▁antip opes ▁used ▁the ▁reg nal ▁name ▁victor ▁iv ... (+7 more)` | 17 |
| 32k | `▁two ▁antip opes ▁used ▁the ▁regnal ▁name ▁victor ▁iv : ... (+6 more)` | 16 |
| 64k | `▁two ▁antipopes ▁used ▁the ▁regnal ▁name ▁victor ▁iv : ▁antipope ... (+5 more)` | 15 |
### Key Findings
- **Best Compression:** 64k achieves 4.699x compression
- **Lowest UNK Rate:** 8k with 0.1338% 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 | 386,225 | 18.56 | 9,782,066 | 8.6% | 17.8% |
| **2-gram** | Subword | 257 🏆 | 8.01 | 64,688 | 68.7% | 99.4% |
| **3-gram** | Word | 4,093,782 | 21.97 | 29,170,233 | 2.0% | 6.5% |
| **3-gram** | Subword | 2,180 | 11.09 | 375,974 | 27.2% | 71.8% |
| **4-gram** | Word | 14,465,722 | 23.79 | 54,673,289 | 1.7% | 4.4% |
| **4-gram** | Subword | 12,758 | 13.64 | 2,193,365 | 14.2% | 38.3% |
| **5-gram** | Word | 12,820,936 | 23.61 | 37,691,280 | 2.5% | 5.0% |
| **5-gram** | Subword | 55,700 | 15.77 | 8,078,460 | 8.7% | 23.9% |
### Top 5 N-grams by Size
**2-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `of the` | 7,591,708 |
| 2 | `in the` | 5,221,237 |
| 3 | `to the` | 2,361,743 |
| 4 | `and the` | 1,799,614 |
| 5 | `on the` | 1,518,298 |
**3-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `the united states` | 408,936 |
| 2 | `one of the` | 329,510 |
| 3 | `as well as` | 264,322 |
| 4 | `part of the` | 247,900 |
| 5 | `references external links` | 203,098 |
**4-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `in the united states` | 156,847 |
| 2 | `under the age of` | 101,794 |
| 3 | `the age of 18` | 97,188 |
| 4 | `the end of the` | 88,360 |
| 5 | `of age or older` | 86,112 |
**5-grams (Word):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `under the age of 18` | 95,573 |
| 2 | `years of age or older` | 85,203 |
| 3 | `65 years of age or` | 84,639 |
| 4 | `of age or older the` | 81,589 |
| 5 | `the median income for a` | 59,537 |
**2-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `e _` | 117,498,416 |
| 2 | `_ t` | 97,071,904 |
| 3 | `t h` | 84,506,441 |
| 4 | `_ a` | 84,102,037 |
| 5 | `s _` | 80,981,888 |
**3-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `_ t h` | 65,028,534 |
| 2 | `t h e` | 60,632,216 |
| 3 | `h e _` | 53,951,238 |
| 4 | `e d _` | 29,954,463 |
| 5 | `_ i n` | 29,022,901 |
**4-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `_ t h e` | 55,274,199 |
| 2 | `t h e _` | 50,142,942 |
| 3 | `_ o f _` | 26,136,576 |
| 4 | `a n d _` | 22,544,155 |
| 5 | `_ a n d` | 20,891,023 |
**5-grams (Subword):**
| Rank | N-gram | Count |
|------|--------|-------|
| 1 | `_ t h e _` | 49,351,863 |
| 2 | `_ a n d _` | 20,550,921 |
| 3 | `_ o f _ t` | 8,921,160 |
| 4 | `n _ t h e` | 8,394,629 |
| 5 | `o f _ t h` | 8,311,158 |
### Key Findings
- **Best Perplexity:** 2-gram (subword) with 257
- **Entropy Trend:** Decreases with larger n-grams (more predictable)
- **Coverage:** Top-1000 patterns cover ~24% 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.9382 | 1.916 | 19.86 | 4,365,871 | 6.2% |
| **1** | Subword | 1.2026 | 2.302 | 11.62 | 32,517 | 0.0% |
| **2** | Word | 0.5167 | 1.431 | 3.51 | 86,666,437 | 48.3% |
| **2** | Subword | 0.5363 | 1.450 | 3.31 | 377,790 | 46.4% |
| **3** | Word | 0.2409 | 1.182 | 1.68 | 303,940,373 | 75.9% |
| **3** | Subword | 0.5420 | 1.456 | 3.45 | 1,251,354 | 45.8% |
| **4** | Word | 0.1077 🏆 | 1.078 | 1.22 | 509,562,649 | 89.2% |
| **4** | Subword | 0.6319 | 1.550 | 3.50 | 4,322,061 | 36.8% |
### Generated Text Samples (Word-based)
Below are text samples generated from each word-based Markov chain model:
**Context Size 1:**
1. `the move in july 2 respectively the murders in e bachs art deco building society was`
2. `of the death in the buachaille etive ship to the signaling involves neuronal signals as the`
3. `and left by his hysterical night and chieftain of measure in allowed for a number 3`
**Context Size 2:**
1. `of the big story is off limits to permanent employment in most notably in the shoot dying`
2. `in the city of lübeck later sold to supermarkets hotels cinemas and four mpvs on the other`
3. `to the limestone florida department of veteran hard rock version in featuring another lengthy playof...`
**Context Size 3:**
1. `the united states was raised significantly due to the interplay of light color etc hearing protectio...`
2. `one of the few performed to significant recognition notable achievements include first indian batsma...`
3. `as well as finishing sixth in the ferrari 312b and stirling mosss lotus in which he took to`
**Context Size 4:**
1. `in the united states helped revive the french economy with the marshall plan until the nys w shut do...`
2. `under the age of 18 living with them 57 1 were married couples living together 9 4 had a`
3. `the age of 18 living with them 44 6 were married couples living together 13 9 had a female`
### Generated Text Samples (Subword-based)
Below are text samples generated from each subword-based Markov chain model:
**Context Size 1:**
1. `_an_ainalltyarmo`
2. `ere_isorandaltii`
3. `agean._he_trhed,`
**Context Size 2:**
1. `e_co-con_ithe_sto`
2. `_the_gh_todent's_`
3. `th_arantime'_toft`
**Context Size 3:**
1. `_the_abird_native_`
2. `the_10_olynoldavit`
3. `he_der_–_to_the_fi`
**Context Size 4:**
1. `_the_treased:_"indo`
2. `the_unit_by_made_fi`
3. `_of_indies_in_the_s`
### Key Findings
- **Best Predictability:** Context-4 (word) with 89.2% predictability
- **Branching Factor:** Decreases with context size (more deterministic)
- **Memory Trade-off:** Larger contexts require more storage (4,322,061 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 | 1,867,537 |
| Total Tokens | 739,735,080 |
| Mean Frequency | 396.10 |
| Median Frequency | 4 |
| Frequency Std Dev | 51092.36 |
### Most Common Words
| Rank | Word | Frequency |
|------|------|-----------|
| 1 | the | 50,118,217 |
| 2 | of | 26,210,950 |
| 3 | and | 20,755,074 |
| 4 | in | 19,609,387 |
| 5 | a | 14,271,839 |
| 6 | to | 14,219,669 |
| 7 | was | 7,449,828 |
| 8 | for | 5,821,739 |
| 9 | as | 5,815,121 |
| 10 | is | 5,683,775 |
### Least Common Words (from vocabulary)
| Rank | Word | Frequency |
|------|------|-----------|
| 1 | brevetting | 2 |
| 2 | karuppukatti | 2 |
| 3 | cirrhatum | 2 |
| 4 | paða | 2 |
| 5 | вим | 2 |
| 6 | correya | 2 |
| 7 | bulamaq | 2 |
| 8 | boorik | 2 |
| 9 | spanishe | 2 |
| 10 | gitarrenmusik | 2 |
### Zipf's Law Analysis
| Metric | Value |
|--------|-------|
| Zipf Coefficient | 1.0573 |
| R² (Goodness of Fit) | 0.986242 |
| Adherence Quality | **excellent** |
### Coverage Analysis
| Top N Words | Coverage |
|-------------|----------|
| Top 100 | 38.8% |
| Top 1,000 | 61.6% |
| Top 5,000 | 80.1% |
| Top 10,000 | 86.4% |
### Key Findings
- **Zipf Compliance:** R²=0.9862 indicates excellent adherence to Zipf's law
- **High Frequency Dominance:** Top 100 words cover 38.8% of corpus
- **Long Tail:** 1,857,537 words needed for remaining 13.6% 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
> *Note: Multilingual alignment visualization not available for this language.*
### 5.2 Model Comparison
| Model | Dimension | Isotropy | Semantic Density | Alignment R@1 | Alignment R@10 |
|-------|-----------|----------|------------------|---------------|----------------|
| **mono_32d** | 32 | 0.7693 🏆 | 0.4027 | N/A | N/A |
| **mono_64d** | 64 | 0.7388 | 0.3350 | N/A | N/A |
| **mono_128d** | 128 | 0.6687 | 0.2629 | N/A | N/A |
### Key Findings
- **Best Isotropy:** mono_32d with 0.7693 (more uniform distribution)
- **Semantic Density:** Average pairwise similarity of 0.3335. Lower values indicate better semantic separation.
- **Alignment Quality:** No aligned models evaluated in this run.
- **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.793** | 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 |
|--------|----------|
| `-s` | skulltrail, scroggins, salatin |
| `-a` | alpana, ayopaya, aekyung |
| `-k` | kairos, kunigundes, kumwartok |
| `-m` | mapae, muktafi, meirás |
| `-c` | cutpurses, ceste, centurynear |
| `-p` | pustynsky, phet, propertys |
| `-w` | wnbd, wrestlerdecember, walska |
| `-t` | technor, tvmaze, twistor |
#### Productive Suffixes
| Suffix | Examples |
|--------|----------|
| `-s` | scroggins, donoughues, kairos |
| `-e` | forebode, mapae, tvmaze |
| `-n` | salatin, gedruckten, fursten |
| `-a` | alpana, ayopaya, flavicauda |
| `-r` | wrestlerdecember, haalandmanchester, shoulder |
| `-i` | rosai, badaczewski, muktafi |
| `-es` | donoughues, kunigundes, cutpurses |
| `-t` | stillmaticchart, phet, quenstedt |
### 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 |
|------|----------|------------------|----------|
| `tter` | 1.46x | 1019 contexts | atter, otter, itter |
| `ubli` | 1.63x | 215 contexts | tubli, ublic, dubli |
| `ttle` | 1.45x | 375 contexts | attle, ittle, ottle |
| `ount` | 1.52x | 208 contexts | count, yount, fount |
| `ontr` | 1.54x | 183 contexts | ontra, kontr, contr |
| `icia` | 1.44x | 202 contexts | licia, ticia, nicia |
| `itie` | 1.57x | 129 contexts | mitie, nitie, itier |
| `esid` | 1.55x | 123 contexts | yesid, cesid, resid |
| `itio` | 1.46x | 142 contexts | aitio, ition, vitio |
| `rsit` | 1.96x | 37 contexts | ḥarsit, parsit, fersit |
| `ucti` | 1.73x | 60 contexts | aucti, fructi, ductis |
| `oduc` | 1.85x | 44 contexts | produc, koduck, roduco |
### 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 |
|--------|--------|-----------|----------|
| `-s` | `-s` | 117 words | superhumps, squiggs |
| `-c` | `-s` | 102 words | cheirogaleus, cuddys |
| `-b` | `-s` | 88 words | betlemitas, bracelins |
| `-p` | `-s` | 88 words | paros, paars |
| `-a` | `-s` | 85 words | abdülhamids, aguasbonenses |
| `-s` | `-e` | 82 words | sulene, solene |
| `-m` | `-s` | 80 words | mascas, mollis |
| `-t` | `-s` | 78 words | tracklines, tirthankaras |
| `-m` | `-e` | 70 words | magnetoreceptive, matratze |
| `-c` | `-e` | 68 words | coudreville, clanvowe |
### 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 |
|------|-----------------|------------|------|
| parintintin | **`parintin-t-in`** | 7.5 | `t` |
| haakonssen | **`haakons-s-en`** | 7.5 | `s` |
| writernet | **`writern-e-t`** | 7.5 | `e` |
| kyŏngsang | **`kyŏngs-a-ng`** | 7.5 | `a` |
| neoformalism | **`neoformali-s-m`** | 7.5 | `s` |
| counterfeit | **`counterfe-i-t`** | 7.5 | `i` |
| glossarist | **`glossari-s-t`** | 7.5 | `s` |
| guitarless | **`guitar-le-ss`** | 7.5 | `le` |
| kyoryusho | **`kyoryus-h-o`** | 7.5 | `h` |
| harrisonharrison | **`harrisonharri-s-on`** | 7.5 | `s` |
| frankowsk | **`frankow-s-k`** | 7.5 | `s` |
| pxseattle | **`pxseat-t-le`** | 7.5 | `t` |
| maribulan | **`maribu-l-an`** | 7.5 | `l` |
| slighhouses | **`slighhou-s-es`** | 7.5 | `s` |
| limaysaurus | **`limaysau-r-us`** | 7.5 | `r` |
### 6.6 Linguistic Interpretation
> **Automated Insight:**
The language 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.70x) |
| N-gram | **2-gram** | Lowest perplexity (257) |
| Markov | **Context-4** | Highest predictability (89.2%) |
| 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 |
---
👈 [Back to README](README.md)
*Generated by Wikilangs Pipeline · 2026-03-04 03:44:40*