Repository navigation
Conversation
…tates examples/speculative_decoding/offline_ar/offline_ar_validate.py replays greedy speculative decoding on conversations dumped by collect_hidden_states/, so a DFlash draft's acceptance length is measured without running the target. It reports vLLM's 1 + accepted / drafts and the share of reply tokens that are the target's own greedy pick, warning when the references are not greedy outputs. The draft step mirrors the draft half of HFDFlashModel.pseudo_speculative_generate; tests/examples/speculative_decoding/test_offline_ar.py pins it to that method. On Nemotron-3.5-Bolt-E4B with its DFlash draft (MT-Bench first turns, thinking on) the replay gives AR 3.741 on the exact greedy tokens against 3.746 from the vLLM engine, in 2 minutes on one RTX PRO 6000. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: h-guo18 <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2976 +/- ##
==========================================
- Coverage 79.53% 79.07% -0.46%
==========================================
Files 660 660
Lines 74720 75153 +433
==========================================
Hits 59430 59430
- Misses 15290 15723 +433
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
What does this PR do?
Type of change: new example
Adds
examples/speculative_decoding/offline_ar/to measure a DFlash draft's acceptance length (AR) without running the target.scripts/ar_validate.pyruns the target at every speculative step. Here the target's greedy replies and hidden states are dumped once with the existingserver_generate.pyandcollect_hidden_states/scripts, andoffline_ar_validate.pyreplays greedy speculative decoding on the dump. Each draft checkpoint then takes minutes on one GPU, all of them scored on the same references, which suits large targets and checkpoint sweeps.HFDFlashModel.pseudo_speculative_generate, and a test pins it to that method. Models that override it (DSpark) are refused.Usage
Testing
Nemotron-3.5-Bolt-E4B and its DFlash draft (block 8), first turns of MT-Bench (80 prompts, thinking on, up to 1024 tokens), one RTX PRO 6000, peak GPU memory 3.7 GiB:
server_generate.py+compute_hidden_states_hf.pyRows 2 and 3 replay different greedy replies (vLLM's greedy decoding depends on the batch), so their AR differs by the references, not the replay. The draft was trained with RoPE theta 1e6, while this checkout resolves a Gemma-4 draft's theta to 1e4, so these runs set 1e6 on the loaded model.
tests/examples/speculative_decoding/test_offline_ar.pychecks that drafts fed from a dump equalpseudo_speculative_generate's on a tiny model with a sliding window (0.3 s). It fails when the anchor, the output slice or the attention mask drifts.Before your PR is "Ready for review"
CONTRIBUTING.md: N/AAdditional Information
A follow-up could move the draft step into
HFDFlashModel, so this script andpseudo_speculative_generateshare one implementation instead of a pinned copy.🤖 Generated with Claude Code