vllm-project/vllm · error · ValueError
MLA only works with naive serde mode..
Error message
MLA only works with naive serde mode..
What it means
ValueError from the LMCache v1 adapter setup: the model uses MLA (Multi-head Latent Attention, e.g. DeepSeek family) but the LMCache config sets remote_serde to a non-'naive' value. MLA stores a single latent KV tensor that cannot be safely re-serialized by the optimized/other serde backends, so only the naive serializer is permitted (None, which defaults to naive, is also allowed). This is a configuration conflict detected at connector construction time.
Source
Thrown at vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/vllm_v1_adapter.py:467
if curr_engine := LMCacheEngineBuilder.get(ENGINE_NAME):
return curr_engine
model_config = vllm_config.model_config
parallel_config = vllm_config.parallel_config
cache_config = vllm_config.cache_config
assert isinstance(lmcache_config, LMCacheEngineConfig), (
"LMCache v1 configuration is should be passed."
)
kv_dtype = get_kv_cache_torch_dtype(cache_config.cache_dtype, model_config.dtype)
use_mla = mla_enabled(model_config)
if use_mla and (
lmcache_config.remote_serde != "naive"
and lmcache_config.remote_serde is not None
):
raise ValueError("MLA only works with naive serde mode..")
# construct kv shape (for mem pool)
num_layer = model_config.get_num_layers(parallel_config)
num_mtp_layers = _calculate_mtp_layers(vllm_config, model_config)
num_layer += num_mtp_layers
chunk_size = lmcache_config.chunk_size
num_kv_head = model_config.get_num_kv_heads(parallel_config)
head_size = model_config.get_head_size()
kv_shape = (num_layer, 1 if use_mla else 2, chunk_size, num_kv_head, head_size)
logger.info(
"use mla: %s, kv shape: %s, num_mtp_layers: %s",
use_mla,
kv_shape,
num_mtp_layers,
)
# Change current device.
from vllm.distributed.parallel_state import get_world_groupView on GitHub (pinned to c794754062)
Solutions
- Set remote_serde to 'naive' (or leave it unset/None) in the LMCache configuration.
- If you need the advanced serde modes, use a non-MLA model.
- Verify model MLA status with mla_enabled(model_config) when unsure why the check fires.
Example fix
# before LMCacheEngineConfig(..., remote_serde="cachegen") # after LMCacheEngineConfig(..., remote_serde="naive")
Defensive patterns
Strategy: validation
Validate before calling
from vllm.config import ModelConfig
# before building the engine:
if mla_enabled(model_config) and cfg.remote_serde not in (None, "naive"):
cfg.remote_serde = "naive" Prevention
- Validate remote_serde against model family at config-load time
- Keep MLA-model deployments on a dedicated, naive-serde LMCache config template
When it happens
Trigger: Running an MLA model (DeepSeek-V2/V3 and derivatives) with lmcache config remote_serde set to e.g. 'cachegen' or 'fast'; passing an LMCacheEngineConfig built externally with remote_serde customized while model_config has MLA enabled.
Common situations: Copy-pasted LMCache config from a non-MLA deployment (Llama-style) onto a DeepSeek deployment; enabling cachegen/binary serde for bandwidth savings and hitting the MLA restriction.
Related errors
- layerwise MLA connector is not supported yet
- Either vllm_config must be provided, or all of model_config,
- LMCacheMPConnector only works without hybrid kv cache manage
- Unknown KVConnectorRole: {self.role}
- --use-replayssm is incompatible with KV connectors (P/D disa
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/646718d59959b15b.
Report an issue: GitHub.