Repository navigation
[rl] MTP verify steps: run verify rows on FA4's decode kernel - #6477
Draft
liangel-02 wants to merge 2 commits into
Draft
liangel-02 wants to merge 2 commits into
liangel-02 wants to merge 2 commits into
Conversation
Uniform verify steps of 8 rows or more run on FA4's decode kernel; fewer rows keep one varlen call. The B200 RL job runs test_vllm_verify_attention.py.
1 task
This branch has not been deployed
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.
Supersedes #6364 (originally by felipemello1).
Summary (human-written)
Agent details
Needs retesting on B200 (SM100): every number below is from one GB300 (SM103). FA4's split heuristics are tuned per GPU, so B200 timings can differ.
Stack, bottom to top:
The stack lands after the vLLM 0.33 PRs ("[rl] generator: vLLM 0.33 API fixes and TP padding in the model wrapper", "[rl] Install vLLM 0.33.0 on the torch nightly"). "[rl] generator: run on vLLM's model runner V2 (vLLM 0.34)" rebases on it.
TLDR: MTP verify rows (1 + k tokens each) now run on SwapAB, FA4's decode kernel for one query token per row, instead of its prefill kernel. On agent loads with long shared prompts, attention per 26-row verify step drops from 25.5 to 14.9 ms, plus 1.2 ms for the fp32 tail's kernels. Qwen3.8-27B, one GB300, 26 multi-turn sessions, MTP-3 with FULL_DECODE_ONLY: 1,008 output tok/s, vs 857 before this PR and 892 without MTP (an earlier version of the stack, NOTE).
Problem
num_speculative_tokens = k, each decode step verifies 1 + k tokens per request.Solution
_verify_rows_as_decode(vllm/attention/attention.py): each row's tokens become extra query heads of one decode row over the keys all of them see. The last k keys are added in fp32, causally, and merged by logsumexp.test_vllm_verify_attention.py.Results
Verify-path grid:
forwardon a uniform MTP-3 verify step, this PR's path vs the parent's FA4 varlen call (max_seqlen_q 4). Qwen3.5 attention configs (head dim 256), rows 1-64 x context 1k-128k, 128-token pages, max_seq_len 131072, CUDA graphs, FA4 4.0.0b40, one GB300, one run per point:On a unique-context load the path ties: 128 agent sessions in groups of 16 that share only a 4k first prompt, MTP-3, 761 output tok/s vs 763 for the varlen call. Its decode steps are 22% faster (p50 49.7 vs 63.7 ms), but the two arms' prefix-cache hits drifted apart (73% vs 82% of prompt tokens), so they ran different prefill work.
NOTE:
vllm/attention/attention.py; the one that lands second rebases: the vLLM V2 model runner PR and the ROCm paged-KV gather PR.You may ask: why not vLLM's
merge_attn_statesfor the merge? It takes token-major outputs of one dtype: three layout copies and a bf16 tail, for ~5 fewer kernels.Follow up / TODO (the
# TODOis inforward)Test plan