2023

On the Expressivity Role of LayerNorm in Transformers' Attention

Brody, Shaked, Alon, Uri, Yahav, Eran

Understand

Layer Normalization (LayerNorm) is an inherent component in all Transformer-based models.

  • In this paper, we show that LayerNorm is crucial to the expressivity of the multi-head attention layer that follows it.
  • This is in contrast to the common belief that LayerNorm's only role is to normalize the activations during the forward pass, and their gradients during the backward pass.
  • We consider a geometric interpretation of LayerNorm and show that it consists of two components: (a) projection of the input vectors to a $d-1$ space that is orthogonal to the $\left[1,1,...,1\right]$ vector, and (b) scaling of all vectors to the same norm of $\sqrt{d}$.

Built on

  • Recursive deep models for semantic compositionality over a sentiment treebank

    Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. 2013 · 2013

    Earlier work this paper cites.

  • Batch normalization: Accelerating deep network training by reducing internal covariate shift

    Sergey Ioffe and Christian Szegedy. 2015 · 2015

    Earlier work this paper cites.

  • Layer normalization

    Original

    Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. 2016 · 2016

    Earlier work this paper cites.

  • SQuAD: 100,000+ Questions for Machine Comprehension of Text

    Original

    Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016 · 2016

    Earlier work this paper cites.

Similar

  • Attention is all you need

    Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017 · 2017

    Cited alongside, same era.

  • Bert: Pre-training of deep bidirectional transformers for language understanding

    Original

    Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018 · 2018

    Cited alongside, same era.

  • Language models are unsupervised multitask learners

    Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019 · 2019

    Cited alongside, same era.

  • Understanding and improving layer normalization

    Jingjing Xu, Xu Sun, Zhiyuan Zhang, Guangxiang Zhao, and Junyang Lin. 2019 · 2019

    Cited alongside, same era.

  • Wikimedia downloads

    Wikimedia Foundation

    Cited in the paper.

Then

  • Root mean square layer normalization

    Biao Zhang and Rico Sennrich. 2019 · 2019

    Later among the works it cites.

  • Stolen probability: A structural weakness of neural language models

    David Demeter, Gregory Kimmel, and Doug Downey. 2020 · 2020

    Later among the works it cites.

  • On layer normalization in the transformer architecture

    Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tie-Yan Liu. 2020 · 2020

    Later among the works it cites.

  • Low-rank softmax can have unargmaxable classes in theory but rarely in practice

    Andreas Grivas, Nikolay Bogoychev, and Adam Lopez. 2022 · 2022

    Later among the works it cites.

Beyond the bibliography

alphaXiv searches the wider corpus for related work and actual follow-ups.

Open on alphaXiv

alphaXiv is searching for related work…