训练算力需求

🧮 Training Compute Estimator

Estimate total training FLOPs from parameter count and training tokens using Kaplan-style scaling laws, for compute planning.

📐 计算公式 / 原理
训练 FLOPs ≈ 6·N·D(N 为参数量,D 为训练 token 数);训练月数 ≈ 6ND / (卡数 × 单卡算力 × 3600 × 24 × 30)
Transformer 训练的经验法则:前向 2N、反向约 4N,合计每 token 约 6N FLOPs,即 Chinchilla 系列缩放律推导的基础。再除以集群有效算力(须乘 MFU,实际常 30%–50%)得到训练周期。

📐 计算公式与说明

算力判读(与上式互补,Kaplan 口径):C≈6·N·D 中系数 6=前向 2ND+反向 4ND;页面结果按 ×10¹⁸ 展示(N、D 以亿为单位输入),月数由 6ND÷(卡数×单卡 10¹⁵ FLOPS×每月秒数) 换算。校验:无强校验,空值按 0 兜底;结果非有限时提示「部分结果无定义」。判据:无固定分级,GPU 数翻倍训练时间减半,N、D 各增 10 倍算力需求增 100 倍。

N、D 单位需一致,结果数量级参考。

📚 深度解析:训练算力需求

💡 常见使用场景

7B 模型算力
N=7×10⁹, D=1×10¹² → FLOPs≈6×7e9×1e12=4.2×10²²。按 1e15 FLOPs/s(约 1 PFLOPS 有效)需≈4.2e7 秒≈487 天单卡;实际靠千卡集群并行缩短。

❓ 常见问题(FAQ)

6ND 是上限还是典型值?
6ND 是前向+反向的理论下界(理想乘加计数),实际含激活重算、通信与低效会更高;规划时乘以 1.5~3 倍余量更稳妥。
参数量和训练数据哪个更耗算力?
二者线性相乘,等比例增。但现代训练常'数据受限',即数据量不足以让参数充分训练,此时加数据比加参数更划算(直到 Chinchilla 最优点)。

Formula & Standard References

Item Formula / Note Source / Standard
Scaling law training compute approximates six times parameters times training tokens Kaplan et al. 2020 scaling laws
Coefficient origin the factor six counts two forward and four backward multiply-adds per parameter per token Kaplan et al. 2020 scaling laws
Capacity planning total compute divided by measured accelerator throughput gives the required device hours MLPerf training benchmark rules