KV cache 占用曲线
纵轴单位:GiB。虚线表示超过该模型公开 native context 后的公式外推。
X 轴:0–1,048,576 tokens
架构感知
2 bytes / element
模型卡片
全部 17 个模型
没有匹配的模型,请换个关键词或公司。
模型参数与计算结果
| 模型 | 用于计算的结构 | 每 token KV | 当前上下文 | 1M 点 | Native context | 备注 |
|---|
公式与架构感知模式说明
架构感知计算原则:
标准 GQA 层按 T × 2(K,V) × KV heads × head_dim × bytes 计算;SWA 层只保留 min(T, window);recurrent / linear attention state 不按逐 token KV 计算;稀疏索引与压缩缓存按模型公开实现单独计入。
所有结果再乘以 batch / tensor_parallel。
GLM-5.1 / GLM-5.2 架构感知:
两者均为 78 层、每层保存 512 维 KV latent + 64 维 RoPE key;DSA 的完整 indexer 另存 128 维 index-K。
GLM-5.1:78 个完整 indexer,因此 elements/token = 78 × (512 + 64 + 128)。
GLM-5.2:IndexShare 由 21 个完整 indexer 服务其余 57 层,因此 elements/token = 78 × (512 + 64) + 21 × 128。
在 BF16、batch=1、TP=1 下,两者分别为 107.25 KiB/token 与 93 KiB/token;GLM-5.2 在 1M context 为 93 GiB。
这里统一按所选 KV 精度计算 index-K;实际引擎可为主 MLA cache 与 indexer cache 采用不同量化格式。
Kimi K2.5 / K2.6 / K2.7 Code 架构感知:
三者公开 config 的文本模型结构相同:61 层 MLA、kv_lora_rank=512、qk_rope_head_dim=64、native context=262,144。
KV_bytes = T × bytes × 61 × (512 + 64)
因此 BF16、batch=1、TP=1 时为 68.625 KiB/token,在 256K context 为 17.15625 GiB。
三条曲线完全重合是架构参数相同的结果;视觉编码器缓存不计入本页文本 KV cache。
MiMo V2.5 Flash / Pro 架构感知:
MiMo V2.5(本页按常用别名标为 Flash)为 48 层:9 个 full-attention 层使用 8 KV heads,39 个 SWA 层使用 4 KV heads;Pro 为 70 层:10 full + 60 SWA,均使用 8 KV heads。
两者 key/value head dim 分别为 192/128,SWA window=128,native context=1,048,576。
KV_bytes = bytes × [(full_layers × T × full_KV_heads + SWA_layers × min(T,128) × SWA_KV_heads) × (192 + 128)]
因此 BF16、batch=1、TP=1、1M context 时,Flash 约为 45.01 GiB,Pro 约为 50.04 GiB;视觉与音频编码器缓存、3 层 MTP 草稿状态不计入文本主模型 KV cache。
腾讯 Hy3 架构感知:
官方 config:80 个主 decoder 层、8 KV heads、head_dim=128、native context=262,144;1 个 MTP 层不计入主模型 KV cache。
KV_bytes = T × bytes × 80 × 8 × (128 K + 128 V)
因此 BF16、batch=1、TP=1 时为 320 KiB/token,在 256K context 为 80 GiB。
Qwen3.5 架构感知:
60 层 = 15 × (3 个 Gated DeltaNet 线性注意力层 + 1 个 Gated Attention 层)。
本页只把 15 个 Gated Attention 层计入随 token 增长的 K/V cache。
DeltaNet 的 recurrent / convolution state 不按逐 token K/V cache 计入。
MiniMax M3 架构感知:
官方 config:60 层、4 KV heads、head_dim=128;前 3 层为 full GQA,后 57 层启用 MSA。
MSA 为选择分支,不会删除需要被任意检索的主 K/V cache;57 个 MSA 层另存 1 个 index-K head(dim=128)。
KV_bytes = T × bytes × [60 × 2 × 4 × 128 + 57 × 1 × 128]
因此 BF16、batch=1、TP=1 时,主 K/V 为 120 KiB/token,计入 index-K 后总量为 134.25 KiB/token。
注意:MSA 的主要收益是把每次注意力读取限制在固定 Top-K block,而不是把持久 KV cache 变成常数空间。
Kimi K3 当前披露边界(2026-07-17):
官方已确认 2.8T 参数、1M context、Kimi Delta Attention (KDA) + Gated MLA 混合结构、Attention Residuals,以及 16/896 Stable LatentMoE。
但总 decoder 层数、KDA state 形状、Gated MLA latent/cache 维度尚未公布;官方表示完整权重最迟于 2026-07-27 发布,技术报告将同步补充。
缺少这些字段无法得到可信的 bytes/token,因此本页先展示 K3 的已知结构与 1M native context,不绘制伪精确曲线。
Laguna-S-2.1 架构感知:
官方 config:48 decoder layers、8 KV heads、head_dim=128;12 层 full attention,36 层 sliding-window attention,sliding_window=512,native context=1,048,576。
entry = 2 × KV heads × head_dim × bytes
KV_bytes = 12 × T × entry + 36 × min(T, 512) × entry
因此 BF16、batch=1、TP=1、1M context 时,KV cache 约为 48.07 GiB。配置中的逐层 Q-head 数为 full=48、SWA=72,但 KV heads 始终为 8,不改变 KV cache 公式。
Step-3.7-Flash 架构感知:
45 decoder layers = 12 × full_attention + 33 × sliding_attention,sliding_window = 512。
entry = 2 × KV heads × head_dim × bytes
KV_bytes = full_layers × T × entry + sliding_layers × min(T, 512) × entry
其中 KV heads = 8,head_dim = 128。
DeepSeek-V4 架构感知:
Flash 使用前 43 层 compress_ratios:2 个 SWA-only、21 个 c4a、20 个 c128a。
Pro 使用前 61 层 compress_ratios:30 个 c4a、31 个 c128a;inference config 的最后 1 个 0 对应 next-n/MTP,不计入核心 decoder。
SWA-only: min(T, 128) × head_dim × bytes
c4a: [min(T,128) + ceil(max(T-128,0)/4)] × head_dim × bytes + ceil(T/4) × index_head_dim × bytes
c128a: [min(T,128) + ceil(max(T-128,0)/128)] × head_dim × bytes
其中 head_dim = 512,index_head_dim = 128。
注意:实际部署中的 KV cache 还会受 paged attention block size、prefix cache、KV 量化格式、tensor parallel 切分方式、 MTP/speculative decoding、服务框架预留内存、batch scheduling、视觉 token 等影响。这个 SPA 适合做容量估算和不同架构的量级对比。