Files
llm-atlas/research/NUMERICS_GROK_LEADS.md

211 lines
11 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.
# 数值精度、优化器与训练稳定性 · Grok Discovery Leads
> **未核验候选,不是正式研究账本。**
>
> 2026-07-29 使用本机 Grok CLI Headless 扩展论文召回。Grok 被要求不修改工作区、不调用子代理,
> 只返回原论文、标准与官方技术报告候选。正式结论只进入 `NUMERICS_RESEARCH.md`
> 且必须由主代理重新打开原文、核对版本、章节、公式、实验设置与限制。
---
## 1. Grok 建议的三条历史主线
### A. 数字怎样在机器里活下来
```text
FP32
→ FP16 mixed precisionFP32 master weights + loss scaling + FP32 accumulate
→ BF16:保留 FP32 的指数位宽,牺牲尾数精度
→ FP8 E4M3 / E5M2:按 tensor 缩放,计算与累加分层
→ fine-grained / block scaling:让离群值只影响小组
→ MXFP432 个 E2M1 元素共享 E8M0 scale
→ QAT:训练时显式经历部署量化误差
```
### B. 梯度怎样变成参数更新
```text
SGD / Momentum
→ Adam:逐元素一阶矩 + 二阶矩
→ AdamW:把 weight decay 从自适应梯度中解耦
→ Adafactor:矩阵行列因子化二阶矩
→ Shampoo:保留张量结构的预条件
→ μP / μTransfer:让超参数跨宽度迁移
→ Muon:对矩阵 momentum 做 NewtonSchulz 正交化
→ scalable Muonweight decay + update RMS matching
→ MuonClip / Per-Head Muon / hybrid MuonAdamW
```
### C. 一次昂贵训练怎样避免突然失控
```text
初始化 / warmup / residual scaling
→ Pre-LN / DeepNorm
→ QK normalization / z-loss / soft-cap
→ 小模型高 LR proxy
→ attention logit 与 SwiGLU outlier 定位
→ QK-Clip / activation clamp / bounded activation
→ 路由、低精度、optimizer state 与集群确定性联合监控
```
这些只是 discovery taxonomy;三条线互相影响,但不能被压缩成一个“稳定性分数”。
---
## 2. 候选一手来源
### 2014–2019:基础格式与自适应优化
| 年份 | 候选 | 原始入口 | Grok 给出的检查点 |
|---:|---|---|---|
| 2014 | Adam: A Method for Stochastic Optimization | <https://arxiv.org/abs/1412.6980> | Algorithm 1;一阶/二阶矩与 bias correction |
| 2015 | Deep Learning with Limited Numerical Precision | <https://arxiv.org/abs/1502.02551> | stochastic rounding 与 16-bit fixed-point |
| 2017 | Mixed Precision Training | <https://arxiv.org/abs/1710.03740> | FP32 master weights、loss scaling、FP32 accumulate |
| 2017 | Decoupled Weight Decay Regularization | <https://arxiv.org/abs/1711.05101> | L2 与 adaptive optimizer 中 weight decay 不等价 |
| 2017 | Quantization and Training of Neural Networks… | <https://arxiv.org/abs/1712.05877> | simulated quantization、fake quant 与 QAT |
| 2018 | Shampoo | <https://arxiv.org/abs/1802.09568> | tensor-mode preconditioner 与扩展成本 |
| 2018 | Adafactor | <https://arxiv.org/abs/1804.04235> | factored second moment、update clipping |
| 2019 | A Study of BFLOAT16 for Deep Learning Training | <https://arxiv.org/abs/1905.12322> | 1-8-7 格式与 FP32 同动态范围 |
### 20202023QK、μP、FP8、量化与 Microscaling
| 年份 | 候选 | 原始入口 | Grok 给出的检查点 |
|---:|---|---|---|
| 2020 | GLU Variants Improve Transformer | <https://arxiv.org/abs/2002.05202> | SwiGLU 原始定义;未讨论低精度 outlier |
| 2020 | Query-Key Normalization for Transformers | <https://arxiv.org/abs/2010.04245> | head 维 L2 norm + learned scale |
| 2021 | 8-bit Optimizers via Block-wise Quantization | <https://arxiv.org/abs/2110.02861> | block-wise dynamic quantization 与 stable embedding |
| 2022 | DeepNet: Scaling Transformers to 1,000 Layers | <https://arxiv.org/abs/2203.00555> | residual scaling、初始化与 bounded update |
| 2022 | Tensor Programs V / μTransfer | <https://arxiv.org/abs/2203.03466> | Maximal Update Parametrization 与跨宽度超参迁移 |
| 2022 | LLM.int8() | <https://arxiv.org/abs/2208.07339> | emergent outlier features 与 mixed INT8/FP16 |
| 2022 | FP8 Formats for Deep Learning | <https://arxiv.org/abs/2209.05433> | E4M3 / E5M2、缩放与 higher-precision output |
| 2022 | GPTQ | <https://arxiv.org/abs/2210.17323> | one-shot weight-only PTQ 与近似二阶补偿 |
| 2022 | SmoothQuant | <https://arxiv.org/abs/2211.10438> | 把 activation 难度迁移到 weight 的等价变换 |
| 2023 | Scaling Vision Transformers to 22B | <https://arxiv.org/abs/2302.05442> | QK LayerNorm 与大规模 logit explosion |
| 2023 | Stable and low-precision training… | <https://arxiv.org/abs/2304.13013> | SwitchBackAdam 二阶矩低估与 loss spike |
| 2023 | QLoRA | <https://arxiv.org/abs/2305.14314> | NF4、double quant、paged optimizer;训练基座仍冻结 |
| 2023 | LLM-QAT | <https://arxiv.org/abs/2305.17888> | data-free distillation、W/A/KV QAT |
| 2023 | Small-scale proxies… | <https://arxiv.org/abs/2309.14322> | 高 LR 小模型复现大尺度不稳定 |
| 2023 | Microscaling Data Formats | <https://arxiv.org/abs/2310.10537> | 32-element block、E8M0 scale、MXFP4 E2M1 |
| 2023 | FP8-LM | <https://arxiv.org/abs/2310.18313> | FP8 gradient / communication / optimizer |
| 2023 | Spike No More | <https://arxiv.org/abs/2312.16903> | “小 sublayer、大 shortcut”的 Jacobian 视角 |
### 20242026Muon、长程 FP8 与生产级 FP4 QAT
| 年份 | 候选 | 原始入口 | Grok 给出的检查点 |
|---:|---|---|---|
| 2024 | Deconstructing What Makes a Good Optimizer… | <https://arxiv.org/abs/2407.07972> | Adam/Adafactor/Lion 对照;尺度只到 1.2B |
| 2024 | Scaling FP8 training to trillion-token LLMs | <https://arxiv.org/abs/2409.12517> | 200B Token 后 SwiGLU outlier 与 Smooth-SwiGLU |
| 2024 | Methods of improving LLM training stability | <https://arxiv.org/abs/2410.16682> | QK norm + soft-cap 的中等规模对照 |
| 2024 | DeepSeek-V3 Technical Report | <https://arxiv.org/abs/2412.19437> | tile/block scaling、FP32 promotion、精度保留表 |
| 2024 | Muon: An Optimizer for Hidden Layers… | <https://kellerjordan.github.io/posts/muon/> | 原始技术博文与 NewtonSchulz update |
| 2025 | Muon is Scalable for LLM Training | <https://arxiv.org/abs/2502.16982> | weight decay、update RMS matching、Moonlight |
| 2025 | Kimi K2 Technical Report | <https://arxiv.org/abs/2507.20534> | MuonClip、QK-Clip、per-head trigger |
| 2025 | FP4 All the Way | <https://arxiv.org/abs/2505.19115> | fully quantized FP4 training 与 quantization-noise threshold |
| 2026 | PowLU | <https://arxiv.org/abs/2605.25704> | bounded activation 与 loss-spike 对照 |
| 2026 | DeepSeek-V4 | <https://arxiv.org/abs/2606.19348> | hybrid Muon、QK RMSNorm、SwiGLU clamp、FP4 QAT |
| 2026 | Kimi K3 | <https://arxiv.org/abs/2607.24653> | Per-Head Muon、SiTU-GLU、MXFP4 QAT |
---
## 3. Grok 建议、但首版不直接采用的线索
以下候选存在“过新、标题/版本漂移、只有推文或缺少大规模复现”等风险:
- Pion、NorMuon、Muon+、Newton-Muon 等 20252026 Muon 分支;
- “Compositional Muon” 的社交媒体讨论;
- 仅由二手文献转述的某些 SwiGLU-Clip 来源;
- 只有厂商吞吐宣传、没有端到端精度与配方对照的格式页面;
- 把所有 outlier 论文合并成一个统一因果理论的综述式结论。
它们可以进入二轮阅读队列,但不得用来证明 K2/K3/V4 的生产实现。
---
## 4. 候选视觉与互动
### 视觉 A:浮点显微镜
- 一个值拆成 sign / exponent / mantissa
- 同时展示 representable range、相邻格点间距、overflow、underflow
- FP8 视图必须显示 scale,不允许让读者误以为格式单独工作。
### 视觉 B:一次 GEMM 的精度流水线
```text
BF16 master / activation
→ group scale
→ FP8 input
→ low-precision multiply
→ higher-precision partial accumulation
→ BF16/FP32 output
```
必须区分“存储格式、乘法输入、累加器、输出、master weights、optimizer states”。
### 视觉 CAdamW vs Muon 更新光谱
- AdamW:逐坐标二阶矩归一;
- Muon:矩阵 momentum → approximate orthogonalization
- 显示 singular values,而不是把 Muon 错画成完整 SVD;
- Per-Head Muon 按逻辑独立 head 分块。
### 视觉 D:稳定性控制室
- attention logits
- activation max / percentile
- gradient norm
- weight / update RMS
- quantization saturation
- MoE expert outlier
- 每条防线标记它干预 forward、backward、optimizer 还是 routing。
---
## 5. 已由主代理回查并纠正的风险
1. **“少一半位数”不自动等于“快两倍”。**
速度取决于硬件指令、kernel、shape、cast、scale、通信与内存瓶颈。
2. **FP8 training 不是“所有 tensor 都是 FP8”。**
DeepSeek-V3 让 GEMM 输入走 FP8,但 attention、normalization、router、master weights、
accumulated gradients 等关键角色保留 BF16/FP32。
3. **MXFP4 不是一个独立标量类型的完整故事。**
标准格式是 32 个 E2M1 元素共享 E8M0 scalescale 粒度与轴是语义的一部分。
4. **PTQ、QAT 与低精度预训练不是同一件事。**
GPTQ/QLoRA 等只回答部分部署或微调问题,不能证明全程 FP4 预训练可行。
5. **Muon 的 `~2×` 是 Moonlight 报告的 scaling-law 作者结果。**
它不是对所有模型、数据和超参数的普遍定理。
6. **K2 的 QK-Clip 与 DeepSeek-V4 的 QK normalization 是结构相关选择。**
K2 报告解释 MLA 中 key 不完全物化带来的约束;V4 的 attention 结构允许直接 RMSNorm。
7. **K3 不只是“继续用 MuonClip”。**
报告同时给出 Per-Head Muon、继承 K2 weight clipping、有界 SiTU-GLU
以及在 post-training 全程对专家权重使用 MXFP4 QAT。
8. **DeepSeek-V4 确实披露训练中遇到 spike。**
报告不是“稳定性完美”的宣传,而是公开 Anticipatory Routing 与 SwiGLU clamping 两个经验补丁。
9. **稳定性不是只有 loss 一条曲线。**
logits、activation、gradient、weight、update、scale、router 与系统错误需要分别监控。
---
## 6. 从候选晋级正式账本的门槛
每条进入正文的结论至少满足:
1. 找到论文 / 标准 / 正式报告的一手入口;
2. 核对标题、版本、作者、年份;
3. 定位到支持结论的章节、公式、图或表;
4. 写清 tensor 角色、格式、group 粒度和计算阶段;
5. 写清模型规模、Token 预算、硬件与 baseline
6. 区分作者报告、课程推导与标准定义;
7. 同时记录失败条件和不可外推范围;
8. 无法公开确认的实现细节明确写为未知。
这份文件保留 Grok 的“召回价值”,并永久阻止未核验摘要越过证据门槛。