Convolutions and Self-Attention: Re-interpreting Relative Positions in Pre-trained Language Models

Tyler A. Chang, Yifan Xu, Weijian Xu, Zhuowen Tu
6/10/2021
cs.CL
transformer-attention

Official code: mlpc-ucsd/BERT_Convolutions (21 stars, Python, last commit 2022-07-13).

Abstract

In this paper, we detail the relationship between convolutions and self-attention in natural language tasks. We show that relative position embeddings in self-attention layers are equivalent to recently-proposed dynamic lightweight convolutions, and we consider multiple new ways of integrating convolutions into Transformer self-attention.

Show full abstract

Specifically, we propose composite attention, which unites previous relative position embedding methods under a convolutional framework. We conduct experiments by training BERT with composite attention, finding that convolutions consistently improve performance on multiple downstream tasks, replacing absolute position embeddings. To inform future work, we present results comparing lightweight convolutions, dynamic convolutions, and depthwise-separable convolutions in language model pre-training, considering multiple injection points for convolutions in self-attention layers.

View on arXivView PDF

Code Implementations(1)

(ACL-IJCNLP 2021) Convolutions and Self-Attention: Re-interpreting Relative Positions in Pre-trained Language Models.

212PythonMay 29, 20214 years ago

Similar Papers

Cite this paper

@article{chang2021convolutions,
  title  = {Convolutions and Self-Attention: Re-interpreting Relative Positions in Pre-trained Language Models},
  author = {Tyler A. Chang and Yifan Xu and Weijian Xu and Zhuowen Tu},
  year   = {2021},
  eprint = {2106.05505},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.05505}
}

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

Discussion