Files
myWiki/papers/deepseek-v4-million-token-context.md

69 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "DeepSeek-V4: 迈向高效百万 Token 上下文智能"
authors: "DeepSeek-AI"
date: "2026"
source: "Hugging Face (Technical Report)"
tags: [large-language-models, mixture-of-experts, long-context, architecture, training]
---
# DeepSeek-V4: 迈向高效百万 Token 上下文智能
> **论文链接**: https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro/blob/main/DeepSeek_V4.pdf
> **模型**: DeepSeek-V4-Pro (1.6T/49B activated) | DeepSeek-V4-Flash (284B/13B activated)
## 核心问题
大语言模型的 reasoning 和 test-time scaling 受限于 vanilla attention 的二次复杂度。如何在保持模型性能的同时,实现百万级 token 的高效推理?
## 方法论贡献
### 1. [[hybrid-attention-architecture]] — 混合注意力架构
结合 [[compressed-sparse-attention]]CSA和 [[heavily-compressed-attention]]HCA大幅降低长上下文的计算量和 KV 缓存:
- **CSA**:沿序列维度压缩 KV cache 后进行稀疏注意力
- **HCA**:激进压缩 KV cache 但保持密集注意力
### 2. [[manifold-constrained-hyper-connections]]mHC— 流形约束超连接
将残差映射矩阵约束到 Birkhoff 多面体(双随机矩阵流形),通过 Sinkhorn-Knopp 算法确保前向/反向传播的数值稳定性。
### 3. [[muon-optimizer]] — Muon 优化器
采用混合 Newton-Schulz 迭代的正交化方法,实现更快收敛和更好的训练稳定性。
### 4. [[on-policy-distillation]]OPD— 在线策略蒸馏
两阶段后训练范式:先独立训练领域专家模型,再通过多教师反向 KL 蒸馏融合为统一模型。
## 关键发现
- **效率革命**1M 上下文下V4-Pro 仅需 V3.2 的 27% FLOPs 和 10% KV cache
- **百万上下文原生支持**:预训练后即可高效处理 1M token 序列
- **混合注意力收益巨大**:相比 BF16 GQA8 基线4.3 层 KV cache 仅约 2%
- **FP4 量化**:路由专家权重和 indexer QK 路径采用 FP4理论可进一步提升 33% 效率
## 技术栈
| 组件 | 技术 | 创新点 |
|------|------|--------|
| 注意力 | CSA + HCA 混合 | 序列压缩 + 稀疏/密集混合 |
| 残差连接 | mHC | 双随机矩阵约束 |
| 优化器 | Muon | 混合 Newton-Schulz 迭代 |
| MoE | DeepSeekMoE | Hash 路由 + 无辅助损失 |
| 量化 | FP4 QAT | MoE 专家权重 FP4 |
| 后训练 | Specialist + OPD | 多教师全词表 KL 蒸馏 |
## 相关概念
- [[compressed-sparse-attention]] — CSA压缩稀疏注意力
- [[heavily-compressed-attention]] — HCA高强度压缩注意力
- [[manifold-constrained-hyper-connections]] — mHC流形约束超连接
- [[muon-optimizer]] — Muon 优化器
- [[on-policy-distillation]] — 在线策略蒸馏
- [[mixture-of-experts]] — 混合专家模型
- [[fp4-quantization-training]] — FP4 量化感知训练
- [[multi-token-prediction]] — 多 Token 预测
- [[test-time-scaling]] — 测试时扩展
- [[million-token-context]] — 百万 Token 上下文
---
*Added: 2026-04-27 | Source: DeepSeek-AI Technical Report*
*See raw archive: [[deepseek-v4-million-token-context]]*