vLLM 双向 KV 传输降低多轮智能体首字延迟
vLLM 博客与 AWS 机器学习博客介绍 vLLM 的双向 KV 缓存传输:在预填充-解码(P-D)分离部署中,解码节点可在后续对话轮次把此前计算的 KV 块回传给预填充节点,从而避免重复计算整段对话历史。作者在 Amazon EC2 P5en 实例搭配 AWS EFA 的 1P1D 部署上称,该功能使 Qwen3-32B 的首字延迟(TTFT)最多降低 1.6 倍、zai-org/GLM-5-FP8 最多降低 3.3 倍,并注明结果随负载与配置变化。部署需使用 vLLM v0.21.0 及以上版本和 NixlConnector,在预填充与解码两端开启 bidirectional_kv_xfer,并配合 KV 缓存感知路由;解码端 KV 块保留时长由 decoder_kv_blocks_ttl 控制,默认 480 秒。
文章指出,智能体对话历史增长会让预填充节点反复重算上下文、推高延迟与加速器开销;双向传输让预填充节点复用解码端保留的 KV 块,从而在长上下文下保持更平稳的首字延迟。
Multi-turn agentic workloads build on accumulated context as an agent reasons, invokes tools, and incorporates earlier results. With each new turn, the client resends the conversation history, including system instructions, prior prompts, tool results, and model responses, causing the growing context to be processed repeatedly. In Prefill-decode (P-D) disaggregation, each request is split across specialized nodes: the prefill node processes the prompt and builds its KV cache, then the decode node retrieves those KV blocks and generates the response.
Conventional disaggregated serving, however, only transfers KV cache in one direction: from prefill to decode node. This one-directional flow creates two inefficiencies for multi-turn workloads. First, after generating a response, the decode node holds KV cache entries for both the prompt and the newly generated tokens. When processing the next turn, the prefill node cannot retrieve those entries, so it must recompute the KV projections for the previous response tokens. Second, the decode node maintains the session state while the prefill nodes do not, increasing the probability of cache eviction for active sessions on the prefill nodes. On a full cache miss, the prefill node must recompute KV projections for the entire conversation history, including system instructions, prior user requests, tool results, and model-generated responses. As the conversation grows, this redundant work consumes more accelerator capacity and increases time to first token (TTFT).
#vLLM#AWS#Amazon EC2 P5en#AWS EFA#Qwen3-32B#GLM-5-FP8#NixlConnector#AWS Trainium