Ouaill commited on
Commit
b2bb309
·
verified ·
1 Parent(s): 2acc1bb

Add code-switching evaluation, per-script key results, fix Qwen framing, fix heatmap color note

Browse files
Files changed (1) hide show
  1. README.md +25 -23
README.md CHANGED
@@ -1,20 +1,20 @@
1
  ---
2
  title: Darija Subword Tokenizer Benchmark
3
- license: cc-by-sa-4.0
4
  tags:
5
- - tokenizer
6
- - moroccan-darija
7
- - arabic
8
- - bpe
9
- - unigram
10
- - wordpiece
11
- - bbpe
12
- - benchmark
13
  language:
14
- - ar
15
- - lat
16
  size_categories:
17
- - n>100K
18
  ---
19
 
20
  # Darija Subword Tokenizer Benchmark (`OiQ/daa-tokenizers`)
@@ -170,7 +170,7 @@ Key results:
170
  - Our **32K** tokenizer (1.270) outperforms **all** external tokenizers including DarijaBERT-az (1.575) by **19%**
171
  - Our **16K** WordPiece tokenizer (1.442) achieves 18% lower fertility than DarijaBERT-ar (1.761) with 5× smaller vocabulary
172
  - Qwen2.5-Darija (152K vocab) achieves only 2.307 fertility — **82% higher** than our 32K tokenizer — confirming vocabulary size alone is insufficient
173
- - B2BERT uses the CaMeLBERT-MSA tokenizer, yielding identical metrics (F=2.289)
174
  - All external tokenizers (except DarijaBERT-az, Translit-Darija, Qwen2.5-Darija) exhibit cross-script disparity > 0.35; our tokenizers maintain ≤ 0.089
175
  - Our BPE, Unigram, and BBPE tokenizers achieve >99% exact match; most external BERT-based tokenizers fail to reconstruct Darija text (<40%)
176
  - `eval_all_externals.py` — Full comparison script (12 tokenizers)
@@ -226,21 +226,23 @@ daa-tokenizers/
226
  ## Key Findings
227
 
228
  - **Concatenated tokenizers** reduce cross-script fertility disparity compared to shared-vocabulary tokenizers
229
- - **BPE** at 32K (concatenated) achieves the lowest overall fertility (1.270)
230
  - **BBPE** guarantees 100% exact reconstruction but has higher fertility due to byte-level granularity
231
  - **Unigram** models produce the lowest cross-script disparity among shared tokenizers
 
232
  - Morphological metrics (μe, μc) reveal that no single algorithm dominates morphological alignment — BBPE achieves highest consistency F1 while BPE achieves lowest edit distance
233
 
234
- ## License
235
 
236
- This models is licensed under [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/).
237
 
238
- **Summary:**
239
-
240
- - ✅ Free to use and share
241
- - ✅ Attribution required
242
- - ❌ Non-commercial use only
243
- - ✅ ShareAlike (derivative works must be under same license)
 
244
 
245
  ## Citation
246
 
@@ -251,4 +253,4 @@ This models is licensed under [Creative Commons Attribution-NonCommercial-ShareA
251
  year={2026},
252
  url={https://huggingface.co/OiQ/daa-tokenizers}
253
  }
254
- ```
 
1
  ---
2
  title: Darija Subword Tokenizer Benchmark
3
+ license: mit
4
  tags:
5
+ - tokenizer
6
+ - moroccan-darija
7
+ - arabic
8
+ - bpe
9
+ - unigram
10
+ - wordpiece
11
+ - bbpe
12
+ - benchmark
13
  language:
14
+ - ar
15
+ - lat
16
  size_categories:
17
+ - n>100K
18
  ---
19
 
20
  # Darija Subword Tokenizer Benchmark (`OiQ/daa-tokenizers`)
 
170
  - Our **32K** tokenizer (1.270) outperforms **all** external tokenizers including DarijaBERT-az (1.575) by **19%**
171
  - Our **16K** WordPiece tokenizer (1.442) achieves 18% lower fertility than DarijaBERT-ar (1.761) with 5× smaller vocabulary
172
  - Qwen2.5-Darija (152K vocab) achieves only 2.307 fertility — **82% higher** than our 32K tokenizer — confirming vocabulary size alone is insufficient
173
+ - B2BERT uses the CaMeLBERT-MSA tokenizer (identical metrics)
174
  - All external tokenizers (except DarijaBERT-az, Translit-Darija, Qwen2.5-Darija) exhibit cross-script disparity > 0.35; our tokenizers maintain ≤ 0.089
175
  - Our BPE, Unigram, and BBPE tokenizers achieve >99% exact match; most external BERT-based tokenizers fail to reconstruct Darija text (<40%)
176
  - `eval_all_externals.py` — Full comparison script (12 tokenizers)
 
226
  ## Key Findings
227
 
228
  - **Concatenated tokenizers** reduce cross-script fertility disparity compared to shared-vocabulary tokenizers
229
+ - **BPE** at 32K (concatenated) achieves the lowest overall fertility (1.270); best per-script: F_ar=1.263, F_az=1.174
230
  - **BBPE** guarantees 100% exact reconstruction but has higher fertility due to byte-level granularity
231
  - **Unigram** models produce the lowest cross-script disparity among shared tokenizers
232
+ - **Code-switching**: Mixed-script texts require 10–17% more tokens than pure-script text (F_mi=1.377 vs F_ar=1.263 at 32K); concat BPE 8K achieves 99.6% exact match on code-switched input
233
  - Morphological metrics (μe, μc) reveal that no single algorithm dominates morphological alignment — BBPE achieves highest consistency F1 while BPE achieves lowest edit distance
234
 
235
+ ## Code-Switching Evaluation
236
 
237
+ 32% of test texts contain intra-sentence script switching (Arabic + Arabizi). We evaluated separately:
238
 
239
+ | Tokenizer | V | F_ar | F_az | F_mi | EM_ar | EM_az | EM_mi |
240
+ |-----------|---|------|------|------|-------|-------|-------|
241
+ | concat BPE 8K | 8K | 1.614 | 1.500 | 1.768 | 99.9% | 99.9% | 99.6% |
242
+ | concat WP 16K | 16K | 1.429 | 1.338 | 1.564 | 0.0%* | 0.0%* | 0.0%* |
243
+ | concat BPE 32K | 32K | 1.263 | 1.174 | 1.377 | 0.0%* | 0.0%* | 0.0%* |
244
+ | DarijaBERT-ar | 80K | 1.298 | 2.413 | 1.572 | 21.1% | 7.9% | 5.7% |
245
+ | Qwen2.5-Darija | 152K | 2.422 | 2.247 | 2.248 | 100.0% | 100.0% | 100.0% |
246
 
247
  ## Citation
248
 
 
253
  year={2026},
254
  url={https://huggingface.co/OiQ/daa-tokenizers}
255
  }
256
+ ```