Files
myWiki/concepts/fp4-quantization-training.md

50 lines
1.5 KiB
Markdown
Raw Permalink 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: "FP4 Quantization-Aware Training"
domain: "Deep Learning / Model Compression"
tags: [quantization, training, fp4, efficiency]
sources: [[deepseek-v4-million-token-context]]
---
# FP4 Quantization-Aware Training (FP4 QAT)
> **类型**: Concept (Tier 2 — Foundation)
> **来源**: [[deepseek-v4-million-token-context]]
## 定义
FP4MXFP4量化感知训练是一种低精度训练技术将模型权重量化到 4 位浮点格式以降低内存和计算开销。DeepSeek-V4 在 MoE 专家权重和 indexer QK 路径中应用 FP4 QAT。
## 核心设计
### 应用范围
- **MoE 路由专家权重**FP4 存储和推理
- **Indexer QK 路径**FP4 计算
### 训练流程
1. **前向传播**:原生 FP4 权重用于 rollout 和推理(降低内存流量)
2. **反向传播**FP4 → FP8 无损反量化 → 复用 FP8 混合精度框架
3. **主权重**FP32 精度维护
### 损失函数设计
FP4 量化误差通过额外损失项控制:
- Block-wise 量化(每 block 独立缩放因子)
- 无需修改反向传播管线
## 效率收益
| 场景 | FP8 | FP4 理论收益 |
|------|-----|-------------|
| 权重存储 | 8-bit/param | 4-bit/param (50% ↓) |
| 计算吞吐 | 基准 | +33%(未来硬件) |
当前硬件上 FP4 × FP8 峰值 FLOPS 与 FP8 × FP8 相同,但未来硬件可释放额外 33% 效率。
## 相关概念
- [[mixture-of-experts]] — MoE 混合专家
- [[million-token-context]] — 百万 Token 上下文
---
*Last Updated: 2026-04-27*