Papers › Block-Recurrent Transformers

Block-Recurrent Transformers

11 Mar 2022arXiv:2203.07852archive 2025-07-28

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

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.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2203.07852")

Code

Syntology Ran 18 of 23 code samples harvested from 2 repositories linked to this paper; 5 have no recorded run. Of those that ran: 2 ran · honoured contract; 3 ran · violated contract; 8 ran · our draft was wrong; 1 ran · fixture could not drive it; 4 ran with no contract checked.

By repository: community (archive-listed): 19 samples from 2 repositories, 14 ran; 4 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

google-research/meliad officialmentioned in papermentioned on GitHubjaxApache-2.0 report
dashstander/block-recurrent-transformer mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

23 samples harvested; 18 ran; 2 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · honoured contract
3ran · violated contract
8ran · our draft was wrong
1ran · fixture could not drive it
4ran
5unverified

Licence: 4 of the 23 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

is_empty lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 039ac61b2d11642b · report
FeedForward lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · our draft was wrong MIT (permissive) · b0bf82c667f91301 · report
GEGLU lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · c5c74119405bfc64 · report
MemoryManager lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran MIT (permissive) · 778a8ddac6fbf372 · report
RotaryEmbedding lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran MIT (permissive) · c779f10c971c5655 · report
all_unique lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 2b23ad0c970e5ae8 · report
apply_rotary_pos_emb dashstander/block-recurrent-transformer/block_recurrent_transformer/transformer.py community (archive-listed) ran · our draft was wrong MIT (permissive) · a0a60756432aafb6 · report
apply_rotary_pos_emb lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · a1f5fb7641bf7ce3 · report
cast_tuple dashstander/block-recurrent-transformer/block_recurrent_transformer/transformer.py community (archive-listed) ran · violated contract fingerprinted MIT (permissive) · 75e2de7f7799802d · report
cast_tuple lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · honoured contract fingerprinted MIT (permissive) · c1b68cdd9e73316a · report
gumbel_sample lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · 41e347331d03a86c · report
rotate_half dashstander/block-recurrent-transformer/block_recurrent_transformer/transformer.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 6b01a575e36ad18c · report
top_k lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 39f3cec3c6be459f · report
Attention lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 20f6b4952e3785e4 · report
AttentionBlock lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 46353ab6ce1236e2 · report
BlockRecurrentTransformer lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 8c4ac9d79f99be7d · report
StateContainer lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 9278e73f426f6715 · report
safe_cat lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py community (archive-listed) unverified MIT (permissive) · 54c65db65b0fbb51 · report
compact identical code first harvested elsewhere ran · honoured contract fingerprinted licence of this copy not recorded · 4a06bf1ac86f840a · report
default identical code first harvested elsewhere ran · violated contract fingerprinted licence of this copy not recorded · 60fff7c3c400d7ff · report
eval_decorator identical code first harvested elsewhere ran · our draft was wrong licence of this copy not recorded · 5444a7d75d38878d · report
exists identical code first harvested elsewhere ran · violated contract licence of this copy not recorded · aa5486a3650902d8 · report

Tasks

Language ModelingLanguage Modelling

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLSTMLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSigmoid ActivationSoftmaxTanh ActivationTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections