fix: roll back MTP verify cache on early abort - #1246
Draft
pierre427 wants to merge 1 commit into
Draft
Conversation
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
Why
The target verify forward appends
[current_token, draft_1, ..., draft_K]to the main model cache, while the MTP drafter has already appended the K proposed draft positions to its own cache. If cancellation, an injected fault, or a host materialization error fires before the fresh accept state is safely available, the generator should keep the already-committed current token and drop every uncommitted draft position from both caches.This is intentionally narrow: normal all-accept behavior is unchanged, and the existing reject behavior now goes through the same combined rollback helper.
Validation
tests/test_mtp_spec_decode.py::test_generator_rolls_back_verify_round_on_early_materialization_abort,::test_generator_emits_first_token_from_backbone_then_draft,::test_generator_rejection_path_does_not_count_as_accept— 3 passedruff check vllm_mlx/spec_decode/mtp/generator.py tests/test_mtp_spec_decode.pyruff format --check vllm_mlx/spec_decode/mtp/generator.py tests/test_mtp_spec_decode.pygit diff --check -- vllm_mlx/spec_decode/mtp/generator.py tests/test_mtp_spec_decode.pyFull
tests/test_mtp_spec_decode.pywas attempted CPU-only in this worktree and is environment-blocked on the local system Python 3.9 / missing optional deps (fastapi,mlx_lm.models.qwen3_5), with the same broader toolchain mismatch outside this diff. Default-GPU validation was intentionally not run because a local Qwen3.5-122B quality gate is active on the machine.