DeepSeek-V4-Flash#
验证过的模型#
引擎文档: DeepSeek-V4-Flash 在 vLLM 支持的模型 (架构 DeepseekV4ForCausalLM)。
状态: 已通过 LMCache 验证。
安装 vLLM: DeepSeek-V4-Flash 需要稀疏 MLA 注意力后端和 fp8_ds_mla KV Cache 内核,因此请按照其专属指南安装 vLLM,而非直接使用 pip install vllm:vLLM DeepSeek-V4-Flash 指南(也可在 https://recipes.vllm.ai/deepseek-ai/DeepSeek-V4-Flash 查看镜像)。
警告
请使用 最新的 vLLM 正式版本,而非 main/dev 分支。当前 vLLM 开发分支对 DeepSeek-V4-Flash 存在兼容性问题(fp4 MoE 专家路由有误,实际权重无法加载)。请按照 vLLM 指南的说明,锁定到最新的标签版本。
启动 LMCache MP 服务器:
lmcache server --l1-size-gb 100 --eviction-policy LRU
使用 LMCache MP 连接器(8 个 GPU)启动 vLLM:
vllm serve deepseek-ai/DeepSeek-V4-Flash \
--tensor-parallel-size 8 \
--enable-expert-parallel \
--kv-cache-dtype fp8_ds_mla \
--trust-remote-code \
--tokenizer-mode deepseek_v4 \
--kv-transfer-config \
'{"kv_connector":"LMCacheMPConnector", "kv_role":"kv_both"}'
--kv-cache-dtype fp8_ds_mla 和 --tokenizer-mode deepseek_v4 是该模型的必选参数;--enable-expert-parallel 将 MoE 专家分散到各张量并行 rank 上。请根据您的硬件调整 --tensor-parallel-size。有关 LMCache + vLLM 的通用配置(端口、远程主机等),请参见 快速入门。
如果在 vLLM 设置中遇到任何问题,请参考 vLLM Recipes 以获取更多详细信息。
状态: 未通过 LMCache 验证。
状态: 支持。TRT-LLM + LMCache 的配置方式,请参阅 快速入门。
CacheBlend 支持#
压缩支持#
方法 |
状态 |
备注 |
|---|---|---|
未验证 |
MTP (speculative decoding) support#
DeepSeek-V4-Flash ships a native multi-token-prediction head
(num_nextn_predict_layers: 1 in its config), which vLLM uses for
speculative decoding. The MTP head has its own KV cache layer; LMCache
detects it from vLLM's speculative_config and stores/retrieves the
draft-layer KV together with the target model's -- no extra LMCache flags
are required.
Status: Validated with LMCache (vLLM MP connector, TP4).
Add the speculative config to the vllm serve command shown above:
--speculative-config '{"method":"mtp","num_speculative_tokens":1}'
Validation evidence (gsm8k store-vs-retrieve, 100 samples): scores match within sampling stderr (0.95 computed vs 0.96 LMCache-retrieved), and the MTP acceptance rate is unchanged when the prefix KV is served by LMCache (0.947 store run vs 0.952 retrieve run) -- i.e. the draft-layer KV survives the store/retrieve round-trip intact. Cold-vs-warm TTFT improved 6.6x with MTP enabled throughout.
MTP-specific caveats:
Generation is not bit-exact between a cached and a fresh run: the MXFP4 MoE kernels do not support vLLM's batch-invariant mode. Expect score-level equivalence, not token-level.
On the vLLM nightly tested, engine startup with CUDA graphs crashed for this model -- also with a vanilla
vllm serve(no LMCache, no MTP), so this is the dev-branch breakage warned about above, not an LMCache or MTP interaction.--enforce-eagerwas used for validation; on tagged vLLM releases (per the vLLM recipe) it should not be needed.
注意事项#
Engine-driven transfers: Compressed KV groups are supported over SHM and inline transport. To select this path explicitly, add
"kv_connector_extra_config": {"lmcache.mp.mp_transfer_mode": "engine_driven"}to--kv-transfer-config. Use matching LMCache versions on the worker and server: registration must communicate physical slot counts separately from logical token counts. This does not require changing the model's compression ratios.需要最新的 vLLM 正式版本。 vLLM 开发分支目前对该模型存在兼容性问题(请参见上方警告)——请使用通过 vLLM 指南安装的标签版本。
稀疏 MLA 混合 KV Cache。 DeepSeek-V4-Flash 将多个具有不同块几何形状的 KV Cache 组交错排列(压缩的 MLA 潜变量以
fp8/uint8格式存储,而稀疏注意力索引器组为float32),因此各组不共享统一的块大小。LMCache 会按各组自身的块大小分别进行存储和检索;除--kv-cache-dtype fp8_ds_mla外,无需设置额外标志。