Skip to content

Support using different attention backend for draft decoding.#14843

Merged
hnyls2002 merged 11 commits intosgl-project:mainfrom
pyc96:kimi-eagle
Dec 19, 2025
Merged

Support using different attention backend for draft decoding.#14843
hnyls2002 merged 11 commits intosgl-project:mainfrom
pyc96:kimi-eagle

Conversation

@pyc96
Copy link
Copy Markdown
Collaborator

@pyc96 pyc96 commented Dec 10, 2025

Motivation + Modifications

Support using different attention backend for drafter decoding by setting SGLANG_DRAFT_ATTN_BACKEND or --speculative-draft-attention-backend.
e.g. Use trtllm_mla for main deepseek target model and use trtllm_mha or flashinfer for eagle heads. In local test, using trtllm_mla + trtllm_mha for drafting can provide up to 15% better TPOT than using flashinfer only.

Also allow DeepseekV3 model to use EAGLE3.

Tests

SGLANG_DRAFTER_ATTN_BACKEND=trtllm_mha python -m sglang.launch_server --port 7080 --model-path moontshotai/Kimi-K2-Thinking --trust-remote-code  --tp-size 8 --speculative-algorithm EAGLE3 --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 4 --speculative-draft-model-path={EAGLE3_MODEL}

Checklist

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@pyc96 pyc96 marked this pull request as ready for review December 10, 2025 20:07
Copy link
Copy Markdown
Collaborator

@b8zhong b8zhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a flag instead? Maybe --speculative-attention-backend

@pyc96
Copy link
Copy Markdown
Collaborator Author

pyc96 commented Dec 10, 2025

@hnyls2002 wdyt? I was discussing with @hnyls2002 and we ended up using env var. Personally both approach sound good to me

@zhyncs
Copy link
Copy Markdown
Collaborator

zhyncs commented Dec 11, 2025

@b8zhong @pyc96 it's not hard to support both, I'm fine with that. btw this pr looks good

@pyc96
Copy link
Copy Markdown
Collaborator Author

pyc96 commented Dec 11, 2025

Thanks for the review! Added a flag --speculative-draft-attention-backend.

@JustinTong0323
Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@hnyls2002 hnyls2002 changed the title Support using different attention backend for drafter decoding. Support using different attention backend for draft decoding. Dec 18, 2025
@hnyls2002
Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@hnyls2002 hnyls2002 merged commit 9e0ef04 into sgl-project:main Dec 19, 2025
90 of 165 checks passed
xiaobaicxy added a commit to xiaobaicxy/sglang that referenced this pull request Dec 19, 2025
* 'main' of https://github.com/sgl-project/sglang: (136 commits)
  fix: unreachable error check in retraction (sgl-project#15433)
  [sgl-kernel] chore: update deepgemm version (sgl-project#13402)
  [diffusion] multi-platform: support diffusion on amd and fix encoder loading on MI325 (sgl-project#13760)
  [amd] Add deterministic all-reduce kernel for AMD (ROCm) (sgl-project#15340)
  [diffusion] refactor: refactor _build_req_from_sampling to use shallow_asdict (sgl-project#13782)
  Add customized sampler registration (sgl-project#15423)
  Update readme (sgl-project#15425)
  Fix Mindspore model import warning (sgl-project#15287)
  [Feature] Xiaomi `MiMo-V2-Flash` day0 support (sgl-project#15207)
  [diffusion] profiling: add bench_serving.py and VBench (sgl-project#15410)
  [DLLM] Fix dLLM regression (sgl-project#15371)
  [Deepseek V3.2] Fix Deepseek MTP in V1 mode (sgl-project#15429)
  chore: update CI_PERMISSIONS (sgl-project#15431)
  [DLLM] Add CI for diffusion LLMs (sgl-project#14723)
  Support using different attention backend for draft decoding. (sgl-project#14843)
  feat(dsv32): better error handling for DeepSeek-v3.2 encoder (sgl-project#14353)
  tiny fix lint on main (sgl-project#15424)
  multimodal: precompute hash for MultimodalDataItem (sgl-project#14354)
  [AMD] Clear pre-built AITER kernels and warmup to prevent segfaults and test timeouts (sgl-project#15318)
  [Performance] optimize NSA backend metadata computation for multi-step speculative decoding (sgl-project#14781)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants