M3-012M3: Deep Learning FoundationsWeight InitializationHard
⚡Flashcard Drill➔Mastery:
Maximal Update Parametrization (μP): Concepts and Hyperparameter Transfer
📐 Mathematical Definition
⚡ One-Sentence Core Answer
μP adjusts weight initialization and learning rates by layer width, ensuring optimal hyperparameters (learning rate, schedule) remain invariant as model width scales.
📌 Key Takeaways
- •Problem: under Standard Parametrization (SP), optimal learning rate systematically shifts when scaling width from 256 to 8192
- •μP solution: scales hidden initializations by and output layer learning rates by
- •Hyperparameter transfer: tune optimal learning rate, weight decay, and schedules cheaply on a small model and transfer directly to massive models
📐 Mathematical Derivations
Mathematical Foundation (Yang & Hu, 2021; Tensor Programs):
Under Standard Parametrization (SP), hidden weight matrices are initialized with , and updated with uniform learning rate . As width , feature representations either blow up or collapse into the 'neural tangent kernel (NTK)' lazy-training regime where features do not adapt.
μP Rules:
- Hidden Weights ($W_{\text{hid}} \in \mathbb{R}^{n \times n}$): Initialization ; Learning rate .
- Output / Readout Projection ($W_{\text{out}} \in \mathbb{R}^{d_{\text{out}} \times n}$): Initialization ; Learning rate .
- Attention Logits: Scale attention scores by instead of .
Under μP, every layer's forward activation change and backward gradient update remain in the infinite-width limit. As a result, the optimal learning rate is independent of width .
Under Standard Parametrization (SP), hidden weight matrices are initialized with , and updated with uniform learning rate . As width , feature representations either blow up or collapse into the 'neural tangent kernel (NTK)' lazy-training regime where features do not adapt.
μP Rules:
- Hidden Weights ($W_{\text{hid}} \in \mathbb{R}^{n \times n}$): Initialization ; Learning rate .
- Output / Readout Projection ($W_{\text{out}} \in \mathbb{R}^{d_{\text{out}} \times n}$): Initialization ; Learning rate .
- Attention Logits: Scale attention scores by instead of .
Under μP, every layer's forward activation change and backward gradient update remain in the infinite-width limit. As a result, the optimal learning rate is independent of width .
🏭 Production Trade-offs
Industrial value: Training multi-billion parameter models is too expensive for exhaustive grid searches. μP allows teams to perform comprehensive hyperparameter searches on small proxy models (e.g., 100M parameters) and transfer the discovered optimal learning rate directly to 70B+ production runs without re-tuning.
⚠️ Common Interview Pitfalls
- ✕Assuming μP enables hyperparameter transfer across depth; μP strictly governs width scaling (depth scaling requires additional depth-μP rules)
- ✕Applying μP without scaling the output readout learning rate by , which breaks the parameterization stability
🎯 Interviewer Follow-up Inquiries
- ?Why must attention logits be scaled by rather than in the infinite-width μP regime?
- ?What is the difference between feature learning and the Neural Tangent Kernel (NTK) regime when scaling width?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚
Associated Knowledge Base Guides & Mindmaps
Explore the comprehensive technical article, exam cards, and global architecture tree.
中文速览与面试要点
什么是 μP(最大更新参数化)?它解决什么问题
按宽度调整初始化与学习率,使最优超参在不同宽度下可迁移(超参迁移)。
核心要点
- 问题的背景( 超参迁移失败 ):在标准参数化(SP)下,若把模型的隐藏宽度从 256 增到 4096,最优学习率会 系统性漂移 (通常需要变小)——这意味着每次改模型规模都要重新搜索超参,成本极高。 根因 :宽度增加会改变前向/反向传播中各层的方差尺度(如标准初始化下激活方差随宽度变化),使有效学习率随宽度漂移。 μP(Maximal Update Parametrization) 的解法: 按宽度 调整初始化与学习率——① 隐藏层初始化方差 ∝1/fan_in(保持方差);② 输出层/读取层的学习率 ∝1/width (关键修正);③ 其他参数的学习率按宽度分档调整。 结果 :在 μP 下,最优超参(尤其学习率) 与宽度无关 ——故可用小模型(如 width=256)搜索超参,直接迁移到大模型(width=8192),节省大量成本。 理论依据 是 Tensor Programs 框架(Yang & Hu),它系统分析了'哪些参数化能使无限宽极限下的学习动力学有良好定义'。
- 实践要点与价值:① 核心实用价值 —— 超参迁移 :这是 μP 最大的卖点,对训练大模型极其重要(否则每次改规模都要重新扫超参);实践中先用小模型扫超参、再零样本迁移到大模型。② 与宽度之外维度 ——μP 主要解决 宽度 的迁移;对深度、序列长度、batch size 的迁移有相应理论(如深度 μP、batch size 的临界分析),但不如宽度成熟。③ 实现方式 ——需修改初始化(按 fan_in 缩放)与优化器的参数分组(不同层用不同的学习率缩放);有开源实现(如 mup 库)可直接套用。④ 与标准做法的关系 ——μP 与'残差分支 1/√(2L) 缩放'、'AdamW 解耦衰减'等技巧互补;GPT-2 的缩放初始化是 μP 思想的一个特例。⑤ 实践建议 ——若训练规模会显著变化(如从实验到生产),值得采用 μP;若规模固定,标准参数化 + 网格搜索也能工作(μP 的收益主要在'跨规模迁移')。⑥ 局限 ——μP 的理论假设(无限宽极限)在有限宽下只是近似;且实现比标准训练复杂(需小心参数分组与缩放),调试成本高;实践中应先验证迁移是否真的有效(用两个宽度对比)。
- 小模型调好的超参可直接用于大模型
- 与 Tensor Program 理论相关
常见陷阱
- 认为 μP 能解决所有超参迁移(主要针对宽度)
- 不验证迁移有效性就盲目依赖 μP