SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2203.07852 · NeurIPS · 2022

Block-Recurrent Transformers

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

arXiv · PDF · Open in the Atlas

Code that ran

18 of 23 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 3 violated it and 4 have no contract verdict; 9 failures of our instrument; 5 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2203.07852.json · badge: /api/ran/2203.07852.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
lucidrains/block-recurrent-transformer-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
11 ran · 5 no recorded run
copy not recorded community
not in the paper's declared repositories
4 ran · 0 no recorded run
dashstander/block-recurrent-transformer reimplementation (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
is_empty Ran
ran; our contract draft was wrong, not the code
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("039ac61b2d11642b")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:10:31Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function is_empty checks if a tensor has zero elements
# It takes a single parameter: t (a torch.Tensor)
# We need to provide a tensor argument

# Create a valid tensor argument
t = torch.tensor([1, 2, 3, 4])

ARGS = {
    "t": t
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FeedForward Ran
ran; our contract draft was wrong, not the code
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("b0bf82c667f91301")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Sequential. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'dim': 8,
    'mult': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
GEGLU Ran
ran on a synthesized input
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("c5c74119405bfc64")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn.functional as F
from torch import nn

class GEGLU(nn.Module):
    def forward(self, x):
        x, gate = x.chunk(2, dim=-1)
        return F.gelu(gate) * x

INIT_ARGS = {}

ARGS = {
    'x': torch.randn(2, 8)
}

if __name__ == '__main__':
    model = GEGLU(**INIT_ARGS)
    output = model(**ARGS)
    print(output.shape)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("f6fa422c7a33d41e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, LayerNorm: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'dim': 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LayerNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a LayerNorm output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MemoryManager Ran
ran on a synthesized input
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("778a8ddac6fbf372")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned list. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn
from einops import rearrange, repeat, pack, unpack
from einops.layers.torch import Rearrange
from itertools import zip_longest

def cast_tuple(t, length=1):
    return t if isinstance(t, tuple) else (t,) * length

def compact(arr):
    return [*filter(exists, arr)]

def exists(val):
    return val is not None

def is_empty(t: torch.Tensor):
    return t.numel() == 0

def safe_cat(*args, dim=1):
    args = compact(args)
    if len(args) == 0:
        return None
    return torch.cat(args, dim=dim)

class MemoryManager(nn.Module):

    def __init__(self, dim, *, layers=1, mem_lengths=512, compress_factors=1):
        super().__init__()
        mem_lengths = cast_tuple(mem_lengths)
        compress_factors = cast_tuple(compress_factors)
        assert all([mem_length > 0 for mem_length in mem_lengths])
        assert len(mem_lengths) == len(compress_factors)
        assert layers >= 1
        self.mem_lengths = mem_lengths
        self.compress_factors = compress_factors
        self.layers = nn.ModuleList([])
        for _ in range(layers):
            compress_fns = nn.ModuleList([])
            for compress_factor in compress_factors:
                compress_fn = nn.Identity()
                if compress_factor > 1:
                    compress_fn = nn.Sequential(Rearrange('b n d -> b d n'), nn.Conv1d(dim * 2, dim * 2, compress_factor, stride=compress_factor, groups=2), Rearrange('b d n -> b n d'))
                compress_fns.append(compress_fn)
            self.layers.append(compress_fns)

    def forward(self, past_memories, new_memories):
        next_memories = []
        for past_memory, new_memory, compress_fns in zip_longest(past_memories, new_memories, self.layers):
            if not (exists(past_memory) or exists(new_memory)):
                next_memories.append(None)
                continue
            next_memory = None
            for mem_length, compress_factor, compress_fn in zip(self.mem_lengths, self.compress_factors, compress_fns):
                current_memory = None
                if exists(past_memory):
                    past_memory, current_memory = (past_memory[..., :-mem_length, :], past_memory[..., -mem_length:, :])
                if not is_empty(new_memory) and compress_factor > 1:
                    new_mem_length = new_memory.shape[-2]
                    curtailed_length = new_mem_length // compress_factor * compress_factor
                    curtailed_slice = slice(-curtailed_length, None) if curtailed_length > 0 else slice(0, 0)
                    new_memory = new_memory[..., curtailed_slice, :]
                    if new_memory.shape[-2] > 0:
                        new_memory = rearrange(new_memory, 'm b n d -> b n (m d)')
                        new_memory = compress_fn(new_memory)
                        new_memory = rearrange(new_memory, 'b n (m d) -> m b n d', m=2)
                current_memory = safe_cat(current_memory, new_memory, dim=-2)
                new_memory, current_memory = (current_memory[..., :-mem_length, :], current_memory[..., -mem_length:, :])
                next_memory = safe_cat(current_memory, next_memory, dim=-2)
            next_memories.append(next_memory)
        return next_memories


INIT_ARGS = {
    'dim': 4,
    'layers': 2,
    'mem_lengths': (8, 16),
    'compress_factors': (1, 2),
}

ARGS = {
    'past_memories': [
        torch.randn(2, 2, 12, 4),
        torch.randn(2, 2, 10, 4),
    ],
    'new_memories': [
        torch.randn(2, 2, 6, 4),
        torch.randn(2, 2, 8, 4),
    ],
}

if __name__ == '__main__':
    model = MemoryManager(**INIT_ARGS)
    output = model(**ARGS)
    print("Output:", output)
    print("Number of output memories:", len(output))
    for i, mem in enumerate(output):
        if mem is not None:
            print(f"Memory {i} shape: {mem.shape}")
        else:
            print(f"Memory {i}: None")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
beartype, einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
RotaryEmbedding Ran
ran on a synthesized input · constructed an object; no result was computed
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("c779f10c971c5655")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, RotaryEmbedding: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

ARGS = {
    'dim': 4,
    'width': 8,
    'scale_base': 512,
    'theta': 10000,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RotaryEmbedding — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RotaryEmbedding output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
all_unique Ran
ran; our contract draft was wrong, not the code
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("2b23ad0c970e5ae8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function all_unique(arr) checks if all elements in arr are unique
# by comparing the length of arr to the length of set(arr)
# This works with any iterable/sequence type

# Test with a list of integers (all unique)
arr1 = [1, 2, 3, 4, 5]

ARGS = {
    "arr": arr1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_rotary_pos_emb Ran
ran; our contract draft was wrong, not the code
dashstander/block-recurrent-transformer/block_recurrent_transformer/transformer.py
code served (permissive licence) · get_code("a0a60756432aafb6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 6) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from einops import rearrange

torch.manual_seed(0)

# Construct t: shape (batch, seq_len, feature_dim)
# The function expects t to have shape [..., seq_len, rot_dim + extra_dims]
# rotate_half expects the last dimension to be even (it splits into j=2 parts)
# Let's make: batch=2, seq_len=3, rot_dim=4, extra_dims=2
t = torch.randn(2, 3, 6)  # batch=2, seq_len=3, total_features=6

# Construct freqs: shape that matches rot_dim
# freqs needs .cos() and .sin() methods, so it should be a tensor
# freqs should have shape compatible with broadcasting to t[..., :rot_dim]
# t[..., :rot_dim] has shape (2, 3, 4), so freqs should be broadcastable
# Typically freqs has shape (seq_len, rot_dim) or (1, 1, rot_dim)
freqs = torch.randn(1, 1, 4)

ARGS = {
    "t": t,
    "freqs": freqs,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 6) — shape (2, 3, 6) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_rotary_pos_emb Ran
ran; our contract draft was wrong, not the code
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("a1f5fb7641bf7ce3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a tensor t with shape (batch=2, seq_len=3, hidden_dim=4)
# The last dimension must be even for rotate_half to work (chunk into 2 parts)
t = torch.randn(2, 3, 4)

# Create pos tensor with shape (seq_len=5, hidden_dim=4) - includes cos and sin
# We need seq_len >= 3 (the sequence length of t)
pos = torch.randn(5, 4)
# Make it look like precomputed rotary embeddings by applying cos/sin conceptually
# For now, just use the raw tensor - the function will call .cos() and .sin() on it
pos = torch.exp(1j * torch.randn(5, 4)).real  # Create a valid tensor

# Actually, let's create pos as a proper tensor that has cos/sin methods
# Just use a regular tensor - torch.Tensor has .cos() and .sin() methods
pos = torch.randn(5, 4)

# scale parameter - can be a float or a tensor
scale = 1.0

ARGS = {
    "t": t,
    "pos": pos,
    "scale": scale
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cast_tuple Ran
ran, violated the contract we drafted
dashstander/block-recurrent-transformer/block_recurrent_transformer/transformer.py
code served (permissive licence) · get_code("75e2de7f7799802d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Test case 1: val is a tuple
val_tuple = (1, 2, 3)
num_1 = 1

# Test case 2: val is not a tuple, num > 1
val_scalar = 5
num_2 = 3

# Test case 3: val is not a tuple, num = 1
val_string = "hello"
num_3 = 1

# Test case 4: val is not a tuple, num = 2
val_list = [1, 2, 3]
num_4 = 2

ARGS = {
    "val": val_scalar,
    "num": num_2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
cast_tuple Ran
ran, honoured the contract we drafted
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("c1b68cdd9e73316a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "t": 42,
    "length": 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compact Ran
ran, honoured the contract we drafted
this paper's copy was not recorded; identical code first harvested from lucidrains/x-transformers
pointer only · get_code("4a06bf1ac86f840a")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

default Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from ThomasMrY/VCT
pointer only; the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("60fff7c3c400d7ff")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

eval_decorator Ran
ran; our contract draft was wrong, not the code
this paper's copy was not recorded; identical code first harvested from lucidrains/recurrent-memory-transformer-pytorch
pointer only · get_code("5444a7d75d38878d")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

exists Ran
ran, violated the contract we drafted
this paper's copy was not recorded; identical code first harvested from ThomasMrY/VCT
pointer only; the stored copy get_code serves, from ThomasMrY/VCT, is pointer only (licence: NONE) · get_code("aa5486a3650902d8")
How it ran

The body of this sample is withheld: this paper's copy of the code was not recorded (its link names no repository or source path), so no licence was read for it. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gumbel_sample Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("41e347331d03a86c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 1, dtype family int, shape (2,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create a small logits tensor with shape (batch=2, classes=4)
# The function uses this tensor to:
# 1. Generate gumbel noise (calls torch.zeros_like, uniform_, log operations)
# 2. Add noise to t and take argmax along dim=-1
t = torch.randn(2, 4)

# temperature parameter - a float controlling the sampling temperature
temperature = 0.5

# dim parameter - the dimension along which to take argmax
dim = -1

ARGS = {
    "t": t,
    "temperature": temperature,
    "dim": dim
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family int, shape (2,) — shape (2,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rotate_half Ran
ran; our contract draft was wrong, not the code
dashstander/block-recurrent-transformer/block_recurrent_transformer/transformer.py
code served (permissive licence) · get_code("6b01a575e36ad18c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from einops import rearrange

torch.manual_seed(0)

# The function rotate_half takes a single parameter 'x' which is a tensor
# It uses rearrange to reshape x into shape '... (j d) -> ... j d' with j=2
# This means the last dimension must be even (divisible by 2)
# Then it unbinds along dim=-2 and concatenates
# Let's create a tensor with shape that works: (batch, seq_len, 2*d)
# where the last dimension is even

x = torch.randn(2, 3, 4)  # batch=2, seq_len=3, last_dim=4 (even, so divisible by 2)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
top_k Ran
ran; our contract draft was wrong, not the code
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("39f3cec3c6be459f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math
import torch

torch.manual_seed(0)

# Create a small logits tensor
# Shape: (batch_size=2, num_classes=4)
logits = torch.randn(2, 4)

# Create ARGS dict with all parameters
ARGS = {
    "logits": logits,
    "thres": 0.9
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Attention Not yet run
unverified (harvested, no recorded run)
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("20f6b4952e3785e4")
How it ran

no invocation recorded.

AttentionBlock Not yet run
unverified (harvested, no recorded run)
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("46353ab6ce1236e2")
How it ran

no invocation recorded.

BlockRecurrentTransformer Not yet run
unverified (harvested, no recorded run)
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("8c4ac9d79f99be7d")
How it ran

no invocation recorded.

StateContainer Not yet run
unverified (harvested, no recorded run)
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("9278e73f426f6715")
How it ran

no invocation recorded.

safe_cat Not yet run
unverified (harvested, no recorded run)
lucidrains/block-recurrent-transformer-pytorch/block_recurrent_transformer_pytorch/block_recurrent_transformer_pytorch.py
code served (permissive licence) · get_code("54c65db65b0fbb51")
How it ran

no invocation recorded.

Also present in other papers' code

Of 23 samples lifted from this paper's linked repositories, 23 carry a function identity and 0 do not. Of the 23 distinct functions with an identity, 11 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 2 the same month, 9 later) and 12 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
exists
brick of this paper's assembly: helper
486 other papers
83 dated earlier, 6 the same month, 394 later, 1 same year, order not determinable, 2 undated · 78 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1611.07004 (2016-11)
Image-to-Image Translation with Conditional Adversarial Networks
1804.04637 (2018-04)
EMBER: An Open Dataset for Training Static PE Malware Machine Learning Models
and 483 more not named here
default
brick of this paper's assembly: helper
163 other papers
41 dated earlier, 6 the same month, 115 later, 1 undated · 27 only as an assembly brick
1603.08155 (2016-03)
Perceptual Losses for Real-Time Style Transfer and Super-Resolution
1810.00825 (2018-10)
Set Transformer: A Framework for Attention-based Permutation-Invariant Neural Networks
1907.01470 (2019-07)
Augmenting Self-attention with Persistent Memory
and 160 more not named here
rotate_half 13 other papers
2 dated earlier, 11 later · 2 only as an assembly brick
2112.04426 (2021-12)
Improving language models by retrieving from trillions of tokens
2202.07765 (2022-02)
General-purpose, long-context autoregressive modeling with Perceiver AR
2204.02311 (2022-04)
PaLM: Scaling Language Modeling with Pathways
and 10 more not named here
LayerNorm
brick of this paper's assembly: model
4 other papers
4 later
2204.02311 (2022-04)
PaLM: Scaling Language Modeling with Pathways
2212.11972 (2022-12)
Scalable Adaptive Computation for Iterative Generation
2308.00951 (2023-08)
From Sparse to Soft Mixtures of Experts
and 1 more not named here
cast_tuple
brick of this paper's assembly: helper
4 other papers
4 later
2303.05511 (2023-03)
Scaling up GANs for Text-to-Image Synthesis
2403.10266 (2024-03)
DSP: Dynamic Sequence Parallelism for Multi-Dimensional Transformers
2412.00733 (2024-12)
Hallo3: Highly Dynamic and Realistic Portrait Image Animation with Video Diffusion Transformer
and 1 more not named here
compact
brick of this paper's assembly: helper
4 other papers
2 dated earlier, 2 later
1907.01470 (2019-07)
Augmenting Self-attention with Persistent Memory
2003.02436 (2020-03)
Talking-Heads Attention
2305.18565 (2023-05)
PaLI-X: On Scaling up a Multilingual Vision and Language Model
and 1 more not named here
eval_decorator
brick of this paper's assembly: helper
2 other papers
2 later
2207.06881 (2022-07)
Recurrent Memory Transformer
2305.18565 (2023-05)
PaLI-X: On Scaling up a Multilingual Vision and Language Model
apply_rotary_pos_emb 1 other paper
1 dated earlier
2112.04426 (2021-12)
Improving language models by retrieving from trillions of tokens
cast_tuple 1 other paper
1 dated earlier
2112.04426 (2021-12)
Improving language models by retrieving from trillions of tokens
gumbel_sample
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2211.17192 (2022-11)
Fast Inference from Transformers via Speculative Decoding
top_k
brick of this paper's assembly: helper
1 other paper
1 later
2407.09099 (2024-07)
Music Proofreading with RefinPaint: Where and How to Modify Compositions given Context

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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 [1].

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2203.07852")
get_code_for_paper("2203.07852")
have("2203.07852")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2203.07852.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2203.07852.svg)](https://syntology.ai/paper/2203.07852)

Connect an agent — have() is free.