-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Adapting Qwen3-32B to Eagle3 mode to resolve head dimension mismatch issues #23740
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
base: main
Are you sure you want to change the base?
Conversation
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.
Code Review
This pull request introduces changes to handle KV cache configurations for models with variable head dimensions, specifically for Qwen3-32B in Eagle3 mode. It adds a new path for creating KV cache configurations when all layers use FullAttentionSpec
but may have different head_size
values. While the memory allocation logic correctly uses the maximum page size, the logic for creating the KVCacheGroupSpec
is flawed. It uses the spec of the first layer to represent the entire group, which can lead to incorrect concurrency calculations and potential runtime errors if other layers have larger memory requirements. My review includes a high-severity fix for this issue to ensure the group's specification reflects the most demanding layer, preventing potential out-of-memory errors.
layer_specs = [ | ||
kv_cache_spec[layer_name] for layer_name in layer_names_one_group | ||
] | ||
merged_layer_spec = layer_specs[0] |
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.
Using the spec of the first layer (layer_specs[0]
) to represent the entire group can be problematic when layers have different head_size
values, as indicated by the PR's purpose. This leads to an incorrect KVCacheGroupSpec
for the group.
For instance, get_max_concurrency_for_kv_cache_config
uses group.kv_cache_spec.page_size_bytes
for its calculation. If the first layer has a smaller head_size
than other layers in the group, its page_size_bytes
will be smaller than the maximum page size used for allocation in _get_kv_cache_config_allFullAttentionSpec_type
. This will cause max_concurrency
to be overestimated, which could lead to out-of-memory errors at runtime.
To ensure correctness, the merged_layer_spec
should represent the most demanding configuration within the group, which corresponds to the layer with the largest page_size_bytes
.
merged_layer_spec = layer_specs[0] | |
merged_layer_spec = max(layer_specs, key=lambda spec: spec.page_size_bytes) |
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run You ask your reviewers to trigger select CI tests on top of Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
… mismatch issues Signed-off-by: funanyang <[email protected]>
bde497b
to
498becf
Compare
Purpose
The adapted weights from https://www.modelscope.cn/models/AngelSlim/Qwen3-32B_eagle3/ can perform Eagle3 inference, but the head dimension (80) of these weights is inconsistent with that of the target model (128), causing an error; therefore, adaptation is required.
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.