Incorporating Residual and Normalization Layers into Analysis of Masked Language Models

Goro Kobayashi, Tatsuki Kuribayashi, Sho Yokoi, Kentaro Inui
9/15/2021
71 citations
cs.CL
transformer-attention

Official code: gorokoba560/norm-analysis-of-transformer (87 stars, Jupyter Notebook, last commit 2024-04-16).

Abstract

Transformer architecture has become ubiquitous in the natural language processing field. To interpret the Transformer-based models, their attention patterns have been extensively analyzed.

Show full abstract

However, the Transformer architecture is not only composed of the multi-head attention; other components can also contribute to Transformers' progressive performance. In this study, we extended the scope of the analysis of Transformers from solely the attention patterns to the whole attention block, i.e., multi-head attention, residual connection, and layer normalization. Our analysis of Transformer-based masked language models shows that the token-to-token interaction performed via attention has less impact on the intermediate representations than previously assumed. These results provide new intuitive explanations of existing reports; for example, discarding the learned attention patterns tends not to adversely affect the performance. The codes of our experiments are publicly available.

View on arXivView PDF

Code Implementations(1)

8712Jupyter Notebook, PythonOct 3, 20202 years ago

Similar Papers

Cite this paper

@article{kobayashi2021incorporating,
  title  = {Incorporating Residual and Normalization Layers into Analysis of Masked Language Models},
  author = {Goro Kobayashi and Tatsuki Kuribayashi and Sho Yokoi and Kentaro Inui},
  year   = {2021},
  eprint = {2109.07152},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2109.07152}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2109.07152.svg)](https://codeofpaper.com/paper/2109.07152)

Discussion