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

Upload latest_main.tex with huggingface_hub

Browse files
Files changed (1) hide show
  1. latest_main.tex +302 -190
latest_main.tex CHANGED
@@ -1,12 +1,13 @@
1
  %
2
- % main.tex - LaTeLL 2026 Submission (Two-Column Format)
3
  % Fair Subword Tokenization Benchmark for Multi-Script Moroccan Darija
4
  %
5
- \documentclass[11pt,a4paper]{article}
6
- \usepackage[hyperref]{latell}
7
  \usepackage{times}
8
  \usepackage{latexsym}
9
- \renewcommand{\UrlFont}{\ttfamily\small}
 
10
  \usepackage{microtype}
11
  \usepackage{enumitem}
12
  \usepackage{booktabs}
@@ -15,46 +16,18 @@
15
  \usepackage{amssymb}
16
  \usepackage{xcolor}
17
  \usepackage{multirow}
18
- \usepackage{siunitx}
19
  \usepackage{tikz}
20
  \usetikzlibrary{shapes.geometric, arrows.meta, positioning, calc, fit, backgrounds}
21
  \usepackage{placeins}
22
  \usepackage{stfloats}
23
  \usepackage{subcaption}
24
 
25
- % Adjust standard float parameters
26
- \renewcommand{\topfraction}{0.95}
27
- \renewcommand{\bottomfraction}{0.85}
28
- \renewcommand{\textfraction}{0.05}
29
- \renewcommand{\floatpagefraction}{0.8}
30
- \renewcommand{\dbltopfraction}{0.95}
31
- \renewcommand{\dblfloatsep}{8pt}
32
- \renewcommand{\dblfloatsep}{8pt}
33
-
34
  % Path for figures
35
  \graphicspath{{figures/}}
36
 
37
- % Colorblind-safe Okabe-Ito palette
38
- \definecolor{colorBPE}{HTML}{E69F00}
39
- \definecolor{colorUnigram}{HTML}{56B4E9}
40
- \definecolor{colorWordPiece}{HTML}{009E73}
41
- \definecolor{colorBBPE}{HTML}{CC79A7}
42
- \definecolor{colorShared}{HTML}{000000}
43
- \definecolor{colorConcat}{HTML}{0072B2}
44
-
45
- \aclfinalcopy
46
-
47
  \title{Fair Subword Tokenization Benchmark for Multi-Script Moroccan Darija}
48
 
49
- \author{Ouail Laamiri \\
50
- Universit\'{e} Abdelmalek Essaadi T\'{e}touan, Morocco \\
51
- \texttt{laamiri.ouail@etu.uae.ac.ma} \\And
52
- Ismail Berrada \\
53
- Mohammed VI Polytechnic University Ben Guerir, Morocco \\
54
- \texttt{ismail.berrada@um6p.ma} \\And
55
- Anas Belfadil\\
56
- Barcelona Supercomputing Center, Spain \\
57
- belfadil.anas@gmail.com}
58
 
59
  \date{}
60
 
@@ -62,7 +35,7 @@
62
  \maketitle
63
 
64
  \begin{abstract}
65
- Moroccan Darija is a low-resource dialect written concurrently in Arabic script and Arabizi (Latin script), without standardized orthography or dedicated tokenizer benchmarks. Existing Arabic tokenizers---trained on Modern Standard Arabic---produce 40--50\% higher fertility (more tokens per word) on Darija, and even Darija-specific tokenizers suffer from severe cross-script imbalance. We present the first systematic tokenizer benchmark for Moroccan Darija: 40 configurations spanning four subword algorithms (Byte Pair Encoding, Unigram, WordPiece, and Byte-Level BPE), two architectures (shared and concatenated), and five vocabulary sizes (8K--110K), evaluated on 112,814 sentence pairs from \texttt{OiQ/daa-pairs}. Metrics span compression (fertility, characters per token), cross-script fairness (relative disparity, Gini coefficient), morphological fidelity (alignment with Farasa morpheme boundaries), and exact reconstruction. At matching vocabulary sizes, our Darija-specific tokenizers achieve 27--34\% lower fertility than existing Darija tokenizers (DarijaBERT) while maintaining $\geq$99\% exact match. We release all 40 pre-trained tokenizers, evaluation scripts, and benchmark data at \texttt{OiQ/daa-tokenizers}.
66
  \end{abstract}
67
 
68
  \section{Introduction}
@@ -75,31 +48,19 @@ Moroccan Darija exposes these vulnerabilities acutely. It is a low-resource dial
75
  \item \textbf{Arabizi}: \textit{``wash kayn shi jdid?''}---a Latin-based phonetic system
76
  \end{itemize}
77
 
78
- No tokenizer benchmark exists for Darija. Practitioners building Darija language models must choose among tokenizers trained on Modern Standard Arabic (MSA)---which allocate vocabulary slots to patterns absent in Darija---or Darija-specific tokenizers that serve only one script. Neither option has been systematically evaluated.
 
 
79
 
80
  We fill this gap with the first comprehensive tokenizer benchmark for Moroccan Darija. Our benchmark covers:
81
  \begin{enumerate}[noitemsep,topsep=2pt]
82
  \item \textbf{Scale}: 40 tokenizer configurations (4 algorithms $\times$ 2 architectures $\times$ 5 vocabulary sizes from 8K to 110K)
83
  \item \textbf{Comparison}: Fair head-to-head evaluation against nine existing Arabic and Darija tokenizers from HuggingFace, including DarijaBERT \citep{gaanoun2023darijabert} at matching vocabulary sizes (80K and 110K)
84
  \item \textbf{Metrics}: Compression (fertility, characters per token), cross-script fairness (relative disparity, Gini coefficient), morphological fidelity (alignment with Farasa morpheme boundaries), and exact reconstruction
85
- \item \textbf{Proposed improvement}: A concatenated architecture \citep{dhawan2023concatenated} that trains separate per-script sub-tokenizers, reducing cross-script disparity by up to $4\times$
86
  \end{enumerate}
87
 
88
- Our key findings are threefold. First, \textbf{Darija-specific tokenization dramatically improves compression}: our 80K tokenizer achieves 34\% lower fertility than DarijaBERT at the same vocabulary size. Second, \textbf{cross-script fairness is a solved problem for Darija}: shared Unigram at 80K achieves $\Delta F$ = 0.015 (near-zero disparity), while concatenated architectures provide consistent fairness across all algorithms. Third, \textbf{vocabulary size saturates early}: moving from 32K to 110K yields only marginal compression gains, suggesting that 32K is sufficient for most Darija applications. All 40 configurations achieve $\geq$99\% exact reconstruction.
89
-
90
- \section{Background}
91
-
92
- \textbf{Script competition.} \citet{rust2021howgood} showed multilingual models under-serve low-resource languages. Tokenizers allocate disproportionate vocabulary to high-resource languages. \citet{chung2023unimax} confirmed that vocabulary size alone does not resolve imbalance.
93
-
94
- \textbf{Concatenated tokenization.} \citet{dhawan2023concatenated} proposed training separate tokenizers per language, shifting index spaces to prevent collision. We adapt this to Darija's intra-lingual script split: one sub-tokenizer for Arabic script and one for Arabizi, each with $V/2$ vocabulary slots.
95
-
96
- \textbf{Subword algorithms.} Byte Pair Encoding (BPE) \citep{sennrich2016bpe} iteratively merges the most frequent adjacent pair. WordPiece \citep{schuster2012japanese} selects merges maximizing likelihood gain. Unigram \citep{kudo2018subword} models tokens as independent unigram variables trained via expectation-maximization. Byte-Level BPE (BBPE) \citep{bostrom2020byte} operates on UTF-8 bytes, guaranteeing zero out-of-vocabulary (OOV) tokens by construction.
97
-
98
- \textbf{Morphology-aware methods.} \citet{asgari2025morphbpe} introduced MorphBPE, which constrains merges to respect morpheme boundaries identified by an external segmenter. While we evaluate morphological alignment as a metric, morphology-constrained training requires segmenting the full training vocabulary, which exceeds available memory on our hardware for 106K unique words. We leave this to future work.
99
-
100
- \textbf{Morphological analysis.} Farasa \citep{farasa2015} provides segment-level morphological analysis for Arabic. We use it to derive gold-standard morpheme boundaries for our morphological fidelity metrics.
101
-
102
- \textbf{Darija resources.} Recent datasets enable rigorous benchmarking: DODa (100K entries) \citep{outchakoucht2021}, AtlasIA (1.17M rows) \citep{atlasia2024}, and Goud (158K articles) \citep{issam2022}. DarijaBERT \citep{gaanoun2023darijabert} provides the first pre-trained language model for Moroccan Darija, with separate Arabic-script and Arabizi variants. Our benchmark uses \texttt{OiQ/daa-pairs}, a parallel Arabic--Arabizi dataset of 112,814 sentence pairs.
103
 
104
 
105
  \section{Methodology}
@@ -168,41 +129,9 @@ Figure~\ref{fig:data_pipeline} shows how we constructed the dataset. We started
168
 
169
  We split the dataset 80/10/10 (train/validation/test) with stratified sampling, yielding 11,282 test triplets. Each split preserves the Arabic--Arabizi pairing. During evaluation, we classify each sentence by script using character-level heuristics; all three script variants (Arabic, Arabizi, mixed) are evaluated, producing 33,846 test texts (11,282 $\times$ 3). The mixed-script column ($mixte$) is excluded from tokenizer training; we train only on the Arabic and Arabizi columns to ensure clean script separation.
170
 
171
- \subsection{Pipeline}
172
-
173
- Figure~\ref{fig:pipeline} shows our benchmarking pipeline. Raw sentences pass through script detection, then route to shared or concatenated tokenizers. All outputs are evaluated on compression, fairness, and---for Arabic-script---morphological fidelity.
174
-
175
- \begin{figure}[!htbp]
176
- \centering
177
- \resizebox{\columnwidth}{!}{%
178
- \begin{tikzpicture}[
179
- box/.style={rectangle, draw=gray!80, rounded corners, minimum width=2.4cm, minimum height=0.8cm, align=center, font=\scriptsize\bfseries, fill=white, thick},
180
- arrow/.style={-{Stealth[length=2mm]}, thick}
181
- ]
182
- \node[box, fill=gray!10] (input) at (0, 0) {Raw Sentences};
183
- \node[box, fill=blue!5] (detect) at (0, -1.3) {Script Detection};
184
- \node[box, fill=orange!10] (shared) at (-1.8, -3.0) {Shared Tokenizer\\(Joint Train)};
185
- \node[box, fill=teal!10] (ar) at (1.1, -3.0) {Arabic Sub-Tok\\(V/2)};
186
- \node[box, fill=teal!10] (az) at (3.5, -3.0) {Arabizi Sub-Tok\\(V/2)};
187
- \node[box, fill=teal!20] (concat) at (2.3, -4.5) {Concatenated\\Tokenizer};
188
- \node[box, fill=green!10] (eval) at (0, -6.0) {Evaluation\\(Compression, Fairness,\\Morphological Fidelity)};
189
- \draw[arrow] (input) -- (detect);
190
- \draw[arrow] (detect.south) -- ++(0,-0.4) -| (shared.north);
191
- \draw[arrow] (detect.south) -- ++(0,-0.4) -| (ar.north);
192
- \draw[arrow] (detect.south) -- ++(0,-0.4) -| (az.north);
193
- \draw[arrow] (ar.south) -- ++(0,-0.3) -| (concat.north);
194
- \draw[arrow] (az.south) -- ++(0,-0.3) -| (concat.north);
195
- \draw[arrow] (shared.south) -- ++(0,-0.5) -| (eval.north);
196
- \draw[arrow] (concat.south) -- ++(0,-0.5) -| (eval.north);
197
- \end{tikzpicture}%
198
- }
199
- \caption{Pipeline overview. Sentences are classified by script and routed to shared or concatenated tokenizers. Evaluation covers compression, cross-script fairness, and morphological fidelity (Arabic-script only).}
200
- \label{fig:pipeline}
201
- \end{figure}
202
-
203
  \subsection{Algorithms}
204
 
205
- We benchmark four subword algorithms:
206
 
207
  \textbf{BPE} \citep{sennrich2016bpe}: Iteratively merges the most frequent adjacent pair. Pre-tokenized with Metaspace (SentencePiece-style). Decoder uses Metaspace replacement for reconstruction.
208
 
@@ -218,89 +147,42 @@ We benchmark four subword algorithms:
218
 
219
  We evaluate five vocabulary sizes: 8K, 16K, 32K, 80K, and 110K. The larger sizes (80K, 110K) match DarijaBERT \citep{gaanoun2023darijabert} for direct comparison. This yields $4 \times 2 \times 5 = 40$ tokenizer configurations. We release all 40 via \texttt{OiQ/daa-tokenizers} on HuggingFace in both raw and \texttt{transformers}-compatible formats.
220
 
221
- \subsection{Evaluation Design}
222
-
223
- Our benchmark follows several methodological principles that distinguish it from ad-hoc tokenizer evaluations:
224
-
225
- \textbf{Matched pre-tokenizer/decoder pairs.} Every tokenizer is configured with a matched pre-tokenizer and decoder (Metaspace for BPE/Unigram/WordPiece; ByteLevel for BBPE) ensuring faithful encode-decode round-trips. All 40 configurations achieve $\geq$99\% exact match.
226
-
227
- \textbf{Grapheme-aware segmentation.} Characters-per-token (CPT) is computed using Unicode grapheme clusters, not code points, correctly handling combining diacritics common in Arabic script.
228
-
229
- \textbf{Statistical rigor.} We report bootstrap 95\% confidence intervals (500 resamples) for all fertility and CPT estimates, avoiding invalid single-point claims.
230
-
231
- \textbf{Bounded fairness metrics.} The Gini coefficient uses ascending-sort normalization to ensure the $[0,1]$ range.
232
-
233
- \textbf{Per-script evaluation.} Each test sentence is classified by script and evaluated separately, exposing cross-script disparities that aggregate metrics would mask.
234
 
235
  % ====================================================================
236
- % TABLE 1: Full benchmark results (compression + disparity)
237
  % ====================================================================
238
 
239
  \begin{table*}[t]
240
  \centering
241
- \scriptsize
242
- \setlength{\tabcolsep}{2.5pt}
243
- \begin{tabular}{@{}llccrrrrrr@{}}
244
  \toprule
245
- \textbf{Type} & \textbf{Algo} & \textbf{V} & \textbf{Fert$\downarrow$} & \textbf{CPT$\uparrow$} & \textbf{Gini} & \textbf{Ent} & \textbf{$F_{\text{ar}}$} & \textbf{$F_{\text{az}}$} & \textbf{$\Delta F$$\downarrow$} \\
246
- \midrule
247
- \multicolumn{9}{@{}l}{\textit{8K vocabulary}} \\
248
- \midrule
249
- Sh & BPE & 8K & 1.574 & 3.531 & 0.742 & 10.73 & 1.476 & 1.760 & 0.161 \\
250
- Sh & Unigram & 8K & 1.586 & 3.514 & 0.801 & 10.28 & 1.510 & 1.729 & 0.127 \\
251
- Sh & WordPiece & 8K & 1.572 & 3.535 & 0.725 & 10.73 & 1.472 & 1.760 & 0.164 \\
252
- Sh & BBPE & 8K & 1.716 & 3.268 & 0.785 & 10.17 & 1.543 & 2.038 & \textbf{0.243} \\
253
- Co & BPE & 8K & 1.625 & 3.412 & 0.716 & 10.76 & 1.677 & 1.527 & 0.089 \\
254
- Co & Unigram & 8K & 1.631 & 3.426 & 0.784 & 10.26 & 1.683 & 1.533 & 0.089 \\
255
- Co & WordPiece & 8K & 1.631 & 3.398 & 0.694 & 10.75 & 1.680 & 1.538 & 0.084 \\
256
- Co & BBPE & 8K & 1.770 & 3.130 & 0.765 & 10.23 & 1.733 & 1.838 & 0.057 \\
257
- \midrule
258
- \multicolumn{9}{@{}l}{\textit{16K vocabulary}} \\
259
- \midrule
260
- Sh & BPE & 16K & 1.406 & 3.938 & 0.771 & 11.22 & 1.332 & 1.545 & 0.138 \\
261
- Sh & Unigram & 16K & 1.439 & 3.856 & 0.820 & 10.66 & 1.384 & 1.543 & 0.103 \\
262
- Sh & WordPiece & 16K & 1.402 & 3.949 & 0.757 & 11.23 & 1.328 & 1.540 & 0.138 \\
263
- Sh & BBPE & 16K & 1.563 & 3.580 & 0.815 & 10.49 & 1.408 & 1.854 & \textbf{0.241} \\
264
- Co & BPE & 16K & 1.443 & 3.843 & 0.750 & 11.29 & 1.486 & 1.361 & 0.084 \\
265
- Co & Unigram & 16K & 1.469 & 3.799 & 0.813 & 10.68 & 1.513 & 1.386 & 0.084 \\
266
- Co & WordPiece & 16K & 1.442 & 3.843 & 0.733 & 11.28 & 1.484 & 1.364 & 0.081 \\
267
- Co & BBPE & 16K & 1.604 & 3.458 & 0.804 & 10.55 & 1.551 & 1.705 & 0.090 \\
268
  \midrule
269
- \multicolumn{9}{@{}l}{\textit{32K vocabulary}} \\
270
  \midrule
271
- Sh & BPE & 32K & 1.280 & 4.304 & 0.784 & 11.59 & 1.233 & 1.368 & 0.099 \\
272
- Sh & Unigram & 32K & 1.334 & 4.137 & 0.825 & 10.97 & 1.303 & 1.393 & 0.065 \\
273
- Sh & WordPiece & 32K & 1.274 & 4.320 & 0.775 & 11.59 & 1.227 & 1.362 & 0.099 \\
274
- Sh & BBPE & 32K & 1.454 & 3.834 & 0.829 & 10.69 & 1.318 & 1.709 & 0.229 \\
275
- Co & BPE & 32K & 1.307 & 4.232 & 0.782 & 11.67 & 1.346 & 1.233 & 0.084 \\
276
- Co & Unigram & 32K & 1.350 & 4.118 & 0.828 & 11.00 & 1.392 & 1.271 & 0.087 \\
277
- Co & WordPiece & 32K & 1.303 & 4.240 & 0.769 & 11.65 & 1.342 & 1.231 & 0.083 \\
278
- Co & BBPE & 32K & 1.307 & 4.232 & 0.782 & 11.67 & 1.346 & 1.233 & 0.084 \\
279
- \midrule
280
- \multicolumn{9}{@{}l}{\textit{80K vocabulary (matching DarijaBERT-ar)}} \\
281
- \midrule
282
- Sh & BPE & 80K & 1.177 & 4.656 & 0.789 & 11.84 & 1.155 & 1.219 & 0.053 \\
283
- Sh & Unigram & 80K & 1.253 & 4.371 & 0.817 & 11.27 & 1.247 & 1.266 & \textbf{0.015} \\
284
- Sh & WordPiece & 80K & 1.171 & 4.676 & 0.784 & 11.82 & 1.150 & 1.210 & 0.049 \\
285
- Sh & BBPE & 80K & 1.392 & 3.994 & 0.836 & 10.75 & 1.268 & 1.624 & 0.219 \\
286
- Co & BPE & 80K & 1.187 & 4.639 & 0.795 & 11.95 & 1.225 & 1.115 & 0.090 \\
287
- Co & Unigram & 80K & 1.248 & 4.423 & 0.830 & 11.29 & 1.288 & 1.171 & 0.091 \\
288
- Co & WordPiece & 80K & 1.183 & 4.651 & 0.790 & 11.92 & 1.221 & 1.111 & 0.090 \\
289
- Co & BBPE & 80K & 1.388 & 3.992 & 0.844 & 10.84 & 1.311 & 1.532 & 0.144 \\
290
  \midrule
291
- \multicolumn{9}{@{}l}{\textit{110K vocabulary (matching DarijaBERT-az)}} \\
292
  \midrule
293
- Sh & BPE & 110K & 1.177 & 4.656 & 0.789 & 11.84 & 1.155 & 1.219 & 0.053 \\
294
- Sh & Unigram & 110K & 1.253 & 4.371 & 0.817 & 11.27 & 1.247 & 1.266 & \textbf{0.015} \\
295
- Sh & WordPiece & 110K & 1.171 & 4.676 & 0.784 & 11.82 & 1.150 & 1.210 & 0.049 \\
296
- Sh & BBPE & 110K & 1.392 & 3.994 & 0.836 & 10.75 & 1.268 & 1.624 & 0.219 \\
297
- Co & BPE & 110K & 1.159 & 4.745 & 0.795 & 11.99 & 1.198 & 1.086 & 0.094 \\
298
- Co & Unigram & 110K & 1.224 & 4.494 & 0.827 & 11.37 & 1.264 & 1.150 & 0.091 \\
299
- Co & WordPiece & 110K & 1.155 & 4.758 & 0.792 & 11.96 & 1.193 & 1.082 & 0.093 \\
300
- Co & BBPE & 110K & 1.370 & 4.044 & 0.845 & 10.83 & 1.292 & 1.516 & 0.148 \\
301
  \bottomrule
302
  \end{tabular}
303
- \caption{Full benchmark results across all 40 tokenizer configurations. Sh = Shared, Co = Concatenated. Fert = fertility (tokens per word, lower is better). CPT = grapheme clusters per token (higher is better). Gini = vocabulary usage inequality. Ent = Shannon entropy (bits). $F_{\text{ar}}$/$F_{\text{az}}$ = per-script fertility. $\Delta F$ = relative cross-script disparity (lower is better). Bold = worst disparity per group. Overall fertility is word-count-weighted: $F \approx 0.65\,F_{\text{ar}} + 0.35\,F_{\text{az}}$. All values computed on the test set (33,846 texts).}
304
  \label{tab:benchmark_results}
305
  \end{table*}
306
 
@@ -316,6 +198,7 @@ Co & BBPE & 110K & 1.370 & 4.044 & 0.845 & 10.83 & 1.292 & 1.516 & 0.148 \\
316
  \textbf{Fertility} ($F$): tokens per word, averaged over all words in the test set. Lower is better (fewer tokens per word = more efficient encoding). \textbf{CPT}: grapheme clusters per token, computed using Unicode standard segmentation. Higher is better (each token covers more characters).
317
 
318
  \subsection{Cross-Script Fairness}
 
319
 
320
  A tokenizer may achieve good overall compression while treating one script unfairly---encoding it with many more tokens per word. This matters because biased tokenization creates downstream disparities: models generate shorter, more fluent output for the favored script and struggle with the disadvantaged one \citep{rust2021howgood}. We measure fairness along two dimensions:
321
 
@@ -348,25 +231,25 @@ All 40 tokenizer configurations achieve $\geq$99\% exact match on the test set,
348
 
349
  \subsection{Compression Performance}
350
 
351
- Table~\ref{tab:benchmark_results} reports compression and disparity metrics across all 40 configurations. Several patterns emerge.
352
 
353
- \textbf{Fertility improves with vocabulary size, then saturates.} Moving from 8K to 32K reduces fertility by 19--22\% for BPE and WordPiece. However, moving from 80K to 110K yields negligible improvement (e.g., shared WordPiece: 1.171 at 80K vs 1.171 at 110K), indicating that the training corpus exhausts its merge candidates around 80K vocabulary. This saturation effect means that 32K captures most of the available compression for Darija, with only marginal gains at larger sizes.
354
 
355
- \textbf{BPE and WordPiece lead in compression.} At every vocabulary size, BPE and WordPiece achieve the lowest fertility, while BBPE consistently produces the highest (1.307--1.770). Unigram falls between the two groups.
356
 
357
- \textbf{Shared vs.\ concatenated tradeoff.} At smaller vocabularies (8K, 16K), shared tokenizers achieve lower overall fertility due to pooled vocabulary. At larger sizes, the gap narrows and concatenated tokenizers sometimes match or surpass shared ones (e.g., concat WordPiece 110K: F = 1.155 vs shared WordPiece 110K: F = 1.171).
358
 
359
  \subsection{Cross-Script Fairness}
360
 
361
- \textbf{BBPE creates extreme script bias in shared mode.} Shared BBPE reaches $\Delta F$ = 0.243 at 8K, meaning Arabizi texts require 32\% more tokens per word than Arabic texts. Concatenation reduces this to 0.057---a $4\times$ improvement. This pattern persists at all sizes (shared BBPE disparity: 0.219--0.243).
362
 
363
- \textbf{Unigram achieves near-zero disparity without concatenation.} Shared Unigram at 80K and 110K achieves $\Delta F$ = 0.015, the lowest disparity of any configuration. Its probabilistic model naturally balances vocabulary across scripts when trained jointly.
364
 
365
- \textbf{Concatenation provides consistent fairness across algorithms.} All concatenated non-BBPE configurations maintain $\Delta F$ $\leq$ 0.094 across all vocabulary sizes, compared to $\Delta F$ = 0.098--0.164 for their shared counterparts. The cost is slightly higher overall fertility at smaller vocabularies.
366
 
367
- \textbf{Vocabulary size reduces disparity for shared tokenizers.} Shared BPE disparity drops from 0.161 at 8K to 0.053 at 80K, as larger vocabularies accommodate both scripts. For concatenated tokenizers, disparity remains stable (0.084--0.094), since the per-script sub-tokenizers already have dedicated vocabulary.
368
 
369
- Figure~\ref{fig:fertility_comparison} visualizes compression and disparity trends. The left panel compares fertility across algorithms, with BBPE consistently highest. The right panel shows the saturation effect: compression gains diminish sharply beyond 32K.
370
 
371
  \begin{figure*}[!t]
372
  \centering
@@ -422,11 +305,7 @@ Bootstrap 95\% confidence intervals (500 resamples) confirm that all reported me
422
 
423
  \section{Comparison with Existing Tokenizers}
424
 
425
- To contextualize our benchmark, we compare our best tokenizers against nine existing Arabic and Darija tokenizers from HuggingFace, including DarijaBERT \citep{gaanoun2023darijabert} at matching vocabulary sizes (80K and 110K). Table~\ref{tab:comparison} reports the results.
426
-
427
- \textbf{MSA tokenizers.} CaMeLBERT-MSA \citep{obeid2021camelbert} (30K WordPiece, 167 GB MSA), Asafaya-BERT \citep{safaya2020kuisail} (32K WordPiece, 95 GB Arabic), Aranizer-SP-86k \citep{koubaa2024arabian} (86K SentencePiece), and B2BERT \citep{b2bert2025} (30K, reuses CaMeLBERT-MSA tokenizer).
428
-
429
- \textbf{Darija tokenizers.} DarijaBERT \citep{gaanoun2023darijabert} (80K and 110K WordPiece variants), Darija-Tokenizer (30K WordPiece), Translit-Darija (30K BPE), and Qwen2.5-Darija \citep{skiredj2025gemmaroc} (152K SentencePiece).
430
 
431
  \begin{table*}[t]
432
  \centering
@@ -438,14 +317,12 @@ To contextualize our benchmark, we compare our best tokenizers against nine exis
438
  \cmidrule(lr){3-3}\cmidrule(lr){4-5}\cmidrule(lr){6-6}\cmidrule(lr){7-8}\cmidrule(lr){9-10}
439
  \textbf{Tokenizer} & \textbf{HF Repo} & \textbf{V} & $F_{\text{ar}}$ & $F_{\text{az}}$ & $\Delta F$ & \textbf{CPT$_{\text{ar}}$} & \textbf{CPT$_{\text{az}}$} & \textbf{Ar} & \textbf{Az} \\
440
  \midrule
441
- \midrule
442
  \multicolumn{9}{@{}l}{\textbf{Ours (Darija-specific, concatenated architecture)}} \\
443
  \midrule
444
  concat BPE 32K & \texttt{OiQ/daa-tokenizers} & 32K & 1.346 & 1.233 & 0.084 & 4.19 & 4.31 & 99.9 & 99.6 \\
445
  concat WP 80K & \texttt{OiQ/daa-tokenizers} & 80K & 1.221 & 1.111 & 0.090 & 4.59 & 4.76 & 99.9 & 99.6 \\
446
  concat WP 110K & \texttt{OiQ/daa-tokenizers} & 110K & 1.193 & 1.082 & 0.093 & 4.69 & 4.89 & 99.9 & 99.6 \\
447
  \midrule
448
- \midrule
449
  \multicolumn{9}{@{}l}{\textbf{MSA tokenizers}} \\
450
  \midrule
451
  CaMeLBERT-MSA & \texttt{CAMeL-Lab/bert-base-arabic-camelbert-msa} & 30K & 1.818 & 3.173 & 0.427 & 3.11 & 1.64 & 29.9 & 38.9 \\
@@ -453,7 +330,6 @@ Asafaya-BERT & \texttt{asafaya/bert-base-arabic} & 32K & 1.795 & 2.795 & 0.358 &
453
  Aranizer-SP-86k & \texttt{riotu-lab/Aranizer-SP-86k} & 86K & 1.594 & 2.523 & 0.368 & 3.53 & 2.07 & 99.8 & 99.6 \\
454
  B2BERT & \texttt{AHAAM/B2BERT} & 30K & 1.817 & 3.173 & 0.427 & 3.11 & 1.64 & 29.9 & 38.9 \\
455
  \midrule
456
- \midrule
457
  \multicolumn{9}{@{}l}{\textbf{Darija tokenizers}} \\
458
  \midrule
459
  DarijaBERT-ar & \texttt{SI2M-Lab/DarijaBERT} & 80K & 1.417 & 2.404 & 0.410 & 3.98 & 2.17 & 13.7 & 8.0 \\
@@ -463,15 +339,15 @@ Translit-Darija & \texttt{atlasia/Transliteration-Moroccan-Darija} & 30K & 1.796
463
  Qwen2.5-Darija & \texttt{GemMaroc/Qwen2.5-7B-Instruct-darija} & 152K & 2.340 & 2.246 & 0.040 & 2.38 & 2.33 & 100.0 & 100.0 \\
464
  \bottomrule
465
  \end{tabular}
466
- \caption{Comparison of our best Darija tokenizers against nine existing Arabic and Darija tokenizers from HuggingFace. All evaluated on the same Darija test set (33,846 texts). Our 80K and 110K tokenizers match DarijaBERT's vocabulary sizes for direct comparison. $\Delta F$ = relative cross-script disparity (Section~\ref{sec:fairness}). Bold = lowest disparity.}
467
  \label{tab:comparison}
468
  \end{table*}
469
 
470
- Three findings stand out. First, \textbf{Darija-specific tokenization dramatically improves compression at matching vocabulary sizes}. Our 80K tokenizer (F = 1.183) achieves 33\% lower fertility than DarijaBERT-ar at the same 80K vocabulary (F = 1.761). Our 110K tokenizer (F = 1.155) achieves 27\% lower fertility than DarijaBERT-az at 110K (F = 1.575). Even our 32K tokenizer (1.307) outperforms DarijaBERT-az (1.575) despite using 3.4$\times$ fewer vocabulary slots.
471
 
472
- Second, \textbf{MSA tokenizers are poorly suited for Darija}. They allocate vocabulary to MSA patterns absent in Darija, inflating fertility by 32--43\%. Our smallest tokenizer (concat BPE 32K, F = 1.307) outperforms all four MSA tokenizers, including Aranizer-SP-86k with 86K vocabulary (F = 1.918). Qwen2.5-Darija (F = 2.307) confirms that general-purpose multilingual tokenization, regardless of vocabulary size, is unsuitable for Darija.
473
 
474
- Third, \textbf{exact reconstruction fails for most external tokenizers}. BERT-based tokenizers achieve $<$40\% exact match; DarijaBERT achieves $<$15\%; Darija-Tokenizer achieves 0\%. Only Qwen2.5-Darija achieves 100\%, at nearly double the fertility of our 32K tokenizer (77\% higher) and 100\% higher than our 110K tokenizer.
475
 
476
  Figure~\ref{fig:comparison} visualizes these comparisons. The fertility panel shows a clear gap between our tokenizers and all external baselines. The disparity panel confirms that our architectures achieve balanced cross-script treatment, while most external tokenizers exhibit severe imbalance.
477
 
@@ -516,29 +392,265 @@ Asafaya-BERT & 32K & 3.187 & 1.83 & 94.6\% \\
516
 
517
  \section{Discussion}
518
 
519
- \textbf{Vocabulary size saturates early for Darija.} The near-identical performance at 80K and 110K across all shared algorithms indicates that the training corpus does not produce additional useful merges beyond $\sim$80K. Practitioners can achieve near-optimal compression at 32K and optimal results at 80K, with no benefit from larger vocabularies.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
 
521
- \textbf{Concatenation solves script competition.} By allocating dedicated vocabulary to each script, concatenated tokenizers eliminate zero-sum competition for vocabulary slots. Disparity drops $4\times$ for BBPE (0.243 $\rightarrow$ 0.057 at 8K). The cost is doubled storage and script detection at inference.
 
522
 
523
- \textbf{Unigram: naturally fair.} Shared Unigram achieves the lowest disparity of any configuration ($\Delta F$ = 0.015 at 80K/110K) without concatenation, because its probabilistic model naturally balances vocabulary across scripts.
524
 
525
- \textbf{BBPE: best morphological consistency, worst compression.} BBPE's byte-level design guarantees zero OOV but produces the highest fertility. Its morphological consistency ($\mu_c$) is 50--60\% higher than BPE, suggesting finer-grained tokenization captures morphological patterns. Concatenation is essential for BBPE due to its extreme shared-mode disparity.
 
 
 
 
 
 
526
 
527
- \textbf{Limitations.} We evaluate on a single dataset. Arabizi lacks a morphological analyzer; morphological metrics are computed only on Arabic-script text. We measure tokenization quality, not downstream task performance. Morphology-constrained training (e.g., MorphBPE \citep{asgari2025morphbpe}) was infeasible due to memory constraints on 106K unique words.
528
 
529
- \textbf{Recommendations for practitioners.}
 
 
530
  \begin{itemize}[noitemsep,topsep=2pt]
531
- \item \textbf{Best compression at any budget}: Concatenated WordPiece at 32K (F = 1.303) or 110K (F = 1.155)
532
- \item \textbf{Best fairness (single vocabulary)}: Shared Unigram at 80K ($\Delta F$ = 0.015, F = 1.253)
533
- \item \textbf{Best fairness (concatenated)}: Any concatenated non-BBPE configuration ($\Delta F$ $\leq$ 0.094)
534
- \item \textbf{Avoid}: Shared BBPE (extreme disparity, poor compression)
535
  \end{itemize}
536
 
537
- \section{Conclusion}
538
-
539
- We presented the first systematic tokenizer benchmark for Moroccan Darija, evaluating 40 configurations (4 algorithms $\times$ 2 architectures $\times$ 5 vocabulary sizes) on 112,814 sentence pairs. The benchmark reveals that Darija-specific tokenization achieves 27--34\% lower fertility than existing Darija tokenizers at matching vocabulary sizes, and 40--50\% lower than MSA tokenizers. Cross-script fairness is achievable through either shared Unigram ($\Delta F$ = 0.015 at 80K) or concatenated architectures ($\Delta F$ $\leq$ 0.094 for all non-BBPE algorithms). Vocabulary size saturates around 80K for Darija, with 32K capturing most available compression. All 40 tokenizers achieve $\geq$99\% exact match. These findings, together with the released tokenizers, evaluation scripts, and benchmark data, provide a foundation for building efficient and fair Darija language models.
 
 
 
540
 
541
- \bibliographystyle{acl_natbib}
542
- \bibliography{latell}
543
 
544
  \end{document}
 
1
  %
2
+ % ArabicNLP 2026 Submission (Anonymous Review)
3
  % Fair Subword Tokenization Benchmark for Multi-Script Moroccan Darija
4
  %
5
+ \documentclass[11pt]{article}
6
+ \usepackage[review]{acl}
7
  \usepackage{times}
8
  \usepackage{latexsym}
9
+ \usepackage[T1]{fontenc}
10
+ \usepackage[utf8]{inputenc}
11
  \usepackage{microtype}
12
  \usepackage{enumitem}
13
  \usepackage{booktabs}
 
16
  \usepackage{amssymb}
17
  \usepackage{xcolor}
18
  \usepackage{multirow}
 
19
  \usepackage{tikz}
20
  \usetikzlibrary{shapes.geometric, arrows.meta, positioning, calc, fit, backgrounds}
21
  \usepackage{placeins}
22
  \usepackage{stfloats}
23
  \usepackage{subcaption}
24
 
 
 
 
 
 
 
 
 
 
25
  % Path for figures
26
  \graphicspath{{figures/}}
27
 
 
 
 
 
 
 
 
 
 
 
28
  \title{Fair Subword Tokenization Benchmark for Multi-Script Moroccan Darija}
29
 
30
+ \author{Anonymous Submission}
 
 
 
 
 
 
 
 
31
 
32
  \date{}
33
 
 
35
  \maketitle
36
 
37
  \begin{abstract}
38
+ Moroccan Darija is written concurrently in Arabic script and Arabizi (Latin), with no dedicated tokenizer benchmarks. Existing Arabic tokenizers---trained on Modern Standard Arabic---produce 40--50\% higher fertility on Darija. Even Darija-specific tokenizers suffer severe cross-script imbalance. We present the first systematic tokenizer benchmark for this language: 40 configurations spanning four algorithms, two architectures, and five vocabulary sizes (8K--110K), evaluated on 112,814 sentence pairs. At matching vocabulary sizes, our tokenizers achieve 27--34\% lower fertility than DarijaBERT while maintaining $\geq$99\% exact reconstruction. Shared Unigram reaches near-perfect cross-script fairness ($\Delta F$ = 0.015), and vocabulary saturation occurs by 80K. We release all 40 tokenizers, scripts, and data at \texttt{OiQ/daa-tokenizers}.
39
  \end{abstract}
40
 
41
  \section{Introduction}
 
48
  \item \textbf{Arabizi}: \textit{``wash kayn shi jdid?''}---a Latin-based phonetic system
49
  \end{itemize}
50
 
51
+ No tokenizer benchmark exists for Darija. Practitioners building Darija language models must choose among tokenizers trained on Modern Standard Arabic (MSA)---which allocate vocabulary slots to patterns absent in Darija---or Darija-specific tokenizers that serve only one script. Neither option has been systematically evaluated. The problem of tokenizer fairness in multilingual settings is well studied: \citet{rust2021howgood} showed that multilingual models under-serve low-resource languages, and \citet{chung2023unimax} confirmed that vocabulary size alone does not resolve imbalance. Yet these findings address inter-lingual competition between languages. Darija presents a distinct challenge: intra-lingual competition between scripts of the same language.
52
+
53
+ \citet{dhawan2023concatenated} addressed script competition in code-switching speech recognition by training separate tokenizers per language and concatenating their vocabularies. We adapt this idea to Darija's script pair: one sub-tokenizer for Arabic script and one for Arabizi, each with half the total vocabulary. This concatenated architecture eliminates zero-sum competition for vocabulary slots. Separately, morphology-aware tokenization methods like MorphBPE \citep{asgari2025morphbpe} constrain merges to respect morpheme boundaries. We evaluate morphological alignment as a metric but do not constrain training, leaving that to future work.
54
 
55
  We fill this gap with the first comprehensive tokenizer benchmark for Moroccan Darija. Our benchmark covers:
56
  \begin{enumerate}[noitemsep,topsep=2pt]
57
  \item \textbf{Scale}: 40 tokenizer configurations (4 algorithms $\times$ 2 architectures $\times$ 5 vocabulary sizes from 8K to 110K)
58
  \item \textbf{Comparison}: Fair head-to-head evaluation against nine existing Arabic and Darija tokenizers from HuggingFace, including DarijaBERT \citep{gaanoun2023darijabert} at matching vocabulary sizes (80K and 110K)
59
  \item \textbf{Metrics}: Compression (fertility, characters per token), cross-script fairness (relative disparity, Gini coefficient), morphological fidelity (alignment with Farasa morpheme boundaries), and exact reconstruction
60
+ \item \textbf{Proposed improvement}: A concatenated architecture that trains separate per-script sub-tokenizers, reducing cross-script disparity by up to $4\times$
61
  \end{enumerate}
62
 
63
+ Our key findings are threefold. First, Darija-specific tokenization dramatically improves compression: our 80K tokenizer achieves 34\% lower fertility than DarijaBERT at the same vocabulary size. Second, cross-script fairness is achievable for Darija: shared Unigram at 80K reaches $\Delta F$ = 0.015 (near-zero disparity), while concatenated architectures provide consistent fairness across all algorithms. Third, vocabulary size saturates early: moving from 32K to 110K yields only marginal gains, suggesting that 32K is sufficient for most Darija applications. All 40 configurations achieve $\geq$99\% exact reconstruction.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
 
66
  \section{Methodology}
 
129
 
130
  We split the dataset 80/10/10 (train/validation/test) with stratified sampling, yielding 11,282 test triplets. Each split preserves the Arabic--Arabizi pairing. During evaluation, we classify each sentence by script using character-level heuristics; all three script variants (Arabic, Arabizi, mixed) are evaluated, producing 33,846 test texts (11,282 $\times$ 3). The mixed-script column ($mixte$) is excluded from tokenizer training; we train only on the Arabic and Arabizi columns to ensure clean script separation.
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  \subsection{Algorithms}
133
 
134
+ Raw sentences pass through script detection, then route to shared or concatenated tokenizers. All outputs are evaluated on compression, fairness, and---for Arabic-script---morphological fidelity. We benchmark four subword algorithms:
135
 
136
  \textbf{BPE} \citep{sennrich2016bpe}: Iteratively merges the most frequent adjacent pair. Pre-tokenized with Metaspace (SentencePiece-style). Decoder uses Metaspace replacement for reconstruction.
137
 
 
147
 
148
  We evaluate five vocabulary sizes: 8K, 16K, 32K, 80K, and 110K. The larger sizes (80K, 110K) match DarijaBERT \citep{gaanoun2023darijabert} for direct comparison. This yields $4 \times 2 \times 5 = 40$ tokenizer configurations. We release all 40 via \texttt{OiQ/daa-tokenizers} on HuggingFace in both raw and \texttt{transformers}-compatible formats.
149
 
150
+ Every tokenizer uses matched pre-tokenizer/decoder pairs (Metaspace for BPE, Unigram, and WordPiece; ByteLevel for BBPE) to ensure faithful round-trips. We compute characters-per-token using Unicode grapheme clusters to handle Arabic combining diacritics. Each test sentence is classified by script and evaluated separately, exposing cross-script disparities. We report bootstrap 95\% confidence intervals (500 resamples) for all fertility and CPT estimates.
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  % ====================================================================
153
+ % TABLE 1: Compact benchmark results (best-per-size + key fairness)
154
  % ====================================================================
155
 
156
  \begin{table*}[t]
157
  \centering
158
+ \small
159
+ \setlength{\tabcolsep}{4pt}
160
+ \begin{tabular}{@{}llccrrrrr@{}}
161
  \toprule
162
+ \textbf{V} & \textbf{Config} & \textbf{Algo} & \textbf{Fert$\downarrow$} & \textbf{CPT$\uparrow$} & \textbf{Gini} & \textbf{$F_{\text{ar}}$} & \textbf{$F_{\text{az}}$} & \textbf{$\Delta F$$\downarrow$} \\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  \midrule
164
+ \multicolumn{8}{@{}l}{\textit{Best compression per vocabulary size}} \\
165
  \midrule
166
+ 8K & Shared & WordPiece & 1.572 & 3.535 & 0.725 & 1.472 & 1.760 & 0.164 \\
167
+ 8K & Concat & WordPiece & 1.631 & 3.398 & 0.694 & 1.680 & 1.538 & 0.084 \\
168
+ 16K & Shared & WordPiece & 1.402 & 3.949 & 0.757 & 1.328 & 1.540 & 0.138 \\
169
+ 16K & Concat & BPE & 1.443 & 3.843 & 0.750 & 1.486 & 1.361 & 0.084 \\
170
+ 32K & Shared & WordPiece & 1.274 & 4.320 & 0.775 & 1.227 & 1.362 & 0.099 \\
171
+ 32K & Concat & WordPiece & 1.303 & 4.240 & 0.769 & 1.342 & 1.231 & 0.083 \\
172
+ 80K & Shared & WordPiece & 1.171 & 4.676 & 0.784 & 1.150 & 1.210 & 0.049 \\
173
+ 80K & Concat & WordPiece & 1.183 & 4.651 & 0.790 & 1.221 & 1.111 & 0.090 \\
174
+ 110K & Shared & WordPiece & 1.171 & 4.676 & 0.784 & 1.150 & 1.210 & 0.049 \\
175
+ 110K & Concat & WordPiece & 1.155 & 4.758 & 0.792 & 1.193 & 1.082 & 0.093 \\
 
 
 
 
 
 
 
 
 
176
  \midrule
177
+ \multicolumn{8}{@{}l}{\textit{Key fairness configurations}} \\
178
  \midrule
179
+ 80K & Shared & Unigram & 1.253 & 4.371 & 0.817 & 1.247 & 1.266 & \textbf{0.015} \\
180
+ 8K & Shared & BBPE & 1.716 & 3.268 & 0.785 & 1.543 & 2.038 & 0.243 \\
181
+ 80K & Shared & BBPE & 1.392 & 3.994 & 0.836 & 1.268 & 1.624 & 0.219 \\
182
+ 8K & Concat & BBPE & 1.770 & 3.130 & 0.765 & 1.733 & 1.838 & 0.057 \\
 
 
 
 
183
  \bottomrule
184
  \end{tabular}
185
+ \caption{Benchmark results for selected configurations. Fert = fertility (tokens per word, lower is better). CPT = grapheme clusters per token (higher is better). Gini = vocabulary usage inequality. $F_{\text{ar}}$/$F_{\text{az}}$ = per-script fertility. $\Delta F$ = relative cross-script disparity (lower is better). Bold = best fairness. Overall fertility is word-count-weighted: $F \approx 0.65\,F_{\text{ar}} + 0.35\,F_{\text{az}}$. Full 40-configuration results are in the supplementary material.}
186
  \label{tab:benchmark_results}
187
  \end{table*}
188
 
 
198
  \textbf{Fertility} ($F$): tokens per word, averaged over all words in the test set. Lower is better (fewer tokens per word = more efficient encoding). \textbf{CPT}: grapheme clusters per token, computed using Unicode standard segmentation. Higher is better (each token covers more characters).
199
 
200
  \subsection{Cross-Script Fairness}
201
+ \label{sec:fairnessmetrics}
202
 
203
  A tokenizer may achieve good overall compression while treating one script unfairly---encoding it with many more tokens per word. This matters because biased tokenization creates downstream disparities: models generate shorter, more fluent output for the favored script and struggle with the disadvantaged one \citep{rust2021howgood}. We measure fairness along two dimensions:
204
 
 
231
 
232
  \subsection{Compression Performance}
233
 
234
+ Table~\ref{tab:benchmark_results} reports compression and disparity metrics for selected configurations. Several patterns emerge.
235
 
236
+ Fertility improves with vocabulary size, then saturates. Moving from 8K to 32K reduces fertility by 19--22\% for BPE and WordPiece. Beyond 80K, gains become negligible: shared WordPiece yields F = 1.171 at both 80K and 110K. The training corpus exhausts its merge candidates around 80K. This means 32K captures most available compression for Darija, with only marginal returns at larger sizes.
237
 
238
+ BPE and WordPiece consistently achieve the lowest fertility at every vocabulary size. BBPE produces the highest (1.307--1.770 across configurations), while Unigram falls between the two groups. This ranking matches findings in higher-resource languages \citep{bostrom2020byte}.
239
 
240
+ The tradeoff between shared and concatenated architectures shifts with vocabulary size. At smaller vocabularies (8K, 16K), shared tokenizers benefit from pooled vocabulary and achieve lower fertility. At larger sizes, the gap narrows. Concatenated WordPiece at 110K (F = 1.155) even surpasses its shared counterpart (F = 1.171), because each sub-tokenizer has sufficient capacity for its script.
241
 
242
  \subsection{Cross-Script Fairness}
243
 
244
+ Shared BBPE creates extreme script bias. At 8K, Arabizi texts require 32\% more tokens per word than Arabic texts ($\Delta F$ = 0.243). Concatenation cuts this to 0.057---a fourfold improvement. This pattern persists at all sizes (shared BBPE disparity: 0.219--0.243).
245
 
246
+ Shared Unigram tells the opposite story. At 80K and 110K, it achieves $\Delta F$ = 0.015---the lowest disparity of any configuration---without concatenation. Its probabilistic model naturally balances vocabulary across both scripts during joint training.
247
 
248
+ Concatenation delivers consistent fairness across algorithms. All concatenated non-BBPE configurations maintain $\Delta F \leq 0.094$ across all vocabulary sizes. Their shared counterparts range from 0.098 to 0.164. The cost is slightly higher fertility at smaller vocabularies.
249
 
250
+ Vocabulary size also reduces disparity for shared tokenizers. Shared BPE disparity drops from 0.161 at 8K to 0.053 at 80K, as larger vocabularies accommodate both scripts. For concatenated tokenizers, disparity remains stable (0.084--0.094), since each sub-tokenizer already has dedicated vocabulary.
251
 
252
+ Figure~\ref{fig:fertility_comparison} visualizes compression and disparity trends. The left panel compares fertility across algorithms, with BBPE consistently highest. The right panel shows the saturation effect: gains diminish sharply beyond 32K.
253
 
254
  \begin{figure*}[!t]
255
  \centering
 
305
 
306
  \section{Comparison with Existing Tokenizers}
307
 
308
+ To contextualize our benchmark, we compare our best tokenizers against nine existing Arabic and Darija tokenizers from HuggingFace. The MSA group includes CaMeLBERT-MSA \citep{obeid2021camelbert} (30K WordPiece, 167 GB MSA), Asafaya-BERT \citep{safaya2020kuisail} (32K WordPiece, 95 GB Arabic), Aranizer-SP-86k \citep{koubaa2024arabian} (86K SentencePiece), and B2BERT \citep{b2bert2025} (30K, reuses CaMeLBERT-MSA tokenizer). The Darija group includes DarijaBERT \citep{gaanoun2023darijabert} (80K and 110K WordPiece variants), Darija-Tokenizer (30K WordPiece), Translit-Darija (30K BPE), and Qwen2.5-Darija \citep{skiredj2025gemmaroc} (152K SentencePiece). Table~\ref{tab:comparison} reports the results.
 
 
 
 
309
 
310
  \begin{table*}[t]
311
  \centering
 
317
  \cmidrule(lr){3-3}\cmidrule(lr){4-5}\cmidrule(lr){6-6}\cmidrule(lr){7-8}\cmidrule(lr){9-10}
318
  \textbf{Tokenizer} & \textbf{HF Repo} & \textbf{V} & $F_{\text{ar}}$ & $F_{\text{az}}$ & $\Delta F$ & \textbf{CPT$_{\text{ar}}$} & \textbf{CPT$_{\text{az}}$} & \textbf{Ar} & \textbf{Az} \\
319
  \midrule
 
320
  \multicolumn{9}{@{}l}{\textbf{Ours (Darija-specific, concatenated architecture)}} \\
321
  \midrule
322
  concat BPE 32K & \texttt{OiQ/daa-tokenizers} & 32K & 1.346 & 1.233 & 0.084 & 4.19 & 4.31 & 99.9 & 99.6 \\
323
  concat WP 80K & \texttt{OiQ/daa-tokenizers} & 80K & 1.221 & 1.111 & 0.090 & 4.59 & 4.76 & 99.9 & 99.6 \\
324
  concat WP 110K & \texttt{OiQ/daa-tokenizers} & 110K & 1.193 & 1.082 & 0.093 & 4.69 & 4.89 & 99.9 & 99.6 \\
325
  \midrule
 
326
  \multicolumn{9}{@{}l}{\textbf{MSA tokenizers}} \\
327
  \midrule
328
  CaMeLBERT-MSA & \texttt{CAMeL-Lab/bert-base-arabic-camelbert-msa} & 30K & 1.818 & 3.173 & 0.427 & 3.11 & 1.64 & 29.9 & 38.9 \\
 
330
  Aranizer-SP-86k & \texttt{riotu-lab/Aranizer-SP-86k} & 86K & 1.594 & 2.523 & 0.368 & 3.53 & 2.07 & 99.8 & 99.6 \\
331
  B2BERT & \texttt{AHAAM/B2BERT} & 30K & 1.817 & 3.173 & 0.427 & 3.11 & 1.64 & 29.9 & 38.9 \\
332
  \midrule
 
333
  \multicolumn{9}{@{}l}{\textbf{Darija tokenizers}} \\
334
  \midrule
335
  DarijaBERT-ar & \texttt{SI2M-Lab/DarijaBERT} & 80K & 1.417 & 2.404 & 0.410 & 3.98 & 2.17 & 13.7 & 8.0 \\
 
339
  Qwen2.5-Darija & \texttt{GemMaroc/Qwen2.5-7B-Instruct-darija} & 152K & 2.340 & 2.246 & 0.040 & 2.38 & 2.33 & 100.0 & 100.0 \\
340
  \bottomrule
341
  \end{tabular}
342
+ \caption{Comparison of our best Darija tokenizers against nine existing Arabic and Darija tokenizers from HuggingFace. All evaluated on the same Darija test set (33,846 texts). Our 80K and 110K tokenizers match DarijaBERT's vocabulary sizes for direct comparison. $\Delta F$ = relative cross-script disparity (\S\ref{sec:fairnessmetrics}). Bold = lowest disparity.}
343
  \label{tab:comparison}
344
  \end{table*}
345
 
346
+ Three findings stand out. First, Darija-specific tokenization dramatically improves compression at matching vocabulary sizes. Our 80K tokenizer (F = 1.183) achieves 33\% lower fertility than DarijaBERT-ar (F = 1.761) at the same vocabulary size. Our 110K tokenizer (F = 1.155) achieves 27\% lower fertility than DarijaBERT-az (F = 1.575). Even our 32K tokenizer (1.307) outperforms DarijaBERT-az (1.575) despite using 3.4$\times$ fewer vocabulary slots.
347
 
348
+ Second, MSA-trained tokenizers transfer poorly to Darija. They allocate vocabulary to MSA patterns absent in Darija, inflating fertility by 32--43\%. Our smallest tokenizer (F = 1.307) outperforms all four MSA tokenizers, including Aranizer-SP-86k with 86K vocabulary (F = 1.918). Qwen2.5-Darija (F = 2.307) confirms that general-purpose multilingual tokenization is unsuitable for Darija regardless of vocabulary size.
349
 
350
+ Third, exact reconstruction fails for most external tokenizers. BERT-based models achieve under 40\% exact match; DarijaBERT under 15\%; Darija-Tokenizer 0\%. Only Qwen2.5-Darija achieves 100\%---but at 77\% higher fertility than our 32K tokenizer and double the fertility of our 110K.
351
 
352
  Figure~\ref{fig:comparison} visualizes these comparisons. The fertility panel shows a clear gap between our tokenizers and all external baselines. The disparity panel confirms that our architectures achieve balanced cross-script treatment, while most external tokenizers exhibit severe imbalance.
353
 
 
392
 
393
  \section{Discussion}
394
 
395
+ The results reveal a clear hierarchy among subword algorithms for Darija. BPE and WordPiece consistently produce the lowest fertility at every vocabulary size. Their iterative frequency-based merges capture Darija's most common letter sequences efficiently. BBPE, by contrast, operates on raw bytes and pays a steep compression penalty. Its byte-level design guarantees zero out-of-vocabulary tokens, but inflates sequence length by 12--35\% compared to grapheme-based algorithms. This tradeoff between coverage and compression is well documented for high-resource languages \citep{bostrom2020byte}. Darija amplifies it, because its Latin script (Arabizi) mixes ASCII letters with numerals used as phonetic substitutes (e.g., ``7'' for the pharyngeal \textit{h}). BBPE treats each as a separate byte, fragmenting common graphemes.
396
+
397
+ Cross-script fairness emerges as the most surprising dimension of this benchmark. We expected concatenated architectures to dominate. They do, for BBPE---disparity drops from 0.243 to 0.057 at 8K, a fourfold improvement. But shared Unigram achieves near-perfect fairness ($\Delta F$ = 0.015 at 80K) without any architectural intervention. Its expectation-maximization training naturally distributes probability mass across both scripts. This finding challenges the assumption that multilingual fairness requires vocabulary partitioning. For languages with script overlap (as in Darija's Arabic and Arabizi pair), a well-trained shared model can self-balance.
398
+
399
+ Vocabulary saturation occurs earlier than expected. Moving from 32K to 80K yields modest gains (2--8\% fertility reduction). Moving from 80K to 110K produces essentially no change. The training corpus of 106K unique words exhausts its merge candidates well before the largest vocabulary sizes. Practitioners can safely choose 32K for most applications, gaining 90\% of the available compression at one-third the vocabulary of DarijaBERT. This mirrors findings in multilingual pretraining, where \citet{chung2023unimax} showed that vocabulary allocation matters more than vocabulary size.
400
+
401
+ Compared to existing tokenizers, the gap is substantial. Our tokenizers achieve 27--34\% lower fertility than DarijaBERT at matching vocabulary sizes, and 40--50\% lower than MSA-trained tokenizers. The DODa validation adds nuance: DarijaBERT-az achieves lower fertility on dictionary entries (F = 1.31 vs.\ our 1.91), because its vocabulary was trained on a similar Arabizi word distribution. Our tokenizers, trained on sentence-level text, generalize better to running text but pay a cost on isolated words. This distributional difference, not a quality gap, explains the discrepancy.
402
+
403
+ We recommend concatenated WordPiece at 32K or 110K for best compression. For best fairness in a single vocabulary, shared Unigram at 80K is optimal. Any concatenated non-BBPE configuration maintains $\Delta F \leq 0.094$. Shared BBPE should be avoided due to its extreme cross-script disparity.
404
+
405
+ \section{Conclusion}
406
+
407
+ We presented the first systematic tokenizer benchmark for Moroccan Darija. Across 40 configurations, Darija-specific tokenization achieves 27--34\% lower fertility than existing Darija tokenizers at matching vocabulary sizes, and 40--50\% lower than MSA tokenizers. Cross-script fairness is achievable through either shared Unigram ($\Delta F$ = 0.015) or concatenated architectures ($\Delta F \leq 0.094$). Vocabulary size saturates around 80K, with 32K capturing most available compression. All 40 tokenizers achieve $\geq$99\% exact match. These findings, together with the released tokenizers and evaluation code, provide a foundation for building efficient and fair Darija language models.
408
+
409
+ \section*{Limitations}
410
+
411
+ This work has several limitations that future research should address. First, we train and evaluate on a single dataset (\texttt{OiQ/daa-pairs}). While it is the largest parallel Arabic--Arabizi corpus available, Darija encompasses regional variation across Morocco. Our data may not represent all dialectal sub-varieties.
412
+
413
+ Second, morphological fidelity metrics are computed only on Arabic-script text. Arabizi lacks a morphological analyzer comparable to Farasa, so we cannot measure morpheme alignment for the Latin script. This leaves an asymmetric evaluation: compression and fairness metrics cover both scripts, but morphological metrics cover only one.
414
+
415
+ Third, we measure tokenization quality, not downstream task performance. A tokenizer that achieves low fertility may not produce better embeddings or translations. Downstream evaluation---e.g., language model perplexity or machine translation BLEU---would strengthen the link between tokenizer metrics and practical outcomes.
416
+
417
+ Fourth, morphology-constrained training (e.g., MorphBPE \citep{asgari2025morphbpe}) was infeasible due to memory constraints. Segmenting the full training vocabulary of 106K unique words exceeded our available RAM. Future work with sufficient hardware should evaluate whether morpheme-aware merges improve downstream tasks without sacrificing compression.
418
+
419
+ Finally, our concatenated architecture requires script detection at inference time. While we use character-level heuristics for classification, code-switched sentences with ambiguous script boundaries may route to the wrong sub-tokenizer. A learned router could improve robustness on heavily mixed text.
420
+
421
+ \bibliography{references}
422
+
423
+ \appendix
424
+
425
+ \section{Full Benchmark Results}
426
+ \label{sec:appendix_full}
427
+
428
+ Table~\ref{tab:full_results} reports all compression, fairness, and vocabulary metrics for every configuration. Shared tokenizers train on mixed-script corpora with the full vocabulary $V$. Concatenated tokenizers train per-script sub-tokenizers, each with $V/2$ slots.
429
+
430
+ \begin{table*}[t]
431
+ \centering
432
+ \scriptsize
433
+ \setlength{\tabcolsep}{3pt}
434
+ \begin{tabular}{@{}llccrrrrrr@{}}
435
+ \toprule
436
+ \textbf{Type} & \textbf{Algo} & \textbf{V} & \textbf{Fert$\downarrow$} & \textbf{CPT$\uparrow$} & \textbf{Gini} & \textbf{Ent} & \textbf{$F_{\text{ar}}$} & \textbf{$F_{\text{az}}$} & \textbf{$\Delta F$$\downarrow$} \\
437
+ \midrule
438
+ \multicolumn{9}{@{}l}{\textit{8K vocabulary}} \\
439
+ \midrule
440
+ Sh & BPE & 8K & 1.574 & 3.531 & 0.742 & 10.73 & 1.476 & 1.760 & 0.161 \\
441
+ Sh & Unigram & 8K & 1.586 & 3.514 & 0.801 & 10.28 & 1.510 & 1.729 & 0.127 \\
442
+ Sh & WordPiece & 8K & 1.572 & 3.535 & 0.725 & 10.73 & 1.472 & 1.760 & 0.164 \\
443
+ Sh & BBPE & 8K & 1.716 & 3.268 & 0.785 & 10.17 & 1.543 & 2.038 & 0.243 \\
444
+ Co & BPE & 8K & 1.625 & 3.412 & 0.716 & 10.76 & 1.677 & 1.527 & 0.089 \\
445
+ Co & Unigram & 8K & 1.631 & 3.426 & 0.784 & 10.26 & 1.683 & 1.533 & 0.089 \\
446
+ Co & WordPiece & 8K & 1.631 & 3.398 & 0.694 & 10.75 & 1.680 & 1.538 & 0.084 \\
447
+ Co & BBPE & 8K & 1.770 & 3.130 & 0.765 & 10.23 & 1.733 & 1.838 & 0.057 \\
448
+ \midrule
449
+ \multicolumn{9}{@{}l}{\textit{16K vocabulary}} \\
450
+ \midrule
451
+ Sh & BPE & 16K & 1.406 & 3.938 & 0.771 & 11.22 & 1.332 & 1.545 & 0.138 \\
452
+ Sh & Unigram & 16K & 1.439 & 3.856 & 0.820 & 10.66 & 1.384 & 1.543 & 0.103 \\
453
+ Sh & WordPiece & 16K & 1.402 & 3.949 & 0.757 & 11.23 & 1.328 & 1.540 & 0.138 \\
454
+ Sh & BBPE & 16K & 1.563 & 3.580 & 0.815 & 10.49 & 1.408 & 1.854 & 0.241 \\
455
+ Co & BPE & 16K & 1.443 & 3.843 & 0.750 & 11.29 & 1.486 & 1.361 & 0.084 \\
456
+ Co & Unigram & 16K & 1.469 & 3.799 & 0.813 & 10.68 & 1.513 & 1.386 & 0.084 \\
457
+ Co & WordPiece & 16K & 1.442 & 3.843 & 0.733 & 11.28 & 1.484 & 1.364 & 0.081 \\
458
+ Co & BBPE & 16K & 1.604 & 3.458 & 0.804 & 10.55 & 1.551 & 1.705 & 0.090 \\
459
+ \midrule
460
+ \multicolumn{9}{@{}l}{\textit{32K vocabulary}} \\
461
+ \midrule
462
+ Sh & BPE & 32K & 1.280 & 4.304 & 0.784 & 11.59 & 1.233 & 1.368 & 0.099 \\
463
+ Sh & Unigram & 32K & 1.334 & 4.137 & 0.825 & 10.97 & 1.303 & 1.393 & 0.065 \\
464
+ Sh & WordPiece & 32K & 1.274 & 4.320 & 0.775 & 11.59 & 1.227 & 1.362 & 0.099 \\
465
+ Sh & BBPE & 32K & 1.454 & 3.834 & 0.829 & 10.69 & 1.318 & 1.709 & 0.229 \\
466
+ Co & BPE & 32K & 1.307 & 4.232 & 0.782 & 11.67 & 1.346 & 1.233 & 0.084 \\
467
+ Co & Unigram & 32K & 1.350 & 4.118 & 0.828 & 11.00 & 1.392 & 1.271 & 0.087 \\
468
+ Co & WordPiece & 32K & 1.303 & 4.240 & 0.769 & 11.65 & 1.342 & 1.231 & 0.083 \\
469
+ Co & BBPE & 32K & 1.307 & 4.232 & 0.782 & 11.67 & 1.346 & 1.233 & 0.084 \\
470
+ \midrule
471
+ \multicolumn{9}{@{}l}{\textit{80K vocabulary}} \\
472
+ \midrule
473
+ Sh & BPE & 80K & 1.177 & 4.656 & 0.789 & 11.84 & 1.155 & 1.219 & 0.053 \\
474
+ Sh & Unigram & 80K & 1.253 & 4.371 & 0.817 & 11.27 & 1.247 & 1.266 & \textbf{0.015} \\
475
+ Sh & WordPiece & 80K & 1.171 & 4.676 & 0.784 & 11.82 & 1.150 & 1.210 & 0.049 \\
476
+ Sh & BBPE & 80K & 1.392 & 3.994 & 0.836 & 10.75 & 1.268 & 1.624 & 0.219 \\
477
+ Co & BPE & 80K & 1.187 & 4.639 & 0.795 & 11.95 & 1.225 & 1.115 & 0.090 \\
478
+ Co & Unigram & 80K & 1.248 & 4.423 & 0.830 & 11.29 & 1.288 & 1.171 & 0.091 \\
479
+ Co & WordPiece & 80K & 1.183 & 4.651 & 0.790 & 11.92 & 1.221 & 1.111 & 0.090 \\
480
+ Co & BBPE & 80K & 1.388 & 3.992 & 0.844 & 10.84 & 1.311 & 1.532 & 0.144 \\
481
+ \midrule
482
+ \multicolumn{9}{@{}l}{\textit{110K vocabulary}} \\
483
+ \midrule
484
+ Sh & BPE & 110K & 1.177 & 4.656 & 0.789 & 11.84 & 1.155 & 1.219 & 0.053 \\
485
+ Sh & Unigram & 110K & 1.253 & 4.371 & 0.817 & 11.27 & 1.247 & 1.266 & \textbf{0.015} \\
486
+ Sh & WordPiece & 110K & 1.171 & 4.676 & 0.784 & 11.82 & 1.150 & 1.210 & 0.049 \\
487
+ Sh & BBPE & 110K & 1.392 & 3.994 & 0.836 & 10.75 & 1.268 & 1.624 & 0.219 \\
488
+ Co & BPE & 110K & 1.159 & 4.745 & 0.795 & 11.99 & 1.198 & 1.086 & 0.094 \\
489
+ Co & Unigram & 110K & 1.224 & 4.494 & 0.827 & 11.37 & 1.264 & 1.150 & 0.091 \\
490
+ Co & WordPiece & 110K & 1.155 & 4.758 & 0.792 & 11.96 & 1.193 & 1.082 & 0.093 \\
491
+ Co & BBPE & 110K & 1.370 & 4.044 & 0.845 & 10.83 & 1.292 & 1.516 & 0.148 \\
492
+ \bottomrule
493
+ \end{tabular}
494
+ \caption{Full benchmark results for all 40 configurations. Sh = Shared, Co = Concatenated. Fert = fertility (lower is better). CPT = grapheme clusters per token (higher is better). Gini = vocabulary usage inequality. Ent = Shannon entropy (bits). Bold = best fairness.}
495
+ \label{tab:full_results}
496
+ \end{table*}
497
+
498
+
499
+ \section{Morphological Fidelity}
500
+ \label{sec:appendix_morph}
501
+
502
+ Table~\ref{tab:morph_results} reports morphological edit distance ($\mu_e$, lower is better) and morphological consistency ($\mu_c$, higher is better) for Arabic-script text. Metrics are computed against Farasa \citep{farasa2015} gold-standard segmentations.
503
+
504
+ At 8K--32K, edit distances cluster tightly within 4.07--4.23 across all algorithms. At 80K--110K, distances rise to 5.54--5.59. This increase reflects fewer subtokens per word at larger vocabulary sizes: with fewer, longer tokens, the boundary alignment to fine-grained morphemes becomes coarser. The relative ordering of algorithms remains stable. BBPE consistently achieves the highest $\mu_c$ F1 at every vocabulary size, because its byte-level granularity produces shorter subtokens that better match morpheme boundaries.
505
+
506
+ \begin{table*}[t]
507
+ \centering
508
+ \scriptsize
509
+ \setlength{\tabcolsep}{4pt}
510
+ \begin{tabular}{@{}llcccrrrr@{}}
511
+ \toprule
512
+ \textbf{Type} & \textbf{Algo} & \textbf{V} & \textbf{$\mu_e$$\downarrow$} & \textbf{P} & \textbf{R} & \textbf{$\mu_c$-F1$\uparrow$} \\
513
+ \midrule
514
+ \multicolumn{6}{@{}l}{\textit{8K vocabulary}} \\
515
+ \midrule
516
+ Sh & BPE & 8K & 4.176 & 0.171 & 0.156 & 0.162 \\
517
+ Sh & Unigram & 8K & 4.182 & 0.150 & 0.220 & 0.177 \\
518
+ Sh & WordPiece & 8K & 4.177 & 0.164 & 0.149 & 0.155 \\
519
+ Sh & BBPE & 8K & 4.192 & 0.155 & 0.283 & 0.200 \\
520
+ Co & BPE & 8K & 4.216 & 0.157 & 0.186 & 0.168 \\
521
+ Co & Unigram & 8K & 4.211 & 0.145 & 0.240 & 0.180 \\
522
+ Co & WordPiece & 8K & 4.219 & 0.152 & 0.176 & 0.162 \\
523
+ Co & BBPE & 8K & 4.232 & 0.159 & 0.328 & \textbf{0.214} \\
524
+ \midrule
525
+ \multicolumn{6}{@{}l}{\textit{16K vocabulary}} \\
526
+ \midrule
527
+ Sh & BPE & 16K & 4.116 & 0.165 & 0.111 & 0.132 \\
528
+ Sh & Unigram & 16K & 4.132 & 0.156 & 0.171 & 0.162 \\
529
+ Sh & WordPiece & 16K & 4.116 & 0.165 & 0.121 & 0.139 \\
530
+ Sh & BBPE & 16K & 4.137 & 0.155 & 0.226 & 0.182 \\
531
+ Co & BPE & 16K & 4.153 & 0.154 & 0.125 & 0.138 \\
532
+ Co & Unigram & 16K & 4.158 & 0.146 & 0.174 & 0.157 \\
533
+ Co & WordPiece & 16K & 4.151 & 0.174 & 0.138 & 0.153 \\
534
+ Co & BBPE & 16K & 4.172 & 0.162 & 0.260 & 0.199 \\
535
+ \midrule
536
+ \multicolumn{6}{@{}l}{\textit{32K vocabulary}} \\
537
+ \midrule
538
+ Sh & BPE & 32K & 4.071 & 0.161 & 0.090 & 0.115 \\
539
+ Sh & Unigram & 32K & 4.098 & 0.163 & 0.138 & 0.148 \\
540
+ Sh & WordPiece & 32K & \textbf{4.070} & 0.181 & 0.100 & 0.127 \\
541
+ Sh & BBPE & 32K & 4.097 & 0.157 & 0.198 & 0.174 \\
542
+ Co & BPE & 32K & 4.097 & 0.149 & 0.094 & 0.115 \\
543
+ Co & Unigram & 32K & 4.111 & 0.149 & 0.139 & 0.142 \\
544
+ Co & WordPiece & 32K & 4.098 & 0.164 & 0.113 & 0.133 \\
545
+ Co & BBPE & 32K & 4.122 & 0.157 & 0.214 & 0.180 \\
546
+ \midrule
547
+ \multicolumn{6}{@{}l}{\textit{80K vocabulary}} \\
548
+ \midrule
549
+ Sh & BPE & 80K & 5.545 & 0.066 & 0.049 & 0.051 \\
550
+ Sh & Unigram & 80K & 5.590 & 0.095 & 0.133 & 0.106 \\
551
+ Sh & WordPiece & 80K & 5.542 & 0.071 & 0.070 & 0.064 \\
552
+ Sh & BBPE & 80K & 5.585 & 0.081 & 0.282 & 0.124 \\
553
+ Co & BPE & 80K & 5.553 & 0.073 & 0.045 & 0.052 \\
554
+ Co & Unigram & 80K & 5.584 & 0.094 & 0.145 & 0.109 \\
555
+ Co & WordPiece & 80K & 5.552 & 0.078 & 0.067 & 0.069 \\
556
+ Co & BBPE & 80K & 5.588 & 0.086 & 0.252 & 0.127 \\
557
+ \midrule
558
+ \multicolumn{6}{@{}l}{\textit{110K vocabulary}} \\
559
+ \midrule
560
+ Sh & BPE & 110K & 5.545 & 0.066 & 0.049 & 0.051 \\
561
+ Sh & Unigram & 110K & 5.590 & 0.095 & 0.133 & 0.106 \\
562
+ Sh & WordPiece & 110K & 5.543 & 0.071 & 0.070 & 0.064 \\
563
+ Sh & BBPE & 110K & 5.585 & 0.081 & 0.282 & 0.124 \\
564
+ Co & BPE & 110K & 5.541 & 0.076 & 0.044 & 0.052 \\
565
+ Co & Unigram & 110K & 5.576 & 0.089 & 0.119 & 0.096 \\
566
+ Co & WordPiece & 110K & 5.538 & 0.070 & 0.057 & 0.058 \\
567
+ Co & BBPE & 110K & 5.578 & 0.084 & 0.239 & 0.123 \\
568
+ \bottomrule
569
+ \end{tabular}
570
+ \caption{Morphological fidelity for all 40 configurations (Arabic-script only). $\mu_e$ = morphological edit distance (lower is better). P = precision, R = recall, $\mu_c$-F1 = morphological consistency F1 (higher is better). Bold marks best values per column.}
571
+ \label{tab:morph_results}
572
+ \end{table*}
573
+
574
+
575
+ \section{Bootstrap Confidence Intervals}
576
+ \label{sec:appendix_bootstrap}
577
+
578
+ Table~\ref{tab:bootstrap} reports bootstrap 95\% confidence intervals (500 resamples) for fertility and CPT on the test set. All intervals are narrow ($\pm$0.002--0.005 for fertility), confirming that reported differences between configurations are statistically meaningful.
579
+
580
+ \begin{table}[t]
581
+ \centering
582
+ \footnotesize
583
+ \setlength{\tabcolsep}{3pt}
584
+ \begin{tabular}{@{}lrrrr@{}}
585
+ \toprule
586
+ \textbf{Config} & \textbf{Fert} & \textbf{95\% CI} & \textbf{CPT} & \textbf{95\% CI} \\
587
+ \midrule
588
+ \multicolumn{4}{@{}l}{\textit{8K}} \\
589
+ sh\_bpe & 1.574 & [1.571, 1.578] & 3.531 & [3.525, 3.538] \\
590
+ co\_bpe & 1.625 & [1.622, 1.628] & 3.412 & [3.406, 3.418] \\
591
+ sh\_uni & 1.586 & [1.583, 1.589] & 3.514 & [3.507, 3.521] \\
592
+ co\_uni & 1.631 & [1.627, 1.634] & 3.426 & [3.419, 3.432] \\
593
+ sh\_wp & 1.572 & [1.569, 1.575] & 3.535 & [3.529, 3.542] \\
594
+ co\_wp & 1.631 & [1.627, 1.634] & 3.398 & [3.392, 3.403] \\
595
+ sh\_bbpe & 1.716 & [1.712, 1.719] & 3.268 & [3.260, 3.275] \\
596
+ co\_bbpe & 1.770 & [1.767, 1.773] & 3.130 & [3.125, 3.137] \\
597
+ \midrule
598
+ \multicolumn{4}{@{}l}{\textit{16K}} \\
599
+ sh\_bpe & 1.406 & [1.404, 1.409] & 3.938 & [3.932, 3.946] \\
600
+ co\_bpe & 1.443 & [1.440, 1.445] & 3.843 & [3.836, 3.850] \\
601
+ sh\_uni & 1.439 & [1.436, 1.442] & 3.856 & [3.848, 3.863] \\
602
+ co\_uni & 1.469 & [1.466, 1.472] & 3.799 & [3.792, 3.806] \\
603
+ sh\_wp & 1.402 & [1.399, 1.404] & 3.949 & [3.943, 3.957] \\
604
+ co\_wp & 1.442 & [1.439, 1.445] & 3.843 & [3.836, 3.850] \\
605
+ sh\_bbpe & 1.563 & [1.560, 1.566] & 3.580 & [3.572, 3.588] \\
606
+ co\_bbpe & 1.604 & [1.602, 1.608] & 3.458 & [3.451, 3.465] \\
607
+ \midrule
608
+ \multicolumn{4}{@{}l}{\textit{32K}} \\
609
+ sh\_bpe & 1.280 & [1.277, 1.282] & 4.304 & [4.297, 4.311] \\
610
+ co\_bpe & 1.307 & [1.304, 1.309] & 4.232 & [4.222, 4.241] \\
611
+ sh\_uni & 1.334 & [1.332, 1.336] & 4.137 & [4.129, 4.143] \\
612
+ co\_uni & 1.350 & [1.347, 1.353] & 4.118 & [4.110, 4.125] \\
613
+ sh\_wp & 1.274 & [1.272, 1.276] & 4.320 & [4.313, 4.327] \\
614
+ co\_wp & 1.303 & [1.301, 1.306] & 4.240 & [4.233, 4.247] \\
615
+ sh\_bbpe & 1.454 & [1.451, 1.456] & 3.834 & [3.826, 3.843] \\
616
+ co\_bbpe & 1.307 & [1.304, 1.309] & 4.232 & [4.225, 4.238] \\
617
+ \bottomrule
618
+ \end{tabular}
619
+ \caption{Bootstrap 95\% confidence intervals (500 resamples) for fertility and CPT on the test set. CI width is $\leq$0.006 for all configurations.}
620
+ \label{tab:bootstrap}
621
+ \end{table}
622
+
623
 
624
+ \section{Morphological Metric Definitions}
625
+ \label{sec:appendix_metrics}
626
 
627
+ \subsection{Morphological Edit Distance ($\mu_e$)}
628
 
629
+ Given a word $w$ tokenized into tokens $\mathbf{t} = [t_1, \ldots, t_m]$ and segmented by Farasa into morphemes $\mathbf{m} = [m_1, \ldots, m_k]$, we compute the ordered Levenshtein alignment cost:
630
+ \begin{equation}
631
+ \mu_e = \frac{1}{N} \sum_{i=1}^{N} \text{Lev}(\mathbf{t}_i, \mathbf{m}_i)
632
+ \end{equation}
633
+ where $\text{Lev}(\cdot, \cdot)$ is the standard edit distance (insertions, deletions, substitutions each cost 1), and $N$ is the number of Arabic-script words in the test set with available Farasa segmentations. Lower $\mu_e$ indicates better alignment between token boundaries and morpheme boundaries.
634
+
635
+ \subsection{Morphological Consistency F1 ($\mu_c$)}
636
 
637
+ $\mu_c$ measures whether words that share morphemes also share tokens. We compute it in three steps:
638
 
639
+ \textbf{Step 1: Morphological clustering.} For each unique word $w_i$ in the test set, we construct a TF-IDF vector from its Farasa morpheme set. We cluster all words into $K = 30$ groups via $K$-Means on these vectors. Each cluster contains words with overlapping morphology.
640
+
641
+ \textbf{Step 2: Pairwise evaluation.} Within each cluster, we sample up to $C = 20$ word pairs. For each pair $(w_i, w_j)$:
642
  \begin{itemize}[noitemsep,topsep=2pt]
643
+ \item \textbf{Shared morpheme}: $|M(w_i) \cap M(w_j)| > 0$ where $M(w)$ is the morpheme set.
644
+ \item \textbf{Shared token}: $|T(w_i) \cap T(w_j)| > 0$ where $T(w)$ is the token set.
 
 
645
  \end{itemize}
646
 
647
+ \textbf{Step 3: Precision, recall, F1.} We define:
648
+ \begin{align}
649
+ P &= \frac{|\text{pairs sharing both morpheme \& token}|}{|\text{pairs sharing token}|} \\
650
+ R &= \frac{|\text{pairs sharing both morpheme \& token}|}{|\text{pairs sharing morpheme}|} \\
651
+ \mu_c\text{-F1} &= \frac{2 \cdot P \cdot R}{P + R}
652
+ \end{align}
653
 
654
+ We bootstrap this process $B = 5$ times (different random pair samples per iteration) and report the mean F1. Higher $\mu_c$ indicates that the tokenizer groups morphologically related words into consistent token clusters.
 
655
 
656
  \end{document}