Fix MTP Mamba align prefix cache retention

YU
4mo ago
+48-2

Summary

  • retain the final block-aligned Mamba cache state for MTP when an uncached prompt tail is still evaluated
  • keep the existing EAGLE safety backoff when the prompt ends exactly on a block boundary
  • gate the behavior behind VLLM_MAMBA_ALIGN_RETAIN_MTP_CACHE_BLOCK=1
  • add a focused 2080 Ti regression test

Motivation

Qwen3.5 MTP uses the EAGLE scheduler path. The generic EAGLE rule backs the final cache position up by one full Mamba block, which discarded about 2K reusable prompt tokens even though the uncached tail still produced the proposer hidden states.

In the tested 8008 deployment, the hot-cache result improved from 6,336 / 8,339 cached prompt tokens at about 1.18 s TTFT to 8,448 / 8,525 cached tokens at about 235 ms TTFT. Decode throughput stayed around 102 tok/s.

The exact-boundary case remains on the legacy EAGLE path.

Validation

  • python -m py_compile for scheduler and regression test
  • focused regression: legacy split 8, retained split 12 with a tail, exact-boundary split 8
  • live Qwen3.5 MTP A/B on the 8008 deployment

Related upstream issue: https://github.com/vllm-project/vllm/issues/38182


Summary by cubic

Retains the final Mamba‑aligned prefix cache block for MTP when the prompt has an uncached tail, avoiding EAGLE backoff and reducing TTFT on hot‑cache prompts. Previously EAGLE always dropped the last complete block; now MTP keeps it with a tail and still prunes on an exact block boundary.

  • Opt-in via VLLM_MAMBA_ALIGN_RETAIN_MTP_CACHE_BLOCK (truthy: 1/true/yes/on; default off); registered in vllm.envs.
  • Applies only to Mamba cache mode "align" on the EAGLE path with MTP; all other cases unchanged.
  • Adds a focused 2080 Ti regression test that verifies tail retention (12) and boundary prune (8).
  • Qwen3.5 MTP hot-cache: cached tokens 6,336→8,448 and TTFT ~1.18s→~235ms; decode throughput unchanged.