[Bugfix][Model Runner V2][Spec Decode] Decouple the draft's gumbel noise stream from the target's (#54282)

Signed-off-by: Giancarlo Delfin <gdelfin@inferact.ai>
This commit is contained in:
Giancarlo Delfin
2026-08-29 09:58:29 -07:00
committed by GitHub
parent 7fbfca2670
commit fe755c8899
11 changed files with 232 additions and 30 deletions
@@ -261,11 +261,11 @@ class DFlashSpeculator(DraftModelSpeculator):
)
num_sample = num_reqs * self.num_speculative_steps
sample_hidden_states = last_hidden_states[self.sample_indices[:num_sample]]
# sample_pos is the predicted token's position Q; verification keys
# Gumbel by the predecessor (Q-1). sample_draft adds +1, so pass Q-2.
# sample_pos is the predicted token's position P. Sampling keys a draw
# by the position before the sampled token, P-1.
draft_tokens = self.sample_draft(
sample_hidden_states,
self.sample_pos[:num_sample] - 2,
self.sample_pos[:num_sample] - 1,
self.sample_idx_mapping[:num_sample],
self.temperature,
self.seeds,