<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>KV Cache - 标签 - lilfry's library</title><link>https://lilfry09.github.io/tags/kv-cache/</link><description>KV Cache - 标签 - lilfry's library</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>lilfry@sjtu.edu.cn (lilfry)</managingEditor><webMaster>lilfry@sjtu.edu.cn (lilfry)</webMaster><copyright>All rights reserved.</copyright><lastBuildDate>Fri, 30 Oct 2026 00:20:00 +0800</lastBuildDate><atom:link href="https://lilfry09.github.io/tags/kv-cache/" rel="self" type="application/rss+xml"/><item><title>KV Cache 优化地图：从丢 Token 到跨层共享</title><link>https://lilfry09.github.io/ai/kv-cache-optimization-map/</link><pubDate>Fri, 30 Oct 2026 00:20:00 +0800</pubDate><author>fry</author><guid>https://lilfry09.github.io/ai/kv-cache-optimization-map/</guid><description><![CDATA[<p>长上下文推理最先撞到的墙，经常不是 FLOPs，而是 KV Cache。</p>
<p>模型每生成一个新 token，都要让当前 query 访问过去 token 的 key 和 value。为了避免把过去全部重算一遍，推理系统把这些 K、V 留在显存里。代价是缓存随上下文长度、层数和 KV head 数一起增长。</p>
<p>这类工作看起来很多，其实可以放进一个很清楚的坐标系：</p>
<blockquote>
<p>KV Cache 优化主要是在 Token、Layer、Head 三个维度上减少需要保存的状态。</p></blockquote>]]></description></item></channel></rss>