Recurrent Memory Transformer

Aydar Bulatov, Yuri Kuratov, Mikhail S. Burtsev
7/14/2022
cs.CLcs.LG

No official code found. Best implementation: booydar/LM-RMT (160 stars, Apache-2.0, last commit 2023-08-14).

Abstract

Transformer-based models show their effectiveness across multiple domains and tasks. The self-attention allows to combine information from all sequence elements into context-aware representations. However, global and local information has to be stored mostly in the same element-wise representations. Moreover, the length of an input sequence is limited by quadratic computational complexity of self-attention. In this work, we propose and study a memory-augmented segment-level recurrent Transformer (RMT). Memory allows to store and process local and global information as well as to pass information between segments of the long sequence with the help of recurrence. We implement a memory mechanism with no changes to Transformer model by adding special memory tokens to the input or output sequence. Then the model is trained to control both memory operations and sequence representations processing. Results of experiments show that RMT performs on par with the Transformer-XL on language modeling for smaller memory sizes and outperforms it for tasks that require longer sequence processing. We show that adding memory tokens to Tr-XL is able to improve its performance. This makes Recurrent Memory Transformer a promising architecture for applications that require learning of long-term dependencies and general purpose in memory processing, such as algorithmic tasks and reasoning.

View on arXivView PDF

Code Implementations(1)

booydar/LM-RMTCommunity100%
Apache-2.0

Recurrent Memory Transformer

16013Shell, PythonNov 11, 20213 years agoApache-2.0

Similar Papers

Cite this paper

@article{bulatov2022recurrent,
  title  = {Recurrent Memory Transformer},
  author = {Aydar Bulatov and Yuri Kuratov and Mikhail S. Burtsev},
  year   = {2022},
  eprint = {2207.06881},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2207.06881v2}
}

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

Discussion