Skip to content

Perf/bpe merge - #2241

Open
ArthurZucker wants to merge 84 commits into
feat/train_encode_splitfrom
perf/bpe-merge
Open

Perf/bpe merge#2241
ArthurZucker wants to merge 84 commits into
feat/train_encode_splitfrom
perf/bpe-merge

Conversation

@ArthurZucker

@ArthurZucker ArthurZucker commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

PipelineTokenizer benchmark

10 / 10 models supported — PipelineTokenizer vs tokenizers v0.23.1 (latest release) · ~10 kB inputs · add_special_tokens on · single thread + 1/2/4/8/max-thread sweep

a42edc914 · 2026-08-03 10:02 UTC · Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz · 48 cores

Per-model encode throughput vs latest release

vs base branch (d183afea5) — per-model geomean ×speedup of this PR's PipelineTokenizer against the base branch's; regressions in red.

Per-model encode throughput vs base branch

Per-model memory footprint

Minimal encode binary size

Decode

Round-trip: v0.23.1 encode_fast produces the id streams (same fixtures, add_special_tokens=true); both implementations decode those SAME ids with skip_special_tokens=false. MB/s counts decoded text bytes.

Per-model decode throughput vs latest release

Per-model decode memory footprint

bert-base-uncased — normalizer-heavy WordPiece · ×4.88 vs v0.23.1 · ×0.99 vs base · decode pending bert-base-uncased speedup bert-base-uncased stage decomposition bert-base-uncased thread scaling bert-base-uncased decode speedup bert-base-uncased decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 12+0 (peak 12) · Pipeline 8+0 (peak 17)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 7.8 27.5 ×3.53 ×1.00 3% (1.2) 77% (27.4) 15% (5.3) 6% (2.1) 0% (0.0) match
arb_Arab lang 4.2 24.4 ×5.84 ×0.98 3% (1.2) 68% (27.4) 10% (3.9) 20% (8.1) 0% (0.1) match
ben_Beng lang 6.0 33.8 ×5.68 ×0.98 4% (1.2) 66% (19.1) 12% (3.4) 19% (5.5) 0% (0.0) match
cmn_Hani lang 3.9 18.7 ×4.84 ×1.00 2% (1.2) 71% (37.6) 11% (5.6) 16% (8.4) 0% (0.0) match
ell_Grek lang 3.8 23.3 ×6.15 ×0.98 3% (1.2) 67% (28.6) 9% (3.9) 21% (8.8) 0% (0.0) match
eng_Latn lang 4.5 18.4 ×4.07 ×1.00 5% (2.5) 71% (38.5) 8% (4.4) 16% (8.6) 0% (0.1) match
heb_Hebr lang 4.2 19.6 ×4.67 ×0.99 2% (1.2) 74% (37.4) 9% (4.4) 15% (7.6) 0% (0.0) match
hin_Deva lang 6.5 27.0 ×4.18 ×0.99 3% (1.2) 74% (27.1) 10% (3.6) 13% (4.9) 0% (0.0) match
jpn_Jpan lang 4.3 26.9 ×6.28 ×0.99 3% (1.2) 63% (23.2) 14% (5.1) 20% (7.3) 0% (0.0) match
kat_Geor lang 6.1 27.7 ×4.51 ×0.99 3% (1.2) 74% (26.5) 11% (3.8) 12% (4.2) 0% (0.0) match
kor_Hang lang 2.4 17.1 ×7.02 ×0.96 2% (1.2) 61% (35.3) 12% (7.1) 25% (14.4) 0% (0.0) match
rus_Cyrl lang 3.7 23.3 ×6.35 ×0.99 3% (1.2) 65% (27.4) 9% (3.8) 24% (10.0) 0% (0.0) match
tam_Taml lang 7.0 37.6 ×5.39 ×0.98 4% (1.2) 71% (18.6) 11% (2.9) 13% (3.5) 0% (0.0) match
tha_Thai lang 8.3 33.0 ×3.95 ×1.00 4% (1.2) 83% (25.0) 9% (2.7) 4% (1.1) 0% (0.0) match
added_normalized_dense modalities 6.7 19.6 ×2.93 ×1.01 3% (1.3) 81% (40.5) 14% (7.3) 2% (1.1) 0% (0.1) match
added_normalized_sparse modalities 5.3 18.4 ×3.45 ×1.01 3% (1.9) 75% (39.9) 13% (6.9) 10% (5.2) 0% (0.0) match
added_special_dense modalities 5.3 38.4 ×7.18 ×1.01 20% (5.2) 38% (9.8) 34% (8.7) 6% (1.5) 2% (0.4) match
added_special_sparse modalities 4.0 21.3 ×5.36 ×1.01 8% (3.7) 60% (27.9) 19% (8.9) 12% (5.7) 0% (0.1) match
agentic-traces modalities 3.9 18.2 ×4.68 ×1.00 4% (2.3) 70% (38.4) 9% (4.9) 16% (8.9) 0% (0.0) match
agentic_swe modalities 4.1 19.4 ×4.72 ×1.00 4% (1.9) 75% (38.6) 7% (3.7) 14% (7.2) 0% (0.0) match
code_mixed modalities 3.9 18.9 ×4.82 ×1.00 4% (2.1) 73% (38.5) 8% (4.2) 15% (7.8) 0% (0.0) match
math_latex modalities 4.1 18.2 ×4.48 ×1.00 4% (2.5) 70% (38.5) 9% (4.7) 17% (9.2) 0% (0.0) match
deepseek-v4 — deepseek 3-regex split-heavy byte-level BPE · ×6.98 vs v0.23.1 · ×1.70 vs base · decode pending deepseek-v4 speedup deepseek-v4 stage decomposition deepseek-v4 thread scaling deepseek-v4 decode speedup deepseek-v4 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 62+0 (peak 67) · Pipeline 92+0 (peak 91)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 4.5 47.3 ×10.63 ×1.42 3% (0.6) 0% (0.0) 24% (4.8) 73% (14.4) 0% (0.0) match
arb_Arab lang 4.4 25.2 ×5.74 ×1.51 2% (0.6) 0% (0.0) 9% (3.5) 89% (33.4) 0% (0.0) match
ben_Beng lang 6.3 28.5 ×4.54 ×1.61 2% (0.6) 0% (0.0) 9% (3.2) 88% (29.7) 0% (0.1) match
cmn_Hani lang 3.7 45.8 ×12.48 ×2.82 4% (0.8) 0% (0.0) 17% (3.2) 80% (15.2) 0% (0.0) match
ell_Grek lang 4.6 26.8 ×5.78 ×1.50 2% (0.6) 0% (0.0) 10% (3.5) 89% (31.7) 0% (0.0) match
eng_Latn lang 3.2 23.1 ×7.30 ×1.80 5% (2.0) 0% (0.0) 13% (5.1) 83% (33.5) 0% (0.0) match
heb_Hebr lang 4.0 20.4 ×5.13 ×1.56 1% (0.6) 0% (0.0) 8% (3.6) 91% (42.8) 0% (0.0) match
hin_Deva lang 5.9 33.6 ×5.70 ×1.58 2% (0.6) 0% (0.0) 12% (3.4) 86% (24.5) 0% (0.0) match
jpn_Jpan lang 4.3 42.5 ×9.93 ×2.40 3% (0.7) 0% (0.0) 14% (3.0) 83% (17.4) 0% (0.0) match
kat_Geor lang 6.0 26.6 ×4.45 ×1.47 2% (0.6) 0% (0.0) 8% (3.1) 90% (33.1) 0% (0.1) match
kor_Hang lang 3.8 27.5 ×7.24 ×1.40 2% (0.6) 0% (0.0) 11% (3.7) 88% (29.9) 0% (0.0) match
rus_Cyrl lang 4.5 21.1 ×4.70 ×1.46 1% (0.6) 0% (0.0) 7% (3.3) 92% (42.7) 0% (0.0) match
tam_Taml lang 6.3 28.1 ×4.46 ×1.60 2% (0.6) 0% (0.0) 8% (2.8) 91% (31.9) 0% (0.0) match
tha_Thai lang 7.1 21.8 ×3.10 ×1.50 1% (0.6) 0% (0.0) 5% (2.4) 94% (41.8) 0% (0.0) match
added_normalized_dense modalities 5.6 47.9 ×8.52 ×2.06 4% (0.7) 0% (0.0) 14% (2.8) 83% (16.4) 0% (0.0) match
added_normalized_sparse modalities 5.1 38.8 ×7.65 ×2.01 5% (1.3) 0% (0.0) 16% (3.8) 79% (19.2) 0% (0.1) match
added_special_dense modalities 3.5 48.5 ×13.75 ×1.31 34% (6.6) 3% (0.6) 31% (6.0) 32% (6.2) 0% (0.0) match
added_special_sparse modalities 3.9 35.0 ×9.04 ×1.71 15% (4.0) 0% (0.1) 25% (6.9) 60% (16.3) 0% (0.0) match
agentic-traces modalities 3.0 24.8 ×8.38 ×1.73 5% (1.8) 0% (0.0) 14% (5.4) 83% (32.0) 0% (0.0) match
agentic_swe modalities 3.1 28.9 ×9.39 ×1.93 4% (1.3) 0% (0.0) 12% (3.9) 85% (28.3) 0% (0.0) match
code_mixed modalities 3.5 27.4 ×7.81 ×1.77 4% (1.6) 0% (0.0) 13% (4.6) 83% (28.8) 0% (0.0) match
math_latex modalities 2.9 24.6 ×8.35 ×1.82 5% (1.9) 0% (0.0) 14% (5.4) 81% (32.1) 0% (0.1) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.62 3.11 4.82 5.31 41.8 20.4 9.1 8.7× / 7.9× 4.2× / 3.8× 1.9× / 1.7×
arb_Arab 1.00 2.81 3.45 5.26 49.1 22.9 10.1 14.2× / 9.3× 6.6× / 4.4× 2.9× / 1.9×
ben_Beng 1.45 2.62 3.17 4.34 36.2 16.0 7.5 11.4× / 8.4× 5.0× / 3.7× 2.4× / 1.7×
cmn_Hani 1.13 2.01 3.19 4.07 60.2 34.2 14.2 18.9× / 14.8× 10.7× / 8.4× 4.4× / 3.5×
ell_Grek 0.58 2.88 3.46 5.76 47.8 21.3 9.5 13.8× / 8.3× 6.2× / 3.7× 2.8× / 1.7×
eng_Latn 0.10 1.16 5.13 6.19 65.9 39.3 16.2 12.8× / 10.6× 7.7× / 6.4× 3.2× / 2.6×
heb_Hebr 1.00 2.85 3.61 5.46 51.1 24.3 10.6 14.2× / 9.4× 6.7× / 4.5× 2.9× / 1.9×
hin_Deva 1.36 2.78 3.37 4.79 38.3 19.1 8.6 11.4× / 8.0× 5.7× / 4.0× 2.6× / 1.8×
jpn_Jpan 1.56 3.11 3.02 4.56 52.8 27.5 11.7 17.5× / 11.6× 9.1× / 6.0× 3.9× / 2.6×
kat_Geor 1.38 2.19 3.06 3.86 32.5 15.1 7.2 10.6× / 8.4× 4.9× / 3.9× 2.4× / 1.9×
kor_Hang 1.07 2.60 3.75 5.27 50.2 27.5 11.9 13.4× / 9.5× 7.3× / 5.2× 3.2× / 2.3×
rus_Cyrl 1.02 2.75 3.33 5.07 48.0 21.0 9.5 14.4× / 9.5× 6.3× / 4.1× 2.9× / 1.9×
tam_Taml 0.92 2.64 2.78 4.49 31.8 13.8 6.6 11.4× / 7.1× 5.0× / 3.1× 2.4× / 1.5×
tha_Thai 1.37 2.23 2.36 3.22 27.5 10.1 5.2 11.7× / 8.5× 4.3× / 3.1× 2.2× / 1.6×
added_normalized_dense 0.06 1.18 2.79 3.91 43.1 20.5 9.3 15.5× / 11.0× 7.4× / 5.3× 3.3× / 2.4×
added_normalized_sparse 0.06 1.18 3.80 4.92 49.1 26.7 11.4 12.9× / 10.0× 7.0× / 5.4× 3.0× / 2.3×
added_special_dense 0.06 1.18 6.02 7.13 171.1 99.7 38.8 28.5× / 24.0× 16.6× / 14.0× 6.4× / 5.4×
added_special_sparse 0.06 1.18 6.89 8.01 101.9 58.0 24.3 14.8× / 12.7× 8.4× / 7.2× 3.5× / 3.0×
agentic-traces 0.57 1.18 5.41 6.02 84.1 54.0 20.5 15.5× / 14.0× 10.0× / 9.0× 3.8× / 3.4×
agentic_swe 0.52 1.16 3.87 4.50 95.9 66.0 24.0 24.8× / 21.3× 17.1× / 14.7× 6.2× / 5.3×
code_mixed 0.07 1.15 4.62 5.69 74.4 54.5 18.8 16.1× / 13.1× 11.8× / 9.6× 4.1× / 3.3×
math_latex 0.56 1.20 5.37 6.01 78.4 48.3 19.8 14.6× / 13.0× 9.0× / 8.0× 3.7× / 3.3×
gemma-4 — byte-fallback BPE, Metaspace-style split (gemma-4) · ×2.94 vs v0.23.1 · ×1.81 vs base · decode pending gemma-4 speedup gemma-4 stage decomposition gemma-4 thread scaling gemma-4 decode speedup gemma-4 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 304+0 (peak 370) · Pipeline 274+0 (peak 370)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 11.1 40.6 ×3.67 ×1.63 3% (0.6) 6% (1.3) 0% (0.0) 91% (18.9) 0% (0.0) match
arb_Arab lang 7.5 22.2 ×2.96 ×2.11 1% (0.6) 4% (1.6) 0% (0.0) 96% (38.4) 0% (0.0) match
ben_Beng lang 10.6 26.6 ×2.52 ×1.65 2% (0.6) 3% (1.1) 0% (0.0) 95% (32.3) 0% (0.0) match
cmn_Hani lang 13.6 48.0 ×3.54 ×1.71 4% (0.6) 1% (0.2) 0% (0.0) 91% (14.9) 4% (0.7) match
ell_Grek lang 7.9 24.8 ×3.14 ×1.87 2% (0.6) 4% (1.6) 0% (0.0) 94% (35.8) 1% (0.2) match
eng_Latn lang 4.0 9.2 ×2.27 ×1.94 2% (2.0) 3% (3.0) 0% (0.0) 96% (101.4) 0% (0.0) match
heb_Hebr lang 8.3 28.9 ×3.48 ×1.88 2% (0.6) 5% (1.6) 0% (0.0) 93% (30.5) 1% (0.2) match
hin_Deva lang 10.0 26.9 ×2.68 ×1.74 2% (0.6) 4% (1.4) 0% (0.0) 94% (31.0) 0% (0.0) match
jpn_Jpan lang 13.8 42.7 ×3.10 ×1.77 3% (0.6) 1% (0.2) 0% (0.0) 96% (19.1) 0% (0.0) match
kat_Geor lang 12.6 39.4 ×3.13 ×1.70 3% (0.6) 4% (0.9) 0% (0.0) 94% (21.9) 0% (0.0) match
kor_Hang lang 10.3 38.6 ×3.74 ×1.73 3% (0.6) 8% (1.7) 0% (0.0) 90% (19.9) 0% (0.0) match
rus_Cyrl lang 7.5 18.2 ×2.44 ×1.96 1% (0.6) 3% (1.5) 0% (0.0) 93% (47.5) 3% (1.6) match
tam_Taml lang 11.6 28.3 ×2.45 ×1.58 2% (0.6) 3% (0.8) 0% (0.0) 96% (30.2) 0% (0.0) match
tha_Thai lang 13.5 34.4 ×2.54 ×1.61 2% (0.6) 2% (0.4) 0% (0.0) 96% (23.9) 0% (0.0) match
added_normalized_dense modalities 5.2 15.5 ×2.96 ×2.23 1% (0.7) 3% (1.8) 0% (0.0) 96% (59.0) 0% (0.0) match
added_normalized_sparse modalities 4.8 12.7 ×2.65 ×2.02 2% (1.3) 4% (2.8) 0% (0.0) 95% (72.6) 0% (0.0) match
added_special_dense modalities 4.8 27.7 ×5.79 ×1.33 26% (8.9) 20% (6.8) 17% (5.9) 37% (12.5) 0% (0.0) match
added_special_sparse modalities 7.0 14.8 ×2.11 ×1.50 7% (4.9) 10% (6.3) 7% (4.3) 77% (50.3) 0% (0.0) match
agentic-traces modalities 4.3 10.8 ×2.49 ×1.95 2% (1.8) 3% (2.8) 0% (0.0) 95% (82.8) 0% (0.0) match
agentic_swe modalities 4.1 14.5 ×3.53 ×2.25 2% (1.3) 6% (4.1) 0% (0.0) 92% (58.6) 0% (0.0) match
code_mixed modalities 4.2 12.5 ×2.98 ×2.02 2% (1.5) 5% (3.5) 0% (0.0) 93% (69.2) 0% (0.0) match
math_latex modalities 4.2 9.9 ×2.33 ×1.89 2% (1.9) 3% (2.9) 0% (0.0) 95% (91.7) 0% (0.0) match
gpt2 — gpt2 ByteLevel regex · ×13.25 vs v0.23.1 · ×1.66 vs base · decode pending gpt2 speedup gpt2 stage decomposition gpt2 thread scaling gpt2 decode speedup gpt2 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 25+2 (peak 27) · Pipeline 32+0 (peak 31)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 3.9 66.0 ×16.94 ×1.51 5% (0.6) 0% (0.0) 28% (3.7) 68% (9.0) 0% (0.0) match
arb_Arab lang 3.7 45.2 ×12.09 ×1.75 3% (0.6) 0% (0.0) 11% (2.3) 87% (18.2) 0% (0.0) match
ben_Beng lang 2.9 67.4 ×23.55 ×1.49 4% (0.6) 0% (0.0) 21% (3.0) 74% (10.3) 0% (0.0) match
cmn_Hani lang 3.6 50.2 ×13.87 ×1.79 3% (0.6) 0% (0.0) 13% (2.3) 85% (15.4) 0% (0.0) match
ell_Grek lang 4.2 45.4 ×10.89 ×1.55 3% (0.6) 0% (0.0) 10% (2.2) 87% (18.1) 0% (0.0) match
eng_Latn lang 3.5 26.0 ×7.48 ×1.87 5% (2.0) 0% (0.0) 8% (2.9) 87% (32.0) 0% (0.0) match
heb_Hebr lang 3.9 46.8 ×11.94 ×1.57 3% (0.6) 0% (0.0) 11% (2.3) 87% (17.7) 0% (0.0) match
hin_Deva lang 3.1 57.9 ×18.79 ×1.40 4% (0.6) 0% (0.0) 19% (3.1) 78% (12.9) 0% (0.0) match
jpn_Jpan lang 4.5 41.1 ×9.15 ×1.90 2% (0.6) 0% (0.0) 7% (2.1) 64% (20.3) 28% (8.8) match
kat_Geor lang 4.5 91.6 ×20.28 ×1.37 6% (0.6) 0% (0.0) 21% (2.0) 74% (7.4) 0% (0.0) match
kor_Hang lang 3.2 63.7 ×19.75 ×1.50 4% (0.6) 0% (0.0) 17% (2.4) 79% (11.5) 0% (0.0) match
rus_Cyrl lang 4.0 48.3 ×12.04 ×1.87 3% (0.6) 0% (0.0) 11% (2.1) 87% (17.1) 0% (0.0) match
tam_Taml lang 2.7 96.5 ×35.97 ×1.49 6% (0.6) 0% (0.0) 28% (2.7) 67% (6.5) 0% (0.0) match
tha_Thai lang 3.4 61.0 ×17.78 ×1.60 4% (0.6) 0% (0.0) 16% (2.5) 80% (12.3) 0% (0.0) match
added_normalized_dense modalities 5.8 52.9 ×9.13 ×2.07 4% (0.7) 0% (0.0) 7% (1.2) 90% (16.3) 0% (0.0) match
added_normalized_sparse modalities 5.0 43.8 ×8.76 ×2.04 6% (1.2) 0% (0.0) 9% (1.9) 87% (18.6) 0% (0.0) match
added_special_dense modalities 4.0 63.2 ×15.78 ×1.39 33% (5.0) 3% (0.5) 27% (4.1) 35% (5.2) 1% (0.2) match
added_special_sparse modalities 4.1 41.7 ×10.08 ×1.76 14% (3.1) 1% (0.3) 18% (4.0) 68% (15.5) 0% (0.0) match
agentic-traces modalities 3.0 29.0 ×9.53 ×1.77 5% (1.8) 0% (0.0) 10% (3.4) 84% (27.8) 0% (0.0) match
agentic_swe modalities 3.3 42.6 ×12.87 ×1.70 6% (1.3) 0% (0.0) 11% (2.4) 97% (21.8) 0% (0.0) match
code_mixed modalities 3.4 35.1 ×10.22 ×1.68 6% (1.5) 0% (0.0) 11% (2.9) 84% (22.6) 0% (0.0) match
math_latex modalities 3.1 27.5 ×8.87 ×1.79 5% (1.9) 0% (0.0) 9% (3.2) 86% (29.8) 0% (0.0) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.63 3.11 3.65 4.13 28.8 21.4 5.6 4.8 7.9× / 7.0× 5.9× / 5.2× 1.5× / 1.4× 1.3× / 1.2×
arb_Arab 1.00 2.78 2.27 4.05 33.8 26.5 6.7 5.1 14.9× / 8.3× 11.7× / 6.5× 2.9× / 1.6× 2.2× / 1.2×
ben_Beng 1.45 2.61 2.98 4.15 69.4 57.9 13.7 4.1 23.3× / 16.7× 19.4× / 13.9× 4.6× / 3.3× 1.4× / 1.0×
cmn_Hani 1.13 2.01 2.31 3.19 27.4 21.8 5.8 2.5 11.9× / 8.6× 9.4× / 6.8× 2.5× / 1.8× 1.1× / 0.8×
ell_Grek 0.58 2.82 2.16 4.39 30.0 22.6 5.8 4.7 13.9× / 6.8× 10.5× / 5.2× 2.7× / 1.3× 2.2× / 1.1×
eng_Latn 0.11 1.17 2.88 3.94 47.4 43.5 11.7 3.9 16.4× / 12.0× 15.1× / 11.0× 4.0× / 3.0× 1.3× / 1.0×
heb_Hebr 1.00 2.93 2.28 4.21 33.5 27.7 6.7 3.0 14.7× / 8.0× 12.2× / 6.6× 2.9× / 1.6× 1.3× / 0.7×
hin_Deva 1.36 2.79 3.07 4.50 65.4 56.6 13.3 4.3 21.3× / 14.5× 18.4× / 12.6× 4.3× / 2.9× 1.4× / 1.0×
jpn_Jpan 1.56 3.11 2.11 3.66 24.3 18.0 4.9 3.7 11.5× / 6.7× 8.5× / 4.9× 2.3× / 1.3× 1.8× / 1.0×
kat_Geor 1.39 2.18 2.05 2.84 18.0 14.5 4.2 2.1 8.8× / 6.4× 7.1× / 5.1× 2.0× / 1.5× 1.0× / 0.7×
kor_Hang 1.08 2.49 2.44 3.85 33.6 28.8 7.4 3.7 13.8× / 8.7× 11.8× / 7.5× 3.0× / 1.9× 1.5× / 1.0×
rus_Cyrl 1.02 2.75 2.10 3.83 28.6 21.9 5.6 2.4 13.6× / 7.5× 10.4× / 5.7× 2.7× / 1.5× 1.1× / 0.6×
tam_Taml 0.93 2.62 2.67 4.36 73.0 60.8 14.2 3.8 27.4× / 16.7× 22.8× / 13.9× 5.3× / 3.3× 1.4× / 0.9×
tha_Thai 1.36 2.21 2.51 3.36 41.5 33.0 8.8 3.3 16.5× / 12.4× 13.1× / 9.8× 3.5× / 2.6× 1.3× / 1.0×
added_normalized_dense 0.06 1.18 1.24 2.36 25.4 23.5 6.2 1.8 20.6× / 10.8× 19.0× / 10.0× 5.0× / 2.6× 1.5× / 0.8×
added_normalized_sparse 0.06 1.18 1.93 3.05 33.6 31.4 8.6 2.6 17.4× / 11.0× 16.3× / 10.3× 4.4× / 2.8× 1.4× / 0.9×
added_special_dense 0.06 1.18 4.11 5.23 100.3 101.3 19.7 2.9 24.4× / 19.2× 24.7× / 19.4× 4.8× / 3.8× 0.7× / 0.6×
added_special_sparse 0.06 1.18 4.03 5.15 65.3 63.3 14.3 3.4 16.2× / 12.7× 15.7× / 12.3× 3.5× / 2.8× 0.8× / 0.7×
agentic-traces 0.57 1.17 3.44 4.04 63.2 63.1 15.1 4.7 18.4× / 15.6× 18.4× / 15.6× 4.4× / 3.7× 1.4× / 1.2×
agentic_swe 0.53 1.17 2.38 3.02 63.9 69.5 14.6 3.5 26.9× / 21.1× 29.2× / 23.0× 6.2× / 4.8× 1.5× / 1.1×
code_mixed 0.09 1.15 2.86 3.92 62.4 68.1 15.0 4.0 21.8× / 15.9× 23.8× / 17.4× 5.2× / 3.8× 1.4× / 1.0×
math_latex 0.56 1.18 3.21 3.83 55.9 52.5 13.6 4.2 17.4× / 14.6× 16.4× / 13.7× 4.2× / 3.5× 1.3× / 1.1×
gpt-oss — o200k-regex byte-level BPE (gpt-oss) · ×7.50 vs v0.23.1 · ×1.55 vs base · decode pending gpt-oss speedup gpt-oss stage decomposition gpt-oss thread scaling gpt-oss decode speedup gpt-oss decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 241+0 (peak 315) · Pipeline 234+0 (peak 316)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 4.0 41.1 ×10.34 ×1.73 3% (0.6) 0% (0.0) 22% (4.8) 75% (16.6) 0% (0.1) match
arb_Arab lang 4.6 31.3 ×6.73 ×1.78 2% (0.6) 0% (0.0) 11% (3.3) 88% (26.1) 0% (0.0) match
ben_Beng lang 6.8 30.2 ×4.47 ×1.73 2% (0.6) 0% (0.0) 12% (3.7) 88% (27.3) 0% (0.0) match
cmn_Hani lang 4.7 22.6 ×4.82 ×1.95 2% (0.6) 0% (0.0) 9% (3.3) 93% (35.5) 0% (0.0) match
ell_Grek lang 5.1 29.9 ×5.82 ×1.87 2% (0.6) 0% (0.0) 10% (3.3) 86% (27.0) 2% (0.6) match
eng_Latn lang 4.0 50.0 ×12.41 ×1.26 11% (2.0) 0% (0.0) 27% (4.7) 62% (10.6) 0% (0.0) match
heb_Hebr lang 4.7 27.8 ×5.94 ×1.64 2% (0.6) 0% (0.0) 10% (3.5) 91% (30.6) 0% (0.0) match
hin_Deva lang 7.0 43.0 ×6.14 ×1.63 3% (0.6) 0% (0.0) 18% (3.8) 78% (16.3) 1% (0.3) match
jpn_Jpan lang 5.4 28.9 ×5.34 ×2.31 2% (0.6) 0% (0.0) 9% (3.1) 88% (28.7) 1% (0.4) match
kat_Geor lang 6.7 24.7 ×3.68 ×1.75 2% (0.6) 0% (0.0) 7% (2.9) 94% (36.7) 0% (0.0) match
kor_Hang lang 4.1 24.9 ×6.06 ×1.71 2% (0.6) 0% (0.0) 10% (3.7) 89% (33.8) 0% (0.0) match
rus_Cyrl lang 5.2 24.5 ×4.69 ×1.60 2% (0.6) 0% (0.0) 8% (3.1) 89% (35.0) 2% (0.7) match
tam_Taml lang 6.9 22.0 ×3.20 ×1.66 1% (0.6) 0% (0.0) 7% (3.2) 93% (40.6) 0% (0.0) match
tha_Thai lang 7.8 18.5 ×2.36 ×1.66 1% (0.6) 0% (0.0) 6% (3.2) 92% (48.5) 1% (0.6) match
added_normalized_dense modalities 5.5 52.8 ×9.57 ×2.11 4% (0.7) 0% (0.0) 12% (2.2) 83% (14.8) 0% (0.1) match
added_normalized_sparse modalities 3.7 45.0 ×12.10 ×1.09 9% (1.3) 0% (0.0) 24% (3.3) 67% (9.0) 0% (0.0) match
added_special_dense modalities 4.4 75.7 ×17.09 ×1.04 40% (5.0) 3% (0.3) 39% (5.0) 15% (1.9) 3% (0.4) match
added_special_sparse modalities 4.5 76.0 ×16.81 ×1.02 27% (3.3) 1% (0.1) 50% (6.0) 20% (2.4) 3% (0.3) match
agentic-traces modalities 3.6 46.6 ×12.86 ×1.27 9% (1.7) 0% (0.0) 26% (5.1) 64% (12.2) 1% (0.2) match
agentic_swe modalities 3.7 44.9 ×12.10 ×1.68 6% (1.3) 0% (0.0) 19% (3.8) 76% (15.2) 0% (0.0) match
code_mixed modalities 3.8 58.5 ×15.32 ×1.19 10% (1.5) 0% (0.0) 29% (4.4) 63% (9.7) 0% (0.0) match
math_latex modalities 3.4 45.9 ×13.65 ×1.24 10% (1.9) 0% (0.0) 27% (5.0) 65% (12.0) 0% (0.0) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.67 3.09 4.80 5.21 29.4 14.9 6.9 4.8 6.1× / 5.6× 3.1× / 2.8× 1.4× / 1.3× 1.0× / 0.9×
arb_Arab 1.01 2.78 3.30 5.07 33.9 16.0 7.5 5.2 10.3× / 6.7× 4.9× / 3.2× 2.3× / 1.5× 1.6× / 1.0×
ben_Beng 1.46 2.63 3.68 4.85 23.7 11.0 5.4 2.8 6.4× / 4.9× 3.0× / 2.3× 1.5× / 1.1× 0.8× / 0.6×
cmn_Hani 1.12 2.01 3.33 4.21 21.3 10.8 5.4 2.5 6.4× / 5.1× 3.2× / 2.6× 1.6× / 1.3× 0.7× / 0.6×
ell_Grek 0.58 2.81 3.26 5.48 31.0 15.8 6.9 5.1 9.5× / 5.7× 4.9× / 2.9× 2.1× / 1.3× 1.6× / 0.9×
eng_Latn 0.09 1.17 4.67 5.75 43.6 29.6 13.6 4.1 9.3× / 7.6× 6.3× / 5.1× 2.9× / 2.4× 0.9× / 0.7×
heb_Hebr 1.00 2.85 3.51 5.37 33.3 17.4 8.0 2.8 9.5× / 6.2× 4.9× / 3.2× 2.3× / 1.5× 0.8× / 0.5×
hin_Deva 1.36 2.78 3.80 5.21 26.4 12.8 6.3 3.2 6.9× / 5.1× 3.4× / 2.5× 1.7× / 1.2× 0.9× / 0.6×
jpn_Jpan 1.56 3.11 3.07 4.62 20.0 9.3 4.7 3.8 6.5× / 4.3× 3.0× / 2.0× 1.5× / 1.0× 1.2× / 0.8×
kat_Geor 1.39 2.17 2.91 3.69 18.5 10.2 4.5 2.1 6.4× / 5.0× 3.5× / 2.8× 1.6× / 1.2× 0.7× / 0.6×
kor_Hang 1.07 2.48 3.73 5.14 32.6 18.9 8.7 3.6 8.8× / 6.4× 5.1× / 3.7× 2.3× / 1.7× 1.0× / 0.7×
rus_Cyrl 1.02 2.75 3.15 4.89 29.0 15.1 6.6 4.8 9.2× / 5.9× 4.8× / 3.1× 2.1× / 1.4× 1.5× / 1.0×
tam_Taml 0.92 2.62 3.21 4.91 18.8 9.0 4.2 2.9 5.9× / 3.8× 2.8× / 1.8× 1.3× / 0.9× 0.9× / 0.6×
tha_Thai 1.36 2.27 3.21 4.11 13.1 5.7 2.7 2.3 4.1× / 3.2× 1.8× / 1.4× 0.8× / 0.7× 0.7× / 0.6×
added_normalized_dense 0.06 1.18 2.21 3.33 33.7 17.7 11.2 2.0 15.2× / 10.1× 8.0× / 5.3× 5.1× / 3.4× 0.9× / 0.6×
added_normalized_sparse 0.06 1.18 3.27 4.39 35.7 21.1 11.5 2.8 10.9× / 8.1× 6.5× / 4.8× 3.5× / 2.6× 0.9× / 0.6×
added_special_dense 0.06 1.18 4.97 6.09 85.8 68.0 23.6 3.3 17.3× / 14.1× 13.7× / 11.2× 4.8× / 3.9× 0.7× / 0.5×
added_special_sparse 0.06 1.18 6.04 7.16 56.7 41.5 16.6 3.8 9.4× / 7.9× 6.9× / 5.8× 2.8× / 2.3× 0.6× / 0.5×
agentic-traces 0.59 1.18 5.06 5.65 52.8 42.6 17.0 4.9 10.4× / 9.3× 8.4× / 7.5× 3.4× / 3.0× 1.0× / 0.9×
agentic_swe 0.51 1.15 3.75 4.39 54.1 49.6 17.0 3.6 14.4× / 12.3× 13.2× / 11.3× 4.5× / 3.9× 1.0× / 0.8×
code_mixed 0.07 1.15 4.41 5.49 53.7 47.4 17.0 4.2 12.2× / 9.8× 10.8× / 8.6× 3.9× / 3.1× 1.0× / 0.8×
math_latex 0.56 1.18 4.95 5.58 50.2 36.2 15.8 4.5 10.1× / 9.0× 7.3× / 6.5× 3.2× / 2.8× 0.9× / 0.8×
glm-5.2 — cl100k-variant regex byte-level BPE (glm-5.2) · ×9.00 vs v0.23.1 · ×1.46 vs base · decode pending glm-5.2 speedup glm-5.2 stage decomposition glm-5.2 thread scaling glm-5.2 decode speedup glm-5.2 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 169+0 (peak 230) · Pipeline 170+0 (peak 231)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 4.1 56.0 ×13.58 ×1.22 8% (1.2) 0% (0.0) 25% (3.7) 67% (9.9) 0% (0.0) match
arb_Arab lang 4.7 28.6 ×6.04 ×1.65 4% (1.2) 0% (0.0) 7% (2.3) 89% (27.8) 0% (0.0) match
ben_Beng lang 4.2 40.4 ×9.55 ×1.49 5% (1.2) 0% (0.0) 14% (3.1) 82% (18.9) 0% (0.0) match
cmn_Hani lang 5.2 21.6 ×4.19 ×1.56 3% (1.2) 0% (0.0) 6% (2.4) 92% (36.5) 0% (0.0) match
ell_Grek lang 5.2 27.2 ×5.19 ×1.39 3% (1.2) 0% (0.0) 7% (2.2) 89% (30.1) 1% (0.4) match
eng_Latn lang 4.0 53.5 ×13.41 ×1.27 17% (2.5) 0% (0.0) 20% (3.0) 63% (9.4) 0% (0.0) match
heb_Hebr lang 4.4 36.2 ×8.28 ×1.44 5% (1.2) 0% (0.0) 9% (2.3) 86% (21.3) 0% (0.0) match
hin_Deva lang 4.0 43.0 ×10.69 ×1.41 5% (1.2) 0% (0.0) 15% (3.3) 81% (17.6) 0% (0.0) match
jpn_Jpan lang 6.0 24.5 ×4.09 ×1.59 3% (1.2) 0% (0.0) 6% (2.2) 91% (31.9) 0% (0.0) match
kat_Geor lang 6.6 37.1 ×5.61 ×1.63 5% (1.2) 0% (0.0) 8% (2.1) 87% (21.5) 0% (0.0) match
kor_Hang lang 4.1 24.4 ×6.02 ×1.35 3% (1.2) 0% (0.0) 7% (2.5) 90% (31.6) 0% (0.0) match
rus_Cyrl lang 5.3 25.0 ×4.68 ×1.38 3% (1.2) 0% (0.0) 6% (2.2) 91% (32.6) 0% (0.0) match
tam_Taml lang 3.9 44.7 ×11.51 ×1.26 5% (1.2) 0% (0.0) 13% (2.8) 81% (17.5) 0% (0.1) match
tha_Thai lang 4.8 59.1 ×12.38 ×2.83 8% (1.2) 0% (0.0) 18% (2.6) 73% (10.4) 0% (0.0) match
added_normalized_dense modalities 6.1 55.5 ×9.09 ×2.08 8% (1.3) 0% (0.0) 6% (1.1) 85% (14.6) 1% (0.2) match
added_normalized_sparse modalities 5.4 72.7 ×13.48 ×1.72 14% (1.9) 0% (0.0) 15% (1.9) 71% (9.2) 1% (0.1) match
added_special_dense modalities 4.2 49.7 ×11.93 ×1.06 60% (11.8) 2% (0.3) 25% (5.0) 11% (2.2) 1% (0.3) match
added_special_sparse modalities 4.4 62.3 ×14.28 ×1.11 42% (6.4) 0% (0.1) 34% (5.2) 22% (3.4) 1% (0.1) match
agentic-traces modalities 3.6 45.1 ×12.58 ×1.28 13% (2.4) 0% (0.0) 20% (3.8) 67% (13.0) 0% (0.1) match
agentic_swe modalities 3.9 45.2 ×11.58 ×1.66 10% (1.9) 0% (0.0) 15% (2.9) 76% (14.9) 0% (0.0) match
code_mixed modalities 4.0 54.3 ×13.54 ×1.23 14% (2.2) 0% (0.0) 21% (3.3) 65% (10.3) 0% (0.0) match
math_latex modalities 3.8 49.2 ×12.80 ×1.34 14% (2.5) 0% (0.0) 20% (3.5) 64% (11.2) 2% (0.4) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.63 3.10 3.67 4.14 26.3 16.1 5.9 4.8 7.2× / 6.4× 4.4× / 3.9× 1.6× / 1.4× 1.3× / 1.2×
arb_Arab 1.00 2.87 2.32 4.18 30.3 19.3 6.8 5.1 13.1× / 7.2× 8.3× / 4.6× 2.9× / 1.6× 2.2× / 1.2×
ben_Beng 1.45 2.61 3.12 4.27 43.8 27.8 10.1 3.7 14.0× / 10.2× 8.9× / 6.5× 3.2× / 2.4× 1.2× / 0.9×
cmn_Hani 1.12 2.01 2.40 3.29 19.1 11.7 4.7 2.4 8.0× / 5.8× 4.9× / 3.6× 1.9× / 1.4× 1.0× / 0.7×
ell_Grek 0.58 2.84 2.22 4.48 27.7 17.1 6.1 4.7 12.5× / 6.2× 7.7× / 3.8× 2.8× / 1.4× 2.1× / 1.0×
eng_Latn 0.11 1.18 3.02 4.09 42.5 33.2 12.3 3.8 14.1× / 10.4× 11.0× / 8.1× 4.1× / 3.0× 1.3× / 0.9×
heb_Hebr 1.00 2.88 2.33 4.22 30.2 19.8 6.9 3.0 12.9× / 7.2× 8.5× / 4.7× 2.9× / 1.6× 1.3× / 0.7×
hin_Deva 1.36 2.80 3.26 4.70 46.1 30.6 10.9 4.1 14.1× / 9.8× 9.4× / 6.5× 3.3× / 2.3× 1.2× / 0.9×
jpn_Jpan 1.56 3.13 2.19 3.75 17.8 10.0 4.1 3.8 8.1× / 4.7× 4.6× / 2.7× 1.9× / 1.1× 1.8× / 1.0×
kat_Geor 1.39 2.32 2.09 3.02 16.6 11.2 4.2 2.0 7.9× / 5.5× 5.4× / 3.7× 2.0× / 1.4× 1.0× / 0.7×
kor_Hang 1.07 2.48 2.51 3.92 30.1 21.5 7.4 3.7 12.0× / 7.7× 8.6× / 5.5× 2.9× / 1.9× 1.5× / 0.9×
rus_Cyrl 1.02 2.69 2.16 3.84 26.2 17.0 5.9 2.4 12.1× / 6.8× 7.9× / 4.4× 2.7× / 1.5× 1.1× / 0.6×
tam_Taml 0.93 2.62 2.75 4.45 42.9 26.6 9.7 3.4 15.6× / 9.6× 9.7× / 6.0× 3.5× / 2.2× 1.2× / 0.8×
tha_Thai 1.36 2.28 2.59 3.51 27.4 16.2 6.7 3.0 10.6× / 7.8× 6.2× / 4.6× 2.6× / 1.9× 1.2× / 0.9×
added_normalized_dense 0.06 1.18 1.06 2.18 23.3 17.0 6.4 2.0 21.9× / 10.7× 16.0× / 7.8× 6.1× / 3.0× 1.9× / 0.9×
added_normalized_sparse 0.06 1.18 1.89 3.01 30.5 22.8 8.8 2.7 16.1× / 10.1× 12.0× / 7.6× 4.6× / 2.9× 1.4× / 0.9×
added_special_dense 0.06 1.18 4.97 6.09 92.3 75.8 21.3 3.3 18.6× / 15.2× 15.2× / 12.4× 4.3× / 3.5× 0.7× / 0.5×
added_special_sparse 0.07 1.18 5.24 6.34 59.1 47.3 15.2 3.5 11.3× / 9.3× 9.0× / 7.5× 2.9× / 2.4× 0.7× / 0.6×
agentic-traces 0.57 1.18 3.76 4.36 51.1 45.0 14.7 4.7 13.6× / 11.7× 12.0× / 10.3× 3.9× / 3.4× 1.2× / 1.1×
agentic_swe 0.51 1.16 2.88 3.53 53.7 53.8 15.6 3.5 18.6× / 15.2× 18.6× / 15.2× 5.4× / 4.4× 1.2× / 1.0×
code_mixed 0.08 1.15 3.29 4.35 51.4 51.6 15.0 4.1 15.6× / 11.8× 15.7× / 11.8× 4.5× / 3.4× 1.2× / 0.9×
math_latex 0.56 1.18 3.45 4.07 49.2 39.1 13.9 4.2 14.2× / 12.1× 11.3× / 9.6× 4.0× / 3.4× 1.2× / 1.0×
llama-2 — model-bounded BPE, no pre-tokenizer · ×5.88 vs v0.23.1 · ×1.62 vs base · decode pending llama-2 speedup llama-2 stage decomposition llama-2 thread scaling llama-2 decode speedup llama-2 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 19+0 (peak 23) · Pipeline 29+0 (peak 29)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 4.8 73.6 ×15.47 ×1.71 0% (0.1) 16% (1.9) 0% (0.0) 84% (10.2) 0% (0.0) match
arb_Arab lang 10.2 74.6 ×7.28 ×1.51 0% (0.0) 18% (2.2) 0% (0.0) 82% (10.1) 0% (0.0) match
ben_Beng lang 11.2 119.6 ×10.70 ×1.42 1% (0.0) 20% (1.5) 0% (0.0) 79% (6.0) 0% (0.0) match
cmn_Hani lang 9.5 97.5 ×10.32 ×1.57 1% (0.1) 4% (0.4) 0% (0.0) 95% (8.2) 0% (0.0) match
ell_Grek lang 10.5 86.3 ×8.19 ×1.48 0% (0.0) 21% (2.2) 0% (0.0) 79% (8.5) 0% (0.0) match
eng_Latn lang 4.4 11.4 ×2.60 ×1.82 0% (0.0) 6% (5.2) 0% (0.0) 95% (85.3) 0% (0.0) match
heb_Hebr lang 10.3 90.3 ×8.78 ×1.48 0% (0.0) 23% (2.3) 0% (0.0) 79% (8.1) 0% (0.0) match
hin_Deva lang 12.2 113.8 ×9.29 ×1.38 0% (0.0) 25% (2.0) 0% (0.0) 74% (5.9) 0% (0.0) match
jpn_Jpan lang 13.2 121.4 ×9.23 ×1.51 1% (0.0) 5% (0.3) 0% (0.0) 94% (6.5) 0% (0.0) match
kat_Geor lang 14.3 128.6 ×8.98 ×1.46 1% (0.0) 20% (1.4) 0% (0.0) 79% (5.4) 0% (0.0) match
kor_Hang lang 7.5 77.1 ×10.32 ×1.47 0% (0.1) 20% (2.3) 0% (0.0) 80% (9.2) 0% (0.0) match
rus_Cyrl lang 8.2 28.2 ×3.42 ×1.74 0% (0.0) 6% (2.0) 0% (0.0) 94% (31.8) 0% (0.0) match
tam_Taml lang 12.9 130.7 ×10.13 ×1.43 0% (0.0) 19% (1.3) 0% (0.0) 81% (5.6) 0% (0.0) match
tha_Thai lang 15.9 125.2 ×7.87 ×1.47 0% (0.0) 11% (0.8) 0% (0.0) 88% (6.2) 0% (0.0) match
added_normalized_dense modalities 5.7 23.4 ×4.13 ×2.69 0% (0.1) 7% (2.7) 0% (0.0) 93% (37.5) 0% (0.0) match
added_normalized_sparse modalities 5.0 15.6 ×3.11 ×2.17 0% (0.0) 7% (4.6) 0% (0.0) 92% (57.7) 0% (0.2) match
added_special_dense modalities 4.1 28.4 ×6.94 ×1.15 15% (5.0) 44% (14.8) 3% (1.1) 39% (13.1) 0% (0.0) match
added_special_sparse modalities 5.7 15.8 ×2.76 ×1.43 3% (2.1) 20% (12.5) 0% (0.3) 76% (46.9) 0% (0.0) match
agentic-traces modalities 4.7 12.9 ×2.76 ×1.85 0% (0.1) 6% (4.5) 0% (0.0) 94% (72.3) 0% (0.0) match
agentic_swe modalities 4.1 12.6 ×3.09 ×1.82 0% (0.0) 8% (6.4) 0% (0.0) 92% (74.5) 0% (0.4) match
code_mixed modalities 4.3 12.8 ×2.98 ×1.84 0% (0.0) 7% (5.4) 0% (0.0) 92% (71.6) 1% (0.4) match
math_latex modalities 4.6 12.1 ×2.66 ×1.84 0% (0.1) 6% (4.8) 0% (0.0) 94% (77.9) 0% (0.3) match
llama-3 — cl100k-regex byte-level BPE (llama-3), single regex · ×9.70 vs v0.23.1 · ×1.49 vs base · decode pending llama-3 speedup llama-3 stage decomposition llama-3 thread scaling llama-3 decode speedup llama-3 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 73+0 (peak 95) · Pipeline 108+0 (peak 108)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 4.4 58.4 ×13.16 ×1.28 5% (0.6) 0% (0.0) 26% (3.7) 71% (10.0) 0% (0.0) match
arb_Arab lang 4.9 29.7 ×6.05 ×1.82 2% (0.6) 0% (0.0) 8% (2.3) 91% (27.2) 0% (0.0) match
ben_Beng lang 4.1 45.1 ×10.89 ×1.43 3% (0.6) 0% (0.0) 15% (3.1) 84% (17.9) 0% (0.0) match
cmn_Hani lang 5.3 25.0 ×4.75 ×1.64 2% (0.6) 0% (0.0) 7% (2.4) 95% (32.2) 0% (0.0) match
ell_Grek lang 5.4 26.7 ×4.93 ×1.43 2% (0.6) 0% (0.0) 6% (2.2) 92% (31.4) 0% (0.0) match
eng_Latn lang 4.3 56.7 ×13.29 ×1.48 14% (2.0) 0% (0.0) 21% (3.0) 66% (9.3) 0% (0.0) match
heb_Hebr lang 4.4 37.2 ×8.46 ×1.51 2% (0.6) 0% (0.0) 10% (2.3) 88% (21.2) 0% (0.0) match
hin_Deva lang 4.5 88.5 ×19.84 ×1.21 6% (0.6) 0% (0.0) 33% (3.2) 61% (5.9) 0% (0.0) match
jpn_Jpan lang 5.9 25.8 ×4.33 ×1.68 2% (0.6) 0% (0.0) 6% (2.2) 92% (31.0) 0% (0.0) match
kat_Geor lang 5.8 58.1 ×10.02 ×1.61 4% (0.6) 0% (0.0) 14% (2.1) 82% (12.6) 0% (0.1) match
kor_Hang lang 4.2 25.3 ×6.05 ×1.47 2% (0.6) 0% (0.0) 7% (2.5) 91% (30.9) 0% (0.0) match
rus_Cyrl lang 5.0 22.3 ×4.46 ×1.45 1% (0.6) 0% (0.0) 5% (2.2) 92% (37.1) 1% (0.4) match
tam_Taml lang 4.2 45.4 ×10.92 ×1.28 3% (0.6) 0% (0.0) 13% (2.7) 84% (17.7) 0% (0.0) match
tha_Thai lang 5.4 44.9 ×8.32 ×2.32 3% (0.6) 0% (0.0) 14% (2.6) 84% (15.6) 0% (0.0) match
added_normalized_dense modalities 6.2 57.2 ×9.23 ×2.13 4% (0.7) 0% (0.0) 6% (1.1) 90% (15.0) 0% (0.0) match
added_normalized_sparse modalities 5.5 74.9 ×13.65 ×1.77 10% (1.3) 0% (0.0) 16% (2.0) 74% (9.3) 0% (0.0) match
added_special_dense modalities 4.2 75.4 ×17.82 ×1.06 39% (5.2) 2% (0.3) 36% (4.7) 20% (2.7) 3% (0.4) match
added_special_sparse modalities 4.4 78.3 ×17.67 ×1.11 27% (3.3) 1% (0.2) 40% (4.8) 31% (3.8) 1% (0.1) match
agentic-traces modalities 3.6 46.5 ×13.07 ×1.34 10% (1.8) 0% (0.0) 20% (3.7) 70% (12.8) 0% (0.0) match
agentic_swe modalities 4.1 47.4 ×11.59 ×1.75 7% (1.3) 0% (0.0) 15% (2.9) 78% (14.6) 0% (0.0) match
code_mixed modalities 4.2 57.1 ×13.49 ×1.29 10% (1.5) 0% (0.0) 22% (3.3) 70% (10.5) 0% (0.0) match
math_latex modalities 4.0 51.6 ×13.01 ×1.40 12% (1.9) 0% (0.0) 21% (3.4) 67% (10.9) 0% (0.0) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.63 3.10 3.66 4.14 27.5 16.2 6.0 4.8 7.5× / 6.6× 4.4× / 3.9× 1.6× / 1.4× 1.3× / 1.2×
arb_Arab 1.00 2.82 2.30 4.12 31.4 19.3 6.8 5.1 13.7× / 7.6× 8.4× / 4.7× 3.0× / 1.7× 2.2× / 1.2×
ben_Beng 1.46 2.63 3.11 4.28 45.5 27.6 10.2 3.7 14.6× / 10.6× 8.9× / 6.4× 3.3× / 2.4× 1.2× / 0.9×
cmn_Hani 1.13 2.01 2.39 3.27 19.7 11.9 4.7 2.5 8.3× / 6.0× 5.0× / 3.6× 2.0× / 1.4× 1.0× / 0.8×
ell_Grek 0.58 2.82 2.20 4.44 28.6 17.2 6.1 4.7 13.0× / 6.4× 7.8× / 3.9× 2.8× / 1.4× 2.2× / 1.1×
eng_Latn 0.10 1.18 2.99 4.08 44.4 32.8 12.6 3.8 14.8× / 10.9× 10.9× / 8.0× 4.2× / 3.1× 1.3× / 0.9×
heb_Hebr 1.00 2.95 2.31 4.26 31.3 19.8 6.9 3.1 13.6× / 7.4× 8.6× / 4.7× 3.0× / 1.6× 1.3× / 0.7×
hin_Deva 1.36 2.79 3.25 4.67 48.2 30.6 11.1 4.1 14.9× / 10.3× 9.4× / 6.6× 3.4× / 2.4× 1.3× / 0.9×
jpn_Jpan 1.56 3.13 2.19 3.76 18.4 10.0 4.1 3.8 8.4× / 4.9× 4.6× / 2.7× 1.9× / 1.1× 1.8× / 1.0×
kat_Geor 1.39 2.19 2.10 2.89 17.1 11.2 4.2 2.0 8.2× / 5.9× 5.3× / 3.9× 2.0× / 1.5× 0.9× / 0.7×
kor_Hang 1.08 2.48 2.51 3.92 31.3 21.5 7.5 3.7 12.5× / 8.0× 8.6× / 5.5× 3.0× / 1.9× 1.5× / 0.9×
rus_Cyrl 1.03 2.77 2.16 3.90 27.3 16.9 6.0 2.6 12.6× / 7.0× 7.8× / 4.3× 2.8× / 1.5× 1.2× / 0.7×
tam_Taml 0.93 2.63 2.73 4.43 44.7 26.6 9.7 3.4 16.4× / 10.1× 9.7× / 6.0× 3.6× / 2.2× 1.3× / 0.8×
tha_Thai 1.36 2.21 2.60 3.45 28.4 16.4 6.8 3.0 10.9× / 8.2× 6.3× / 4.8× 2.6× / 2.0× 1.2× / 0.9×
added_normalized_dense 0.06 1.18 1.07 2.18 24.1 16.8 6.7 2.0 22.6× / 11.0× 15.8× / 7.7× 6.3× / 3.1× 1.9× / 0.9×
added_normalized_sparse 0.06 1.18 1.97 3.09 31.7 22.9 9.2 2.7 16.1× / 10.3× 11.6× / 7.4× 4.6× / 3.0× 1.4× / 0.9×
added_special_dense 0.06 1.18 4.72 5.84 96.8 73.8 21.8 3.3 20.5× / 16.6× 15.6× / 12.6× 4.6× / 3.7× 0.7× / 0.6×
added_special_sparse 0.06 1.18 4.85 5.97 62.4 45.9 15.7 3.5 12.9× / 10.5× 9.5× / 7.7× 3.2× / 2.6× 0.7× / 0.6×
agentic-traces 0.59 1.18 3.71 4.30 53.4 43.8 15.4 4.7 14.4× / 12.4× 11.8× / 10.2× 4.1× / 3.6× 1.3× / 1.1×
agentic_swe 0.51 1.15 2.87 3.52 55.9 52.0 15.8 3.4 19.5× / 15.9× 18.1× / 14.8× 5.5× / 4.5× 1.2× / 1.0×
code_mixed 0.07 1.16 3.28 4.37 53.4 49.6 15.8 4.1 16.3× / 12.2× 15.1× / 11.4× 4.8× / 3.6× 1.2× / 0.9×
math_latex 0.56 1.20 3.45 4.09 51.4 39.6 14.5 4.2 14.9× / 12.6× 11.5× / 9.7× 4.2× / 3.5× 1.2× / 1.0×
mistral-small-4 — tekken byte-level BPE, 1k added specials (mistral-small-4) · ×6.92 vs v0.23.1 · ×1.34 vs base · decode pending mistral-small-4 speedup mistral-small-4 stage decomposition mistral-small-4 thread scaling mistral-small-4 decode speedup mistral-small-4 decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 152+0 (peak 194) · Pipeline 145+0 (peak 194)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 3.8 44.0 ×11.61 ×1.10 6% (1.2) 0% (0.0) 25% (5.0) 66% (13.2) 2% (0.5) match
arb_Arab lang 4.7 28.6 ×6.11 ×1.38 4% (1.2) 0% (0.0) 12% (3.7) 85% (26.3) 0% (0.0) match
ben_Beng lang 6.7 26.2 ×3.90 ×1.40 3% (1.2) 0% (0.0) 11% (4.0) 85% (31.1) 1% (0.4) match
cmn_Hani lang 4.9 28.4 ×5.73 ×1.66 4% (1.2) 0% (0.0) 11% (3.3) 84% (25.6) 1% (0.3) match
ell_Grek lang 5.2 25.0 ×4.80 ×1.36 3% (1.2) 0% (0.0) 9% (3.3) 89% (33.5) 0% (0.0) match
eng_Latn lang 3.9 42.8 ×11.13 ×1.18 13% (2.5) 0% (0.0) 24% (4.7) 63% (12.6) 0% (0.1) match
heb_Hebr lang 4.6 22.7 ×4.91 ×1.47 3% (1.2) 0% (0.0) 9% (3.7) 88% (36.8) 0% (0.2) match
hin_Deva lang 6.7 34.7 ×5.19 ×1.36 4% (1.2) 0% (0.0) 15% (4.1) 80% (21.6) 0% (0.1) match
jpn_Jpan lang 5.0 27.9 ×5.57 ×1.73 4% (1.2) 0% (0.0) 12% (3.1) 89% (23.8) 0% (0.0) match
kat_Geor lang 6.7 23.2 ×3.43 ×1.54 3% (1.2) 0% (0.0) 7% (2.9) 90% (37.8) 0% (0.0) match
kor_Hang lang 4.2 23.6 ×5.63 ×1.26 3% (1.2) 0% (0.0) 10% (3.9) 90% (34.6) 0% (0.0) match
rus_Cyrl lang 5.0 21.5 ×4.30 ×1.31 3% (1.2) 0% (0.0) 7% (3.2) 91% (39.1) 0% (0.0) match
tam_Taml lang 7.0 22.2 ×3.18 ×1.48 3% (1.2) 0% (0.0) 8% (3.5) 90% (38.6) 0% (0.0) match
tha_Thai lang 8.2 20.5 ×2.51 ×1.40 2% (1.2) 0% (0.0) 7% (3.5) 89% (41.9) 1% (0.4) match
added_normalized_dense modalities 5.7 47.4 ×8.26 ×1.64 6% (1.3) 0% (0.0) 11% (2.3) 82% (16.6) 0% (0.0) match
added_normalized_sparse modalities 5.4 61.8 ×11.42 ×1.48 12% (1.9) 0% (0.0) 21% (3.2) 68% (10.5) 0% (0.0) match
added_special_dense modalities 4.3 74.2 ×17.15 ×1.06 39% (5.1) 2% (0.3) 40% (5.2) 17% (2.2) 2% (0.3) match
added_special_sparse modalities 4.5 69.7 ×15.32 ×1.09 26% (3.6) 2% (0.2) 42% (5.7) 30% (4.1) 1% (0.1) match
agentic-traces modalities 3.5 37.7 ×10.87 ×1.14 9% (2.4) 0% (0.0) 20% (5.1) 69% (17.1) 2% (0.4) match
agentic_swe modalities 3.5 34.4 ×9.69 ×1.42 7% (1.9) 0% (0.0) 14% (3.8) 80% (22.2) 0% (0.0) match
code_mixed modalities 3.7 44.9 ×11.98 ×1.07 10% (2.1) 0% (0.0) 21% (4.4) 68% (14.1) 0% (0.0) match
math_latex modalities 3.6 43.9 ×12.08 ×1.17 12% (2.5) 0% (0.0) 25% (4.9) 63% (12.5) 0% (0.0) match

Pre-tokenize: classify + fsm vs regex engines — ns/byte, lower better. The fsm is the scalar jump-table in both pipe columns; SIMD / scalar is the classify pass (regex pre-tokenizers have no SIMD fsm). ×vs = engine ÷ our pipeline (SIMD / scalar classify); onig & pcre2 (JIT) are C, fancy is pure-Rust fancy-regex, logos is a compile-time DFA lexer (approximate grammar; n/a for deepseek).

Fixture classify SIMD classify scalar pipe (SIMD cls + fsm) pipe (scalar cls + fsm) onig fancy pcre2 logos ×vs onig ×vs fancy ×vs pcre2 ×vs logos
amh_Ethi 2.96 3.12 4.99 5.15 29.0 14.5 6.7 5.8× / 5.6× 2.9× / 2.8× 1.3× / 1.3×
arb_Arab 1.00 2.81 3.69 5.49 34.3 16.4 7.3 9.3× / 6.2× 4.4× / 3.0× 2.0× / 1.3×
ben_Beng 1.46 2.61 3.97 5.13 23.5 11.3 5.3 5.9× / 4.6× 2.8× / 2.2× 1.3× / 1.0×
cmn_Hani 1.12 2.03 3.35 4.26 22.1 11.6 5.5 6.6× / 5.2× 3.5× / 2.7× 1.6× / 1.3×
ell_Grek 0.58 2.83 3.29 5.53 29.7 15.4 6.6 9.0× / 5.4× 4.7× / 2.8× 2.0× / 1.2×
eng_Latn 0.10 1.16 4.69 5.75 44.3 30.8 13.1 9.5× / 7.7× 6.6× / 5.3× 2.8× / 2.3×
heb_Hebr 1.00 2.85 3.75 5.60 32.8 17.9 7.9 8.7× / 5.9× 4.8× / 3.2× 2.1× / 1.4×
hin_Deva 1.36 2.78 4.06 5.48 25.3 13.0 6.2 6.2× / 4.6× 3.2× / 2.4× 1.5× / 1.1×
jpn_Jpan 1.56 3.14 3.13 4.72 20.8 9.7 4.7 6.6× / 4.4× 3.1× / 2.1× 1.5× / 1.0×
kat_Geor 1.38 2.23 2.95 3.80 18.5 10.4 4.5 6.3× / 4.9× 3.5× / 2.7× 1.5× / 1.2×
kor_Hang 1.09 2.48 3.89 5.29 32.9 20.0 8.6 8.4× / 6.2× 5.1× / 3.8× 2.2× / 1.6×
rus_Cyrl 1.02 2.76 3.19 4.93 28.6 15.5 6.4 9.0× / 5.8× 4.9× / 3.2× 2.0× / 1.3×
tam_Taml 0.92 2.61 3.54 5.23 18.8 8.9 4.1 5.3× / 3.6× 2.5× / 1.7× 1.2× / 0.8×
tha_Thai 1.36 2.22 3.49 4.35 13.3 5.8 2.8 3.8× / 3.0× 1.7× / 1.3× 0.8× / 0.6×
added_normalized_dense 0.06 1.18 2.25 3.37 32.8 17.5 11.1 14.6× / 9.7× 7.8× / 5.2× 4.9× / 3.3×
added_normalized_sparse 0.06 1.18 3.18 4.30 35.0 20.7 11.3 11.0× / 8.1× 6.5× / 4.8× 3.6× / 2.6×
added_special_dense 0.06 1.18 5.19 6.31 89.6 68.1 23.3 17.3× / 14.2× 13.1× / 10.8× 4.5× / 3.7×
added_special_sparse 0.06 1.18 5.71 6.83 57.7 41.6 16.2 10.1× / 8.4× 7.3× / 6.1× 2.8× / 2.4×
agentic-traces 0.57 1.20 5.09 5.72 57.2 44.4 17.3 11.2× / 10.0× 8.7× / 7.7× 3.4× / 3.0×
agentic_swe 0.51 1.15 3.80 4.44 61.5 54.9 18.5 16.2× / 13.9× 14.5× / 12.4× 4.9× / 4.2×
code_mixed 0.08 1.17 4.39 5.49 55.7 49.4 17.1 12.7× / 10.2× 11.3× / 9.0× 3.9× / 3.1×
math_latex 0.58 1.19 4.91 5.52 52.3 38.0 15.8 10.7× / 9.5× 7.7× / 6.9× 3.2× / 2.9×
t5-base — Unigram + Metaspace · ×2.58 vs v0.23.1 · ×1.03 vs base · decode pending t5-base speedup t5-base stage decomposition t5-base thread scaling t5-base decode speedup t5-base decode thread scaling

Memory (RSS MB, load+encode): v0.23.1 34+2 (peak 36) · Pipeline 61+1 (peak 66)

Fixture Group v0.23.1 MB/s Pipeline MB/s Speedup Δ base added-token normalize pre-tokenize model post Ids
amh_Ethi lang 5.8 16.3 ×2.83 ×1.06 1% (0.6) 36% (21.5) 3% (1.8) 65% (39.4) 0% (0.0) match
arb_Arab lang 4.5 12.7 ×2.82 ×1.01 1% (0.6) 27% (27.0) 2% (2.1) 71% (70.7) 0% (0.0) match
ben_Beng lang 7.4 20.9 ×2.83 ×1.03 1% (0.6) 32% (24.4) 2% (1.5) 65% (49.5) 1% (0.4) match
cmn_Hani lang 12.8 23.6 ×1.85 ×1.01 1% (0.6) 24% (16.6) 1% (0.5) 74% (50.9) 1% (0.4) match
ell_Grek lang 4.9 13.8 ×2.83 ×1.04 1% (0.6) 28% (27.3) 2% (1.9) 70% (68.0) 0% (0.0) match
eng_Latn lang 2.4 5.9 ×2.43 ×1.05 1% (2.0) 17% (41.3) 1% (3.3) 83% (198.6) 0% (0.0) match
heb_Hebr lang 4.4 13.2 ×3.01 ×1.02 1% (0.6) 25% (23.8) 2% (2.1) 71% (67.0) 1% (1.0) match
hin_Deva lang 6.3 21.1 ×3.36 ×1.03 1% (0.6) 31% (24.6) 2% (1.6) 67% (53.6) 0% (0.0) match
jpn_Jpan lang 13.6 24.3 ×1.78 ×0.99 1% (0.6) 27% (19.9) 1% (0.6) 72% (52.1) 0% (0.0) match
kat_Geor lang 8.2 21.3 ×2.60 ×1.03 1% (0.6) 26% (18.7) 2% (1.2) 69% (49.7) 2% (1.6) match
kor_Hang lang 4.7 12.3 ×2.62 ×1.01 1% (0.6) 26% (24.5) 2% (2.2) 69% (64.0) 2% (1.7) match
rus_Cyrl lang 4.6 8.7 ×1.90 ×1.02 0% (0.6) 18% (26.9) 1% (1.7) 81% (119.9) 0% (0.0) match
tam_Taml lang 9.1 22.8 ×2.50 ×1.04 1% (0.6) 27% (18.8) 2% (1.1) 70% (49.3) 0% (0.2) match
tha_Thai lang 13.0 25.5 ×1.96 ×1.04 1% (0.6) 27% (18.9) 1% (0.7) 73% (51.5) 0% (0.0) match
added_normalized_dense modalities 4.2 12.7 ×3.00 ×1.04 0% (0.7) 19% (37.6) 1% (1.4) 80% (155.8) 0% (0.0) match
added_normalized_sparse modalities 3.9 13.2 ×3.41 ×1.04 1% (1.3) 22% (38.9) 2% (2.9) 76% (135.0) 0% (0.0) match
added_special_dense modalities 6.4 33.8 ×5.32 ×1.00 10% (4.9) 35% (16.8) 6% (3.1) 49% (23.2) 0% (0.0) match
added_special_sparse modalities 4.0 16.1 ×4.02 ×1.02 3% (3.2) 27% (34.5) 7% (9.1) 63% (79.3) 0% (0.0) match
agentic-traces modalities 3.2 6.1 ×1.91 ×1.09 1% (1.8) 17% (40.5) 1% (2.6) 81% (189.5) 0% (0.5) match
agentic_swe modalities 4.7 8.9 ×1.89 ×1.05 1% (1.3) 20% (37.6) 1% (1.7) 79% (147.3) 0% (0.0) match
code_mixed modalities 4.1 8.1 ×1.97 ×1.05 1% (1.5) 20% (39.3) 1% (2.1) 77% (152.8) 1% (1.5) match
math_latex modalities 2.8 6.4 ×2.28 ×1.09 1% (1.9) 18% (41.4) 1% (3.3) 79% (177.7) 0% (1.0) match

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@ArthurZucker
ArthurZucker changed the base branch from main to feat/train_encode_split July 24, 2026 16:25
@ArthurZucker
ArthurZucker changed the base branch from feat/bpe-cache-min to feat/train_encode_split August 3, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants