DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression
基本信息
- 发布时间:2026-09
- 发布机构:DeepSeek-AI
- 模型规模:748B 总参数(552B backbone + 196B Engram),8B/16B 激活(prefill/decode)
- 上下文长度:1M tokens
- 技术报告:DeepSeek-V4.1 Technical Report
- 模型地址:https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash
核心创新
设计目标
解决长上下文 agent 场景的三大瓶颈:
- HBM 容量:global KV cache 占用过大
- SSD/host memory 容量:persistent KV cache 存储压力
- 带宽:cache 迁移与加载成本高
KV Cache 压缩效果
| 指标 | DeepSeek-V4-Flash | DeepSeek-V4.1-Flash | 压缩比 |
|---|---|---|---|
| Global KV cache (bytes/token) | ~3560 | 890 | 1/4 |
| Persistent KV cache | 基准 | 基准的 1/8 | 1/8 |
| Decode FLOPs 增长(4K→1M) | 显著增长 | +25% | 近乎恒定 |
架构设计
1. CED(Causal Encoder-Decoder)
结构划分
总共 40 层 Transformer:
├─ Causal Encoder(层 1-20)
│ ├─ 完整 self-attention + FFN
│ └─ 输出 H_20(encoder 最终隐藏状态)
│
└─ Decoder(层 21-40)
├─ Global KV:从 H_20 投影生成
└─ SWA KV:逐层计算(保留精细建模)
Global Attention 的投影机制
对于 decoder 层 l > 20:
C_l = H_20 @ W_KV_l # Main KV entries
Z_l = H_20 @ W_Z_l # Compression weights
关键特性:
- 不是直接复用:decoder global KV 从 encoder 输出重新投影,非拷贝
- Layer-dependent 投影:每个 decoder 层有独立的
W_KV_l和W_Z_l,保持层间异质性 - 仅限 global branch:SWA 仍然从本层隐藏状态
H_l生成
Prefill 复杂度降低
| 阶段 | 传统 | CED |
|---|---|---|
| 全层前向传播 | O(N·L) | — |
| Encoder(L/2 层) | — | O(N·L/2) |
| Decoder global KV 投影 | — | O(N·L/2·d²) ≈ 可忽略 |
| Decoder SWA bounded replay | — | O(n_win·L/2) |
| 总计 | O(N·L) | O(N·L/2) 当 N >> n_win |
实际减少 接近 50% prefill 计算,特别适合 agent 场景(大量 prefill + 少量 decode)。
与 YoCo 的区别
| 方案 | YoCo | CED |
|---|---|---|
| 上层 KV 来源 | 直接共享下层 KV | 从 encoder 输出投影生成 |
| 层级专用性 | 无(完全共享) | 有(每层独立投影矩阵) |
| KV 表达能力 | 受限(上下层相同) | 保留(可学习不同表示) |
2. CSA2(Compressed Sparse Attention 2)
三种模式
┌─ Full Mode ────────────────────────────┐
│ • 计算 main KV 和 indexer K │
│ • 使用 indexer Q 对 K 打分 │
│ • 选出 Top-K indices │
└────────────────────────────────────────┘
┌─ Reindex Mode ─────────────────────────┐
│ • 复用前层的 main KV 和 indexer K │
│ • 用自己的 indexer Q 重新打分 │
│ • 选出新的 Top-K indices │
└────────────────────────────────────────┘
┌─ Reuse Mode ───────────────────────────┐
│ • 复用前层的 main KV │
│ • 复用前层的 Top-K indices │
│ • 直接执行 sparse attention │
└────────────────────────────────────────┘
所有模式都保留:
- 自己的 main Q
- 自己的 SWA KV
Encoder 配置(18 层 CSA2,compression ratio m=2)
分为 3 组,每组 6 层:
Group 1: [Full, Reuse, Reuse, Reuse, Reuse, Reuse]
Group 2: [Full, Reuse, Reuse, Reuse, Reuse, Reuse]
Group 3: [Full, Reuse, Reuse, Reuse, Reuse, Reuse]
Decoder 配置(20 层 CSA2,compression ratio m=1)
分为 5 组,每组 4 层:
Group 1: [Full, Reuse, Reuse, Reuse]
Group 2: [Reindex, Reuse, Reuse, Reuse]
Group 3: [Reindex, Reuse, Reuse, Reuse]
Group 4: [Reindex, Reuse, Reuse, Reuse]
Group 5: [Reindex, Reuse, Reuse, Reuse]
Hierarchical Sparse Indexer(仅 Decoder)
目标:减少 decoder 深层 indexer 的计算量
机制:
- Decoder 首个 Full Mode 层(Group 1 第一层):
- 对全部 causally visible 位置打分
- 选出 Top-512 indices 用于自己的 attention
- 同时进行 blockwise candidate selection:
- 将位置分为 blocks(每 block 8 个位置)
- 每个 block 取最大 indexer score
- 选出 Top-2048 blocks → 16,384 个候选位置
- 后续 Reindex Mode 层:
- 只在这 16,384 个候选位置内打分
- 从中选出自己的 Top-512 indices
复杂度:
- First Full layer:O(context_length) per query
- 后续 Reindex layers:O(16384) per query(与 context length 无关)
与 CSA/HCA 的简化
相比 DeepSeek-V4 的 CSA:
- 去除 overlap:压缩比 m 的 entry 从 2m 个 KV 生成(有 overlap)→ 从 m 个生成(无 overlap)
- 去除 absolute PE:不再在压缩时编码位置信息
- 统一架构:纯 CSA2,不再混合 HCA(Heavily Compressed Attention)
- 统一 indexer K 来源:从 main KV 投影,而非从隐藏状态单独压缩
3. FP4 Main KV Cache
格式选择
- 训练格式:E2M1(NVFP4 风格),单 E4M3 scale per 16 channels
- 动态范围:支持 magnitude 最大 448×6=2688
- RMSNorm 后 KV latent(512-d)的 L2 norm ≤ √512 ≈ 22.6
- RoPE 保持 norm 不变
- 训练实测最大 magnitude ~10
- 去除二级 scale:NVFP4 的 global scale 对 KV cache 冗余,省略以简化布局
- 部署格式:为硬件兼容性使用 OCP-standard MXFP4(虽然精度略低)
量化策略
- Main KV cache:FP4(E2M1 训练,MXFP4 部署)
- Indexer Q/K:FP4(沿用 V4 的 QAT)
- SWA KV cache:FP8(对量化敏感,保留更高精度)
- 量化时机:RoPE 之后(decode 时直接用 dequantized 值做 attention)
引入时机
后训练(post-training)阶段引入 QAT,基于 V4 训练好的高精度权重。
4. SWA Bounded Replay(部署优化)
核心问题
- V4 策略:持久化 SWA KV 到 SSD,完整 replay 需要 L×n_win tokens
- 成本:SWA KV 占 persistent cache 近 50%,但复用窗口短(分钟级)
V4.1 解决方案
Encoder SWA Bounded Replay:
# 传统:完整重建需要 replay L×n_win tokens
for l in range(L):
swa_kv[l] = compute_layer(tokens[-L*n_win:])
# Bounded Replay:只 replay n_win tokens
swa_kv = compute_all_layers(tokens[-n_win:]) # 截断 SWA 范围- 存储策略变更:
- SWA KV 不再进入 persistent cache(SSD)
- 放入分布式内存池(10% host DRAM,TTL 分钟级)
- Miss 时成本:O(n_win×L/2) vs 原 O(L×n_win)
- 质量影响:实验显示”negligible performance degradation”
Decoder SWA Bounded Replay:
CED 架构下,decoder global KV 从 encoder 投影获得,但 decoder SWA KV 仍需生成:
# 传统:需要 replay L/2 × n_win tokens 通过 decoder
decoder_swa = compute_decoder(tokens[-L/2*n_win:])
# Bounded Replay:只 replay n_win tokens
decoder_swa = compute_decoder(tokens[-n_win:]) # 每层 SWA 范围截断训练感知:后训练阶段模拟 bounded replay,让模型适应这种近似。
效果汇总
| 优化 | 减少量 | 备注 |
|---|---|---|
| Global KV FP4 + CSA2 | 1/4 | 架构 + 精度 |
| Persistent cache 移除 SWA | 额外 ~1/2 | 存储策略 |
| 总 persistent cache 减少 | 1/8 | 相对 V4-Flash |
5. 其他架构模块
Single-Pass mHC
原 mHC(DeepSeek-V4):
X_{l+1} = B_l @ X_l + C_l @ F_l(A_l @ X_l)
(A_l, B_l, C_l) = H(X_l)
需要 3 个串行 kernel:
- Residual update:
X_l = B_{l-1} @ X_{l-1} + C_{l-1} @ Y_{l-1} - Coefficient prediction:
(A_l, B_l, C_l) = H(X_l) - Input mixing:
X̂_l = A_l @ X_l
激活内存流量:(4n+4)d
Single-Pass mHC:
X_{l+1} = B_l @ X_l + C_l @ F_l(A_{l-1} @ X_l) # 用前一层的 A
(A_l, B_l, C_l) = H(X_l)
依赖解耦:input mixing 用 A_{l-1},不需要等当前层的系数计算完成
Mega-mHC 融合 kernel:
- 单次遍历完成:residual update + input mixing + coefficient prediction
- 激活内存流量:(2n+2)d(减半)
- 达到理论下界
Engram(条件记忆)
配置:
- 总参数:196B(不计入 552B backbone)
- 部署:2 个模块,分别在第 1 和第 14 层(zero-indexed)
- 每模块:
- n-gram 阶数:{2, 3, 4}
- Hash heads:8 per order
- 总 embedding 维度:2048 per order
- 表大小:~16M entries per head(不同质数)
- 精度:Embedding table 和 K/V projection 用 FP8
优化策略:
- 训练优化器:Momentum + Sinkhorn balancing(代替 Adam,减少优化器状态内存)
- 推理 prefetch:确定性寻址 → 后台 RDMA 预取(与首层计算 overlap)
DSpark(投机解码)
训练时机:backbone 预训练后单独训练(冻结 backbone),后训练时继续训练(不回传梯度到 backbone)
结构:
- Drafter:3 层 Transformer blocks(SWA 128)
- 并行草稿:单次前向生成 5 个 draft positions
- Markov head:建模 draft tokens 依赖
- Confidence head:预测 per-position 接受概率 → prefix survival probability
- Scheduler:结合 throughput curves 动态选择验证长度
DeepSeek-ViT(视觉编码器)
架构:
- 32 层 ViT,hidden_dim=1024,16 attention heads,patch_size=14
- 位置编码:2D-RoPE(支持任意分辨率)
- 归一化:RMSNorm
- 激活函数:SwiGLU
- 降采样:3×3 pixel-unshuffle(降 9 倍 token 数)→ 支持最大 ~1344×1344 分辨率
训练两阶段:
- Contrastive pretraining:
- 47B 图文对(alt-text)
- Sigmoid contrastive loss(SigLIP)
- 分辨率:224×224(低分辨率加速训练)
- Autoregressive fine-tuning:
- 连接 4B MoE LLM
- 236B tokens(captions + alt-text + charts + OCR)
- 分辨率:544×544 ~ 1344×1344
- 训练后丢弃 LLM,保留 ViT
MLP Projector:2 层,hidden_dim=5120
Multimodal Load Balancing:
- 图像和文本 token 分别维护 expert-wise correction biases
- Routing 时按 modality 选 bias,权重仍用原始 score
- Sequence-level balance loss(weight 0.0001)防止单序列极端不均
详细配置
Transformer 参数
| 组件 | 配置 |
|---|---|
| 总层数 | 40(20 encoder + 20 decoder) |
| Hidden dimension | 5120 |
| Query heads | 64 |
| Head dimension | 512 |
| Query compression dim | 1280 |
| Output projection groups | 8 |
| Intermediate dim per group | 1024 |
| SWA window size (n_win) | 128 |
CSA2 参数
| 参数 | Encoder | Decoder |
|---|---|---|
| Compression ratio (m) | 2 | 1 |
| Indexer Q heads | 32 | 32 |
| Indexer head dim | 128 | 128 |
| Attention Top-K | 512 | 512 |
| Hierarchical candidate pool | — | 16,384 (2048 blocks × 8) |
MoE 参数
| 参数 | 值 |
|---|---|
| Shared experts | 1 |
| Routed experts | 384 |
| Activated experts per token | 6 |
| Expert intermediate dim | 2304 |
| Activation function | SwiGLU (clamped at 10) |
mHC 参数
| 参数 | 值 |
|---|---|
| Expansion factor | 4 |
| Sinkhorn-Knopp iterations | 20 |
训练
预训练数据
规模:45T tokens
- 模态比例:7:1(文本:多模态)
- 文本:
- 过滤低能力模型生成内容和机器翻译(视为隐式重复)
- 新增最新代码(repos + commits + libraries + frameworks)
- Model-in-the-loop data iteration(为未来合成数据奠基)
- 领域专家标注细粒度质量维度
- 多模态:
- Image-text pairs:alt-text + 图文相关性过滤 + 语义去重
- Interleaved data:webpages + PDFs,分阶段过滤(启发式 → 统计 → 质量模型 → SmolVLM 严格打分)
- Domain-specific:visual grounding + OCR + long-tail knowledge + image-code pairs + computer-use trajectories
- 去重:
- 文本-多模态 union(多模态版本优先,取更大 epoch count)
- Ultra-long documents 预切分后再 mix
- Best-fit packing:padding rate ≤ 10
优化器
Muon(矩阵参数):
- 适用:Linear 层权重矩阵、Engram projection、vision-language projector
- Head-wise Muon:Query/Key 按 head 切分后再应用(提供 per-head 预条件)
- 配置:momentum=0.95,weight_decay=0.1,RMS rescale=0.18(复用 AdamW lr)
AdamW(非矩阵参数):
- 适用:RMSNorm weights + biases + scaling factors
- 配置:β1=0.9,β2=0.95,ε=10^-20,weight_decay=0.1(仅 norm weights)
Sinkhorn-balanced update(大矩阵):
- 适用:Engram embedding tables + token embedding + prediction head
- 配置:
- Momentum=0.95,lr correction=0.18(同 Muon)
- K=11(Sinkhorn 迭代),τ=10^-3(row masking),ε=10
- 不使用 weight decay
- 算法:见 Algorithm 1(row/column RMS normalization + Nesterov momentum)
Engram 特殊处理:
- 学习率 scale by 5× 相对基础 lr
- Sinkhorn 保持 row/column scaling vectors 避免重复写全矩阵
- RL rollout 时 Engram tables 常驻 GPU memory(避免 host memory OOM)
训练超参数
| 阶段 | Token 范围 | Batch size | Learning rate | 序列长度 |
|---|---|---|---|---|
| Warmup | 0-2000 steps | 100.6M tokens | 0 → 2.6×10^-4(线性) | 64K |
| Main training | 2000 steps - 28T | 100.6M | 2.6×10^-4 | 64K |
| LR decay | 28T - 40T | 100.6M | 2.6×10^-4 → 2.6×10^-5(cosine) | 64K |
| Context extension | 34T | 100.6M | 继续 cosine | 64K → 1M |
| Final | 40T - 45T | 100.6M | 2.6×10^-5 | 1M |
Vision encoder 训练策略:
- Main training:冻结(除 final norm layer + projector)
- LR decay 阶段:解冻全部,用更小 lr 联合训练
负载均衡(Multimodal MoE):
- Image/text bias update speed:0.001
- Sequence-level balance loss weight:0.0001
其他:
- 稀疏注意力从头训练(无 dense warmup)
- Sample-level attention masking
训练基础设施
Vision encoder 并行:
- Disaggregated design:ViT 在 LLM 参数树外复制
- 三阶段执行:ViT forward → LLM forward/backward → ViT backward
- Communication-computation overlap:
- Contrastive learning:AllGather(Vision) || Forward(Text)
- AllGather(Text) || Backward(Text)
Long-sequence multimodal:
- Balanced image sharding:图像跨 CP ranks 负载均衡分片(单次加载)
- Incremental image transfer(RL):增量传输 + cache CPU 解码/预处理到分布式文件系统
CSA2 跨 stage 支持:
- Shadow indexers:每个 stage 放轻量副本,单一逻辑 owner 负责优化/checkpoint
- Pipeline payload extension:传递中间表示 + sparse routing info(与 context parallelism 对齐)
- Micro-batch shared-state management:跨 forward/recomputation/backward 协调生命周期
后训练
核心理念
“no algorithmic innovation: the recipe follows the standard paradigm of SFT → RL → OPD”
所有提升来自:
- 大规模自动化任务合成
- 环境构建与扩展
- 数据质量控制(过滤 + 去重 + 难度校准)
任务合成管线
通用 Agent
数据源:
- 内部员工 + 外部合作伙伴自愿返回的交互数据
- 大规模负反馈 + 失败案例
环境构建:
- Mocked tools:重现真实工具的 interface + behavior(SaaS + 企业后台 + 专用业务系统)
- 单轮/多轮环境:基于真实 workflow + 失败条件构建
- Task triplet:(problem, environment, verification system)
质量信号:
- Difficulty:确保非平凡
- Correctness:无致命缺陷
- 用作 RL reward,迭代训练任务构建能力
代码 Agent
数据源:
- 内部/外部 coding-agent 会话(高复杂度 + 失败案例 + trajectory 去重)
- GitHub repos(star 阈值)
环境构建(多智能体协作):
Agent 1(设计):
- 判断是否可容器化 + 自动验证
- 选择 turn/commit 作为起点
- 设计实现方向
- 产出 evaluation points(fail-to-pass + pass-to-pass)
- 按需从 web 获取外部资源
↓
Agent 2(实现):
- 在隔离容器设置依赖 + 工作目录 + 测试代码
- 自测试
- 移除 solution 泄露痕迹
- 打包为新 image layer
↓
Solving Agents(测试):
- 多个不同 agent 尝试任务
↓
Quality Inspector(检查):
- 审查环境 + 轨迹
- 检查:环境问题 + 事实错误 + eval/description 不匹配 + hackability
↓
Repair Agent(修复):
- 修复所有识别的错误
- 调整过易/过难的 eval points
- 重新进入验证
强化学习
Scaling 两个维度:
- 训练计算量:cumulative RL steps
- Scaffold 数量:单一 scaffold 内 + 同 scaffold 变体 + 异构 scaffolds
Rollout 架构(跨异构 scaffolds):
┌─ Agent Sandbox ─────────────────┐
│ 运行 scaffold + tools │
└─────────────────────────────────┘
↕
┌─ Worker Container ──────────────┐
│ • Scaffold-agnostic 控制层 │
│ • 交互归一化为通用 trajectory │
│ • 与 trainer 通信 │
└─────────────────────────────────┘
DSec 支持:
- Rollout 与 training GPU pool 分离
- Trainer preemption 时 suspend + offload rollout 状态
模型合并:
- 跨 run/scaffold/config 的 checkpoints 合并
- 重初始化下一轮 RL(见 Figure 7/8 的断点续跑)
DSec(DeepSeek Elastic Compute)
规模:百万级并发 sandbox instances
水平扩展
Sharding:
- 分割为多个 scale units(隔离爆炸半径)
Relaxed-consistency scheduling:
- 多个独立 placement engine 副本(无同步协调)
- 基于近期测量预测资源可用性
- 每个 node 本地验证 placement(超过 warning threshold 拒绝)
高密度部署
Sub-NUMA partitioning:
- Worker VM 绑定单独 NUMA domain
- Container 运行在 VM 内,CPU/memory 限制在 VM 的 local NUMA
- 平衡激进内存 overcommit vs kernel lock contention
- 密度:~1000 → 2500+ concurrent containers per node(无性能退化)
Latency-sensitive (LS) execution class:
- Non-LS tasks:
SCHED_IDLE(最低调度优先级) - Core scheduling:同优先级任务才在 sibling hyperthreads 并发(消除干扰)
Misbehavior 缓解
观察到的 agent 攻击:
- XFS driver permission issue
- AppArmor illegal memory access
- 从 package mirror 泄露答案
- 删除关键 binaries / 破坏系统文件 / 移除文件系统
防御措施:
- Per-sandbox AppArmor profiles
- eBPF-based 细粒度网络策略
- Crash 视为 failed trajectory + “repercussion” signal 反馈 RL
可控推理力度
目标:单一 checkpoint 提供 cost-quality 连续调节
接口:标量 effort level b ∈ {1, ..., 100}(插入 system prompt)
机制:
# 每个 effort level b 采样 M_b 个 responses
z_{b,j} ~ π_θ(·|x, b)
# Subgroup 内 mean-centering(不同 effort level 不直接比较)
advantages = relative_to_group_mean(rewards)
# Length penalty(effort-dependent)
r_len_{b,j} = -min(C_max, k(b) · ℓ_{b,j} / L_norm)
# Exponential decay of penalty coefficient
k(b) = k_0 · exp(-(b - b_min) / τ)
参数含义:
k_0:最低 effort level 的基础惩罚系数τ:衰减速率(增加 τ 使 penalty 降为 e^-1)λ:τ = λ·Δb,Δb 为训练 effort levels 平均间隔
理论动机(见 Appendix C):
假设边际收益指数衰减 p'_x(ℓ) ≈ a_x·exp(-ℓ/s_x),则最优长度与 effort 近似线性:
ℓ*_x(b) ≈ C_x + (s_x/τ)·(b - b_min)
API mapping(production deployment Sept 2026):
low:b=50high:b=75max:b=100
异步 RL 基础设施
动机:长尾问题 bottleneck rollout 效率
并发维护:
- 上界:upper bound on in-flight samples
- Sample-level dispatch:新完成样本数达到 GRPO group size → dispatch 下一个 prompt(无论哪个 group 产生)
Checkpoint 切换:
- Token-level interruption:任意 token boundary 停止
- State persistence:KV cache + expert routing 存为 token granularity
- Seamless resumption:新 checkpoint 直接复用状态(无 re-prefill)
- Sample-grained GC:完成即释放
Off-policy & length bias 缓解:
- Length bias:
- Per-dataset concurrency limit(调节稳态比例)
- 丢弃过早返回的短样本(平滑到稳态分布)
- Off-policy:
- Bound max off-policy ratio(调节 dispatch + waiting logic)
- Loss masking:消除过旧 token 的梯度贡献
Concatenated routing-replay:
- 跨多 checkpoint 的样本:拼接各 segment 的 expert routing(不丢弃重算)
大规模 On-Policy Distillation
规模:40+ teacher models,跨所有领域
异构支持:
- Teacher 可架构不同(相互间 + 与 student)
- 每个 domain 的最佳 teacher 可来自不同训练阶段
- 切换 teacher 成本可忽略
动态重配置:
- 训练中调整:dataset mixture + per-dataset concurrency + active teachers
- 异步设置下不同 config 的样本可能共存 in-flight
- 基础设施支持无缝 transition(不中断 rollout/training)
性能评估
Base Model(预训练)
与 DeepSeek-V4-Flash-Base / V4-Pro-Base 对比(内部评估框架):
| Benchmark | V4-Flash-Base | V4-Pro-Base | V4.1-Flash-Base |
|---|---|---|---|
| 激活参数 | 13B | 49B | 8B/16B |
| 总参数 | 284B | 1.6T | 552B |
| AGIEval | 83.9 | 84.4 | 83.4 |
| MMLU-Pro | 68.3 | 73.5 | 74.1 |
| C-Eval | 92.1 | 93.1 | 92.1 |
| BBH | 86.9 | 87.5 | 86.1 |
| BigCodeBench | 56.8 | 59.2 | 60.6 |
| HumanEval | 69.5 | 76.8 | 79.4 |
| GSM8K | 90.8 | 92.6 | 93.0 |
| MATH | 57.4 | 64.5 | 61.1 |
| LongBench-V2 | 44.7 | 51.5 | 45.2 |
| Multimodal | — | — | |
| MMMU-Pro | — | — | 56.5 |
| CVBench | — | — | 77.9 |
| DocVQA | — | — | 95.6 |
| RefCOCO-avg | — | — | 86.0 |
Held-out BPB(内部语料):V4.1-Flash-Base 在所有任务上均最低(5%-10% 提升)
Post-Training(Max effort)
Reasoning
| Benchmark | Opus-5 | GPT-5.6 Sol | K3 | GLM-5.3 | V4-Pro | V4-Flash | V4.1-Flash |
|---|---|---|---|---|---|---|---|
| GPQA Diamond | 93.4 | 94.1 | 92.9 | 88.1 | 92.4 | 89.9 | 90.9 |
| HLE | 56.3 | 44.5 | 43.5 | 42.0† | 42.7† | 37.8† | 36.8 (39.1†) |
| Codeforces | — | — | — | — | 3348 | 3289 | 3471 |
| MathArena Apex | — | — | 65.6 | — | 65.3 | 58.6 | 65.6 |
Code Agent
| Benchmark | Opus-5 | GPT-5.6 Sol | K3 | GLM-5.3 | V4-Pro | V4-Flash | V4.1-Flash |
|---|---|---|---|---|---|---|---|
| Terminal-Bench 2.1 | 89.1 | 88.8 | 88.3 | 88.2 | 87.9 | 82.7 | 90.6 |
| Terminal-Bench 3.0 | 43.3 | 34.4 | 17.7 | 28.3 | 11.8 | 7.6 | 30.0 |
| Terminal-Bench 4.0 | 51.8 | 39.9 | 12.6 | 37.9 | 12.4 | 7.0 | 31.2 |
| DeepSWE v1.1 | 74.0 | 73.0 | 67.5 | 66.9 | 62.7 | 54.4 | 74.2 |
| ProgramBench | 37.0 | 23.0 | 17.5 | 19.0 | 15.5 | — | 20.3 |
| NL2Repo-Bench | 75.3 | 56.8 | 58.0 | 58.0 | 61.5 | 54.2 | 65.4 |
Cyber Security
| Benchmark | Opus-5 | GPT-5.6 Sol | K3 | GLM-5.3 | V4-Pro | V4-Flash | V4.1-Flash |
|---|---|---|---|---|---|---|---|
| CyberGym | — | 84.5 | 80.0 | 84.5 | 83.3 | 76.7 | 88.1 |
| SEC-Bench Pro | — | 74.3 | — | — | 56.4 | 30.9 | 62.8 |
| ExploitGym | 22.1 | 33.7 | — | 15.0 | 5.4 | 1.8 | 15.3 |
General Agent
| Benchmark | Opus-5 | GPT-5.6 Sol | K3 | GLM-5.3 | V4-Pro | V4-Flash | V4.1-Flash |
|---|---|---|---|---|---|---|---|
| HLE w/ tools | 63.6 | — | 59.8 | 62.5 | 60.0 | 51.5 | 63.9 |
| AutomationBench | 50.3 | 45.8 | 46.7 | 48.8 | 43.2 | 37.7 | 54.8 |
| Agents’ Last Exam | 28.6 | 26.7 | 27.6 | 28.5 | 25.7 | 25.2 | 31.8 |
Visual Agent
| Benchmark | Opus-5 | GPT-5.6 Sol | K3 | V4.1-Flash |
|---|---|---|---|---|
| Chartography | 84.0 | 79.9 | 68.1 | 78.9 |
| BabyVision | 94.1 | 88.9 | 85.7 | 89.6 |
| ZeroBench-main | 52.0 | 53.0 | 41.0 | 49.0 |
Reasoning Effort Scaling
8 Reasoning Benchmarks 平均(AIME 2026 + Apex 2025 Shortlist + GPQA Diamond + HLE-Text + IMO-AnswerBench + LiveCodeBench + MathArena Apex + SimpleQA-Verified):
| Effort | Pass@1 | Avg tokens |
|---|---|---|
| 25 | 67.1% | ~8k |
| 40 | 70.5% | ~12k |
| 60 | 73.8% | ~16k |
| 80 | 75.6% | ~21k |
| 100 | 76.3% | ~25k |
DeepSWE v1.1(mini-SWE):
| Effort | Resolved | Avg tokens |
|---|---|---|
| 25 | 66.0% | ~50k |
| 40 | 69.2% | ~80k |
| 60 | 71.8% | ~120k |
| 80 | 73.5% | ~170k |
| 100 | 74.2% | ~210k |
Terminal-Bench 2.1(DSH Minimal):
| Effort | Pass@1 | Avg tokens |
|---|---|---|
| 25 | 82.4% | ~25k |
| 40 | 86.1% | ~40k |
| 60 | 88.5% | ~60k |
| 80 | 89.8% | ~75k |
| 100 | 90.6% | ~90k |
特性:
- Accuracy 单调提升(无退化)
- 长度线性增长(2.0-3.1× from 25→100)
- 60-80 range 已恢复大部分准确率(< 一半 token budget)
- 单一 checkpoint 提供连续 cost-quality trade-off
跨 Scaffold 鲁棒性
DeepSWE v1.1 (N=8 samples, max_steps=500, 1M context, temp=1.0, top_p=0.95):
| Scaffold | Resolved |
|---|---|
| mini-SWE | 74.2% |
| DeepSeek Harness (Minimal) | 72.6% |
| DeepSeek Harness (Standard) | 70.5% |
| Claude Code (v2.1.251) | 69.8% |
| DeepSeek Harness (PTC) | 67.6% |
| Pi | 66.2% |
| OpenCode | 65.5% |
| Codex | 65.6% |
Terminal-Bench 2.1 (N=3 samples):
| Scaffold | Pass@1 |
|---|---|
| DeepSeek Harness (Minimal) | 90.6% |
| DeepSeek Harness (Standard) | 85.8% |
| DeepSeek Harness (PTC) | 85.8% |
| Claude Code (avg 4 versions) | 87.8% |
| Pi | 86.1% |
| OpenCode | 85.0% |
| Codex | 84.1% |
结论:性能在不同 prompt/tool schema/turn-taking logic 下保持鲁棒(未过拟合单一 harness)
多智能体协作
Harness:DeepSeek Harness Agent Team mode
- Lead agent 异步创建 teammates(
spawn_teammate) - Shared repo checkout(编辑互相可见)
- Durable peer mailbox(
send_message) - Task board(
team_task_*tools,revision checks) - Interrupt 机制(
interrupt_agent)
训练 reward:
- Task performance
- Collaboration bonus(鼓励委派与沟通)
- Derived-latency penalty(DAG critical path,促进高效协调)
ProgramBench(172 golden tasks,Almost@1):
| Deadline | Single-agent | Multi-agent |
|---|---|---|
| 1h | 12.79% | 13.59% |
| 2h | 15.12% | 18.02% |
| 4h | 17.73% | 23.26% |
| 8h | 19.38% | 28.26% |
| 12h | 20.39% | 30.04% |
FrontierSWE v2 no-GPU(Mean@5):
| Deadline | Single-agent | Multi-agent |
|---|---|---|
| 1h | 10.50% | 13.50% |
| 2h | 15.30% | 18.90% |
| 4h | 20.10% | 24.70% |
| 8h | 24.60% | 29.40% |
| 20h | 28.20% | 32.90% |
收益:每个 deadline 上多智能体均超越单智能体(+4-10 points)
推理系统
内核效率
Reuse Mode 层(占大多数):
- Prefill:15 kernels
- Decode:11 kernels
融合内核:
- FlashMLA:fused-RoPE-attention-RoPE-cast
- DeepGEMM:Mega-Gate + Mega-mHC + Mega-MoE
- TileKernels
- DeepSelect:TopK
部署架构
EPD(Encoder-Prefill-Decode)disaggregation:
- Vision encoding / prefill / decoding 独立扩展
- 执行 overlap
Persistent KV Cache 管理
V4.1 策略:
- Global KV:完整存储在 persistent cache(SSD/host memory,72h+ TTL)
- SWA KV:移至分布式内存池(10% host DRAM,分钟级 TTL)
- 访问模式差异:
- Global KV:长尾复用(小时-天)
- SWA KV:窄窗口复用(分钟级,session 内)
Miss 处理:
- Global KV hit + SWA KV miss:Encoder SWA Bounded Replay(成本低廉)
- 高 turnover 使内存池足够应对大部分并发活跃 sessions
局限性与未来方向
架构鲁棒性边界
未完全表征:
- CSA2 潜在选择错误(长上下文稀疏检索)
- SWA Bounded Replay 近似重建(cache 恢复边界)
未来工作:
- 扩展 stress-testing(长上下文稀疏检索)
- 监控真实负载的失败模式
- 改进极端条件下的鲁棒性
性能差距
Benchmark 饱和 vs 真实能力:
- 接近 Fable-5/GPT-6 Astra(日常体验相似)
- 但在最难任务上仍有差距(高难度推理 + edge cases)
未来方向:
- 更新评估协议(评估 SOTA 推理边界)
- 协同 scaling:data + model capacity + RL
- Model-harness co-design(联合系统优化)
相关工作
KV Cache 压缩
- GQA(Ainslie et al., 2023):减少 KV heads
- MLA(DeepSeek-V2):跨 heads 共享小 latent
- Cross-layer KV reuse:
- Brandon et al., 2024
- IndexCache(Bai et al., 2026):复用 Top-K indices
- YOIO(Sun et al., 2026b):单次 sparse routing 全层共享
- HySparse(Gao et al., 2026):sparse 层复用 dense 层 KV
CSA2 独特性:覆盖三个乘性维度(entry size × sequence × layer)
Encoder-Decoder
- YoCo(Sun et al., 2024):上半层直接共享下半层 KV
- CED 改进:layer-dependent 投影 + 保留 KV 表达能力
优化器
- Muon(Jordan et al., 2024):Newton-Schulz 预条件
- Adafactor(Shazeer & Stern, 2018):row/column 分解
- Adammini(Zhang et al., 2025a):embedding/head 行归一化
- Sinkhorn balancing(Scetbon et al., 2025):从 SinkGD 扩展到 embedding tables
引用
@article{deepseek2026v41,
title={DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression},
author={DeepSeek-AI},
journal={arXiv preprint},
year={2026},
url={https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash}
}资源链接
- HuggingFace: https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash
- 技术报告 PDF: https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/blob/main/DeepSeek_V41_Tech_Report.pdf
- 相关仓库:
- FlashMLA: https://github.com/deepseek-ai/FlashMLA
- DeepGEMM: https://github.com/deepseek-ai/DeepGEMM
- TileKernels: https://github.com/deepseek-ai/TileKernels
- DeepSelect: https://github.com/deepseek-ai/DeepSelect
- DeepSeek Harness: https://github.com/deepseek-ai/deepseek-harness