spec-decode: eliminate replay pass via fast-rollback#390
Draft
howard0su wants to merge 1 commit into
Draft
Conversation
Replace the expensive snapshot→verify→restore→replay cycle with: - Pure-attention targets (Gemma4): KV truncation (no replay needed) - Hybrid SSM targets (Qwen35): fast-rollback using per-step SSM intermediate states captured during verify (GPU memcpy, no recompute) Key changes: - DFlashTarget interface: add truncate_kv(), has_recurrent_state(), supports_fast_rollback(), rollback_to() - Qwen35DFlashTarget: implement rollback via delta_captures (SSM dequant + conv cudaMemcpy2D), enable capture_delta_intermediate during verify - dflash_spec_decode.cpp: three-way branch (fast-rollback / legacy replay / pure-attention truncate) - qwen35_backend.cpp: daemon inline loop supports fast-rollback - server_main.cpp: add --fast-rollback CLI flag Fast-rollback uses the implicit bonus approach: target_tok[accept_n-1] seeds the next draft step and is guaranteed accepted as draft_tok[0], producing identical output with zero extra forward passes. Performance (Qwen3.6-27B, 256 tokens, RTX 2080 Ti): Baseline (replay): 36.5 tok/s Fast-rollback: 47.7 tok/s (+30%)
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.
Replace the expensive snapshot→verify→restore→replay cycle with:
Key changes:
Fast-rollback uses the implicit bonus approach: target_tok[accept_n-1] seeds the next draft step and is guaranteed accepted as draft_tok[0], producing identical output with zero extra forward passes.
Performance (Qwen3.6-27B, 256 tokens, RTX 2080 Ti):
Baseline (replay): 36.5 tok/s
Fast-rollback: 47.7 tok/s (+30%)