The Case for Translation-Invariant Self-Attention in Transformer-Based Language Models

Ulme Wennberg, Gustav Eje Henter
6/3/2021
cs.CLcs.AIcs.LG

Official code: ulmewennberg/tisa (9 stars, last commit 2021-12-23).

Abstract

Mechanisms for encoding positional information are central for transformer-based language models. In this paper, we analyze the position embeddings of existing language models, finding strong evidence of translation invariance, both for the embeddings themselves and for their effect on self-attention. The degree of translation invariance increases during training and correlates positively with model performance. Our findings lead us to propose translation-invariant self-attention (TISA), which accounts for the relative position between tokens in an interpretable fashion without needing conventional position embeddings. Our proposal has several theoretical advantages over existing position-representation approaches. Experiments show that it improves on regular ALBERT on GLUE tasks, while only adding orders of magnitude less positional parameters.

View on arXivView PDF

Code Implementations(1)

ulmewennberg/tisaOfficial100%
92PythonMay 27, 20214 years ago

Similar Papers

Cite this paper

@article{wennberg2021case,
  title  = {The Case for Translation-Invariant Self-Attention in Transformer-Based Language Models},
  author = {Ulme Wennberg and Gustav Eje Henter},
  year   = {2021},
  eprint = {2106.01950},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.01950}
}

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/2106.01950.svg)](https://codeofpaper.com/paper/2106.01950)

Discussion