Samai-sa commited on
Commit
ea80f98
·
verified ·
1 Parent(s): 007fc5f

Publish SamAI Tokenizer

Browse files
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ results/generated/
CITATION.cff ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ message: "If you use SunAI-64K, please cite this repository."
3
+ title: "SunAI-64K: An Arabic-Focused Byte-Level BPE Tokenizer"
4
+ type: software
5
+ authors:
6
+ - family-names: Aljohani
7
+ given-names: Yasser
8
+ version: 1.0.0
9
+ date-released: 2026-09-20
10
+ license: Apache-2.0
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ SunAI-64K
2
+ Copyright 2026 Yasser Aljohani
3
+
4
+ This product includes aggregate benchmark results produced from third-party
5
+ datasets and tokenizers. Those projects remain governed by their respective
6
+ licenses and terms. No benchmark source documents or training-corpus text are
7
+ redistributed in this repository.
PUBLISHING.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Publish to Hugging Face
2
+
3
+ The repository is prepared as a Hugging Face **model repository** containing a
4
+ tokenizer, not model weights.
5
+
6
+ ## 1. Review the public metadata
7
+
8
+ Before publishing, replace every occurrence of `YOUR_USERNAME` in `README.md`,
9
+ `README_AR.md`, and `example.py` with your Hugging Face username or organization.
10
+ Confirm the project name and author details in `CITATION.cff`.
11
+
12
+ ## 2. Authenticate
13
+
14
+ ```bash
15
+ python -m pip install -U huggingface_hub
16
+ hf auth login
17
+ hf auth whoami
18
+ ```
19
+
20
+ Use a Hugging Face account or token with write permission. Never place the
21
+ token inside a source file or commit it to the repository.
22
+
23
+ ## 3. Verify locally
24
+
25
+ ```bash
26
+ python -m pip install -r requirements.txt
27
+ python verify_tokenizer.py
28
+ sha256sum -c SHA256SUMS
29
+ ```
30
+
31
+ ## 4. Upload
32
+
33
+ ```bash
34
+ python upload_to_hub.py YOUR_USERNAME/SunAI-64K
35
+ ```
36
+
37
+ The script creates a public model repository if it does not already exist and
38
+ uploads the folder in one commit. To test privately first, add `--private`.
39
+
40
+ You can also use the Hugging Face CLI after creating the repository:
41
+
42
+ ```bash
43
+ hf upload YOUR_USERNAME/SunAI-64K . .
44
+ ```
45
+
46
+ ## 5. Test the published repository
47
+
48
+ ```python
49
+ from transformers import PreTrainedTokenizerFast
50
+
51
+ repo_id = "YOUR_USERNAME/SunAI-64K"
52
+ tokenizer = PreTrainedTokenizerFast.from_pretrained(repo_id)
53
+
54
+ text = "المملكة العربية السعودية"
55
+ ids = tokenizer.encode(text, add_special_tokens=False)
56
+
57
+ assert tokenizer.decode(ids) == text
58
+ assert len(tokenizer) == 65_536
59
+ print(ids)
60
+ ```
61
+
62
+ ## Recommended first release
63
+
64
+ After verifying the public page, create a `v1.0.0` tag so downstream training
65
+ runs can pin the tokenizer revision instead of depending on a moving `main`
66
+ branch.
README.md ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ar
4
+ - en
5
+ license: apache-2.0
6
+ library_name: tokenizers
7
+ datasets:
8
+ - AdaMLLab/AraMix
9
+ - HuggingFaceFW/fineweb-2
10
+ - HuggingFaceFW/fineweb
11
+ tags:
12
+ - tokenizer
13
+ - arabic
14
+ - arabic-nlp
15
+ - bpe
16
+ - byte-level
17
+ - saudi-arabia
18
+ ---
19
+
20
+ # SamAI-Tokenizer
21
+
22
+ SamAI-Tokenizer is an Arabic-focused, byte-level BPE tokenizer intended for training
23
+ new Arabic-heavy language models. It has a vocabulary of 65,536 tokens, uses
24
+ NFC normalization, preserves the original text during decoding, and includes
25
+ reserved tokens for future model development.
26
+
27
+ This repository contains the complete tokenizer, validation reports, the
28
+ four-dataset benchmark implementation, and aggregate benchmark results. It
29
+ does **not** contain model weights or redistribute training/benchmark text.
30
+
31
+ ## Key specifications
32
+
33
+ | Property | Value |
34
+ | --- | --- |
35
+ | Algorithm | Byte-level BPE |
36
+ | Vocabulary size | 65,536 |
37
+ | Normalization | Unicode NFC |
38
+ | Pre-tokenizer | ByteLevel |
39
+ | Unknown-token fallback | Byte-level coverage |
40
+ | Named special tokens | `<pad>`, `<bos>`, `<eos>`, `<unk>`, `<user>`, `<assistant>`, `<system>` |
41
+ | Reserved token IDs | 7–255 |
42
+ | Tokenizer SHA-256 | `7d9496a251b44688557a79fab59b5cf7a12f11a9559540b9a1e223657f35f613` |
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install -U tokenizers transformers huggingface_hub
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ Replace `SamAI/SamAI-Tokenizer` with the published repository ID.
53
+
54
+ ### Transformers
55
+
56
+ ```python
57
+ from transformers import PreTrainedTokenizerFast
58
+
59
+ tokenizer = PreTrainedTokenizerFast.from_pretrained(
60
+ "SamAI/SamAI-Tokenizer"
61
+ )
62
+
63
+ text = "المملكة العربية السعودية"
64
+ ids = tokenizer.encode(text, add_special_tokens=False)
65
+
66
+ print(ids)
67
+ print(tokenizer.convert_ids_to_tokens(ids))
68
+ print(tokenizer.decode(ids))
69
+ ```
70
+
71
+ ### Tokenizers
72
+
73
+ ```python
74
+ from huggingface_hub import hf_hub_download
75
+ from tokenizers import Tokenizer
76
+
77
+ path = hf_hub_download(
78
+ repo_id="SamAI/SamAI-Tokenizer",
79
+ filename="tokenizer.json",
80
+ )
81
+ tokenizer = Tokenizer.from_file(path)
82
+
83
+ encoding = tokenizer.encode(
84
+ "السلام عليكم ورحمة الله وبركاته",
85
+ add_special_tokens=False,
86
+ )
87
+
88
+ print(encoding.ids)
89
+ print(encoding.tokens)
90
+ print(tokenizer.decode(encoding.ids))
91
+ ```
92
+
93
+ ## Training mixture
94
+
95
+ The tokenizer was trained from sampled text covering Arabic and English. The
96
+ training text itself is not included.
97
+
98
+ | Source bucket | Characters used |
99
+ | --- | ---: |
100
+ | Saudi schoolbooks | 29,856,611 |
101
+ | AraMix Arabic | 200,000,000 |
102
+ | FineWeb2 Arabic | 200,000,000 |
103
+ | FineWeb English | 200,000,000 |
104
+ | **Total** | **629,856,611** |
105
+
106
+ The released metadata records the training-input SHA-256 as
107
+ `bf02ef3cfa689f435aa5402ace1cb09221f9bec22b1f19dd6e73eaf1bddbd115`.
108
+ This identifies the exact processed input used by the original training run;
109
+ it is not a hash of the upstream datasets.
110
+
111
+ ## Validation
112
+
113
+ The supplied validation run reported zero round-trip failures and zero unknown
114
+ tokens across Saudi schoolbooks, AraMix Arabic, FineWeb2 Arabic, and FineWeb
115
+ English samples. See [`reports/validation.json`](reports/validation.json) and
116
+ [`reports/stress.json`](reports/stress.json).
117
+
118
+ ## Four-dataset Arabic benchmark
119
+
120
+ SamAI-Tokenizer was compared on four complementary Arabic datasets:
121
+
122
+ | Benchmark | Register | Documents | Words |
123
+ | --- | --- | ---: | ---: |
124
+ | ArabicMMLU | Academic questions and reading passages | 14,435 | 410,566 |
125
+ | MLQA Arabic | Questions and long answer-bearing passages | 10,933 | 638,708 |
126
+ | MASSIVE Arabic | Short assistant commands | 2,907 | 15,356 |
127
+ | Arabic Dialects Dataset | Regional dialect text | 9,807 | 337,653 |
128
+ | **Combined** | | **38,082** | **1,402,283** |
129
+
130
+ The primary ranking is an equal-weight macro average: each benchmark receives
131
+ 25% weight regardless of corpus size. Lower tokens per word is better.
132
+
133
+ | Rank | Tokenizer | Mean tokens/word | Tokens versus SunAI |
134
+ | ---: | --- | ---: | ---: |
135
+ | 1 | ALLaM-7B | 1.5021 | -4.86% |
136
+ | **2** | **SamAI-Tokenizer** | **1.6207** | **baseline** |
137
+ | 3 | Falcon-H1-7B | 1.8880 | +19.30% |
138
+ | 4 | Mistral-Small-3.1 | 1.8929 | +20.71% |
139
+ | 5 | Qwen3.8-Flash-Next | 1.9039 | +21.94% |
140
+ | 6 | Qwen3.5-4B | 1.9039 | +21.94% |
141
+ | 7 | tiktoken-o200k | 1.9919 | +26.37% |
142
+ | 8 | GPT-OSS-20B | 1.9919 | +26.37% |
143
+ | 9 | Fanar-1 | 2.1570 | +36.81% |
144
+ | 10 | DeepSeek-V3 | 2.2774 | +46.25% |
145
+ | 11 | Qwen2.5-7B | 2.3740 | +50.25% |
146
+ | 12 | Qwen3-8B | 2.3740 | +50.25% |
147
+ | 13 | GLM-5.3-Flash | 2.5225 | +60.21% |
148
+ | 14 | Kimi-K2.6 | 2.8693 | +84.13% |
149
+ | 15 | tiktoken-cl100k | 4.0800 | +164.63% |
150
+
151
+ ### Results by benchmark
152
+
153
+ | Benchmark | SunAI tokens/word | Best tokenizer | Best tokens/word | SunAI position |
154
+ | --- | ---: | --- | ---: | ---: |
155
+ | Arabic Dialects | 1.3043 | ALLaM-7B | 1.2812 | 2 |
156
+ | ArabicMMLU | 2.4838 | ALLaM-7B | 1.9943 | 5 |
157
+ | MASSIVE Arabic | 1.2549 | ALLaM-7B | 1.1939 | 2 |
158
+ | MLQA Arabic | **1.4397** | **SamAI-Tokenizer** | **1.4397** | **1** |
159
+
160
+ Complete aggregate results are under [`results/`](results/). The row-level
161
+ benchmark output is intentionally excluded because it reproduces third-party
162
+ dataset text; the script can regenerate it for users who accept the applicable
163
+ dataset terms.
164
+
165
+ ## Benchmark methodology
166
+
167
+ - All available examples were used, followed by exact-text deduplication within
168
+ each benchmark.
169
+ - Token counts exclude chat templates and added special tokens.
170
+ - `tokens_per_word` is total tokens divided by whitespace-separated words.
171
+ - The macro ranking averages each benchmark's ratio to SunAI, giving every
172
+ benchmark equal weight.
173
+ - The pooled report instead sums all tokens and words before calculating the
174
+ ratio; MLQA and ArabicMMLU therefore receive more weight in that view.
175
+ - Qwen2.5 and Qwen3 produced identical results. Qwen3.5 and Qwen3.8 also
176
+ produced identical results. GPT-OSS and `o200k_base` produced identical
177
+ results. These should be interpreted as tokenizer-family duplicates, not
178
+ independent confirmations.
179
+ - Jais-13B, Gemma-3-4B, Llama-4-Scout, and Aya-Expanse were gated during the
180
+ published run. AceGPT-v2 could not be loaded by the tested library version.
181
+ They are not included in the ranking.
182
+
183
+ To reproduce the benchmark:
184
+
185
+ ```bash
186
+ pip install -r benchmark/requirements.txt
187
+ python benchmark/benchmark.py
188
+ ```
189
+
190
+ Some competitor tokenizers require executing repository-provided Python code.
191
+ That is disabled by default. Review and pin the relevant repositories before
192
+ enabling it:
193
+
194
+ ```bash
195
+ SUNAI_TRUST_REMOTE_CODE=1 python benchmark/benchmark.py
196
+ ```
197
+
198
+ ## Limitations
199
+
200
+ - Tokenization efficiency does not measure language-model quality, factuality,
201
+ safety, reasoning, or downstream accuracy.
202
+ - Fully vocalized Arabic is the clearest weakness. One heavily diacritized
203
+ ArabicMMLU subject accounts for most of the gap to ALLaM. Excluding `Arabic
204
+ Language (General)`, SunAI records approximately 1.630 tokens/word versus
205
+ ALLaM's 1.709 on the remaining ArabicMMLU subjects.
206
+ - ArabicMMLU contains reading passages repeated across different questions.
207
+ Exact full-document deduplication does not remove every repeated passage.
208
+ - Whitespace-separated words are a transparent efficiency denominator, but
209
+ they are not a linguistic segmentation of Arabic morphology.
210
+ - The tokenizer was designed for training new models. Replacing the tokenizer
211
+ of an already pretrained model requires resizing and retraining its embedding
212
+ and output layers; it is not a drop-in vocabulary replacement.
213
+
214
+ ## License and data terms
215
+
216
+ The tokenizer files and repository code are released under Apache-2.0. Source
217
+ datasets and benchmark datasets remain subject to their own licenses and terms.
218
+ No source-corpus or benchmark documents are distributed here. Users are
219
+ responsible for confirming that their intended use complies with the relevant
220
+ upstream terms.
221
+
222
+ ## Citation
223
+
224
+ ```bibtex
225
+ @software{aljohani2026sunai64k,
226
+ author = {Yasser Aljohani},
227
+ title = {SamAI-Tokenizer: An Arabic-Focused Byte-Level BPE Tokenizer},
228
+ year = {2026},
229
+ version = {1.0.0},
230
+ url = {https://huggingface.co/SamAI/SamAI-Tokenizer}
231
+ }
232
+ ```
README_AR.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SamAI-Tokenizer
2
+
3
+ `SamAI-Tokenizer` هو مقطّع نصوص عربي مبني بخوارزمية BPE على مستوى البايت، ومصمم
4
+ لتدريب نماذج لغوية جديدة تركّز على اللغة العربية. يبلغ حجم القاموس 65,536
5
+ رمزًا، ويستخدم Unicode NFC مع إمكانية استعادة النص الأصلي بعد فك الترميز.
6
+
7
+ تتضمن الحزمة ملف `tokenizer.json` الكامل، وملفات إعداد Hugging Face، وتقارير
8
+ التحقق، ونتائج مقارنة على أربع مجموعات بيانات عربية، إضافة إلى سكربت إعادة
9
+ تشغيل المقارنة.
10
+
11
+ ## أبرز النتائج
12
+
13
+ - المركز الثاني في المتوسط المتساوي لأربعة اختبارات من بين 15 مقطّعًا تم
14
+ تشغيلها بنجاح.
15
+ - 1.6207 رمز لكل كلمة في المتوسط.
16
+ - المركز الأول على MLQA Arabic بمعدل 1.4397 رمز لكل كلمة.
17
+ - يتفوق في كفاءة التقطيع على Fanar-1 بنسبة 36.81%، وعلى `o200k_base` بنسبة
18
+ 26.37%، وعلى `cl100k_base` بنسبة 164.63% وفق المتوسط المتساوي.
19
+ - الضعف الأوضح هو النص العربي المشكول بالكامل، ويجب أخذه في الاعتبار عند
20
+ تدريب نماذج للقرآن أو النصوص التراثية والتعليمية المشكولة.
21
+
22
+ ## الاستخدام
23
+
24
+ ```python
25
+ from transformers import PreTrainedTokenizerFast
26
+
27
+ tokenizer = PreTrainedTokenizerFast.from_pretrained(
28
+ "SamAI/SamAI-Tokenizer"
29
+ )
30
+
31
+ text = "المملكة العربية السعودية"
32
+ ids = tokenizer.encode(text, add_special_tokens=False)
33
+
34
+ print(ids)
35
+ print(tokenizer.convert_ids_to_tokens(ids))
36
+ print(tokenizer.decode(ids))
37
+ ```
38
+
39
+ التفاصيل الكاملة والمنهجية والقيود موجودة في [`README.md`](README.md).
SHA256SUMS ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ 7d9496a251b44688557a79fab59b5cf7a12f11a9559540b9a1e223657f35f613 tokenizer.json
2
+ 5b31993809ba4357d5244f8acf545bd51cf9e067194a3c5265566115a184f5d0 tokenizer_config.json
3
+ 65e01cbbbc962caacbd445bca5bbb15bd5f6b5d6a3e70c7782f2d8082de1133f special_tokens_map.json
4
+ 7accea76f23ec2adf4f0d99070ae3135d8668cdbb319e7bff6809adf98f35d6c meta.json
5
+ a90011eaa38b558f0660ba749aeb31382c3f2b27ac3a91943e23b4f70a6606e3 reports/validation.json
6
+ 5017e97f06b75ce480dcc6d519f44c1822828c2a3223ba5788678520d5584881 reports/stress.json
benchmark/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Benchmark reproduction
2
+
3
+ The benchmark compares SunAI-64K with Arabic-focused and recent multilingual
4
+ tokenizers on four datasets. It downloads tokenizer assets only, not model
5
+ weights.
6
+
7
+ ## Run
8
+
9
+ From the repository root:
10
+
11
+ ```bash
12
+ python -m venv .venv
13
+ source .venv/bin/activate
14
+ pip install -r benchmark/requirements.txt
15
+ python benchmark/benchmark.py
16
+ ```
17
+
18
+ Generated files are written to `results/generated/`. Override paths when
19
+ needed:
20
+
21
+ ```bash
22
+ SUNAI_TOKENIZER_PATH=/path/to/tokenizer.json \
23
+ SUNAI_BENCHMARK_OUTPUT=/path/to/results \
24
+ python benchmark/benchmark.py
25
+ ```
26
+
27
+ Third-party remote code is disabled by default. Some custom tokenizers will be
28
+ skipped unless you review their repositories and explicitly opt in:
29
+
30
+ ```bash
31
+ SUNAI_TRUST_REMOTE_CODE=1 python benchmark/benchmark.py
32
+ ```
33
+
34
+ Gated repositories also require accepting their terms and authenticating with
35
+ Hugging Face before running the script.
36
+
37
+ ## Published files
38
+
39
+ - `arabic_4bench_macro_average.csv`: equal 25% weight per benchmark; primary
40
+ ranking.
41
+ - `arabic_4bench_pooled_overall.csv`: all tokens and words pooled together.
42
+ - `arabic_4bench_by_benchmark.csv`: result for every tokenizer and benchmark.
43
+ - `arabic_4bench_by_category.csv`: detailed subject, dialect, and intent
44
+ breakdowns.
45
+ - `arabicmmlu_summary.csv` and `arabicmmlu_by_subject.csv`: the original
46
+ ArabicMMLU-only comparison.
47
+
48
+ The script also produces document-level results locally. Those results are not
49
+ published because they contain copies of benchmark text.
benchmark/benchmark.py ADDED
@@ -0,0 +1,678 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import math
3
+ import os
4
+ import random
5
+
6
+ import pandas as pd
7
+ import tiktoken
8
+ from datasets import get_dataset_config_names, load_dataset
9
+ from huggingface_hub import hf_hub_download
10
+ from tokenizers import Tokenizer as CoreTokenizer
11
+ from transformers import AutoTokenizer
12
+
13
+
14
+ # ---------------------------------------------------------------------
15
+ # Configuration
16
+ # ---------------------------------------------------------------------
17
+
18
+ REPO_ROOT = Path(__file__).resolve().parents[1]
19
+
20
+ MY_TOKENIZER_PATH = Path(
21
+ os.environ.get("SUNAI_TOKENIZER_PATH", REPO_ROOT / "tokenizer.json")
22
+ )
23
+
24
+ # Four complementary Arabic benchmarks. Each loader uses evaluation/test data
25
+ # where available, and no prompt/chat-template text is injected.
26
+ EXPECTED_BENCHMARKS = {
27
+ "ArabicMMLU",
28
+ "MLQA-Arabic",
29
+ "MASSIVE-Arabic",
30
+ "Arabic-Dialects",
31
+ }
32
+
33
+ # None = use every available example. Set (for example) 1000 for a quick run;
34
+ # the limit is applied independently to each benchmark.
35
+ MAX_EXAMPLES_PER_BENCHMARK = None
36
+
37
+ BATCH_SIZE = 128
38
+ RANDOM_SEED = 42
39
+
40
+ OUTPUT_DIR = Path(
41
+ os.environ.get(
42
+ "SUNAI_BENCHMARK_OUTPUT",
43
+ REPO_ROOT / "results" / "generated",
44
+ )
45
+ )
46
+
47
+ # Some third-party tokenizers require executing code from their repositories.
48
+ # Keep this disabled by default. Review those repositories and enable it only
49
+ # when you explicitly accept that risk:
50
+ # SUNAI_TRUST_REMOTE_CODE=1 python benchmark/benchmark.py
51
+ TRUST_REMOTE_CODE = os.environ.get(
52
+ "SUNAI_TRUST_REMOTE_CODE", "0"
53
+ ).lower() in {"1", "true", "yes"}
54
+
55
+ # Only tokenizer/configuration files are downloaded, not model weights.
56
+ #
57
+ # The list deliberately keeps older baselines while adding newer model
58
+ # families. Some repositories (for example Jais, Gemma, Llama and Aya) may
59
+ # require accepting their Hugging Face terms and running `hf auth login`.
60
+ # A failed or gated tokenizer is reported and skipped without stopping the
61
+ # rest of the benchmark.
62
+ HF_TOKENIZERS = {
63
+ # Existing Arabic and multilingual baselines
64
+ "Fanar-1": "QCRI/Fanar-1-9B-Instruct",
65
+ "ALLaM-7B": "humain-ai/ALLaM-7B-Instruct-preview",
66
+ "Jais-13B": "inception42/jais-13b",
67
+ "Qwen2.5-7B": "Qwen/Qwen2.5-7B",
68
+
69
+ # Newer Qwen tokenizer generations
70
+ "Qwen3-8B": "Qwen/Qwen3-8B",
71
+ "Qwen3.5-4B": "Qwen/Qwen3.5-4B",
72
+ "Qwen3.8-Flash-Next": "Qwen/Qwen3.8-Flash-Next",
73
+
74
+ # Recent frontier/open-weight model families
75
+ "DeepSeek-V3": "deepseek-ai/DeepSeek-V3",
76
+ "GPT-OSS-20B": "openai/gpt-oss-20b",
77
+ "GLM-5.3-Flash": "zai-org/GLM-5.3-Flash",
78
+ "Kimi-K2.6": "moonshotai/Kimi-K2.6",
79
+
80
+ # Recent multilingual tokenizers with Arabic coverage/relevance
81
+ "Gemma-3-4B": "google/gemma-3-4b-it",
82
+ "Llama-4-Scout": "meta-llama/Llama-4-Scout-17B-16E-Instruct",
83
+ "Mistral-Small-3.1": "mistralai/Mistral-Small-3.1-24B-Instruct-2503",
84
+ "Falcon-H1-7B": "tiiuae/Falcon-H1-7B-Instruct",
85
+ "Aya-Expanse-8B": "CohereLabs/aya-expanse-8b",
86
+
87
+ # Additional Arabic-focused baseline
88
+ "AceGPT-v2-8B": "FreedomIntelligence/AceGPT-v2-8B",
89
+ }
90
+
91
+ TIKTOKEN_ENCODINGS = {
92
+ "tiktoken-cl100k": "cl100k_base",
93
+ "tiktoken-o200k": "o200k_base",
94
+ }
95
+
96
+
97
+ # ---------------------------------------------------------------------
98
+ # Dataset preparation
99
+ # ---------------------------------------------------------------------
100
+
101
+ def clean_value(value) -> str:
102
+ """Convert dataset values to clean text while ignoring null/NaN values."""
103
+ if value is None:
104
+ return ""
105
+
106
+ if isinstance(value, float) and math.isnan(value):
107
+ return ""
108
+
109
+ value = str(value).strip()
110
+
111
+ if value.lower() in {"nan", "none", "null"}:
112
+ return ""
113
+
114
+ return value
115
+
116
+
117
+ def arabic_mmlu_row_to_text(row) -> str:
118
+ """
119
+ Build one benchmark document from the original dataset text.
120
+
121
+ No artificial English prompt or chat template is added because we want
122
+ to measure the tokenizers, not differences in prompt formatting.
123
+ """
124
+ parts = []
125
+
126
+ context = clean_value(row.get("Context"))
127
+ question = clean_value(row.get("Question"))
128
+
129
+ if context:
130
+ parts.append(context)
131
+
132
+ if question:
133
+ parts.append(question)
134
+
135
+ for index in range(1, 6):
136
+ option = clean_value(row.get(f"Option {index}"))
137
+ if option:
138
+ parts.append(option)
139
+
140
+ return "\n".join(parts)
141
+
142
+
143
+ def make_record(benchmark, category, text, **metadata):
144
+ text = clean_value(text)
145
+ if not text:
146
+ return None
147
+
148
+ return {
149
+ "benchmark": benchmark,
150
+ "category": category,
151
+ "configuration": metadata.get("configuration", ""),
152
+ "group": metadata.get("group", category),
153
+ "subject": metadata.get("subject", category),
154
+ "country": metadata.get("country", ""),
155
+ "text": text,
156
+ "words": len(text.split()),
157
+ "characters": len(text),
158
+ "bytes": len(text.encode("utf-8")),
159
+ }
160
+
161
+
162
+ def deduplicate_and_limit(records):
163
+ unique = []
164
+ seen = set()
165
+
166
+ for record in records:
167
+ if record is None or record["text"] in seen:
168
+ continue
169
+ seen.add(record["text"])
170
+ unique.append(record)
171
+
172
+ if (
173
+ MAX_EXAMPLES_PER_BENCHMARK is not None
174
+ and len(unique) > MAX_EXAMPLES_PER_BENCHMARK
175
+ ):
176
+ random.Random(RANDOM_SEED).shuffle(unique)
177
+ unique = unique[:MAX_EXAMPLES_PER_BENCHMARK]
178
+
179
+ return unique
180
+
181
+
182
+ def load_arabic_mmlu():
183
+ dataset_id = "MBZUAI/ArabicMMLU"
184
+ print(f"\nLoading ArabicMMLU: {dataset_id}")
185
+
186
+ configurations = get_dataset_config_names(dataset_id)
187
+
188
+ # Some dataset versions may provide an aggregate "All" configuration.
189
+ all_config = next(
190
+ (name for name in configurations if name.lower() == "all"),
191
+ None,
192
+ )
193
+
194
+ configs_to_load = [all_config] if all_config else configurations
195
+ records = []
196
+
197
+ for position, config_name in enumerate(configs_to_load, start=1):
198
+ print(
199
+ f"[{position}/{len(configs_to_load)}] "
200
+ f"Loading configuration: {config_name}"
201
+ )
202
+
203
+ dataset = load_dataset(
204
+ dataset_id,
205
+ config_name,
206
+ split="test",
207
+ )
208
+
209
+ for row in dataset:
210
+ # Keep held-out test questions only.
211
+ if row.get("is_few_shot", 0) not in {0, False, None}:
212
+ continue
213
+
214
+ records.append(
215
+ make_record(
216
+ "ArabicMMLU",
217
+ "academic-exams",
218
+ arabic_mmlu_row_to_text(row),
219
+ configuration=config_name,
220
+ group=clean_value(row.get("Group")) or "Unknown",
221
+ subject=clean_value(row.get("Subject")) or config_name,
222
+ country=clean_value(row.get("Country")) or "Unknown",
223
+ )
224
+ )
225
+
226
+ return deduplicate_and_limit(records)
227
+
228
+
229
+ def load_mlqa_arabic():
230
+ """Arabic questions and long answer-bearing passages from MLQA."""
231
+ dataset_id = "mteb/MLQARetrieval"
232
+ print(f"\nLoading MLQA Arabic: {dataset_id}")
233
+ records = []
234
+
235
+ for config_name in ("ara-ara-corpus", "ara-ara-queries"):
236
+ category = "passages" if config_name.endswith("corpus") else "questions"
237
+
238
+ # Both validation and test exist in the MTEB parquet conversion.
239
+ for split_name in ("validation", "test"):
240
+ dataset = load_dataset(dataset_id, config_name, split=split_name)
241
+ for row in dataset:
242
+ records.append(
243
+ make_record(
244
+ "MLQA-Arabic",
245
+ category,
246
+ row.get("text"),
247
+ configuration=config_name,
248
+ group="QA",
249
+ subject=category,
250
+ )
251
+ )
252
+
253
+ return deduplicate_and_limit(records)
254
+
255
+
256
+ def load_massive_arabic():
257
+ """Short Arabic assistant commands from the MASSIVE NLU benchmark."""
258
+ dataset_id = "mteb/amazon_massive_intent"
259
+ print(f"\nLoading MASSIVE Arabic: {dataset_id}")
260
+ configurations = get_dataset_config_names(dataset_id)
261
+ config_name = "ar" if "ar" in configurations else "default"
262
+ dataset = load_dataset(dataset_id, config_name, split="test")
263
+ records = []
264
+
265
+ for row in dataset:
266
+ language = clean_value(row.get("lang"))
267
+ if config_name == "default" and language not in {"ar", "ar-SA"}:
268
+ continue
269
+
270
+ intent = clean_value(row.get("label_text") or row.get("label"))
271
+ records.append(
272
+ make_record(
273
+ "MASSIVE-Arabic",
274
+ "assistant-commands",
275
+ row.get("text"),
276
+ configuration=config_name,
277
+ group="spoken-NLU",
278
+ subject=intent or "assistant-command",
279
+ country="Saudi Arabia" if language == "ar-SA" else "",
280
+ )
281
+ )
282
+
283
+ return deduplicate_and_limit(records)
284
+
285
+
286
+ def load_arabic_dialects():
287
+ """Regional dialectal/transcribed Arabic covering five dialect groups."""
288
+ dataset_id = "arbml/Arabic_Dialects_Dataset"
289
+ print(f"\nLoading Arabic dialects: {dataset_id}")
290
+ dataset = load_dataset(dataset_id, split="train")
291
+ label_feature = dataset.features.get("label")
292
+ records = []
293
+
294
+ for row in dataset:
295
+ label = row.get("label")
296
+ if label_feature is not None and hasattr(label_feature, "int2str"):
297
+ try:
298
+ dialect = label_feature.int2str(label)
299
+ except (TypeError, ValueError):
300
+ dialect = clean_value(label)
301
+ else:
302
+ dialect = clean_value(label)
303
+
304
+ records.append(
305
+ make_record(
306
+ "Arabic-Dialects",
307
+ dialect or "dialectal-Arabic",
308
+ row.get("Text") or row.get("text"),
309
+ configuration="default",
310
+ group="dialectal-Arabic",
311
+ subject=dialect or "Unknown dialect",
312
+ )
313
+ )
314
+
315
+ return deduplicate_and_limit(records)
316
+
317
+
318
+ def load_all_benchmarks() -> pd.DataFrame:
319
+ records = []
320
+ loaders = (
321
+ load_arabic_mmlu,
322
+ load_mlqa_arabic,
323
+ load_massive_arabic,
324
+ load_arabic_dialects,
325
+ )
326
+
327
+ for loader in loaders:
328
+ loaded = loader()
329
+ records.extend(loaded)
330
+ print(f"Loaded {len(loaded):,} unique documents")
331
+
332
+ frame = pd.DataFrame(records)
333
+ loaded_names = set(frame["benchmark"].unique())
334
+ missing = EXPECTED_BENCHMARKS - loaded_names
335
+ if missing:
336
+ raise RuntimeError(f"Missing required benchmarks: {sorted(missing)}")
337
+
338
+ print("\nBenchmark corpus summary:")
339
+ print(
340
+ frame.groupby("benchmark")
341
+ .agg(documents=("text", "size"), words=("words", "sum"), bytes=("bytes", "sum"))
342
+ .to_string()
343
+ )
344
+ print(f"\nCombined documents: {len(frame):,}")
345
+ print(f"Combined words: {frame['words'].sum():,}")
346
+ print(f"Combined UTF-8 bytes: {frame['bytes'].sum():,}")
347
+
348
+ return frame
349
+
350
+
351
+ # ---------------------------------------------------------------------
352
+ # Tokenizer wrappers
353
+ # ---------------------------------------------------------------------
354
+
355
+ def encode_in_batches(texts, encode_batch):
356
+ token_lengths = []
357
+
358
+ for start in range(0, len(texts), BATCH_SIZE):
359
+ batch = texts[start : start + BATCH_SIZE]
360
+ encoded_batch = encode_batch(batch)
361
+
362
+ token_lengths.extend(len(token_ids) for token_ids in encoded_batch)
363
+
364
+ completed = min(start + BATCH_SIZE, len(texts))
365
+ print(
366
+ f"\rProcessed {completed:,}/{len(texts):,}",
367
+ end="",
368
+ flush=True,
369
+ )
370
+
371
+ print()
372
+ return token_lengths
373
+
374
+
375
+ def benchmark_custom_tokenizer(frame):
376
+ if not MY_TOKENIZER_PATH.exists():
377
+ raise FileNotFoundError(
378
+ f"Your tokenizer was not found: {MY_TOKENIZER_PATH}"
379
+ )
380
+
381
+ tokenizer = CoreTokenizer.from_file(str(MY_TOKENIZER_PATH))
382
+
383
+ print(f"\nBenchmarking your tokenizer: {MY_TOKENIZER_PATH}")
384
+ print(f"Vocabulary size: {tokenizer.get_vocab_size():,}")
385
+
386
+ return encode_in_batches(
387
+ frame["text"].tolist(),
388
+ lambda batch: [
389
+ encoding.ids
390
+ for encoding in tokenizer.encode_batch(
391
+ batch,
392
+ add_special_tokens=False,
393
+ )
394
+ ],
395
+ )
396
+
397
+
398
+ def benchmark_huggingface_tokenizer(name, repository, frame):
399
+ print(f"\nLoading {name}: {repository}")
400
+
401
+ load_kwargs = {
402
+ "use_fast": True,
403
+ "trust_remote_code": TRUST_REMOTE_CODE,
404
+ "token": os.environ.get("HF_TOKEN"),
405
+ }
406
+ if name == "Mistral-Small-3.1":
407
+ load_kwargs["fix_mistral_regex"] = True
408
+
409
+ try:
410
+ tokenizer = AutoTokenizer.from_pretrained(repository, **load_kwargs)
411
+ except Exception as auto_error:
412
+ # Some new repositories expose tokenizer.json before their tokenizer
413
+ # class is supported by the installed Transformers version. The raw
414
+ # Hugging Face Tokenizers file is sufficient for this compression test.
415
+ try:
416
+ tokenizer_path = hf_hub_download(
417
+ repo_id=repository,
418
+ filename="tokenizer.json",
419
+ token=os.environ.get("HF_TOKEN"),
420
+ )
421
+ core_tokenizer = CoreTokenizer.from_file(tokenizer_path)
422
+ print(f"AutoTokenizer unavailable; using tokenizer.json fallback")
423
+ print(f"Vocabulary size: {core_tokenizer.get_vocab_size():,}")
424
+ print(f"Benchmarking {name}")
425
+ return encode_in_batches(
426
+ frame["text"].tolist(),
427
+ lambda batch: [
428
+ encoding.ids
429
+ for encoding in core_tokenizer.encode_batch(
430
+ batch,
431
+ add_special_tokens=False,
432
+ )
433
+ ],
434
+ )
435
+ except Exception as fallback_error:
436
+ raise RuntimeError(
437
+ f"AutoTokenizer failed: {auto_error}; "
438
+ f"tokenizer.json fallback failed: {fallback_error}"
439
+ ) from auto_error
440
+
441
+ print(f"Vocabulary size: {len(tokenizer):,}")
442
+ print(f"Benchmarking {name}")
443
+
444
+ def encode_batch(batch):
445
+ output = tokenizer(
446
+ batch,
447
+ add_special_tokens=False,
448
+ padding=False,
449
+ truncation=False,
450
+ return_attention_mask=False,
451
+ return_token_type_ids=False,
452
+ )
453
+ return output["input_ids"]
454
+
455
+ return encode_in_batches(frame["text"].tolist(), encode_batch)
456
+
457
+
458
+ def benchmark_tiktoken(name, encoding_name, frame):
459
+ print(f"\nLoading {name}: {encoding_name}")
460
+
461
+ tokenizer = tiktoken.get_encoding(encoding_name)
462
+
463
+ def encode_batch(batch):
464
+ return [
465
+ tokenizer.encode(
466
+ text,
467
+ allowed_special=set(),
468
+ disallowed_special=(),
469
+ )
470
+ for text in batch
471
+ ]
472
+
473
+ return encode_in_batches(frame["text"].tolist(), encode_batch)
474
+
475
+
476
+ # ---------------------------------------------------------------------
477
+ # Metrics and reports
478
+ # ---------------------------------------------------------------------
479
+
480
+ def build_summary(frame, token_columns, benchmark_name):
481
+ total_documents = len(frame)
482
+ total_words = int(frame["words"].sum())
483
+ total_characters = int(frame["characters"].sum())
484
+ total_bytes = int(frame["bytes"].sum())
485
+
486
+ custom_total = int(frame[token_columns["SunAI-64K"]].sum())
487
+ rows = []
488
+
489
+ for tokenizer_name, column in token_columns.items():
490
+ total_tokens = int(frame[column].sum())
491
+ ratio = total_tokens / custom_total
492
+
493
+ rows.append(
494
+ {
495
+ "benchmark": benchmark_name,
496
+ "tokenizer": tokenizer_name,
497
+ "documents": total_documents,
498
+ "tokens": total_tokens,
499
+ "tokens_per_word": total_tokens / total_words,
500
+ "characters_per_token": total_characters / total_tokens,
501
+ "bytes_per_token": total_bytes / total_tokens,
502
+ "token_ratio_vs_yours": ratio,
503
+ "extra_tokens_vs_yours_pct": (ratio - 1.0) * 100,
504
+ }
505
+ )
506
+
507
+ return pd.DataFrame(rows).sort_values(
508
+ "tokens_per_word",
509
+ ascending=True,
510
+ )
511
+
512
+
513
+ def build_macro_summary(by_benchmark):
514
+ """Equal-weight average so every benchmark contributes exactly 25%."""
515
+ macro = (
516
+ by_benchmark.groupby("tokenizer", as_index=False)
517
+ .agg(
518
+ benchmarks=("benchmark", "nunique"),
519
+ mean_tokens_per_word=("tokens_per_word", "mean"),
520
+ mean_characters_per_token=("characters_per_token", "mean"),
521
+ mean_bytes_per_token=("bytes_per_token", "mean"),
522
+ mean_token_ratio_vs_yours=("token_ratio_vs_yours", "mean"),
523
+ mean_extra_tokens_vs_yours_pct=("extra_tokens_vs_yours_pct", "mean"),
524
+ )
525
+ .sort_values("mean_tokens_per_word")
526
+ )
527
+ macro.insert(0, "rank", range(1, len(macro) + 1))
528
+ return macro
529
+
530
+
531
+ def build_subject_report(frame, token_columns):
532
+ rows = []
533
+
534
+ for (benchmark, group, subject), subset in frame.groupby(
535
+ ["benchmark", "group", "subject"],
536
+ dropna=False,
537
+ ):
538
+ words = int(subset["words"].sum())
539
+ byte_count = int(subset["bytes"].sum())
540
+ custom_tokens = int(subset[token_columns["SunAI-64K"]].sum())
541
+
542
+ for tokenizer_name, column in token_columns.items():
543
+ tokens = int(subset[column].sum())
544
+
545
+ rows.append(
546
+ {
547
+ "benchmark": benchmark,
548
+ "group": group,
549
+ "subject": subject,
550
+ "tokenizer": tokenizer_name,
551
+ "documents": len(subset),
552
+ "words": words,
553
+ "tokens": tokens,
554
+ "tokens_per_word": tokens / words if words else 0,
555
+ "bytes_per_token": byte_count / tokens if tokens else 0,
556
+ "token_ratio_vs_yours": (
557
+ tokens / custom_tokens if custom_tokens else 0
558
+ ),
559
+ }
560
+ )
561
+
562
+ return pd.DataFrame(rows)
563
+
564
+
565
+ # ---------------------------------------------------------------------
566
+ # Main benchmark
567
+ # ---------------------------------------------------------------------
568
+
569
+ def main():
570
+ OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
571
+
572
+ frame = load_all_benchmarks()
573
+ token_columns = {}
574
+
575
+ # Your tokenizer
576
+ column = "tokens__SunAI_64K"
577
+ frame[column] = benchmark_custom_tokenizer(frame)
578
+ token_columns["SunAI-64K"] = column
579
+
580
+ # Hugging Face competitors
581
+ for name, repository in HF_TOKENIZERS.items():
582
+ try:
583
+ column = f"tokens__{name}"
584
+ frame[column] = benchmark_huggingface_tokenizer(
585
+ name,
586
+ repository,
587
+ frame,
588
+ )
589
+ token_columns[name] = column
590
+
591
+ except Exception as error:
592
+ print(f"\nWARNING: Could not benchmark {name}")
593
+ print(f"Repository: {repository}")
594
+ print(f"Reason: {error}")
595
+
596
+ # OpenAI tiktoken baselines
597
+ for name, encoding_name in TIKTOKEN_ENCODINGS.items():
598
+ try:
599
+ column = f"tokens__{name}"
600
+ frame[column] = benchmark_tiktoken(
601
+ name,
602
+ encoding_name,
603
+ frame,
604
+ )
605
+ token_columns[name] = column
606
+
607
+ except Exception as error:
608
+ print(f"\nWARNING: Could not benchmark {name}: {error}")
609
+
610
+ by_benchmark = pd.concat(
611
+ [
612
+ build_summary(subset, token_columns, benchmark_name)
613
+ for benchmark_name, subset in frame.groupby("benchmark", sort=True)
614
+ ],
615
+ ignore_index=True,
616
+ )
617
+ macro_summary = build_macro_summary(by_benchmark)
618
+ overall_summary = build_summary(frame, token_columns, "ALL-POOLED")
619
+ subject_report = build_subject_report(frame, token_columns)
620
+
621
+ document_path = OUTPUT_DIR / "arabic_4bench_document_results.csv"
622
+ benchmark_path = OUTPUT_DIR / "arabic_4bench_by_benchmark.csv"
623
+ macro_path = OUTPUT_DIR / "arabic_4bench_macro_average.csv"
624
+ overall_path = OUTPUT_DIR / "arabic_4bench_pooled_overall.csv"
625
+ subject_path = OUTPUT_DIR / "arabic_4bench_by_category.csv"
626
+
627
+ frame.to_csv(document_path, index=False)
628
+ by_benchmark.to_csv(benchmark_path, index=False)
629
+ macro_summary.to_csv(macro_path, index=False)
630
+ overall_summary.to_csv(overall_path, index=False)
631
+ subject_report.to_csv(subject_path, index=False)
632
+
633
+ print("\n" + "=" * 100)
634
+ print("Four-benchmark Arabic tokenizer comparison: equal-weight macro average")
635
+ print("=" * 100)
636
+
637
+ print(
638
+ macro_summary.to_string(
639
+ index=False,
640
+ formatters={
641
+ "mean_tokens_per_word": "{:.4f}".format,
642
+ "mean_characters_per_token": "{:.4f}".format,
643
+ "mean_bytes_per_token": "{:.4f}".format,
644
+ "mean_token_ratio_vs_yours": "{:.4f}".format,
645
+ "mean_extra_tokens_vs_yours_pct": "{:+.2f}%".format,
646
+ },
647
+ )
648
+ )
649
+
650
+ print("\n" + "=" * 100)
651
+ print("Results by benchmark")
652
+ print("=" * 100)
653
+ for benchmark_name in sorted(by_benchmark["benchmark"].unique()):
654
+ print(f"\n--- {benchmark_name} ---")
655
+ subset = by_benchmark[by_benchmark["benchmark"] == benchmark_name]
656
+ print(
657
+ subset.to_string(
658
+ index=False,
659
+ formatters={
660
+ "tokens_per_word": "{:.4f}".format,
661
+ "characters_per_token": "{:.4f}".format,
662
+ "bytes_per_token": "{:.4f}".format,
663
+ "token_ratio_vs_yours": "{:.4f}".format,
664
+ "extra_tokens_vs_yours_pct": "{:+.2f}%".format,
665
+ },
666
+ )
667
+ )
668
+
669
+ print("\nReports saved to:")
670
+ print(macro_path)
671
+ print(benchmark_path)
672
+ print(overall_path)
673
+ print(subject_path)
674
+ print(document_path)
675
+
676
+
677
+ if __name__ == "__main__":
678
+ main()
benchmark/requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ datasets>=3.0
2
+ huggingface_hub>=0.32
3
+ pandas>=2.0
4
+ tiktoken>=0.8
5
+ tokenizers>=0.20
6
+ transformers>=4.45
example.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PreTrainedTokenizerFast
2
+
3
+
4
+ # Replace this with your published Hugging Face repository ID.
5
+ REPO_ID = "SamAI/SamAI-Tokenizer"
6
+
7
+ tokenizer = PreTrainedTokenizerFast.from_pretrained(REPO_ID)
8
+
9
+ text = "المملكة العربية السعودية"
10
+ encoding = tokenizer(text, add_special_tokens=False)
11
+
12
+ print("Text:", text)
13
+ print("Token IDs:", encoding["input_ids"])
14
+ print("Tokens:", tokenizer.convert_ids_to_tokens(encoding["input_ids"]))
15
+ print("Token count:", len(encoding["input_ids"]))
16
+ print("Decoded:", tokenizer.decode(encoding["input_ids"]))
meta.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "algorithm": "bpe",
3
+ "requested_vocab": 65536,
4
+ "actual_vocab": 65536,
5
+ "reserved": 256,
6
+ "file": "tokenizer.json",
7
+ "characters_by_bucket": {
8
+ "saudi_schoolbooks": 29856611,
9
+ "aramix_arabic": 200000000,
10
+ "fineweb2_arabic": 200000000,
11
+ "fineweb_english": 200000000
12
+ },
13
+ "training_sha256": "bf02ef3cfa689f435aa5402ace1cb09221f9bec22b1f19dd6e73eaf1bddbd115",
14
+ "normalization": "NFC"
15
+ }
reports/stress.json ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_sha256": "7d9496a251b44688557a79fab59b5cf7a12f11a9559540b9a1e223657f35f613",
3
+ "groups": {
4
+ "msa": {
5
+ "documents": 1,
6
+ "tokens": 30,
7
+ "words": 13,
8
+ "characters": 65,
9
+ "bytes": 115,
10
+ "roundtrip_failures": 0,
11
+ "unknown_tokens": 0,
12
+ "tokens_per_word": 2.3076923076923075,
13
+ "bytes_per_token": 3.8333333333333335
14
+ },
15
+ "gulf_saudi": {
16
+ "documents": 1,
17
+ "tokens": 15,
18
+ "words": 9,
19
+ "characters": 47,
20
+ "bytes": 86,
21
+ "roundtrip_failures": 0,
22
+ "unknown_tokens": 0,
23
+ "tokens_per_word": 1.6666666666666667,
24
+ "bytes_per_token": 5.733333333333333
25
+ },
26
+ "other_dialect": {
27
+ "documents": 1,
28
+ "tokens": 14,
29
+ "words": 8,
30
+ "characters": 47,
31
+ "bytes": 86,
32
+ "roundtrip_failures": 0,
33
+ "unknown_tokens": 0,
34
+ "tokens_per_word": 1.75,
35
+ "bytes_per_token": 6.142857142857143
36
+ },
37
+ "english": {
38
+ "documents": 1,
39
+ "tokens": 13,
40
+ "words": 9,
41
+ "characters": 67,
42
+ "bytes": 67,
43
+ "roundtrip_failures": 0,
44
+ "unknown_tokens": 0,
45
+ "tokens_per_word": 1.4444444444444444,
46
+ "bytes_per_token": 5.153846153846154
47
+ },
48
+ "code": {
49
+ "documents": 1,
50
+ "tokens": 22,
51
+ "words": 7,
52
+ "characters": 49,
53
+ "bytes": 49,
54
+ "roundtrip_failures": 0,
55
+ "unknown_tokens": 0,
56
+ "tokens_per_word": 3.142857142857143,
57
+ "bytes_per_token": 2.227272727272727
58
+ },
59
+ "arabizi": {
60
+ "documents": 1,
61
+ "tokens": 15,
62
+ "words": 6,
63
+ "characters": 35,
64
+ "bytes": 35,
65
+ "roundtrip_failures": 0,
66
+ "unknown_tokens": 0,
67
+ "tokens_per_word": 2.5,
68
+ "bytes_per_token": 2.3333333333333335
69
+ },
70
+ "unicode": {
71
+ "documents": 1,
72
+ "tokens": 40,
73
+ "words": 7,
74
+ "characters": 57,
75
+ "bytes": 85,
76
+ "roundtrip_failures": 0,
77
+ "unknown_tokens": 0,
78
+ "tokens_per_word": 5.714285714285714,
79
+ "bytes_per_token": 2.125
80
+ },
81
+ "math": {
82
+ "documents": 1,
83
+ "tokens": 22,
84
+ "words": 14,
85
+ "characters": 44,
86
+ "bytes": 68,
87
+ "roundtrip_failures": 0,
88
+ "unknown_tokens": 0,
89
+ "tokens_per_word": 1.5714285714285714,
90
+ "bytes_per_token": 3.090909090909091
91
+ }
92
+ }
93
+ }
reports/validation.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_sha256": "7d9496a251b44688557a79fab59b5cf7a12f11a9559540b9a1e223657f35f613",
3
+ "groups": {
4
+ "saudi_schoolbooks": {
5
+ "documents": 229,
6
+ "tokens": 31833,
7
+ "words": 18880,
8
+ "characters": 116742,
9
+ "bytes": 205534,
10
+ "roundtrip_failures": 0,
11
+ "unknown_tokens": 0,
12
+ "tokens_per_word": 1.6860699152542373,
13
+ "bytes_per_token": 6.456633053749254
14
+ },
15
+ "aramix_arabic": {
16
+ "documents": 5703,
17
+ "tokens": 3293519,
18
+ "words": 2454958,
19
+ "characters": 14302541,
20
+ "bytes": 25621109,
21
+ "roundtrip_failures": 0,
22
+ "unknown_tokens": 0,
23
+ "tokens_per_word": 1.341578552464034,
24
+ "bytes_per_token": 7.779250400559402
25
+ },
26
+ "fineweb2_arabic": {
27
+ "documents": 6024,
28
+ "tokens": 3770575,
29
+ "words": 2685728,
30
+ "characters": 15828573,
31
+ "bytes": 28416402,
32
+ "roundtrip_failures": 0,
33
+ "unknown_tokens": 0,
34
+ "tokens_per_word": 1.4039303309940545,
35
+ "bytes_per_token": 7.536357717324281
36
+ },
37
+ "fineweb_english": {
38
+ "documents": 3433,
39
+ "tokens": 1967458,
40
+ "words": 1398259,
41
+ "characters": 8333087,
42
+ "bytes": 8383641,
43
+ "roundtrip_failures": 0,
44
+ "unknown_tokens": 0,
45
+ "tokens_per_word": 1.4070769435419332,
46
+ "bytes_per_token": 4.261153732379547
47
+ }
48
+ }
49
+ }
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tokenizers>=0.20
2
+ transformers>=4.45
3
+ huggingface_hub>=0.32
results/arabic_4bench_by_benchmark.csv ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ benchmark,tokenizer,documents,tokens,tokens_per_word,characters_per_token,bytes_per_token,token_ratio_vs_yours,extra_tokens_vs_yours_pct
2
+ Arabic-Dialects,ALLaM-7B,9807,432591,1.2811703139021422,4.223703220825214,7.658263810389028,0.9822639315897748,-1.7736068410225236
3
+ Arabic-Dialects,SunAI-64K,9807,440402,1.3043035305476331,4.148791331556169,7.522436319544417,1.0,0.0
4
+ Arabic-Dialects,Falcon-H1-7B,9807,545003,1.6140919820051947,3.352524665001844,6.078674796285525,1.237512545356288,23.751254535628807
5
+ Arabic-Dialects,Mistral-Small-3.1,9807,566146,1.676709521313301,3.2273229873566183,5.851663705122,1.2855209558539697,28.552095585396977
6
+ Arabic-Dialects,Qwen3.8-Flash-Next,9807,571810,1.6934841390421527,3.195355100470436,5.7937007047795595,1.298381932870423,29.83819328704229
7
+ Arabic-Dialects,Qwen3.5-4B,9807,571810,1.6934841390421527,3.195355100470436,5.7937007047795595,1.298381932870423,29.83819328704229
8
+ Arabic-Dialects,GPT-OSS-20B,9807,587234,1.7391641715015118,3.1114274718425703,5.641526205907696,1.3334044804519507,33.34044804519507
9
+ Arabic-Dialects,tiktoken-o200k,9807,587234,1.7391641715015118,3.1114274718425703,5.641526205907696,1.3334044804519507,33.34044804519507
10
+ Arabic-Dialects,Fanar-1,9807,632482,1.8731715696291755,2.8888347810688684,5.2379293007548045,1.4361469748093787,43.61469748093787
11
+ Arabic-Dialects,Qwen2.5-7B,9807,695479,2.059744767557226,2.627161999140161,4.763473807260895,1.5791912843265925,57.91912843265925
12
+ Arabic-Dialects,Qwen3-8B,9807,695479,2.059744767557226,2.627161999140161,4.763473807260895,1.5791912843265925,57.91912843265925
13
+ Arabic-Dialects,DeepSeek-V3,9807,698041,2.067332438923984,2.6175196012841653,4.745990565024117,1.5850086965999246,58.50086965999246
14
+ Arabic-Dialects,GLM-5.3-Flash,9807,747927,2.215075832289362,2.4429336018087326,4.429437632282295,1.6982824782812067,69.82824782812067
15
+ Arabic-Dialects,Kimi-K2.6,9807,885844,2.6235336277183974,2.062593413738762,3.7398187491251282,2.0114440897180303,101.14440897180303
16
+ Arabic-Dialects,tiktoken-cl100k,9807,1294421,3.8335835902538995,1.4115469387471309,2.5593651524504004,2.9391805668457454,193.91805668457454
17
+ ArabicMMLU,ALLaM-7B,14435,818785,1.9942835013128217,3.17674725355252,5.800798744481152,0.8029177396294429,-19.70822603705571
18
+ ArabicMMLU,Qwen3.5-4B,14435,984657,2.3982916266812158,2.641603116618274,4.823615736241148,0.9655753009035442,-3.4424699096455846
19
+ ArabicMMLU,Qwen3.8-Flash-Next,14435,984657,2.3982916266812158,2.641603116618274,4.823615736241148,0.9655753009035442,-3.4424699096455846
20
+ ArabicMMLU,Mistral-Small-3.1,14435,1008568,2.4565307404899577,2.578976330797725,4.709258076797995,0.9890229288794836,-1.097707112051638
21
+ ArabicMMLU,SunAI-64K,14435,1019762,2.483795540790031,2.55066672419643,4.6575642159641175,1.0,0.0
22
+ ArabicMMLU,Falcon-H1-7B,14435,1053222,2.5652927909276464,2.4696341322152406,4.509597216921029,1.0328115776034015,3.2811577603401476
23
+ ArabicMMLU,GPT-OSS-20B,14435,1088017,2.650041649820005,2.390654741607898,4.365379401240974,1.0669322841996465,6.6932284199646475
24
+ ArabicMMLU,tiktoken-o200k,14435,1088017,2.650041649820005,2.390654741607898,4.365379401240974,1.0669322841996465,6.6932284199646475
25
+ ArabicMMLU,DeepSeek-V3,14435,1163831,2.834698927821593,2.2349232835351525,4.081010902785714,1.1412770822995955,14.127708229959545
26
+ ArabicMMLU,Fanar-1,14435,1177059,2.8669178646064215,2.209806815121417,4.035147770842413,1.1542487364698821,15.424873646988214
27
+ ArabicMMLU,Qwen3-8B,14435,1308878,3.1879843922779774,1.987253968666293,3.6287621917397956,1.2835132119063075,28.351321190630753
28
+ ArabicMMLU,Qwen2.5-7B,14435,1308878,3.1879843922779774,1.987253968666293,3.6287621917397956,1.2835132119063075,28.351321190630753
29
+ ArabicMMLU,GLM-5.3-Flash,14435,1368588,3.333417769615604,1.900552248010358,3.4704432597684622,1.3420660899307877,34.20660899307877
30
+ ArabicMMLU,Kimi-K2.6,14435,1471044,3.5829659543167236,1.768181645144537,3.228732111344052,1.4425365918714366,44.253659187143654
31
+ ArabicMMLU,tiktoken-cl100k,14435,1960187,4.774352966392736,1.3269514592230232,2.423037699974543,1.9222004742283003,92.22004742283004
32
+ MASSIVE-Arabic,ALLaM-7B,2907,18333,1.1938655899973951,4.306005563737522,7.766813942071674,0.9513258263712314,-4.867417362876858
33
+ MASSIVE-Arabic,SunAI-64K,2907,19271,1.2549492055222715,4.096414301281719,7.388770691712937,1.0,0.0
34
+ MASSIVE-Arabic,Falcon-H1-7B,2907,23860,1.5537900494920551,3.308549874266555,5.967686504610226,1.2381298323906387,23.81298323906387
35
+ MASSIVE-Arabic,Mistral-Small-3.1,2907,24875,1.619887991664496,3.1735477386934674,5.724180904522613,1.2907996471381868,29.079964713818683
36
+ MASSIVE-Arabic,Qwen3.8-Flash-Next,2907,24973,1.6262698619432143,3.16109398150002,5.7017178552837064,1.295885008562088,29.58850085620881
37
+ MASSIVE-Arabic,Qwen3.5-4B,2907,24973,1.6262698619432143,3.16109398150002,5.7017178552837064,1.295885008562088,29.58850085620881
38
+ MASSIVE-Arabic,GPT-OSS-20B,2907,25338,1.650039072675176,3.1155576604309734,5.6195832346672985,1.314825385293965,31.482538529396507
39
+ MASSIVE-Arabic,tiktoken-o200k,2907,25338,1.650039072675176,3.1155576604309734,5.6195832346672985,1.314825385293965,31.482538529396507
40
+ MASSIVE-Arabic,Fanar-1,2907,27249,1.774485543110185,2.897060442585049,5.225476164262909,1.4139899330600385,41.39899330600385
41
+ MASSIVE-Arabic,Qwen2.5-7B,2907,29540,1.9236780411565513,2.6723764387271496,4.8202098849018284,1.5328732292045042,53.28732292045042
42
+ MASSIVE-Arabic,Qwen3-8B,2907,29540,1.9236780411565513,2.6723764387271496,4.8202098849018284,1.5328732292045042,53.28732292045042
43
+ MASSIVE-Arabic,DeepSeek-V3,2907,30202,1.966788226100547,2.6138004105688366,4.714555327461757,1.5672253645373877,56.72253645373877
44
+ MASSIVE-Arabic,GLM-5.3-Flash,2907,32085,2.089411305027351,2.4604020570359983,4.437868162692848,1.6649369518966322,66.49369518966321
45
+ MASSIVE-Arabic,Kimi-K2.6,2907,37595,2.448228705392029,2.0998005053863547,3.7874451389812474,1.950858803383322,95.0858803383322
46
+ MASSIVE-Arabic,tiktoken-cl100k,2907,55108,3.5886949726491273,1.4324961893010089,2.583817231617914,2.859633646411707,185.9633646411707
47
+ MLQA-Arabic,SunAI-64K,10933,919527,1.4396672657928193,4.123509151987924,7.390784609913575,1.0,0.0
48
+ MLQA-Arabic,ALLaM-7B,10933,982992,1.5390319206898928,3.8572826635415143,6.913612725230724,1.0690191805134597,6.901918051345968
49
+ MLQA-Arabic,Mistral-Small-3.1,10933,1161531,1.8185634123887597,3.2643795129015065,5.850920896644171,1.2631831365473771,26.318313654737715
50
+ MLQA-Arabic,Falcon-H1-7B,10933,1161685,1.8188045241330937,3.263946766980722,5.850145263130711,1.2633506139569584,26.335061395695835
51
+ MLQA-Arabic,Qwen3.8-Flash-Next,10933,1211872,1.8973803365544193,3.1287776266800456,5.607874428982599,1.3179297617144468,31.792976171444675
52
+ MLQA-Arabic,Qwen3.5-4B,10933,1211872,1.8973803365544193,3.1287776266800456,5.607874428982599,1.3179297617144468,31.792976171444675
53
+ MLQA-Arabic,GPT-OSS-20B,10933,1231681,1.928394508914872,3.0784578149699477,5.517683556050633,1.3394723591585673,33.94723591585673
54
+ MLQA-Arabic,tiktoken-o200k,10933,1231681,1.928394508914872,3.0784578149699477,5.517683556050633,1.3394723591585673,33.94723591585673
55
+ MLQA-Arabic,Fanar-1,10933,1349942,2.1135511062958345,2.8087710434966837,5.034309622191175,1.4680830470448394,46.80830470448394
56
+ MLQA-Arabic,DeepSeek-V3,10933,1431242,2.2408393193759903,2.649222144123775,4.748341650119267,1.5564980691159693,55.64980691159693
57
+ MLQA-Arabic,Qwen3-8B,10933,1484612,2.324398629733775,2.553985822558352,4.577644529345041,1.6145387791766854,61.45387791766854
58
+ MLQA-Arabic,Qwen2.5-7B,10933,1484612,2.324398629733775,2.553985822558352,4.577644529345041,1.6145387791766854,61.45387791766854
59
+ MLQA-Arabic,GLM-5.3-Flash,10933,1566196,2.4521314904463387,2.420947314384662,4.339192540397243,1.7032626556914587,70.32626556914587
60
+ MLQA-Arabic,Kimi-K2.6,10933,1802615,2.8222834221584825,2.103431958571298,3.770092892825146,1.9603720173523997,96.03720173523998
61
+ MLQA-Arabic,tiktoken-cl100k,10933,2633608,4.123336485530164,1.4397275524679451,2.5805002111172204,2.8640899070935384,186.40899070935384
results/arabic_4bench_by_category.csv ADDED
The diff for this file is too large to render. See raw diff
 
results/arabic_4bench_macro_average.csv ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ rank,tokenizer,benchmarks,mean_tokens_per_word,mean_characters_per_token,mean_bytes_per_token,mean_token_ratio_vs_yours,mean_extra_tokens_vs_yours_pct
2
+ 1,ALLaM-7B,4,1.502087831475563,3.8909346754141927,7.034872305543145,0.9513816695259771,-4.861833047402281
3
+ 2,SunAI-64K,4,1.6206788856631889,3.72984537725556,6.739888959283761,1.0,0.0
4
+ 3,Falcon-H1-7B,4,1.8879948366394974,3.0986638596160905,5.601525945236872,1.1929511423268218,19.295114232682163
5
+ 4,Mistral-Small-3.1,4,1.8929229164641286,3.0610566424373293,5.534005895771695,1.2071316671047543,20.713166710475434
6
+ 5,Qwen3.8-Flash-Next,4,1.9038564910552505,3.0317074563171937,5.481727181321753,1.2194430010126256,21.94430010126255
7
+ 6,Qwen3.5-4B,4,1.9038564910552505,3.0317074563171937,5.481727181321753,1.2194430010126256,21.94430010126255
8
+ 7,tiktoken-o200k,4,1.9919098507278912,2.924024422212847,5.28604309946665,1.2636586272760324,26.365862727603236
9
+ 8,GPT-OSS-20B,4,1.9919098507278912,2.924024422212847,5.28604309946665,1.2636586272760324,26.365862727603236
10
+ 9,Fanar-1,4,2.157031520910404,2.7011182705680046,4.883215714512826,1.3681171728460346,36.81171728460347
11
+ 10,DeepSeek-V3,4,2.2774147280555286,2.5288663598779824,4.5724746113477135,1.4625023031382192,46.25023031382193
12
+ 11,Qwen2.5-7B,4,2.3739514576813825,2.460194557272989,4.44752260331189,1.5025291261535223,50.252912615352244
13
+ 12,Qwen3-8B,4,2.3739514576813825,2.460194557272989,4.44752260331189,1.5025291261535223,50.252912615352244
14
+ 13,GLM-5.3-Flash,4,2.522509099344664,2.3062088053099377,4.1692353987852115,1.6021370439500213,60.21370439500213
15
+ 14,Kimi-K2.6,4,2.869252927396408,2.008501880710238,3.6315222230688935,1.8413028755812972,84.13028755812971
16
+ 15,tiktoken-cl100k,4,4.079992003706481,1.402680534934777,2.5366800737900195,2.646276148644823,164.62761486448227
results/arabic_4bench_pooled_overall.csv ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ benchmark,tokenizer,documents,tokens,tokens_per_word,characters_per_token,bytes_per_token,token_ratio_vs_yours,extra_tokens_vs_yours_pct
2
+ ALL-POOLED,ALLaM-7B,38082,2252701,1.6064524778521883,3.6839460718488604,6.659080810103072,0.939031547811095,-6.0968452188905005
3
+ ALL-POOLED,SunAI-64K,38082,2398962,1.7107545338565753,3.459341581900839,6.253086960110248,1.0,0.0
4
+ ALL-POOLED,Mistral-Small-3.1,38082,2761120,1.969017666191489,3.0056024366923566,5.432910558034421,1.1509644587950956,15.096445879509556
5
+ ALL-POOLED,Falcon-H1-7B,38082,2783770,1.9851698979449939,2.98114750859446,5.388705963495547,1.1604060422799527,16.04060422799527
6
+ ALL-POOLED,Qwen3.8-Flash-Next,38082,2793312,1.991974515843093,2.970963859389857,5.37029805478228,1.164383595905229,16.43835959052291
7
+ ALL-POOLED,Qwen3.5-4B,38082,2793312,1.991974515843093,2.970963859389857,5.37029805478228,1.164383595905229,16.43835959052291
8
+ ALL-POOLED,GPT-OSS-20B,38082,2932270,2.0910686359315487,2.830172187417939,5.115803797058252,1.2223078147965662,22.230781479656624
9
+ ALL-POOLED,tiktoken-o200k,38082,2932270,2.0910686359315487,2.830172187417939,5.115803797058252,1.2223078147965662,22.230781479656624
10
+ ALL-POOLED,Fanar-1,38082,3186732,2.2725312936119173,2.6041816506690867,4.70730453643419,1.3283795241441925,32.83795241441925
11
+ ALL-POOLED,DeepSeek-V3,38082,3323316,2.3699324601382177,2.497153144630243,4.513840393149493,1.3853141483691698,38.53141483691698
12
+ ALL-POOLED,Qwen3-8B,38082,3518509,2.509129041712693,2.3586209385850654,4.263430333701008,1.46667975566099,46.66797556609901
13
+ ALL-POOLED,Qwen2.5-7B,38082,3518509,2.509129041712693,2.3586209385850654,4.263430333701008,1.46667975566099,46.66797556609901
14
+ ALL-POOLED,GLM-5.3-Flash,38082,3714796,2.6491057796464763,2.2339931990881867,4.038153912085616,1.548501393519364,54.85013935193639
15
+ ALL-POOLED,Kimi-K2.6,38082,4197098,2.9930463394336235,1.9772778715197978,3.574116687292029,1.7495475126325468,74.95475126325468
16
+ ALL-POOLED,tiktoken-cl100k,38082,5943324,4.238319939698335,1.3963278798194412,2.523994653496932,2.4774564999362223,147.74564999362224
results/arabicmmlu_by_subject.csv ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ group,subject,tokenizer,documents,words,tokens,tokens_per_word,bytes_per_token,token_ratio_vs_yours
2
+ Humanities,History,SunAI-64K,1065,22191,33607,1.5144427921229326,7.207873359716726,1.0
3
+ Humanities,History,Fanar-1,1065,22191,48439,2.1828218647199313,5.000825780879044,1.4413366262980927
4
+ Humanities,History,ALLaM-7B,1065,22191,36070,1.6254337343968275,6.715691710562795,1.0732883030321063
5
+ Humanities,History,Qwen2.5-7B,1065,22191,51053,2.3006173674011987,4.744775037705914,1.5191180408843397
6
+ Humanities,History,Qwen3-8B,1065,22191,51053,2.3006173674011987,4.744775037705914,1.5191180408843397
7
+ Humanities,History,Qwen3.5-4B,1065,22191,44449,2.003019242035059,5.449728902787465,1.3226113607284198
8
+ Humanities,History,Qwen3.8-Flash-Next,1065,22191,44449,2.003019242035059,5.449728902787465,1.3226113607284198
9
+ Humanities,History,DeepSeek-V3,1065,22191,51726,2.3309449776936595,4.6830414105092215,1.5391436307912043
10
+ Humanities,History,GPT-OSS-20B,1065,22191,43976,1.98170429453382,5.5083454611606335,1.308536911952867
11
+ Humanities,History,Kimi-K2.6,1065,22191,63822,2.876030823306746,3.795478048321895,1.8990686464129496
12
+ Humanities,History,Mistral-Small-3.1,1065,22191,42654,1.9221305934838449,5.679068786045858,1.2691998690748951
13
+ Humanities,History,Falcon-H1-7B,1065,22191,42137,1.8988328601685367,5.748748131096186,1.2538161692504537
14
+ Humanities,History,tiktoken-cl100k,1065,22191,92850,4.184128700824659,2.608885298869144,2.762817270211563
15
+ Humanities,History,tiktoken-o200k,1065,22191,43976,1.98170429453382,5.5083454611606335,1.308536911952867
16
+ Humanities,Islamic Studies,SunAI-64K,2210,39174,61563,1.5715270332363303,6.147994737098582,1.0
17
+ Humanities,Islamic Studies,Fanar-1,2210,39174,81872,2.0899576249553276,4.622935802227868,1.3298897064795412
18
+ Humanities,Islamic Studies,ALLaM-7B,2210,39174,62341,1.5913871445346404,6.071269309122408,1.012637460812501
19
+ Humanities,Islamic Studies,Qwen2.5-7B,2210,39174,85998,2.195282585388268,4.401137235749669,1.3969104819453244
20
+ Humanities,Islamic Studies,Qwen3-8B,2210,39174,85998,2.195282585388268,4.401137235749669,1.3969104819453244
21
+ Humanities,Islamic Studies,Qwen3.5-4B,2210,39174,76174,1.9445040077602491,4.968742615590622,1.2373341130224322
22
+ Humanities,Islamic Studies,Qwen3.8-Flash-Next,2210,39174,76174,1.9445040077602491,4.968742615590622,1.2373341130224322
23
+ Humanities,Islamic Studies,DeepSeek-V3,2210,39174,85147,2.173558993209782,4.4451243144209425,1.3830872439614703
24
+ Humanities,Islamic Studies,GPT-OSS-20B,2210,39174,76229,1.945908000204217,4.9651576171798135,1.2382275067816708
25
+ Humanities,Islamic Studies,Kimi-K2.6,2210,39174,108211,2.7623168428039007,3.497694319431481,1.757727856017413
26
+ Humanities,Islamic Studies,Mistral-Small-3.1,2210,39174,73369,1.8729003931178843,5.158704630020853,1.1917710313012686
27
+ Humanities,Islamic Studies,Falcon-H1-7B,2210,39174,75589,1.9295706335834992,5.007196814351294,1.2278316521287136
28
+ Humanities,Islamic Studies,tiktoken-cl100k,2210,39174,153064,3.9072854444274263,2.472749960800711,2.4862985884378603
29
+ Humanities,Islamic Studies,tiktoken-o200k,2210,39174,76229,1.945908000204217,4.9651576171798135,1.2382275067816708
30
+ Humanities,Law,SunAI-64K,314,11281,15675,1.389504476553497,7.622838915470495,1.0
31
+ Humanities,Law,Fanar-1,314,11281,23510,2.0840351032709865,5.082433007230965,1.4998405103668262
32
+ Humanities,Law,ALLaM-7B,314,11281,15815,1.4019147238719971,7.5553588365475814,1.0089314194577352
33
+ Humanities,Law,Qwen2.5-7B,314,11281,24968,2.213278964630795,4.785645626401794,1.5928548644338119
34
+ Humanities,Law,Qwen3-8B,314,11281,24968,2.213278964630795,4.785645626401794,1.5928548644338119
35
+ Humanities,Law,Qwen3.5-4B,314,11281,20174,1.788316638595869,5.922871022107663,1.2870175438596492
36
+ Humanities,Law,Qwen3.8-Flash-Next,314,11281,20174,1.788316638595869,5.922871022107663,1.2870175438596492
37
+ Humanities,Law,DeepSeek-V3,314,11281,25517,2.2619448630440564,4.682682133479641,1.627878787878788
38
+ Humanities,Law,GPT-OSS-20B,314,11281,21664,1.920397127914192,5.515509601181684,1.38207336523126
39
+ Humanities,Law,Kimi-K2.6,314,11281,32118,2.8470880241113377,3.720281462108475,2.0489952153110047
40
+ Humanities,Law,Mistral-Small-3.1,314,11281,20248,1.7948763407499335,5.901224812327143,1.291738437001595
41
+ Humanities,Law,Falcon-H1-7B,314,11281,19290,1.709954791241911,6.194297563504406,1.230622009569378
42
+ Humanities,Law,tiktoken-cl100k,314,11281,47266,4.189876783973052,2.5279905217280922,3.0153748006379586
43
+ Humanities,Law,tiktoken-o200k,314,11281,21664,1.920397127914192,5.515509601181684,1.38207336523126
44
+ Humanities,Philosophy,SunAI-64K,39,1407,2160,1.535181236673774,6.564814814814815,1.0
45
+ Humanities,Philosophy,Fanar-1,39,1407,2989,2.1243781094527363,4.744061559049849,1.3837962962962962
46
+ Humanities,Philosophy,ALLaM-7B,39,1407,2229,1.584221748400853,6.36159712875729,1.0319444444444446
47
+ Humanities,Philosophy,Qwen2.5-7B,39,1407,3076,2.1862117981520965,4.609882964889467,1.424074074074074
48
+ Humanities,Philosophy,Qwen3-8B,39,1407,3076,2.1862117981520965,4.609882964889467,1.424074074074074
49
+ Humanities,Philosophy,Qwen3.5-4B,39,1407,2724,1.9360341151385927,5.2055800293685754,1.261111111111111
50
+ Humanities,Philosophy,Qwen3.8-Flash-Next,39,1407,2724,1.9360341151385927,5.2055800293685754,1.261111111111111
51
+ Humanities,Philosophy,DeepSeek-V3,39,1407,3109,2.2096659559346126,4.560952074622065,1.4393518518518518
52
+ Humanities,Philosophy,GPT-OSS-20B,39,1407,2701,1.919687277896233,5.249907441688263,1.2504629629629629
53
+ Humanities,Philosophy,Kimi-K2.6,39,1407,3901,2.7725657427149963,3.634965393488849,1.8060185185185185
54
+ Humanities,Philosophy,Mistral-Small-3.1,39,1407,2579,1.8329779673063256,5.498255137650252,1.1939814814814815
55
+ Humanities,Philosophy,Falcon-H1-7B,39,1407,2839,2.017768301350391,4.9947164494540335,1.3143518518518518
56
+ Humanities,Philosophy,tiktoken-cl100k,39,1407,5530,3.9303482587064678,2.5641952983725136,2.560185185185185
57
+ Humanities,Philosophy,tiktoken-o200k,39,1407,2701,1.919687277896233,5.249907441688263,1.2504629629629629
58
+ Language,Arabic Language,SunAI-64K,669,17268,32934,1.9072272411396802,5.384982085382887,1.0
59
+ Language,Arabic Language,Fanar-1,669,17268,41489,2.402652304841325,4.274602906794572,1.2597619481387017
60
+ Language,Arabic Language,ALLaM-7B,669,17268,31908,1.847810979847116,5.558135890685722,0.968846784478047
61
+ Language,Arabic Language,Qwen2.5-7B,669,17268,43938,2.5444753300903407,4.036346670308162,1.3341227910366187
62
+ Language,Arabic Language,Qwen3-8B,669,17268,43938,2.5444753300903407,4.036346670308162,1.3341227910366187
63
+ Language,Arabic Language,Qwen3.5-4B,669,17268,38512,2.2302524901552006,4.605032197756543,1.1693690411125282
64
+ Language,Arabic Language,Qwen3.8-Flash-Next,669,17268,38512,2.2302524901552006,4.605032197756543,1.1693690411125282
65
+ Language,Arabic Language,DeepSeek-V3,669,17268,43402,2.5134352559647906,4.086194184599788,1.3178478168458128
66
+ Language,Arabic Language,GPT-OSS-20B,669,17268,38810,2.2475098447996293,4.569672764751353,1.178417440942491
67
+ Language,Arabic Language,Kimi-K2.6,669,17268,52348,3.0315033588139912,3.3878849239703523,1.5894819942916136
68
+ Language,Arabic Language,Mistral-Small-3.1,669,17268,37280,2.158906648135279,4.7572156652360515,1.1319608914799295
69
+ Language,Arabic Language,Falcon-H1-7B,669,17268,38668,2.239286541579801,4.586453915382228,1.1741057873322402
70
+ Language,Arabic Language,tiktoken-cl100k,669,17268,72894,4.221334259902711,2.43297116360743,2.213335762433959
71
+ Language,Arabic Language,tiktoken-o200k,669,17268,38810,2.2475098447996293,4.569672764751353,1.178417440942491
72
+ Language,Arabic Language (General),SunAI-64K,612,130856,563958,4.309760347251941,3.265697090918118,1.0
73
+ Language,Arabic Language (General),Fanar-1,612,130856,544644,4.162162988323042,3.3815042486468223,0.9657527688232103
74
+ Language,Arabic Language (General),ALLaM-7B,612,130856,340840,2.6046952375129915,5.403462034972421,0.6043712475042468
75
+ Language,Arabic Language (General),Qwen2.5-7B,612,130856,638412,4.878736932200281,2.8848392574074424,1.132020469609439
76
+ Language,Arabic Language (General),Qwen3-8B,612,130856,638412,4.878736932200281,2.8848392574074424,1.132020469609439
77
+ Language,Arabic Language (General),Qwen3.5-4B,612,130856,401647,3.069381610319741,4.585409576070529,0.7121931065788587
78
+ Language,Arabic Language (General),Qwen3.8-Flash-Next,612,130856,401647,3.069381610319741,4.585409576070529,0.7121931065788587
79
+ Language,Arabic Language (General),DeepSeek-V3,612,130856,502855,3.84281194595586,3.662519016416263,0.8916532791449009
80
+ Language,Arabic Language (General),GPT-OSS-20B,612,130856,507338,3.877070978785841,3.6301558329949657,0.8996024526649148
81
+ Language,Arabic Language (General),Kimi-K2.6,612,130856,655978,5.0129760958611,2.8075880593556493,1.163168179190649
82
+ Language,Arabic Language (General),Mistral-Small-3.1,612,130856,500913,3.82797120498869,3.676718312361628,0.8882097603012991
83
+ Language,Arabic Language (General),Falcon-H1-7B,612,130856,485719,3.7118588371950847,3.7917314331949132,0.86126803769075
84
+ Language,Arabic Language (General),tiktoken-cl100k,612,130856,800767,6.119451916610625,2.2999399325896297,1.419905383024977
85
+ Language,Arabic Language (General),tiktoken-o200k,612,130856,507338,3.877070978785841,3.6301558329949657,0.8996024526649148
86
+ Language,Arabic Language (Grammar),SunAI-64K,365,9238,18334,1.9846287075124487,5.132158830587978,1.0
87
+ Language,Arabic Language (Grammar),Fanar-1,365,9238,23311,2.523381684347261,4.03642057397795,1.2714628558961492
88
+ Language,Arabic Language (Grammar),ALLaM-7B,365,9238,16880,1.8272353323230137,5.574229857819906,0.9206937929529835
89
+ Language,Arabic Language (Grammar),Qwen2.5-7B,365,9238,24349,2.6357436674604893,3.8643476118115734,1.3280789789462202
90
+ Language,Arabic Language (Grammar),Qwen3-8B,365,9238,24349,2.6357436674604893,3.8643476118115734,1.3280789789462202
91
+ Language,Arabic Language (Grammar),Qwen3.5-4B,365,9238,21007,2.2739770513098074,4.479126005617175,1.1457946983746046
92
+ Language,Arabic Language (Grammar),Qwen3.8-Flash-Next,365,9238,21007,2.2739770513098074,4.479126005617175,1.1457946983746046
93
+ Language,Arabic Language (Grammar),DeepSeek-V3,365,9238,23563,2.550660316085733,3.993252132580741,1.2852078106250682
94
+ Language,Arabic Language (Grammar),GPT-OSS-20B,365,9238,21320,2.307858843905607,4.413367729831145,1.1628668048434603
95
+ Language,Arabic Language (Grammar),Kimi-K2.6,365,9238,28426,3.0770729595150463,3.3101034264405826,1.550452710810516
96
+ Language,Arabic Language (Grammar),Mistral-Small-3.1,365,9238,20445,2.21314137259147,4.602249938860357,1.1151412675902694
97
+ Language,Arabic Language (Grammar),Falcon-H1-7B,365,9238,21652,2.343797358735657,4.345695547755404,1.1809752372640996
98
+ Language,Arabic Language (Grammar),tiktoken-cl100k,365,9238,39172,4.240311755791296,2.402047380782191,2.136576851750845
99
+ Language,Arabic Language (Grammar),tiktoken-o200k,365,9238,21320,2.307858843905607,4.413367729831145,1.1628668048434603
100
+ Other,Driving Test,SunAI-64K,1211,29647,44828,1.5120585556717374,6.785602748282323,1.0
101
+ Other,Driving Test,Fanar-1,1211,29647,63874,2.15448443350086,4.762266336850675,1.4248683858302846
102
+ Other,Driving Test,ALLaM-7B,1211,29647,47040,1.5866698148210612,6.466517857142857,1.0493441599000624
103
+ Other,Driving Test,Qwen2.5-7B,1211,29647,68843,2.3220899247815967,4.4185320221373265,1.5357142857142858
104
+ Other,Driving Test,Qwen3-8B,1211,29647,68843,2.3220899247815967,4.4185320221373265,1.5357142857142858
105
+ Other,Driving Test,Qwen3.5-4B,1211,29647,57867,1.9518669679900158,5.256622945720359,1.2908673150709378
106
+ Other,Driving Test,Qwen3.8-Flash-Next,1211,29647,57867,1.9518669679900158,5.256622945720359,1.2908673150709378
107
+ Other,Driving Test,DeepSeek-V3,1211,29647,67160,2.265321955003879,4.529258487194759,1.4981707861158204
108
+ Other,Driving Test,GPT-OSS-20B,1211,29647,57716,1.9467737039160793,5.270375632406958,1.2874988846256803
109
+ Other,Driving Test,Kimi-K2.6,1211,29647,82860,2.79488649779067,3.6710716871832005,1.8483983224770233
110
+ Other,Driving Test,Mistral-Small-3.1,1211,29647,55718,1.8793807130569704,5.459366811443339,1.2429285268135986
111
+ Other,Driving Test,Falcon-H1-7B,1211,29647,54844,1.849900495834317,5.546367879804537,1.223431783706612
112
+ Other,Driving Test,tiktoken-cl100k,1211,29647,119858,4.042837386582116,2.5378781558177175,2.6737307040242704
113
+ Other,Driving Test,tiktoken-o200k,1211,29647,57716,1.9467737039160793,5.270375632406958,1.2874988846256803
114
+ Other,General Knowledge,SunAI-64K,1198,19003,32538,1.7122559595853286,6.0611592599422215,1.0
115
+ Other,General Knowledge,Fanar-1,1198,19003,44258,2.32900068410251,4.456098332504858,1.3601942344335853
116
+ Other,General Knowledge,ALLaM-7B,1198,19003,34096,1.7942430142609063,5.784197559831065,1.0478824758743623
117
+ Other,General Knowledge,Qwen2.5-7B,1198,19003,46807,2.463137399357996,4.213429615228492,1.4385334070932447
118
+ Other,General Knowledge,Qwen3-8B,1198,19003,46807,2.463137399357996,4.213429615228492,1.4385334070932447
119
+ Other,General Knowledge,Qwen3.5-4B,1198,19003,41421,2.1797084670841445,4.761304652229545,1.2730038723953532
120
+ Other,General Knowledge,Qwen3.8-Flash-Next,1198,19003,41421,2.1797084670841445,4.761304652229545,1.2730038723953532
121
+ Other,General Knowledge,DeepSeek-V3,1198,19003,45788,2.409514287217808,4.307198392591945,1.407216178007253
122
+ Other,General Knowledge,GPT-OSS-20B,1198,19003,40827,2.1484502446982057,4.830577803904279,1.254748294302047
123
+ Other,General Knowledge,Kimi-K2.6,1198,19003,57073,3.0033678892806397,3.4555393969127257,1.7540414284836192
124
+ Other,General Knowledge,Mistral-Small-3.1,1198,19003,39568,2.0821975477556176,4.9842802264456125,1.2160550740672444
125
+ Other,General Knowledge,Falcon-H1-7B,1198,19003,40229,2.1169815292322265,4.902383852444753,1.236369783022927
126
+ Other,General Knowledge,tiktoken-cl100k,1198,19003,80452,4.233647318844393,2.4513747327599065,2.4725551662671337
127
+ Other,General Knowledge,tiktoken-o200k,1198,19003,40827,2.1484502446982057,4.830577803904279,1.254748294302047
128
+ Other,Management,SunAI-64K,75,1686,2805,1.6637010676156583,6.080213903743315,1.0
129
+ Other,Management,Fanar-1,75,1686,3825,2.2686832740213525,4.458823529411765,1.3636363636363635
130
+ Other,Management,ALLaM-7B,75,1686,2906,1.723606168446026,5.868891947694426,1.036007130124777
131
+ Other,Management,Qwen2.5-7B,75,1686,3811,2.260379596678529,4.475203358698504,1.3586452762923351
132
+ Other,Management,Qwen3-8B,75,1686,3811,2.260379596678529,4.475203358698504,1.3586452762923351
133
+ Other,Management,Qwen3.5-4B,75,1686,3362,1.9940688018979833,5.0728732897085065,1.1985739750445632
134
+ Other,Management,Qwen3.8-Flash-Next,75,1686,3362,1.9940688018979833,5.0728732897085065,1.1985739750445632
135
+ Other,Management,DeepSeek-V3,75,1686,3916,2.3226571767497033,4.355209397344229,1.396078431372549
136
+ Other,Management,GPT-OSS-20B,75,1686,3395,2.013641755634638,5.023564064801178,1.2103386809269163
137
+ Other,Management,Kimi-K2.6,75,1686,4812,2.8540925266903914,3.54426433915212,1.7155080213903744
138
+ Other,Management,Mistral-Small-3.1,75,1686,3251,1.9282325029655991,5.246078129806214,1.1590017825311942
139
+ Other,Management,Falcon-H1-7B,75,1686,3347,1.9851720047449586,5.0956080071706005,1.1932263814616755
140
+ Other,Management,tiktoken-cl100k,75,1686,6753,4.005338078291815,2.525544202576633,2.407486631016043
141
+ Other,Management,tiktoken-o200k,75,1686,3395,2.013641755634638,5.023564064801178,1.2103386809269163
142
+ STEM,Biology,SunAI-64K,1409,29117,47477,1.630559466978054,6.448048528761295,1.0
143
+ STEM,Biology,Fanar-1,1409,29117,67911,2.332348799670296,4.507870595338016,1.4303978768666934
144
+ STEM,Biology,ALLaM-7B,1409,29117,51255,1.7603118453137343,5.972763632816311,1.0795753733386693
145
+ STEM,Biology,Qwen2.5-7B,1409,29117,72478,2.489198749871209,4.223819641822346,1.5265918234092297
146
+ STEM,Biology,Qwen3-8B,1409,29117,72478,2.489198749871209,4.223819641822346,1.5265918234092297
147
+ STEM,Biology,Qwen3.5-4B,1409,29117,62891,2.1599409279802178,4.867691720595952,1.324662468142469
148
+ STEM,Biology,Qwen3.8-Flash-Next,1409,29117,62891,2.1599409279802178,4.867691720595952,1.324662468142469
149
+ STEM,Biology,DeepSeek-V3,1409,29117,70678,2.4273791942851255,4.331390248733694,1.4886787286475556
150
+ STEM,Biology,GPT-OSS-20B,1409,29117,63269,2.1729230346532953,4.838609745689042,1.3326242180424206
151
+ STEM,Biology,Kimi-K2.6,1409,29117,86236,2.9617062197341757,3.549955934876386,1.8163742443709585
152
+ STEM,Biology,Mistral-Small-3.1,1409,29117,60698,2.084624102757839,5.043559919601964,1.278471681024496
153
+ STEM,Biology,Falcon-H1-7B,1409,29117,61629,2.1165985506748637,4.967369257979198,1.2980811761484508
154
+ STEM,Biology,tiktoken-cl100k,1409,29117,121687,4.179242367002095,2.51574942269922,2.5630726457021296
155
+ STEM,Biology,tiktoken-o200k,1409,29117,63269,2.1729230346532953,4.838609745689042,1.3326242180424206
156
+ STEM,Computer Science,SunAI-64K,542,9776,14540,1.487315875613748,7.119463548830812,1.0
157
+ STEM,Computer Science,Fanar-1,542,9776,21367,2.1856587561374794,4.844713811016989,1.469532324621733
158
+ STEM,Computer Science,ALLaM-7B,542,9776,15718,1.6078150572831424,6.585888789922382,1.0810178817056395
159
+ STEM,Computer Science,Qwen2.5-7B,542,9776,22331,2.2842675941080195,4.635573865926291,1.5358321870701512
160
+ STEM,Computer Science,Qwen3-8B,542,9776,22331,2.2842675941080195,4.635573865926291,1.5358321870701512
161
+ STEM,Computer Science,Qwen3.5-4B,542,9776,19352,1.9795417348608837,5.349162877221993,1.330949105914718
162
+ STEM,Computer Science,Qwen3.8-Flash-Next,542,9776,19352,1.9795417348608837,5.349162877221993,1.330949105914718
163
+ STEM,Computer Science,DeepSeek-V3,542,9776,22512,2.30278232405892,4.598303127221038,1.5482806052269602
164
+ STEM,Computer Science,GPT-OSS-20B,542,9776,19491,1.9937602291325696,5.311015340413524,1.34050894085282
165
+ STEM,Computer Science,Kimi-K2.6,542,9776,27989,2.863031914893617,3.6984886919861375,1.924965612104539
166
+ STEM,Computer Science,Mistral-Small-3.1,542,9776,18821,1.9252250409165304,5.500079698209447,1.2944291609353507
167
+ STEM,Computer Science,Falcon-H1-7B,542,9776,19322,1.9764729950900164,5.357468170996791,1.3288858321870702
168
+ STEM,Computer Science,tiktoken-cl100k,542,9776,40046,4.096358428805237,2.584952304849423,2.7541953232462175
169
+ STEM,Computer Science,tiktoken-o200k,542,9776,19491,1.9937602291325696,5.311015340413524,1.34050894085282
170
+ STEM,Math,SunAI-64K,409,4585,7744,1.6889858233369683,4.202221074380165,1.0
171
+ STEM,Math,Fanar-1,409,4585,11268,2.4575790621592146,2.8880014199503017,1.4550619834710743
172
+ STEM,Math,ALLaM-7B,409,4585,9977,2.176008724100327,3.2617019144031274,1.2883522727272727
173
+ STEM,Math,Qwen2.5-7B,409,4585,11670,2.5452562704471102,2.788517566409597,1.5069731404958677
174
+ STEM,Math,Qwen3-8B,409,4585,11670,2.5452562704471102,2.788517566409597,1.5069731404958677
175
+ STEM,Math,Qwen3.5-4B,409,4585,10996,2.3982551799345693,2.9594397962895598,1.4199380165289257
176
+ STEM,Math,Qwen3.8-Flash-Next,409,4585,10996,2.3982551799345693,2.9594397962895598,1.4199380165289257
177
+ STEM,Math,DeepSeek-V3,409,4585,9908,2.160959651035987,3.284416633023819,1.2794421487603307
178
+ STEM,Math,GPT-OSS-20B,409,4585,9200,2.0065430752453652,3.5371739130434783,1.18801652892562
179
+ STEM,Math,Kimi-K2.6,409,4585,11418,2.4902944383860413,2.8500613067087057,1.4744318181818181
180
+ STEM,Math,Mistral-Small-3.1,409,4585,10657,2.324318429661941,3.0535798066998217,1.3761621900826446
181
+ STEM,Math,Falcon-H1-7B,409,4585,11069,2.414176663031625,2.939922305537989,1.4293646694214877
182
+ STEM,Math,tiktoken-cl100k,409,4585,14486,3.159432933478735,2.2464448432969766,1.8706095041322315
183
+ STEM,Math,tiktoken-o200k,409,4585,9200,2.0065430752453652,3.5371739130434783,1.18801652892562
184
+ STEM,Natural Science,SunAI-64K,578,9714,17306,1.7815523985999588,6.16751415693979,1.0
185
+ STEM,Natural Science,Fanar-1,578,9714,23515,2.4207329627341982,4.539017648309589,1.3587773026695944
186
+ STEM,Natural Science,ALLaM-7B,578,9714,17754,1.8276714021000617,6.011884645713642,1.0258869756153934
187
+ STEM,Natural Science,Qwen2.5-7B,578,9714,25268,2.601194152769199,4.224117460820009,1.460071651450364
188
+ STEM,Natural Science,Qwen3-8B,578,9714,25268,2.601194152769199,4.224117460820009,1.460071651450364
189
+ STEM,Natural Science,Qwen3.5-4B,578,9714,21571,2.2206094296891083,4.948078438644476,1.2464463191956547
190
+ STEM,Natural Science,Qwen3.8-Flash-Next,578,9714,21571,2.2206094296891083,4.948078438644476,1.2464463191956547
191
+ STEM,Natural Science,DeepSeek-V3,578,9714,24277,2.4991764463660697,4.396548173168019,1.4028082745868484
192
+ STEM,Natural Science,GPT-OSS-20B,578,9714,21630,2.2266831377393452,4.934581599630143,1.2498555414307178
193
+ STEM,Natural Science,Kimi-K2.6,578,9714,29929,3.0810170887379043,3.5662735139830932,1.7294002080203397
194
+ STEM,Natural Science,Mistral-Small-3.1,578,9714,20641,2.1248713197446985,5.171018845986144,1.192707731422628
195
+ STEM,Natural Science,Falcon-H1-7B,578,9714,21462,2.209388511426807,4.973208461466778,1.240147925574945
196
+ STEM,Natural Science,tiktoken-cl100k,578,9714,42341,4.358760551780935,2.5208426820339622,2.446608112793251
197
+ STEM,Natural Science,tiktoken-o200k,578,9714,21630,2.2266831377393452,4.934581599630143,1.2498555414307178
198
+ STEM,Physics,SunAI-64K,255,7398,11407,1.5419032170856988,5.738406241781362,1.0
199
+ STEM,Physics,Fanar-1,255,7398,16104,2.1768045417680453,4.064704421261799,1.411764705882353
200
+ STEM,Physics,ALLaM-7B,255,7398,12596,1.7026223303595567,5.196729120355668,1.1042342421320241
201
+ STEM,Physics,Qwen2.5-7B,255,7398,17613,2.380778588807786,3.7164594333730765,1.5440518979573945
202
+ STEM,Physics,Qwen3-8B,255,7398,17613,2.380778588807786,3.7164594333730765,1.5440518979573945
203
+ STEM,Physics,Qwen3.5-4B,255,7398,15136,2.0459583671262505,4.32465644820296,1.3269045323047253
204
+ STEM,Physics,Qwen3.8-Flash-Next,255,7398,15136,2.0459583671262505,4.32465644820296,1.3269045323047253
205
+ STEM,Physics,DeepSeek-V3,255,7398,16504,2.2308732089753986,3.966190014541929,1.4468308933111247
206
+ STEM,Physics,GPT-OSS-20B,255,7398,14807,2.0014868883482024,4.420746944012967,1.2980625931445604
207
+ STEM,Physics,Kimi-K2.6,255,7398,20342,2.749662070829954,3.2178743486382855,1.7832909616901902
208
+ STEM,Physics,Mistral-Small-3.1,255,7398,14345,1.9390375777237092,4.563123039386546,1.2575611466643288
209
+ STEM,Physics,Falcon-H1-7B,255,7398,14855,2.0079751284130847,4.406462470548637,1.302270535636013
210
+ STEM,Physics,tiktoken-cl100k,255,7398,27688,3.742633144092998,2.3641288644900316,2.4272814938195846
211
+ STEM,Physics,tiktoken-o200k,255,7398,14807,2.0014868883482024,4.420746944012967,1.2980625931445604
212
+ Social Science,Accounting,SunAI-64K,74,2202,4070,1.8483197093551318,5.774447174447174,1.0
213
+ Social Science,Accounting,Fanar-1,74,2202,5447,2.4736603088101727,4.314668624931155,1.3383292383292382
214
+ Social Science,Accounting,ALLaM-7B,74,2202,4242,1.9264305177111716,5.5403111739745405,1.0422604422604422
215
+ Social Science,Accounting,Qwen2.5-7B,74,2202,5808,2.637602179836512,4.046487603305785,1.427027027027027
216
+ Social Science,Accounting,Qwen3-8B,74,2202,5808,2.637602179836512,4.046487603305785,1.427027027027027
217
+ Social Science,Accounting,Qwen3.5-4B,74,2202,4976,2.259763851044505,4.723070739549839,1.2226044226044226
218
+ Social Science,Accounting,Qwen3.8-Flash-Next,74,2202,4976,2.259763851044505,4.723070739549839,1.2226044226044226
219
+ Social Science,Accounting,DeepSeek-V3,74,2202,5669,2.5744777475022707,4.145704709825366,1.392874692874693
220
+ Social Science,Accounting,GPT-OSS-20B,74,2202,5048,2.292461398728429,4.655705229793978,1.2402948402948404
221
+ Social Science,Accounting,Kimi-K2.6,74,2202,7045,3.1993642143505903,3.335982966643009,1.730958230958231
222
+ Social Science,Accounting,Mistral-Small-3.1,74,2202,4963,2.2538601271571297,4.73544227281886,1.2194103194103194
223
+ Social Science,Accounting,Falcon-H1-7B,74,2202,5037,2.287465940054496,4.665872543180464,1.2375921375921375
224
+ Social Science,Accounting,tiktoken-cl100k,74,2202,9647,4.381017257039056,2.436197781693791,2.3702702702702703
225
+ Social Science,Accounting,tiktoken-o200k,74,2202,5048,2.292461398728429,4.655705229793978,1.2402948402948404
226
+ Social Science,Civics,SunAI-64K,323,7045,10769,1.5286018452803407,7.218590398365679,1.0
227
+ Social Science,Civics,Fanar-1,323,7045,15673,2.2246983676366217,4.9599310916863395,1.455381186739716
228
+ Social Science,Civics,ALLaM-7B,323,7045,11696,1.6601845280340668,6.6464603283173735,1.0860804160089146
229
+ Social Science,Civics,Qwen2.5-7B,323,7045,16640,2.361958836053939,4.6716947115384615,1.5451759680564583
230
+ Social Science,Civics,Qwen3-8B,323,7045,16640,2.361958836053939,4.6716947115384615,1.5451759680564583
231
+ Social Science,Civics,Qwen3.5-4B,323,7045,14381,2.041305890702626,5.405535081009665,1.3354071872968707
232
+ Social Science,Civics,Qwen3.8-Flash-Next,323,7045,14381,2.041305890702626,5.405535081009665,1.3354071872968707
233
+ Social Science,Civics,DeepSeek-V3,323,7045,16980,2.410220014194464,4.578150765606596,1.5767480731729966
234
+ Social Science,Civics,GPT-OSS-20B,323,7045,14008,1.988360539389638,5.549471730439748,1.3007707308013743
235
+ Social Science,Civics,Kimi-K2.6,323,7045,20874,2.9629524485450673,3.724106544026061,1.9383415358900549
236
+ Social Science,Civics,Mistral-Small-3.1,323,7045,13880,1.9701916252661462,5.60064841498559,1.2888847618163246
237
+ Social Science,Civics,Falcon-H1-7B,323,7045,13354,1.895528743789922,5.8212520593080725,1.2400408580183861
238
+ Social Science,Civics,tiktoken-cl100k,323,7045,30289,4.299361249112846,2.5665092938030307,2.812610270220076
239
+ Social Science,Civics,tiktoken-o200k,323,7045,14008,1.988360539389638,5.549471730439748,1.3007707308013743
240
+ Social Science,Economics,SunAI-64K,584,15822,24265,1.5336240677537605,7.296723676076653,1.0
241
+ Social Science,Economics,Fanar-1,584,15822,35489,2.2430160535962584,4.989010679365437,1.462559241706161
242
+ Social Science,Economics,ALLaM-7B,584,15822,25510,1.6123119706737454,6.9406115248922,1.0513084689882546
243
+ Social Science,Economics,Qwen2.5-7B,584,15822,37455,2.3672734167614715,4.727139233747163,1.5435812899237584
244
+ Social Science,Economics,Qwen3-8B,584,15822,37455,2.3672734167614715,4.727139233747163,1.5435812899237584
245
+ Social Science,Economics,Qwen3.5-4B,584,15822,31162,1.969536088990014,5.681759835697323,1.2842365547084278
246
+ Social Science,Economics,Qwen3.8-Flash-Next,584,15822,31162,1.969536088990014,5.681759835697323,1.2842365547084278
247
+ Social Science,Economics,DeepSeek-V3,584,15822,37290,2.3568448995070157,4.74805577902923,1.5367813723470019
248
+ Social Science,Economics,GPT-OSS-20B,584,15822,31515,1.9918467956010617,5.618118356338251,1.2987842571605193
249
+ Social Science,Economics,Kimi-K2.6,584,15822,46902,2.9643534319302236,3.7749989339473795,1.9329074799093344
250
+ Social Science,Economics,Mistral-Small-3.1,584,15822,31225,1.9735178864871699,5.670296236989592,1.2868328868740986
251
+ Social Science,Economics,Falcon-H1-7B,584,15822,29581,1.8696119327518645,5.985429836719516,1.2190809808365959
252
+ Social Science,Economics,tiktoken-cl100k,584,15822,67099,4.2408671470104915,2.6387129465416774,2.7652586029260253
253
+ Social Science,Economics,tiktoken-o200k,584,15822,31515,1.9918467956010617,5.618118356338251,1.2987842571605193
254
+ Social Science,Geography,SunAI-64K,1367,27069,43937,1.6231482507665596,6.795479891663063,1.0
255
+ Social Science,Geography,Fanar-1,1367,27069,62704,2.3164505522922902,4.76162605256443,1.4271343059380477
256
+ Social Science,Geography,ALLaM-7B,1367,27069,46879,1.7318334626325316,6.369013844151966,1.0669595102077976
257
+ Social Science,Geography,Qwen2.5-7B,1367,27069,67231,2.4836898296944843,4.441001918757716,1.5301681953706443
258
+ Social Science,Geography,Qwen3-8B,1367,27069,67231,2.4836898296944843,4.441001918757716,1.5301681953706443
259
+ Social Science,Geography,Qwen3.5-4B,1367,27069,56939,2.1034763013040747,5.243734522910483,1.2959237089469013
260
+ Social Science,Geography,Qwen3.8-Flash-Next,1367,27069,56939,2.1034763013040747,5.243734522910483,1.2959237089469013
261
+ Social Science,Geography,DeepSeek-V3,1367,27069,65243,2.4102478850345412,4.576322364085036,1.4849215922798553
262
+ Social Science,Geography,GPT-OSS-20B,1367,27069,56698,2.094573127932321,5.266023492892166,1.290438582515875
263
+ Social Science,Geography,Kimi-K2.6,1367,27069,80426,2.971147807455022,3.7123940019396713,1.8304845574345086
264
+ Social Science,Geography,Mistral-Small-3.1,1367,27069,54771,2.0233846835863902,5.451297219331398,1.2465803309283747
265
+ Social Science,Geography,Falcon-H1-7B,1367,27069,55178,2.0384203332225055,5.411087752365073,1.2558435942372033
266
+ Social Science,Geography,tiktoken-cl100k,1367,27069,115984,4.284753777383723,2.5742602427921093,2.639779684548331
267
+ Social Science,Geography,tiktoken-o200k,1367,27069,56698,2.094573127932321,5.266023492892166,1.290438582515875
268
+ Social Science,Political Science,SunAI-64K,210,3858,10023,2.5979782270606533,4.5571186271575375,1.0
269
+ Social Science,Political Science,Fanar-1,210,3858,12004,3.111456713322965,3.8050649783405532,1.1976454155442482
270
+ Social Science,Political Science,ALLaM-7B,210,3858,12164,3.152928978745464,3.7550147977638932,1.2136086999900229
271
+ Social Science,Political Science,Qwen2.5-7B,210,3858,12639,3.276049766718507,3.6138935042329297,1.2609997006884166
272
+ Social Science,Political Science,Qwen3-8B,210,3858,12639,3.276049766718507,3.6138935042329297,1.2609997006884166
273
+ Social Science,Political Science,Qwen3.5-4B,210,3858,14579,3.7789009849663038,3.132999519857329,1.454554524593435
274
+ Social Science,Political Science,Qwen3.8-Flash-Next,210,3858,14579,3.7789009849663038,3.132999519857329,1.454554524593435
275
+ Social Science,Political Science,DeepSeek-V3,210,3858,14129,3.6622602384655263,3.2327836364923206,1.4096577870896938
276
+ Social Science,Political Science,GPT-OSS-20B,210,3858,13506,3.5007776049766717,3.3819043388123795,1.3475007482789585
277
+ Social Science,Political Science,Kimi-K2.6,210,3858,15329,3.9733022291342666,2.979711657642377,1.529382420433004
278
+ Social Science,Political Science,Mistral-Small-3.1,210,3858,14998,3.8875064800414725,3.045472729697293,1.4963583757358077
279
+ Social Science,Political Science,Falcon-H1-7B,210,3858,12929,3.351218247796786,3.5328331657514114,1.2899331537463834
280
+ Social Science,Political Science,tiktoken-cl100k,210,3858,22315,5.784085018144116,2.046874299798342,2.226379327546643
281
+ Social Science,Political Science,tiktoken-o200k,210,3858,13506,3.5007776049766717,3.3819043388123795,1.3475007482789585
282
+ Social Science,Social Science,SunAI-64K,946,12617,20441,1.6201157168899105,6.404823638765227,1.0
283
+ Social Science,Social Science,Fanar-1,946,12617,28272,2.2407862407862407,4.6307654216185625,1.383102587936011
284
+ Social Science,Social Science,ALLaM-7B,946,12617,21541,1.7072996750416105,6.0777586927255,1.0538134142165256
285
+ Social Science,Social Science,Qwen2.5-7B,946,12617,29450,2.3341523341523343,4.44553480475382,1.4407318624333447
286
+ Social Science,Social Science,Qwen3-8B,946,12617,29450,2.3341523341523343,4.44553480475382,1.4407318624333447
287
+ Social Science,Social Science,Qwen3.5-4B,946,12617,26159,2.0733137829912023,5.004816697886005,1.2797319113546304
288
+ Social Science,Social Science,Qwen3.8-Flash-Next,946,12617,26159,2.0733137829912023,5.004816697886005,1.2797319113546304
289
+ Social Science,Social Science,DeepSeek-V3,946,12617,29395,2.3297931362447493,4.453852696036741,1.4380411917225184
290
+ Social Science,Social Science,GPT-OSS-20B,946,12617,25690,2.036141713561068,5.096185286103542,1.2567878283841298
291
+ Social Science,Social Science,Kimi-K2.6,946,12617,36157,2.8657367044463817,3.6209032829051084,1.7688469252971968
292
+ Social Science,Social Science,Mistral-Small-3.1,946,12617,24923,1.9753507172862013,5.253019299442283,1.219265202289516
293
+ Social Science,Social Science,Falcon-H1-7B,946,12617,25290,2.0044384560513593,5.176789244760775,1.2372193141235752
294
+ Social Science,Social Science,tiktoken-cl100k,946,12617,51644,4.0932075770785445,2.535066997134227,2.526490876180226
295
+ Social Science,Social Science,tiktoken-o200k,946,12617,25690,2.036141713561068,5.096185286103542,1.2567878283841298
results/arabicmmlu_summary.csv ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tokenizer,documents,tokens,tokens_per_word,characters_per_token,bytes_per_token,token_ratio_vs_yours,extra_tokens_vs_yours_pct
2
+ ALLaM-7B,14455,819457,1.9940358288275573,3.17696962744842,5.801229350655373,0.8030892382355218,-19.69107617644782
3
+ Qwen3.5-4B,14455,985479,2.3980275164616964,2.6417508643005077,4.82390593812755,0.9657951294663464,-3.420487053365362
4
+ Qwen3.8-Flash-Next,14455,985479,2.3980275164616964,2.6417508643005077,4.82390593812755,0.9657951294663464,-3.420487053365362
5
+ SunAI-64K,14455,1020381,2.4829567299503106,2.5513901180049414,4.658904860047374,1.0,0.0
6
+ Falcon-H1-7B,14455,1054020,2.564812606763774,2.4699626193051367,4.510216124931215,1.0329670975841376,3.296709758413763
7
+ Mistral-Small-3.1,14455,1065947,2.593835319768149,2.442325931777096,4.459750813126732,1.0446558687392258,4.465586873922578
8
+ tiktoken-o200k,14455,1088838,2.649537417813186,2.3909801090704037,4.365992002483381,1.0670896459263746,6.708964592637456
9
+ GPT-OSS-20B,14455,1088838,2.649537417813186,2.3909801090704037,4.365992002483381,1.0670896459263746,6.708964592637456
10
+ DeepSeek-V3,14455,1164768,2.834302622677964,2.2351146322701174,4.08137757905437,1.1415030268105737,14.150302681057369
11
+ Fanar-1,14455,1177965,2.8664157058940902,2.210074153306762,4.035653011761809,1.154436431097796,15.443643109779593
12
+ Qwen3-8B,14455,1309838,3.1873105019053227,1.9875664013412346,3.6293480567825944,1.2836754114394524,28.36754114394524
13
+ Qwen2.5-7B,14455,1309838,3.1873105019053227,1.9875664013412346,3.6293480567825944,1.2836754114394524,28.36754114394524
14
+ Kimi-K2.6,14455,1472196,3.582386349810441,1.768371874397159,3.2290931370551204,1.4427904870827661,44.27904870827661
15
+ tiktoken-cl100k,14455,1961832,4.773848167921471,1.3270198467554817,2.4231728302933178,1.9226465408509175,92.26465408509175
special_tokens_map.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<bos>",
3
+ "eos_token": "<eos>",
4
+ "unk_token": "<unk>",
5
+ "pad_token": "<pad>",
6
+ "additional_special_tokens": [
7
+ "<user>",
8
+ "<assistant>",
9
+ "<system>"
10
+ ]
11
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "clean_up_tokenization_spaces": false,
4
+ "bos_token": "<bos>",
5
+ "eos_token": "<eos>",
6
+ "unk_token": "<unk>",
7
+ "pad_token": "<pad>",
8
+ "additional_special_tokens": [
9
+ "<user>",
10
+ "<assistant>",
11
+ "<system>"
12
+ ]
13
+ }
upload_to_hub.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ from pathlib import Path
3
+
4
+ from huggingface_hub import HfApi
5
+
6
+
7
+ def main() -> None:
8
+ parser = argparse.ArgumentParser(
9
+ description="Create a Hugging Face model repository and upload SunAI-64K."
10
+ )
11
+ parser.add_argument(
12
+ "repo_id",
13
+ help="Destination repository, for example yasseraljohani/SunAI-64K",
14
+ )
15
+ parser.add_argument(
16
+ "--private",
17
+ action="store_true",
18
+ help="Create a private repository instead of a public one.",
19
+ )
20
+ args = parser.parse_args()
21
+
22
+ root = Path(__file__).resolve().parent
23
+ api = HfApi()
24
+ api.create_repo(
25
+ repo_id=args.repo_id,
26
+ repo_type="model",
27
+ private=args.private,
28
+ exist_ok=True,
29
+ )
30
+ api.upload_folder(
31
+ repo_id=args.repo_id,
32
+ repo_type="model",
33
+ folder_path=root,
34
+ ignore_patterns=[
35
+ "*.zip",
36
+ "__pycache__/**",
37
+ "results/generated/**",
38
+ ],
39
+ commit_message="Publish SunAI-64K tokenizer and benchmark results",
40
+ )
41
+ print(f"Uploaded to https://huggingface.co/{args.repo_id}")
42
+
43
+
44
+ if __name__ == "__main__":
45
+ main()
verify_tokenizer.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from hashlib import sha256
2
+ from pathlib import Path
3
+
4
+ from tokenizers import Tokenizer
5
+
6
+
7
+ ROOT = Path(__file__).resolve().parent
8
+ TOKENIZER_PATH = ROOT / "tokenizer.json"
9
+ EXPECTED_SHA256 = "7d9496a251b44688557a79fab59b5cf7a12f11a9559540b9a1e223657f35f613"
10
+
11
+ actual_sha256 = sha256(TOKENIZER_PATH.read_bytes()).hexdigest()
12
+ if actual_sha256 != EXPECTED_SHA256:
13
+ raise RuntimeError(
14
+ f"SHA-256 mismatch: expected {EXPECTED_SHA256}, got {actual_sha256}"
15
+ )
16
+
17
+ tokenizer = Tokenizer.from_file(str(TOKENIZER_PATH))
18
+ if tokenizer.get_vocab_size() != 65_536:
19
+ raise RuntimeError(f"Unexpected vocabulary size: {tokenizer.get_vocab_size()}")
20
+
21
+ samples = [
22
+ "المملكة العربية السعودية",
23
+ "السلام عليكم ورحمة الله وبركاته",
24
+ "Artificial intelligence والذكاء الاصطناعي",
25
+ "ياهلا ومرحبا فيكم",
26
+ ]
27
+
28
+ for text in samples:
29
+ encoding = tokenizer.encode(text, add_special_tokens=False)
30
+ decoded = tokenizer.decode(encoding.ids)
31
+ if decoded != text:
32
+ raise RuntimeError(f"Round-trip failure: {text!r} -> {decoded!r}")
33
+
34
+ print("Tokenizer verification passed")
35
+ print(f"Vocabulary size: {tokenizer.get_vocab_size():,}")
36
+ print(f"SHA-256: {actual_sha256}")