[CB] Better overall script and decode bucketting#45653
Open
Conversation
|
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. |
2a57d88 to
fcabcbc
Compare
ArthurZucker
approved these changes
Apr 29, 2026
Comment on lines
+95
to
+96
| model = AutoModelForCausalLM.from_pretrained(self.model_id, attn_implementation=self.attn_impl) | ||
| model = model.to(device="cuda").eval() # type: ignore |
Collaborator
There was a problem hiding this comment.
why not use device map auto?
| self, | ||
| generation_config: GenerationConfig | None = None, | ||
| continuous_batching_config: ContinuousBatchingConfig | None = None, | ||
| workload_hints: dict[str, int] | None = None, |
Collaborator
There was a problem hiding this comment.
we can use typedDict here explicits which keys are accepted
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.
Summary
This PR updates the
continuous_batching_overallscript to better reflect the way users use continuous batching (ie. using simpler or the default config) on realistic tasks (GSM8K or RL rollouts of various lengths).It also changes the way decode-only batches are bucketed: instead of using linear intervals, these batches are now bucketed using powers of 2. This led to better latencies.
Decode batches are also automatically turned on unless the user explicitly disables them, using workload hints (ie. max sequence length)
Performances
New script, before PR:
New script, after PR:
This is mostly because of the auto-activation of the decode path IMO.
Tests
RUN_SLOW=1 pytest tests/generation/test_continuous_batching.pyRUN_SLOW=1 pytest tests/cli/test_serve.pyRUN_SLOW=1 pytest tests/generation/test_paged_attention.py