Repository navigation
perf: enforce minimum BPE tokenization job size - #66
Merged
AlonKejzman merged 2 commits intoSep 10, 2026
Merged
Conversation
Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
jthomson04
marked this pull request as ready for review
September 9, 2026 21:56
AlonKejzman
reviewed
Sep 10, 2026
AlonKejzman
reviewed
Sep 10, 2026
AlonKejzman
approved these changes
Sep 10, 2026
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.
Small BPE workloads can create too many Rayon jobs when the thread pool is large, adding scheduling and synchronization overhead under concurrent requests.
This change keeps buffers below 64 KiB sequential and otherwise selects
min(pool_threads, split_count, byte_len / (32 * 1024))jobs. Both tokenization paths divide splits evenly across those jobs and fall back to sequential processing when fewer than two jobs are selected. Token order and the configured thread-pool size are unchanged.Validation:
cargo fmt --check: passed.cargo clippy -- -D warnings: passed.cargo test pre_tokenized::tests: all 11 tests passed, including byte-threshold boundaries and split/thread caps.cargo test: 255 passed, 9 ignored, 11 failed. All 11 failures were Hugging Face cache-lock acquisition errors while loading model files; full-suite validation remains incomplete.