Repository navigation
[Spec] Disambiguate verified_id into bonus_token(s) / accept_tokens - #24724
Merged
Merged
Conversation
hnyls2002
requested review from
BBuf,
ByronHsu,
Edwardf0t1,
Fridge003,
HaiShaw,
Qiaolin-Yu,
ShangmingCai,
Ying1123,
ch-wan,
ispobock,
kpham-sgl,
merrymercy and
xiezhq-hermann
as code owners
May 8, 2026 22:34
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
verified_id into bonus_token(s) / accept_tokens
This was referenced May 10, 2026
5 tasks done
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 16, 2026
…64 an invariant THE DEATH. 2026-08-16 00:25:07, nineteen minutes into the c4b88e1 boot under five-lane load, all three ranks at once: RuntimeError: Expected 'candidates' to be of type long (torch.int64) tree_speculative_sampling_target_only <- eagle_sample <- verify <- run_batch The iteration before: full token usage 0.97, a 257-token chunked prefill admitted, 143,984 pending. THE HYPOTHESIS WAS HALF RIGHT. Not a float tensor from a defaulted torch.empty -- int32, deliberately: eagle_sample candidates = verify_input.draft_token.reshape(..) _build_trivial_verify_input draft_token = draft_input.bonus_tokens verify bonus_tokens = torch.empty_like(accept_lens, dtype=torch.int32) bonus_tokens = torch.empty((0,), dtype=torch.int32) draft_token IS the candidates tensor, and one construction path hands it over int32. int32 is CORRECT at its source -- bonus_tokens is an *input* to build_tree_kernel_efficient on the ordinary path, never the candidates tensor. The dtype is wrong at the door it came through, not where it was made. WHY ONLY UNDER PRESSURE. The trivial path is taken when drafting is disabled at high batch size, or on a phase-flip draft bootstrap -- both load states. The ordinary path takes draft_token from build_tree_kernel_efficient, which returns int64. A quiet instance never sees it. LATENT, NOT INTRODUCED BY sgl-project#679, and this was checked before anything was written. The int32 dates to upstream sgl-project#24724 (2026-05-08). The trivial path and all three int32 constructions are byte-identical at 1d1dbf9, and no commit in this chain touches python/sglang/srt/speculative/ at all. What sgl-project#679 changed is SURVIVAL: the instance used to die at the allocator before it could keep taking the trivial path at 0.97 usage. The park removed the earlier death and exposed this one. That changes the framing, not the necessity. THE FIX IS AT THE CONSTRUCTION SITE. A .to(long) in eagle_sample would fix this crash and leave every other consumer free to be handed the wrong dtype. EagleVerifyInput.__post_init__ enforces the contract for EVERY construction path, present and future. The class already DECLARED that contract in its own create_idle_input default (torch.empty((0,), dtype=torch.long)) -- a default is not an invariant, and this makes it one. The source is deliberately NOT changed: bonus_tokens must stay int32 for its other consumers, so converting at its origin would trade this crash for a different one. CONVERT, DO NOT RAISE -- a serving instance degrades rather than dies, which is the whole subject of sgl-project#679 -- and the conversion is a no-op on every compliant path. But it is ANNOUNCED, once per offending dtype, because a fix that silences its own trigger is how the defect returns: the next path to hand over the wrong dtype would otherwise be absorbed without a word. Tests: 12, extending the exhaustion work to the verify path at ~1.0 usage. RED-FIRST against 82ba7e2: 7 fail there, including the crash reproduction itself (int32 bonus_tokens -> int64 candidates). Covered: both bonus_tokens branches, the float case the hypothesis proposed, value preservation across the conversion, None, announce-once, silence on the compliant path, and three pins that this stays a construction-site fix (post_init enforcement; the trivial path still hands over bonus_tokens; eagle_sample still derives candidates from the field -- if any of those move, the pin must move with them). No regressions: 1017 pass, zero failures. NOT BOOTED. Desk-only; READY-FOR-BOOT.
Chronostasys
pushed a commit
to MindLab-Research/sglang
that referenced
this pull request
Aug 24, 2026
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.
Summary
verified_idinto two semantically distinct names per the speculative-decoding naming rule (Add speculative decoding naming convention rule #24094):[bs]bonus tokens ->bonus_token(scalar) /bonus_tokens(batched) — Rule 2[sum_accepted]accepted-token tensor ->accept_tokens— Rule 3bonus_token(s)obeys Rule 7 plural-for-non-scalar like every other spec name.Changes
EagleDraftInput.verified_id->bonus_tokens,EagleVerifyOutput.verified_id->accept_tokens, Triton kernelfill_new_verified_id->fill_bonus_tokens, etc.bonus_token(Rule 7); ptr params and[bs]tensors are plural..claude/rules/speculative-naming.md: remove the singular-exception clauses in Rule 2 + Rule 7; tighten Rule 2 wording.