Skip to main content
QUICK REVIEW

[论文解读] PowerNorm: Rethinking Batch Normalization in Transformers

Sheng Shen, Zhewei Yao|arXiv (Cornell University)|Mar 17, 2020
Advanced Neural Network Applications参考文献 47被引用 16
一句话总结

本文提出 PowerNorm (PN),一种针对 Transformer 的新型归一化技术,通过放松零均值约束并使用运行中的二次均值来稳定小批量统计量,解决了在自然语言处理(NLP)中批量归一化(BN)的不稳定性问题。PN 显著优于标准层归一化(LN)和原始 BN,在 IWSLT14/WMT14 上分别取得 0.4/0.6 的 BLEU 提升,在 PTB/WikiText-103 上实现 5.6/3.0 的 PPL 改进,且无需调整超参数。

ABSTRACT

The standard normalization method for neural network (NN) models used in Natural Language Processing (NLP) is layer normalization (LN). This is different than batch normalization (BN), which is widely-adopted in Computer Vision. The preferred use of LN in NLP is principally due to the empirical observation that a (naive/vanilla) use of BN leads to significant performance degradation for NLP tasks; however, a thorough understanding of the underlying reasons for this is not always evident. In this paper, we perform a systematic study of NLP transformer models to understand why BN has a poor performance, as compared to LN. We find that the statistics of NLP data across the batch dimension exhibit large fluctuations throughout training. This results in instability, if BN is naively implemented. To address this, we propose Power Normalization (PN), a novel normalization scheme that resolves this issue by (i) relaxing zero-mean normalization in BN, (ii) incorporating a running quadratic mean instead of per batch statistics to stabilize fluctuations, and (iii) using an approximate backpropagation for incorporating the running statistics in the forward pass. We show theoretically, under mild assumptions, that PN leads to a smaller Lipschitz constant for the loss, compared with BN. Furthermore, we prove that the approximate backpropagation scheme leads to bounded gradients. We extensively test PN for transformers on a range of NLP tasks, and we show that it significantly outperforms both LN and BN. In particular, PN outperforms LN by 0.4/0.6 BLEU on IWSLT14/WMT14 and 5.6/3.0 PPL on PTB/WikiText-103. We make our code publicly available at \url{https://github.com/sIncerass/powernorm}.

研究动机与目标

  • 探究为何标准批量归一化(BN)在自然语言处理(NLP)中失败,尽管其在计算机视觉(CV)中取得了成功。
  • 识别 BN 在 NLP 中表现不佳的根本原因,特别是由于小批量统计量方差过高导致的不稳定性。
  • 开发一种归一化方法,在保留 BN 优势的同时克服其在 NLP 任务中的不稳定性。
  • 证明 PowerNorm(PN)在无需超参数调优的情况下,优于 BN 和层归一化(LN),并在多个 NLP 基准上表现更优。

提出的方法

  • 提出 PowerNorm(PN)作为改进的 BN,放松零均值约束,用运行中的二次均值替代方差以稳定统计量。
  • 引入 PN-V 作为变体,仅使用运行中的二次均值而不进行零中心化,从而保持一阶光滑性。
  • 设计一种近似反向传播方案,将运行统计量整合到前向传播中,确保梯度有界。
  • 理论分析表明,在温和假设下,PN 可使损失函数的利普希茨常数更小,且梯度有界。
  • 在机器翻译(IWSLT14、WMT14)和语言建模(PTB、WikiText-103)上进行实证评估,结果一致显示性能提升。
  • 通过嵌入层的奇异值分解(SVD)分析表示能力,表明 PN 可产生更良态的嵌入表示。

实验结果

研究问题

  • RQ1为何标准批量归一化(BN)在 NLP 模型中失败,尽管其在 CV 中表现成功?
  • RQ2是什么导致了 BN 在 NLP 中的不稳定性,特别是小批量统计量方差方面?
  • RQ3能否设计一种改进的 BN 变体,以在 NLP 中稳定训练,同时保留 BN 的优势?
  • RQ4PowerNorm 与层归一化(LN)和原始 BN 相比,在不同小批量大小下的性能和鲁棒性如何?
  • RQ5PowerNorm 是否能通过奇异值分布的测量,提升学习嵌入的表示能力?

主要发现

  • NLP 数据的小批量统计量在整个训练过程中表现出显著高于 CV 数据的方差,导致原始 BN 的不稳定性。
  • PowerNorm(PN)在 IWSLT14/WMT14 上分别优于层归一化(LN)0.4/0.6 的 BLEU 分数,在 PTB/WikiText-103 上分别实现 5.6/3.0 的 PPL 改进,且无需调整超参数。
  • PN-V(无零中心化的变体)仅在大批次大小(如 4K)时与 LN 表现相当,而 PN 在所有批次大小下均持续优于 LN。
  • 原始 BN 在 PTB/WikiText-103 上使性能下降超过 7.5/6.3 的 PPL,而 PN 实现了无需预训练的 SOTA 结果。
  • 奇异值分析表明,PN 在嵌入层中导致奇异值衰减更缓慢,表明其具有更强的表示能力。
  • PN 中的近似反向传播方案确保了梯度有界,这是稳定训练的必要条件,理论已证明。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。