Skip to content

perf: enforce minimum BPE tokenization job size - #66

Open
jthomson04 wants to merge 1 commit into
crusoecloud:mainfrom
jthomson04:jthomson04/min-bpe-job-size
Open

perf: enforce minimum BPE tokenization job size#66
jthomson04 wants to merge 1 commit into
crusoecloud:mainfrom
jthomson04:jthomson04/min-bpe-job-size

Conversation

@jthomson04

Copy link
Copy Markdown

Summary

  • require at least 64 pre-token splits per parallel BPE job
  • use sequential tokenization when the input cannot fill at least two jobs
  • divide splits evenly across the selected jobs in both tokenization paths

The current implementation can create nearly one Rayon job per split when the BPE pool is large. Under high request concurrency, that nested parallelism spends substantial CPU on scheduling and synchronization for small amounts of BPE work.

The job count is now min(pool_threads, split_count / 64). Token order and the configured BPE thread-pool size are unchanged.

Validation

  • cargo fmt --check
  • cargo clippy -- -D warnings
  • cargo test parallel_jobs_have_minimum_grain

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
@jthomson04
jthomson04 marked this pull request as ready for review September 9, 2026 21:56
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.

1 participant