Skip to content

[Spec] Fix EAGLE3 aux-layer capture for Qwen3.5 - #38307

Open
Jin-Chuan wants to merge 2 commits into
sgl-project:mainfrom
Jin-Chuan:fix-qwen35-eagle3-aux-capture
Open

Jin-Chuan wants to merge 2 commits into
sgl-project:mainfrom
Jin-Chuan:fix-qwen35-eagle3-aux-capture

Conversation

@Jin-Chuan

@Jin-Chuan Jin-Chuan commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Serving the Qwen3.5 architecture family with --speculative-algorithm EAGLE3 crashes at startup. Root cause is that the inner decoder collects aux hidden states through the DFLASH-style per-layer flags, while EAGLE3's layer ids were
never wired into that mechanism.

  • Multimodal — Qwen3.5-VL (models/qwen3_5.py) and Qwen4 (models/qwen4_exp.py) inherit the wrapper in models/qwen3_vl.py, which only writes the layers_to_capture list the flag-based inner ignores. Both fail at CUDA
    graph capture with:

    ValueError: too many values to unpack (expected 2)
    
  • Text-only — Qwen3.8-2.4T-A95B ships as Qwen3_5MoeForCausalLM and is served through models/qwen3_5_text.py, which lacks the EAGLE3 hook entirely. It fails right at startup with:

    AttributeError: 'Qwen3_5ForCausalLM' object has no attribute 'set_eagle3_layers_to_capture'
    

Modifications

python/sglang/srt/models/qwen3_5.py

  • Add set_eagle3_layers_to_capture to the inner Qwen3_5ForCausalLM, reusing the same per-layer flag mechanism as set_dflash_layers_to_capture, so the forward returns hidden states and aux hidden states together as the EAGLE3 contract requires.

python/sglang/srt/models/qwen3_vl.py

  • Qwen3VLForConditionalGeneration.set_eagle3_layers_to_capture now skips non-last PP ranks and delegates to the inner model's own set_eagle3_layers_to_capture when implemented, falling back to the previous layers_to_capture assignment otherwise.

python/sglang/srt/models/qwen3_5_text.py

  • Forward set_eagle3_layers_to_capture to the inner body.

test/registered/unit/models/test_qwen3_eagle_capture.py

  • New mock-based regression test covering both the multimodal and text-only wrappers.

Accuracy Tests

With this fix, serving a Qwen3.5-35B-A3B model with --speculative-algorithm EAGLE3 passes CUDA-graph capture, and the server serves normally once the companion fix for the OOB gather in EAGLE3 draft-extend prefill BCG on multimodal models is also applied (#38330).

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #36687158669
Latest PR Test (Extra): ❌ Run #36687158446
Latest PR Test (AMD ROCm 10): ❌ Run #36687158894

@AniZpZ AniZpZ added the run-ci CI: run the baseline test suite on this PR label Sep 7, 2026
@Jin-Chuan

Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci

@Jin-Chuan
Jin-Chuan force-pushed the fix-qwen35-eagle3-aux-capture branch 2 times, most recently from f17520a to ba6f323 Compare September 30, 2026 08:01
@Jin-Chuan

Copy link
Copy Markdown
Contributor Author

/tag-and-rerun-ci

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants