Repository navigation
chore: fix benchmark script and bench both implementations - #51
Merged
Merged
Conversation
AmitMY
force-pushed
the
chore/bench-both-impls
branch
2 times, most recently
from
July 23, 2026 07:39
a952f3b to
a2c861e
Compare
benchmarks/bench_tokenizers.py imported complex_tokenization.examples.*, which no longer exists, so it did not run at all. It now benches BPE, BNE n=4, BoundlessBPE, and SuperBPE for both the reference and the fast implementation (when installed) plus HuggingFace, prints a digest of each merge list so output divergence between implementations is visible (see issue #47), and takes --samples/--merges so the same script scales from a smoke run to the full wikitext-2 train split. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tracemalloc only tracks Python allocations, so fast (Rust) rows showed ~0MB. Each case now runs in its own subprocess and reports ru_maxrss, which covers Rust memory too and isolates cases from each other. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rges) Calibrated on wikitext-2: BPE and BNE handle the full split within 10s, Boundless (connected) caps at ~3700 rows, so 3500 keeps a default run's slowest case near 10s while still exercising ~10% of the dataset. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each subprocess was paying seconds to import datasets and stream rows; the parent now writes the corpus to a temp file the children read. Default samples calibrated to 2000 so the whole default run (9 cases, 100 merges) stays around 30 seconds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AmitMY
force-pushed
the
chore/bench-both-impls
branch
from
July 23, 2026 08:22
8515541 to
f67e5da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
benchmarks/bench_tokenizers.pyimportedcomplex_tokenization.examples.*, which no longer exists — the script didn't run at all. Rewritten to:ru_maxrss). tracemalloc only tracks Python allocations — Rust rows showed 0.04 MB — and in a shared process the first case absorbed one-time allocations (BPE looked heavier than BNE). Subprocesses fix both and cover Rust memory for real.datasets+ streaming rows cost seconds per child).--samples/--mergesfor scale. Default calibrated to 2,000 rows / 100 merges → the whole run takes ~30s (measured 26.5s), with the slowest single case (Python Boundless) at ~5s. For reference: Python BPE/BNE handle the full split within 10s; connected mode caps at ~3,700 rows per 10s;--samples 0 --merges 500is the full-scale run (~25 min, Python Boundless dominating).Default run output (2,000 rows ≈ 626k chars, 100 merges, ~30s total)
b4e28c5ada20d930a4356598b73bb39999e699129999e6991205af39227404c28a32d1787721b689787721b689fast digests differ from reference pending #52 (tie-break + n>2 merge fix) — once it lands, matching digests here become the parity check on every run.
Full-scale numbers (--samples 0 --merges 500, ~2M words) from this script's previous run
🤖 Generated with Claude Code