Repository navigation
[Model][Spec Decode] Migrate Medusa to the Flat Model layout - #61357
Closed
AlejandroParedesLT wants to merge 1 commit into
Closed
AlejandroParedesLT wants to merge 1 commit into
AlejandroParedesLT wants to merge 1 commit into
Conversation
Moves vllm/model_executor/models/medusa.py to vllm/models/medusa/common/medusa.py per RFC vllm-project#44219, repointing the MedusaModel registry entry. Medusa is pure torch (nn.Linear/SiLU/LogitsProcessor/ParallelLMHead, no custom kernels) and has no dependency on any base model's architecture code, so it needs only a common/ directory and no nvidia/amd/cpu/xpu split -- the only content change is fixing the now-external import of maybe_prefix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S7agbtPNuVe9pxACkqbitP
6 tasks done
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
Contributor
Author
|
Closing: Medusa support was removed entirely in #61701 (merged 2026-10-15), after this PR was opened. Per that PR's rationale, Medusa isn't supported by Model Runner V2 and EAGLE/MTP/DFlash/DSpark cover its use case, so there's nothing left to migrate to the Flat Model layout here. Picking a different drafter for the next migration slice instead. |
This was referenced Oct 16, 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.
Overview
First slice of #61024's "Migrate speculative model code to Flat Model" bullet (RFC #44219). Moves the Medusa draft-model implementation from the legacy
vllm/model_executor/models/layout into the newvllm/models/<name>/<hw>/layout.Claims
vllm/model_executor/models/medusa.pytovllm/models/medusa/common/medusa.py+ a package__init__.py, and repoints theMedusaModelentry inregistry.pytovllm.models.medusa.from .utils import maybe_prefixto the now-externalfrom vllm.model_executor.models.utils import maybe_prefix(verified by diffing old vs. new file content).common/directory, nonvidia/amd/cpu/xpusplit: it's puretorch.nn(Linear,SiLU,LogitsProcessor,ParallelLMHead), no custom kernels, and has no dependency on any base model's architecture code (unlike e.g.llama_eagle.py, which importsLlamaForCausalLMdirectly and so can't move independently of a Llama migration). That made it the first candidate out of the ~30 remaining legacy drafter files.Validation
Not yet validated:
tests/v1/e2e/spec_decode/acceptance_rates/mtp_other/test_medusa.py(the realvicuna-7b+FasterDecoding/medusa-vicuna-7b-v1.3acceptance-rate test). It fails consistently (~4s, reproduced twice) withRuntimeError: Engine core initialization failed... Failed core proc(s): {}fromwait_for_engine_startup-- before weight download or model loading begins. This looks like an engine-multiprocessing/sandbox limitation in the dev environment used for this PR, not something caused by this diff (the directfrom vllm.models.medusa import Medusaimport works, and the registry's own import-sanity test passes), but I haven't confirmed that againstmainyet. Flagging explicitly rather than claiming this test passes -- will confirm before marking ready for review.Details
Convention followed: matches already-migrated families (
deepseek_v32,kimi_k3,glm5next, etc.) --vllm/models/<name>/__init__.pyre-exporting fromcommon/<name>.py. Medusa is the first fullycommon-only package in the new layout (no existing family currently skips thenvidia/amdsplit entirely), since it has nothing hardware-specific to split out.Duplicate-work check: searched open issues/PRs (
gh issue list/gh pr list, several keyword variants) before starting; found no PR doing this specific migration. One unrelated open PR (#48715, a large personal-fork rebase) happens to touchmedusa.pyincidentally among dozens of unrelated files -- not a competing Flat Model migration.Scope: this PR only moves Medusa. The other ~30 legacy drafter files (EAGLE/EAGLE3, MTP variants, DFlash) are out of scope here; most are entangled with their own not-yet-migrated base model and need to be scoped individually.
This PR is a draft while the e2e validation gap above is resolved.
Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI. (e2e acceptance-rate test not yet confirmed -- see Validation section)
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code
https://claude.ai/code/session_01S7agbtPNuVe9pxACkqbitP