<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>显存估算 on AI 观察</title><link>https://ai.wujiong.cc/tags/%E6%98%BE%E5%AD%98%E4%BC%B0%E7%AE%97/</link><description>Recent content in 显存估算 on AI 观察</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sat, 17 Oct 2026 14:57:00 +0800</lastBuildDate><atom:link href="https://ai.wujiong.cc/tags/%E6%98%BE%E5%AD%98%E4%BC%B0%E7%AE%97/index.xml" rel="self" type="application/rss+xml"/><item><title>KV Cache 显存怎么估算：公式、示例与降低占用的办法</title><link>https://ai.wujiong.cc/posts/2026-10-17-hardware-kv-cache-memory-estimate/</link><pubDate>Sat, 17 Oct 2026 14:57:00 +0800</pubDate><guid>https://ai.wujiong.cc/posts/2026-10-17-hardware-kv-cache-memory-estimate/</guid><description>&lt;p&gt;KV Cache 的显存占用可以用一个公式估算：&lt;strong&gt;每个 token 的 KV 字节数 = 2 × 层数 × KV 头数 × 每头维度 × 每个元素的字节数&lt;/strong&gt;，再乘以序列长度和并发序列数。部署前算一遍，就能知道在给定显卡上能支撑多长的上下文和多少并发。&lt;/p&gt;
&lt;h2 id="为什么要算-kv-cache"&gt;为什么要算 KV Cache&lt;/h2&gt;
&lt;p&gt;推理时显存主要分给三部分：模型权重、KV Cache、运行时开销（激活、框架缓冲等）。权重大小相对固定，KV Cache 则随&lt;strong&gt;上下文长度 × 并发数&lt;/strong&gt;线性增长。很多「模型能加载，但一上并发就显存不足」的问题，原因就在这里。&lt;/p&gt;</description></item></channel></rss>