Skip to content

[None][fix] spec-decode NaN guard (~isnan, not isfinite) + draft_len_schedule CUDA-graph crash - #10

Merged
sopwg612 merged 2 commits into
deep-main-v1.3.0rc16from
fix/spec-guard-isnan-draftlen-deep-main-rc16
Jun 17, 2026
Merged

[None][fix] spec-decode NaN guard (~isnan, not isfinite) + draft_len_schedule CUDA-graph crash#10
sopwg612 merged 2 commits into
deep-main-v1.3.0rc16from
fix/spec-guard-isnan-draftlen-deep-main-rc16

Conversation

@sopwg612

Copy link
Copy Markdown

What

Restore the spec-decode target-logits NaN guard to a NaN-only check, and pull in the draft_len_schedule CUDA-graph crash fix.

Why

The guard in _torch/speculative/interface.py (SpecWorkerBase) and mtp.py was rewritten in 23939ea ("FP8 KV-cache + spec-decode robustness") to torch.isfinite(logits).all(). isfinite is False for -inf as well as NaN. Guided decoding (xgrammar) writes -inf into masked-token logits as normal grammar masking, so the guard false-positively os._exits the engine on ANY structured-output (response_format) request under speculative decoding (Eagle3/MTP). This took down guided+spec models on rc16 (gpt-oss-120b-Turbo, MiniMax-M2.5, Kimi-K2.5, ...).

Fix

Validated in prod (Turbo + MiniMax): guided+spec requests no longer crash, structured output returns valid JSON, NaN protection retained.

chungen04 and others added 2 commits June 17, 2026 22:02
…schedule reaching 0 crashes during CUDA graph capture, "bitmask must have the same batch size as logits" (NVIDIA#15023)

Signed-off-by: chungen04 <b09901027@ntu.edu.tw>
…ided-decoding -inf is legal)

Standardize the spec-decode target-logits guard on (~torch.isnan(logits)).all() so guided-decoding -inf (legitimate grammar masking) never trips it, while real NaN (argmax->PAD corruption) still does. Aligns deep-main with the priority build branch and the shipped rc16 images.

Signed-off-by: Sihan Wang <sihan@deepinfra.com>
@sopwg612
sopwg612 merged commit 11e61cd into deep-main-v1.3.0rc16 Jun 17, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants