<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>LLM on Costa的生活技术实验室</title><link>https://n.cqs.es/tags/llm/</link><description>Recent content in LLM on Costa的生活技术实验室</description><generator>Hugo</generator><language>zh-hans</language><lastBuildDate>Tue, 02 Jun 2026 14:26:00 +0800</lastBuildDate><atom:link href="https://n.cqs.es/tags/llm/index.xml" rel="self" type="application/rss+xml"/><item><title>KV Cache Optimization 论文解读</title><link>https://n.cqs.es/posts/2026/2026-1-kv-cache/</link><pubDate>Tue, 02 Jun 2026 14:26:00 +0800</pubDate><guid>https://n.cqs.es/posts/2026/2026-1-kv-cache/</guid><description>&lt;h2 class="group head-tag" id="-论文解读">📄 论文解读&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#-%e8%ae%ba%e6%96%87%e8%a7%a3%e8%af%bb">&lt;/a>&lt;/h2>&lt;p>&lt;strong>KV Cache Optimization Strategies for Scalable and Efficient LLM Inference&lt;/strong>
Yichun Xu, Navjot K. Khaira, Tejinder Singh（Dell Technologies）
arXiv:2603.20397 · 2026 年 3 月 24 日 · 24 页 · 78 篇引用&lt;/p>
&lt;h2 class="group head-tag" id="为什么-kv-cache-是个问题">为什么 KV cache 是个问题&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#%e4%b8%ba%e4%bb%80%e4%b9%88-kv-cache-%e6%98%af%e4%b8%aa%e9%97%ae%e9%a2%98">&lt;/a>&lt;/h2>&lt;ul>
&lt;li>自回归生成时每生成一个 token 都要&amp;quot;看到&amp;quot;前面所有 token 的 K/V 向量&lt;/li>
&lt;li>不缓存的话，每个 step 都要从 0 重算所有历史 token → O(N²)&lt;/li>
&lt;li>缓存后，&lt;strong>KV cache 的内存随上下文长度线性增长&lt;/strong>：&lt;code>KV 大小 = 2·H·D·L·B·N&lt;/code>&lt;/li>
&lt;li>上下文从 2K 涨到 100K、1M、10M 后，KV cache 直接吃掉所有 GPU 显存，推理变慢、变贵、变得不可部署&lt;/li>
&lt;/ul>



 &lt;img src="https://n.cqs.es/images/posts/2026/2026-1-kv-cache_cover.webp" alt="Transformer self-attention with KV cache" loading="lazy" style="width:70%;" />


&lt;h2 class="group head-tag" id="五大技术分类">五大技术分类&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#%e4%ba%94%e5%a4%a7%e6%8a%80%e6%9c%af%e5%88%86%e7%b1%bb">&lt;/a>&lt;/h2>&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>#&lt;/th>
 &lt;th>类别&lt;/th>
 &lt;th>一句话原理&lt;/th>
 &lt;th>代表工作&lt;/th>
 &lt;th>典型收益&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>1&lt;/td>
 &lt;td>&lt;strong>Cache Eviction&lt;/strong>（驱逐）&lt;/td>
 &lt;td>生成过程中丢掉&amp;quot;不重要&amp;quot;的 token&lt;/td>
 &lt;td>H₂O、SnapKV、Ada-KV&lt;/td>
 &lt;td>内存砍 80%+，精度几乎不掉&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>2&lt;/td>
 &lt;td>&lt;strong>Cache Compression&lt;/strong>（压缩）&lt;/td>
 &lt;td>把 KV 量化到 2-4 bit 或低秩投影&lt;/td>
 &lt;td>KIVI、KVQuant、Palu&lt;/td>
 &lt;td>内存 ×4~×8，lossless 或 &amp;lt; 2% 精度损失&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>3&lt;/td>
 &lt;td>&lt;strong>Hybrid Memory&lt;/strong>（混合内存）&lt;/td>
 &lt;td>KV 主体放 CPU/SSD，GPU 上只留热点&lt;/td>
 &lt;td>vLLM/PagedAttention、FlexGen、Oneiros&lt;/td>
 &lt;td>单卡跑巨型模型、batch 大 6×、吞吐 3~33×&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>4&lt;/td>
 &lt;td>&lt;strong>New Attention&lt;/strong>（新型注意力）&lt;/td>
 &lt;td>改 attention 算法本身，O(N²) → O(N log N)&lt;/td>
 &lt;td>Linear、Log-Linear、Kimi Linear&lt;/td>
 &lt;td>6.3× 吞吐 + 75% 内存下降（Kimi 数据）&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>5&lt;/td>
 &lt;td>&lt;strong>Combination&lt;/strong>（组合拳）&lt;/td>
 &lt;td>上面 4 类挑几种拼起来&lt;/td>
 &lt;td>RocketKV、KVzip、ShadowKV、TailorKV&lt;/td>
 &lt;td>综合最优&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 class="group head-tag" id="七大部署场景--推荐方法">七大部署场景 × 推荐方法&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#%e4%b8%83%e5%a4%a7%e9%83%a8%e7%bd%b2%e5%9c%ba%e6%99%af--%e6%8e%a8%e8%8d%90%e6%96%b9%e6%b3%95">&lt;/a>&lt;/h2>&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>场景&lt;/th>
 &lt;th>推荐&lt;/th>
 &lt;th>理由&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>超长上下文（&amp;gt;1M）单请求&lt;/td>
 &lt;td>Eviction + Compression；Kimi Linear&lt;/td>
 &lt;td>显存是瓶颈，必须砍 cache 大小&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>最少改动现有模型&lt;/td>
 &lt;td>Ada-KV、SnapKV、KIVI&lt;/td>
 &lt;td>全部 fine-tuning-free、plug-and-play&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>高吞吐数据中心&lt;/td>
 &lt;td>PagedAttention/vLLM、Oneiros、ShadowKV&lt;/td>
 &lt;td>batch 大、lossless、充分利用多租户&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>边缘/低显存设备&lt;/td>
 &lt;td>InfiniPot、TailorKV&lt;/td>
 &lt;td>单卡 24GB 跑 8B/128K&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>多轮对话&lt;/td>
 &lt;td>RocketKV-MT、KVzip、ShadowKV&lt;/td>
 &lt;td>不能像 H₂O 那样永久丢 token&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>Prefill-heavy（长 prompt 编码）&lt;/td>
 &lt;td>NACL、HashEvict、LayerKV、MiniCache&lt;/td>
 &lt;td>关注 TTFT（首 token 延迟）&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>精度敏感推理&lt;/td>
 &lt;td>PagedAttention&lt;/td>
 &lt;td>无损 offload；不推荐 eviction/compression/linear attention&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 class="group head-tag" id="核心结论">核心结论&lt;a data-title-of-head class="group-hover:after:content-['__#'] no-underline hover:text-[--hs-text-color-hover]" href="#%e6%a0%b8%e5%bf%83%e7%bb%93%e8%ae%ba">&lt;/a>&lt;/h2>&lt;p>&lt;strong>没有银弹。&lt;/strong>&lt;/p></description></item></channel></rss>