-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[vllm, rollout, cfg, doc] feat: Accelerate RL rollouts with EAGLE/EAGLE3 speculative decoding #5925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alekseymalakhov11
wants to merge
8
commits into
verl-project:main
Choose a base branch
from
alekseymalakhov11:add-eagle-speculative-decoding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9226279
add eagle speculative decoding for rollouts
alekseymalakhov11 157c8fc
merge origin/master
alekseymalakhov11 743ad8d
fix
alekseymalakhov11 8349c49
fix docs
alekseymalakhov11 81e2338
remove config
alekseymalakhov11 2731f38
fix assert
alekseymalakhov11 4c3396b
fix async requests
alekseymalakhov11 b91f6da
add warning
alekseymalakhov11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |||||||||||||||||||||
| "RolloutConfig", | ||||||||||||||||||||||
| "DiffusionRolloutConfig", | ||||||||||||||||||||||
| "CheckpointEngineConfig", | ||||||||||||||||||||||
| "SpeculativeDecodingConfig", | ||||||||||||||||||||||
| "SkipConfig", | ||||||||||||||||||||||
| ] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -165,6 +166,18 @@ class CheckpointEngineConfig(BaseConfig): | |||||||||||||||||||||
| custom_backend_module: Optional[str] = None | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @dataclass | ||||||||||||||||||||||
| class SpeculativeDecodingConfig(BaseConfig): | ||||||||||||||||||||||
| enable: bool = False | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| method: str = "eagle3" | ||||||||||||||||||||||
| num_steps: int = 3 | ||||||||||||||||||||||
| num_draft_tokens: int = 4 | ||||||||||||||||||||||
| draft_model_path: str | None = None | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| draft_tensor_parallel_size: int = 1 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @dataclass | ||||||||||||||||||||||
| class RolloutConfig(BaseConfig): | ||||||||||||||||||||||
| _mutable_fields = { | ||||||||||||||||||||||
|
|
@@ -285,6 +298,8 @@ class RolloutConfig(BaseConfig): | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| mtp: MtpConfig = field(default_factory=MtpConfig) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| speculative_decoding: SpeculativeDecodingConfig = field(default_factory=SpeculativeDecodingConfig) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| qat: Optional[dict] = None | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def __post_init__(self): | ||||||||||||||||||||||
|
|
@@ -334,6 +349,46 @@ def __post_init__(self): | |||||||||||||||||||||
| f"Current rollout {self.name=} not implemented pipeline_model_parallel_size > 1 yet." | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if self.name != "vllm" and self.speculative_decoding.enable: | ||||||||||||||||||||||
| raise NotImplementedError( | ||||||||||||||||||||||
| f"Rollout {self.name=} does not support speculative decoding " | ||||||||||||||||||||||
| f"{self.speculative_decoding.method=} for rollout acceleration yet" | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if self.name == "vllm" and self.speculative_decoding.enable: | ||||||||||||||||||||||
| if self.speculative_decoding.method.lower() not in {"eagle", "eagle3"}: | ||||||||||||||||||||||
| warnings.warn( | ||||||||||||||||||||||
| "Speculative decoding methods other than 'eagle' and 'eagle3' are untested and may be buggy ", | ||||||||||||||||||||||
| stacklevel=2, | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if not ( | ||||||||||||||||||||||
| self.speculative_decoding.draft_tensor_parallel_size == self.tensor_model_parallel_size | ||||||||||||||||||||||
| or self.speculative_decoding.draft_tensor_parallel_size == 1 | ||||||||||||||||||||||
| ): | ||||||||||||||||||||||
| raise ValueError( | ||||||||||||||||||||||
| f"draft_tensor_parallel_size={self.speculative_decoding.draft_tensor_parallel_size} " | ||||||||||||||||||||||
| "cannot be other value than 1 or target model " | ||||||||||||||||||||||
| "tensor_parallel_size={self.tensor_model_parallel_size} " | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
Comment on lines
+369
to
+373
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The f-string for the
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if self.speculative_decoding.method.lower() in {"eagle", "eagle3"} and ( | ||||||||||||||||||||||
| self.enable_chunked_prefill or self.enable_prefix_caching or not self.enforce_eager | ||||||||||||||||||||||
| ): | ||||||||||||||||||||||
| warnings.warn( | ||||||||||||||||||||||
| "vLLM speculative decoding with EAGLE/EAGLE3 may regress throughput when " | ||||||||||||||||||||||
| "enable_chunked_prefill=True, enable_prefix_caching=True, or enforce_eager=False. " | ||||||||||||||||||||||
| "Overriding to enable_chunked_prefill=False, enable_prefix_caching=False, " | ||||||||||||||||||||||
| "and enforce_eager=True for now.", | ||||||||||||||||||||||
| stacklevel=2, | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| self.enable_chunked_prefill = False | ||||||||||||||||||||||
| self.enable_prefix_caching = False | ||||||||||||||||||||||
| self.enforce_eager = True | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if self.speculative_decoding.enable and self.mtp.enable_rollout: | ||||||||||||||||||||||
| raise ValueError("Use either speculative_decoding or mtp, but not both simultaneously") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| @dataclass | ||||||||||||||||||||||
| class DiffusionRolloutConfig(RolloutConfig): | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation for
acceptance_ratewhenspec_delta["num_draft_tokens"]is 0 results infloat("inf"). This is likely incorrect and can cause issues with metric aggregation (e.g.,np.meanoverinfwill beinf). When no draft tokens are generated, the acceptance rate should be 0.0.