Ouaill commited on
Commit
0687ce2
·
verified ·
1 Parent(s): 153f03d

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +13 -13
README.md CHANGED
@@ -30,7 +30,7 @@ size_categories:
30
 
31
  The first systematic subword tokenizer benchmark for **Moroccan Darija**, a low-resource dialect written concurrently in Arabic script and Arabizi (Latin script). We train and evaluate **40 tokenizer configurations** spanning four algorithms, two architectures, and five vocabulary sizes (8K--110K) on 112,814 parallel sentence pairs from [`OiQ/daa-pairs`](https://huggingface.co/datasets/OiQ/daa-pairs).
32
 
33
- Our tokenizers achieve **27--34% lower fertility** than existing Darija tokenizers (DarijaBERT) at matching vocabulary sizes, and **40--50% lower fertility** than MSA-trained tokenizers. All 40 configurations maintain $\geq$99% exact reconstruction.
34
 
35
  ---
36
 
@@ -39,7 +39,7 @@ Our tokenizers achieve **27--34% lower fertility** than existing Darija tokenize
39
  | Architecture | Description | Algorithms | Vocab Sizes | Count |
40
  |---|---|---|---|---|
41
  | **Shared** | Single vocabulary trained on mixed Arabic + Arabizi corpus | BPE, Unigram, WordPiece, BBPE | 8K, 16K, 32K, 80K, 110K | 20 |
42
- | **Concatenated** | Separate per-script vocabularies ($V/2$ each) with ID shifting | BPE, Unigram, WordPiece, BBPE | 8K, 16K, 32K, 80K, 110K | 20 |
43
 
44
  All tokenizers are released in both raw (HuggingFace `tokenizers`) and `transformers`-compatible formats. The 80K and 110K sizes match DarijaBERT's vocabulary sizes for direct comparison.
45
 
@@ -80,7 +80,7 @@ print(tok_az.encode(text_az))
80
 
81
  ### Best Tokenizer per Vocabulary Size
82
 
83
- | Vocab | Configuration | Algorithm | Fertility $\downarrow$ | Disparity $\downarrow$ | Exact Match |
84
  |---|---|---|---|---|---|
85
  | 8K | Shared | WordPiece | **1.572** | 0.164 | 99.9% |
86
  | 16K | Shared | WordPiece | **1.402** | 0.138 | 99.9% |
@@ -90,7 +90,7 @@ print(tok_az.encode(text_az))
90
 
91
  ### Comparison with Existing Tokenizers
92
 
93
- | Tokenizer | Vocab | Fertility $\downarrow$ | Disparity $\downarrow$ | EM (Ar) | EM (Az) |
94
  |---|---|---|---|---|---|
95
  | **Ours: concat WP 110K** | **110K** | **1.155** | 0.093 | **99.9%** | **99.6%** |
96
  | **Ours: concat WP 80K** | **80K** | **1.183** | 0.090 | **99.9%** | **99.6%** |
@@ -111,24 +111,24 @@ At matching vocabulary sizes, our 80K tokenizer achieves **33% lower fertility**
111
 
112
  | Metric | Definition | Direction |
113
  |---|---|---|
114
- | **Fertility** ($F$) | Tokens per word, averaged over test set | Lower is better |
115
  | **CPT** | Grapheme clusters per token (Unicode-aware) | Higher is better |
116
- | **Disparity** ($\Delta F$) | Relative cross-script gap: $\|F_{ar} - F_{az}\| / \max(F_{ar}, F_{az})$ | Lower is better |
117
  | **Exact Match** | Fraction of texts that round-trip perfectly through encode/decode | Higher is better |
118
  | **Gini** | Vocabulary usage inequality (0 = uniform, 1 = concentrated) | Lower is better |
119
 
120
- Overall fertility is word-count-weighted: $F \approx 0.65 \cdot F_{ar} + 0.35 \cdot F_{az}$
121
 
122
  ### Morphological Fidelity (Arabic-script only)
123
 
124
  | Metric | Definition | Direction |
125
  |---|---|---|
126
- | **$\mu_e$** | Edit distance between tokenizer boundaries and Farasa morpheme boundaries | Lower is better |
127
- | **$\mu_c$-F1** | Whether words sharing morphemes also share tokens (KMeans + TF-IDF) | Higher is better |
128
 
129
  ### Statistical Rigor
130
 
131
- All fertility and CPT values include **bootstrap 95% confidence intervals** (500 resamples). CI width is $\leq 0.006$ for all configurations.
132
 
133
  ---
134
 
@@ -147,13 +147,13 @@ All fertility and CPT values include **bootstrap 95% confidence intervals** (500
147
 
148
  ## Key Findings
149
 
150
- 1. **Darija-specific tokenization dramatically improves compression.** Our tokenizers achieve 27--34% lower fertility than DarijaBERT at matching vocabulary sizes.
151
 
152
- 2. **Cross-script fairness is achievable.** Shared Unigram at 80K reaches $\Delta F = 0.015$ (near-zero disparity) without concatenation. Concatenated architectures maintain $\Delta F \leq 0.094$ across all non-BBPE algorithms.
153
 
154
  3. **Vocabulary size saturates early.** Moving from 32K to 110K yields only marginal gains. The training corpus exhausts merge candidates around 80K.
155
 
156
- 4. **BBPE requires concatenation.** Shared BBPE exhibits extreme cross-script disparity ($\Delta F = 0.219$--$0.243$). Concatenation reduces this 4x.
157
 
158
  5. **MSA tokenizers transfer poorly to Darija.** They produce 40--50% higher fertility, allocating vocabulary to MSA patterns absent in Darija.
159
 
 
30
 
31
  The first systematic subword tokenizer benchmark for **Moroccan Darija**, a low-resource dialect written concurrently in Arabic script and Arabizi (Latin script). We train and evaluate **40 tokenizer configurations** spanning four algorithms, two architectures, and five vocabulary sizes (8K--110K) on 112,814 parallel sentence pairs from [`OiQ/daa-pairs`](https://huggingface.co/datasets/OiQ/daa-pairs).
32
 
33
+ Our tokenizers achieve **27--33% lower fertility** than existing Darija tokenizers (DarijaBERT) at matching vocabulary sizes, and **40--50% lower fertility** than MSA-trained tokenizers. All 40 configurations maintain 99% exact reconstruction.
34
 
35
  ---
36
 
 
39
  | Architecture | Description | Algorithms | Vocab Sizes | Count |
40
  |---|---|---|---|---|
41
  | **Shared** | Single vocabulary trained on mixed Arabic + Arabizi corpus | BPE, Unigram, WordPiece, BBPE | 8K, 16K, 32K, 80K, 110K | 20 |
42
+ | **Concatenated** | Separate per-script vocabularies (V/2 each) with ID shifting | BPE, Unigram, WordPiece, BBPE | 8K, 16K, 32K, 80K, 110K | 20 |
43
 
44
  All tokenizers are released in both raw (HuggingFace `tokenizers`) and `transformers`-compatible formats. The 80K and 110K sizes match DarijaBERT's vocabulary sizes for direct comparison.
45
 
 
80
 
81
  ### Best Tokenizer per Vocabulary Size
82
 
83
+ | Vocab | Configuration | Algorithm | Fertility | Disparity | Exact Match |
84
  |---|---|---|---|---|---|
85
  | 8K | Shared | WordPiece | **1.572** | 0.164 | 99.9% |
86
  | 16K | Shared | WordPiece | **1.402** | 0.138 | 99.9% |
 
90
 
91
  ### Comparison with Existing Tokenizers
92
 
93
+ | Tokenizer | Vocab | Fertility | Disparity | EM (Ar) | EM (Az) |
94
  |---|---|---|---|---|---|
95
  | **Ours: concat WP 110K** | **110K** | **1.155** | 0.093 | **99.9%** | **99.6%** |
96
  | **Ours: concat WP 80K** | **80K** | **1.183** | 0.090 | **99.9%** | **99.6%** |
 
111
 
112
  | Metric | Definition | Direction |
113
  |---|---|---|
114
+ | **Fertility** (F) | Tokens per word, averaged over test set | Lower is better |
115
  | **CPT** | Grapheme clusters per token (Unicode-aware) | Higher is better |
116
+ | **Disparity** (ΔF) | Relative cross-script gap: \|F<sub>ar</sub> F<sub>az</sub>\| / max(F<sub>ar</sub>, F<sub>az</sub>) | Lower is better |
117
  | **Exact Match** | Fraction of texts that round-trip perfectly through encode/decode | Higher is better |
118
  | **Gini** | Vocabulary usage inequality (0 = uniform, 1 = concentrated) | Lower is better |
119
 
120
+ Overall fertility is word-count-weighted: F 0.65·F<sub>ar</sub> + 0.35·F<sub>az</sub>
121
 
122
  ### Morphological Fidelity (Arabic-script only)
123
 
124
  | Metric | Definition | Direction |
125
  |---|---|---|
126
+ | **μ<sub>e</sub>** | Edit distance between tokenizer boundaries and Farasa morpheme boundaries | Lower is better |
127
+ | **μ<sub>c</sub>-F1** | Whether words sharing morphemes also share tokens (KMeans + TF-IDF) | Higher is better |
128
 
129
  ### Statistical Rigor
130
 
131
+ All fertility and CPT values include **bootstrap 95% confidence intervals** (500 resamples). CI width is 0.006 for all configurations.
132
 
133
  ---
134
 
 
147
 
148
  ## Key Findings
149
 
150
+ 1. **Darija-specific tokenization dramatically improves compression.** Our tokenizers achieve 27--33% lower fertility than DarijaBERT at matching vocabulary sizes.
151
 
152
+ 2. **Cross-script fairness is achievable.** Shared Unigram at 80K reaches ΔF = 0.015 (near-zero disparity) without concatenation. Concatenated architectures maintain ΔF 0.094 across all non-BBPE algorithms.
153
 
154
  3. **Vocabulary size saturates early.** Moving from 32K to 110K yields only marginal gains. The training corpus exhausts merge candidates around 80K.
155
 
156
+ 4. **BBPE requires concatenation.** Shared BBPE exhibits extreme cross-script disparity (ΔF = 0.2190.243). Concatenation reduces this 4x.
157
 
158
  5. **MSA tokenizers transfer poorly to Darija.** They produce 40--50% higher fertility, allocating vocabulary to MSA patterns absent in Darija.
159