From f819265a4ab0187181575c02174ec4a2f91d9220 Mon Sep 17 00:00:00 2001 From: roikoren755 <26850796+roikoren755@users.noreply.github.com> Date: Tue, 21 Apr 2026 17:51:43 +0300 Subject: [PATCH] Default to 'align' mamba cache mode for Mamba-based models when speculative decoding is enabled (#40454) Signed-off-by: Roi Koren --- vllm/model_executor/models/config.py | 29 +++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/vllm/model_executor/models/config.py b/vllm/model_executor/models/config.py index 521184e4c6..856f4b33ed 100644 --- a/vllm/model_executor/models/config.py +++ b/vllm/model_executor/models/config.py @@ -325,15 +325,26 @@ class MambaModelConfig(VerifyAndUpdateConfig): if cache_config.enable_prefix_caching: if cache_config.mamba_cache_mode == "none": - cache_config.mamba_cache_mode = ( - "all" if model_config.supports_mamba_prefix_caching else "align" - ) - logger.warning( - "Mamba cache mode is set to '%s' for %s by default " - "when prefix caching is enabled", - cache_config.mamba_cache_mode, - model_config.architecture, - ) + if ( + model_config.supports_mamba_prefix_caching + and vllm_config.speculative_config is not None + ): + cache_config.mamba_cache_mode = "align" + logger.warning( + "Mamba cache mode is set to 'align' for %s by default " + "when prefix caching and speculative decoding are enabled", + model_config.architecture, + ) + else: + cache_config.mamba_cache_mode = ( + "all" if model_config.supports_mamba_prefix_caching else "align" + ) + logger.warning( + "Mamba cache mode is set to '%s' for %s by default " + "when prefix caching is enabled", + cache_config.mamba_cache_mode, + model_config.architecture, + ) if ( cache_config.mamba_cache_mode == "all" and not model_config.supports_mamba_prefix_caching