Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Block-Recurrent Transformers

About

We introduce the Block-Recurrent Transformer, which applies a transformer layer in a recurrent fashion along a sequence, and has linear complexity with respect to sequence length. Our recurrent cell operates on blocks of tokens rather than single tokens during training, and leverages parallel computation within a block in order to make efficient use of accelerator hardware. The cell itself is strikingly simple. It is merely a transformer layer: it uses self-attention and cross-attention to efficiently compute a recurrent function over a large set of state vectors and tokens. Our design was inspired in part by LSTM cells, and it uses LSTM-style gates, but it scales the typical LSTM cell up by several orders of magnitude. Our implementation of recurrence has the same cost in both computation time and parameter count as a conventional transformer layer, but offers dramatically improved perplexity in language modeling tasks over very long sequences. Our model out-performs a long-range Transformer XL baseline by a wide margin, while running twice as fast. We demonstrate its effectiveness on PG19 (books), arXiv papers, and GitHub source code. Our code has been released as open source.

DeLesley Hutchins, Imanol Schlag, Yuhuai Wu, Ethan Dyer, Behnam Neyshabur• 2022

Related benchmarks

TaskDatasetResultRank
Language ModelingarXiv (test)
PPL2.36
137
Language ModelingPG-19 (test)
Perplexity11.96
106
Language ModelingPG19 bytes (test)
Bits Per Token0.952
14
Language ModelingPG19 tokens (test)
Bits per Token3.52
14
Language ModelingarXiv tokens (test)
Bits Per Token1.24
14
Language ModelingGitHub (val)
Perplexity2.01
13
Language ModelingGitHub tokens (test)
Bits Per Token (BPT)0.976
11
Showing 7 of 7 rows

Other info

Code

Follow for update