<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>PD分离 on moyutianzun 的博客</title><link>https://moyutianzun.com/tags/pd%E5%88%86%E7%A6%BB/</link><description>Recent content in PD分离 on moyutianzun 的博客</description><generator>Hugo</generator><language>zh-cn</language><copyright>moyutianzun</copyright><lastBuildDate>Mon, 29 Sep 2025 09:53:22 +0800</lastBuildDate><atom:link href="https://moyutianzun.com/tags/pd%E5%88%86%E7%A6%BB/index.xml" rel="self" type="application/rss+xml"/><item><title>PD分离 —— Prefix Cache和Chunk Prefills</title><link>https://moyutianzun.com/blog/pdfen-chi------prefix-cachehe-chunk-prefills/</link><pubDate>Mon, 29 Sep 2025 09:53:22 +0800</pubDate><guid>https://moyutianzun.com/blog/pdfen-chi------prefix-cachehe-chunk-prefills/</guid><description>&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;目前推理框架基本上都需要用到多轮对话的场景，自然产生了&lt;code&gt;kv cache&lt;/code&gt;的存储和索引算法。如果能把&lt;code&gt;prompt&lt;/code&gt;和后续产生的&lt;code&gt;KV Cache&lt;/code&gt;保存下来，会极大地降低首&lt;code&gt;Token&lt;/code&gt;的耗时。&lt;/p&gt;&lt;p style=""&gt;&lt;/p&gt;&lt;p style=""&gt;目前使用最多的就是两个技术方案，一个是&lt;code&gt;SGLang&lt;/code&gt;推出的&lt;code&gt;RadixAttention&lt;/code&gt;&lt;span style="font-size: mediumpx; color: rgb(25, 27, 31)"&gt;的&lt;/span&gt;&lt;code&gt;Prefix Cache&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;，另一个是&lt;/span&gt;&lt;code&gt;vllm&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;原生的&lt;/span&gt;&lt;code&gt;Chunk Prefills&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;。当然&lt;/span&gt;&lt;code&gt;vllm&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;也兼容了&lt;/span&gt;&lt;code&gt;Prefix Cache&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;，这两个技术只能用一个，vllm默认是Chunk Prefills，可以通过加入参数&lt;/span&gt;&lt;code&gt;--enable-prefix-caching&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;来开启，这里不谈&lt;/span&gt;&lt;code&gt;TensorRT-LLM&lt;/code&gt;&lt;span fontsize="" color="rgb(25, 27, 31)" style="color: rgb(25, 27, 31)"&gt;是因为其不完全开源。&lt;/span&gt;&lt;/p&gt;</description></item></channel></rss>