Repository navigation
Conversation
- Add tape_rollback.py with TapeRecorder, TapeBuffer, LayerTape - KB-scale tape instead of MB-scale snapshots (5000x reduction) - Update cache_patch.py GatedDeltaNet patch to record per-position tape - Remove K clamping for SSM caches in generator.py - Add bit-exactness verification utilities - Add unit tests in test_mtp_tape_rollback.py - Add benchmark script bench_mtp_k3.py - Add implementation status docs in docs/tape-rollback-status.md Gate test: verify K=3 output is bit-exact vs K=0 baseline. Expected: 81% acceptance at K=3, ~2.2x speedup vs K=1. Refs: #44 MTP speculative decoding
marzukia
force-pushed
the
feat/tape-rollback-k2
branch
from
July 21, 2026 03:30
539d604 to
3864c97
Compare
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.
Overview
Implements tape-based SSM rollback for MTP speculative decoding, unlocking K>=2 on SSM-hybrid targets like Qwen3.5-122B.
The Problem
GatedDeltaNet (SSM) layers maintain recurrent state that updates every token. On draft rejection, the state needs to roll back to after the last accepted token. The naive approach snapshots the entire SSM state (MBs per layer), making K>=2 prohibitively expensive.
The Solution: Tape Rollback
Instead of storing full state snapshots, record tiny deltas at each position during the draft forward. On rejection, replay from the accepted position using the tape.
Memory Savings
5000x reduction in rollback memory footprint.
Changes
New Files
vllm_mlx/spec_decode/mtp/tape_rollback.py (356 lines)
tests/test_mtp_tape_rollback.py (350+ lines)
bench/bench_mtp_k3.py - Benchmark script for testing K=1,2,3 acceptance rates
docs/tape-rollback-status.md - Implementation status and deployment checklist
Modified Files
vllm_mlx/spec_decode/mtp/cache_patch.py
vllm_mlx/spec_decode/mtp/generator.py
Expected Impact
Gate Test
Critical: Verify K=3 output is bit-exact vs K=0 baseline at temp=0.
References