[BugFix] Honor drop_eagle_block in MambaManager
On a hybrid model (full-attention + Mamba/GDN layers, e.g. Qwen3.6-35B-A3B), enabling MTP/EAGLE speculative decoding together with prefix caching corrupts the recurrent state, and the server serves wrong answers. #43559 reports tool-eval accuracy dropping from ~90% to ~50%. Nothing raises an exception and nothing shows up in the logs, so an operator has no signal that anything is wrong, and prefix caching then spreads it, because the corrupted state is hash-reachable and every later request sharing that prefix restores from it. The root cause is the find_longest_cache_hit method on MambaManager, at vllm/v1/core/single_type_kv_cache_manager.py:1049 on main, which takes drop_eagle_block in its signature and never acts on it. Its body searches right-to-left for the last cached block, builds [null]*i + [cached], and breaks, referencing neither drop_eagle_block nor .pop(. Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -1538,6 +1538,15 @@ class MambaManager(SingleTypeKVCacheManager):
|
||||
return computed_blocks, hit_length
|
||||
|
||||
max_num_blocks = max_length // block_size
|
||||
if drop_eagle_block and max_num_blocks > 0:
|
||||
# EAGLE/MTP: drop the final matched page. Its recurrent-state snapshot
|
||||
# may have been taken over draft tokens that verification later rejects,
|
||||
# so the state must be restored from the previous page boundary and
|
||||
# recomputed forward. FullAttentionManager (see find_longest_cache_hit
|
||||
# above) pops the last block; Mamba keeps only the rightmost real block
|
||||
# with the prefix null-padded, so a literal pop would delete the state
|
||||
# block itself -- lower the search ceiling by one page instead.
|
||||
max_num_blocks -= 1
|
||||
# Search from right to left and early stop when a match is found.
|
||||
for i in range(max_num_blocks - 1, -1, -1):
|
||||
if cached_block := block_pool.get_cached_block(
|
||||
|
||||
Reference in New Issue
Block a user