SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2001.04451 · ICLR · 2020

Reformer: The Efficient Transformer

Nikita Kitaev, Łukasz Kaiser, Anselm Levskaya

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-21; 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/2001.04451.json · badge: /api/ran/2001.04451.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
Rick-McCoy/Reformer-pytorch port (classifier label)
classifier basis: classifier_2025
6 ran · 2 no recorded run
FunctionStatusWhere it lives
LocalitySensitiveHash Ran
ran on a synthesized input · constructed an object; no result was computed
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("f730a019cd6dfa68")
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, LocalitySensitiveHash: 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)

class MockModelConfig:
    def __init__(self):
        self.d_model = 8
        self.head = 2
        self.rounds = 3

class MockHyperparams:
    def __init__(self):
        self.model = MockModelConfig()

class MockArgs:
    pass

hp = MockHyperparams()
args = MockArgs()

ARGS = {
    "hp": hp,
    "args": args
}
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 LocalitySensitiveHash — 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 LocalitySensitiveHash 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
expand Ran
ran; our contract draft was wrong, not the code
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("bde1d7f419f43bee")
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 (1, 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

torch.manual_seed(0)

# Create a small input tensor with distinct dimensions for probing
input_tensor = torch.randn(2, 4)

# Test with default parameters
ARGS = {
    "input_tensor": input_tensor,
    "dim": 0,
    "num": 1
}
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 (1, 2, 4) — shape (1, 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
expand_gather Ran
ran; our contract draft was wrong, not the code
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("e25bbd4d3edcecd5")
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, 2, 3) 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 test tensors
# input_tensor: will be gathered from, needs to support gather operation
# Shape: (batch=2, dim=4, feature=3)
input_tensor = torch.randn(2, 4, 3)

# index: used to index into input_tensor along dim, then expanded
# Shape: (batch=2, feature=3) - will be expanded along expand_dim
index = torch.randint(0, 4, (2, 3))

# dim: which dimension to gather along (must be 1 in this case since index is 2D)
dim = 1

# expand_dim: which dimension to add/expand in the index before gathering
expand_dim = 0

# num: how many times to expand along expand_dim
num = 2

ARGS = {
    "input_tensor": input_tensor,
    "dim": dim,
    "index": index,
    "expand_dim": expand_dim,
    "num": num,
}
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, 2, 3) — shape (2, 2, 3) 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
get_dup_keys Ran
ran; our contract draft was wrong, not the code
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("fa28de4db6c8dda3")
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 int, 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)

# Construct a small input tensor for get_dup_keys
# The function sorts along dim=-1, so we need a tensor with shape suitable for that
# Let's use shape (2, 3, 4) - batch of 2, sequence of 3, features of 4
input_tensor = torch.randint(0, 3, (2, 3, 4))

# rounds parameter - determines how many shifts to check for duplicates
rounds = 2

ARGS = {
    "input_tensor": input_tensor,
    "rounds": rounds
}
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 int, 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
look_back Ran
ran; our contract draft was wrong, not the code
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("48898f78f7058226")
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, 8) 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)

# The function expects a tensor with shape (batch, buckets, features)
# It performs operations on dim=1 (buckets) and dim=2 (features)
# Let's create a small tensor: batch=2, buckets=3, features=4
input_tensor = torch.randn(2, 3, 4)

ARGS = {
    "input_tensor": input_tensor
}
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, 8) — shape (2, 3, 8) 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
reverse_sort Ran
ran; our contract draft was wrong, not the code
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("4afdf83df6c27154")
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 int, 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

torch.manual_seed(0)

# The function takes sorted indices and produces an "unsorted" index mapping
# that tells you where each original position ended up after sorting.
# 
# indice: a tensor of sorted indices (the result of argsort or similar)
# dim: the dimension along which the sorting happened
#
# We need to construct a valid sorted indices tensor.
# Let's create a simple case: a 2D tensor of sorted indices along dim=1

# Create a tensor of shape (2, 4) containing sorted indices
# For example, if we sorted [3, 1, 4, 2] we'd get indices [1, 3, 0, 2]
indice = torch.tensor([
    [1, 3, 0, 2],
    [0, 1, 2, 3]
], dtype=torch.long)

dim = 1

ARGS = {
    "indice": indice,
    "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 2, dtype family int, 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
LSHAttention Not yet run
unverified (harvested, no recorded run)
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("6874256369242fb8")
How it ran

no invocation recorded.

deterministic_dropout Not yet run
unverified (harvested, no recorded run)
Rick-McCoy/Reformer-pytorch/model/attention.py
code served (permissive licence) · get_code("939cb0f4831afed5")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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.

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-21.

Repositories linked to this paper

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

Abstract

Large Transformer models routinely achieve state-of-the-art results on a number of tasks but training these models can be prohibitively costly, especially on long sequences. We introduce two techniques to improve the efficiency of Transformers. For one, we replace dot-product attention by one that uses locality-sensitive hashing, changing its complexity from O(L 2 ) to O(L log L), where L is the length of the sequence. Furthermore, we use reversible residual layers instead of the standard residuals, which allows storing activations only once in the training process instead of N times, where N is the number of layers. The resulting model, the Reformer, performs on par with Transformer models while being much more memory-efficient and much faster on long sequences.

For agents

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

get_harvested_code_for_paper("2001.04451")
get_code_for_paper("2001.04451")
have("2001.04451")

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

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

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

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

Connect an agent — have() is free.