Repository navigation
Conversation
…ing is available The MRV2 sampler routed unseeded top-k/top-p batches to FlashInfer's fused sampler even with use_fp64_gumbel set, so those steps drew fp32 noise. Skip the FlashInfer sampler when fp64 Gumbel is requested, as the V1 sampler and the MRV2 XPU path already do. Assisted-by: AI coding assistant Signed-off-by: Cy <15118312+cycancode@users.noreply.github.com>
cycancode
requested review from
WoosukKwon,
njhill and
yewentao256
as code owners
October 20, 2026 04:45
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.
Overview
With
--use-fp64-gumbel, Model Runner V2 still sends unseeded top-k/top-p batches to FlashInfer's fused sampler, which draws fp32 noise, so the flag is silently ignored for those steps. This skips the FlashInfer sampler when fp64 Gumbel is requested, matching the V1 sampler and MRV2's own XPU path.Claims
use_fp64_gumbel=True, MRV2 samples unseeded top-k/top-p requests with fp64 Gumbel noise instead of FlashInfer.Validation
End to end on
34ac4f96a3(Qwen3-0.6B, RTX 4090, MRV2,--enforce-eager, FlashInfer kernels installed withvllm download-kernels). The engine ran in-process (VLLM_ENABLE_V1_MULTIPROCESSING=0) so I could count which sampling function each step called. Workload: 4 prompts,temperature=0.8, top_p=0.9, max_tokens=16, no seed, so 16 sampling steps per run.use_fp64_gumbelmainTrueflashinfer_sample× 16Truegumbel_sample(use_fp64=True)× 16Falseflashinfer_sample× 16 (unchanged)Tests:
tests/v1/worker/test_gpu_sampler_flags.py::test_fp64_gumbel_bypasses_flashinfer_samplerrunsSampler.sampleon an unseeded top-p request with FlashInfer reported as supported andflashinfer_samplepatched to fail. It fails onmainand passes with the fix.pytest tests/v1/worker/test_gpu_sampler_flags.py: 17 passed.pytest tests/v1/worker/test_gpu_logits_processors.py tests/v1/worker/test_gpu_thinking_budget.py tests/v1/sample/test_topk_topp_sampler.py: 168 passed, 1 skipped.pre-commit run --files <changed files>: all hooks pass, including mypy.Details
Root cause:
Sampler.__init__invllm/v1/worker/gpu/sample/sampler.pysetuse_flashinferfromflashinfer_sampler_supported()alone.sample()then routes a batch toflashinfer_samplewhenever it has top-k/top-p and no greedy, seeded or processed-logprobs requests, souse_fp64_gumbelonly took effect for steps that happened to fall back togumbel_sample.Other paths already handle this: V1's
TopKTopPSampler.forward_cudaandforward_hipfall back to native sampling whenuse_fp64_gumbelis set (#43150), and MRV2 already excludes its XPU sampler for the same reason (#57277). MRV2 picked up the FlashInfer sampler in #42472, two days before #43150, which only touched V1.Not a duplicate: I found no issue or PR for this (searched "fp64 gumbel", "use_fp64_gumbel", "fp64 flashinfer", "MRV2 flashinfer sampler"). #54843 and #54952 cover the CPU spec-decode recovered-token path. Of the open PRs that touch this sampler, #60993 edits the FlashInfer call site but does not change when FlashInfer is used.
AI assistance was used to find this bug, write the fix and the test, and run the validation shown above.
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.
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.