SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2009.14794 · ICLR · 2021

Rethinking Attention with Performers

Krzysztof Choromanski, Adrian Weller, Lucy Colwell, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, and 1 more

arXiv · PDF · Open in the Atlas

Code that ran

11 of 16 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 4 failures of our instrument; 5 no recorded run), measured 2026-11-23; 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/2009.14794.json · badge: /api/ran/2009.14794.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
google-research/google-research canonical (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
lucidrains/performer-pytorch community
Papers with Code archive
5 ran · 1 no recorded run
idiap/fast-transformers community
Papers with Code archive
3 ran · 1 no recorded run
xl402/performer community (classifier label)
classifier basis not recorded on the link
2 ran · 1 no recorded run
teddykoker/performer community
Papers with Code archive
1 ran · 1 no recorded run
FunctionStatusWhere it lives
Favor Ran
ran on a synthesized input · constructed an object; no result was computed
idiap/fast-transformers/fast_transformers/feature_maps/fourier_features.py
pointer only (licence: NONE) · get_code("6451bb5de4de0afc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, idiap/fast-transformers when it was checked. 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.

FeatureMap Ran
ran on a synthesized input · constructed an object; no result was computed
idiap/fast-transformers/fast_transformers/feature_maps/fourier_features.py
pointer only (licence: NONE) · get_code("7075608a1ad15a59")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, idiap/fast-transformers when it was checked. 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.

RandomFourierFeatures Ran
ran on a synthesized input · constructed an object; no result was computed
idiap/fast-transformers/fast_transformers/feature_maps/fourier_features.py
pointer only (licence: NONE) · get_code("080893f281eb2f9d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, idiap/fast-transformers when it was checked. 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.

build_linear_attention_equation Ran
ran on a synthesized input
xl402/performer/performer/networks/build_attention.py
code served (permissive licence) · get_code("58f9da6e70d9e0ad")
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 float; 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 string
import numpy as np

# Analyze the function to understand what arguments it needs:
# - rank: an integer representing the rank (number of dimensions)
# - attn_axes: a tuple or array of integers representing attention axes

# The function uses:
# - rank: passed to range(), used as index, subtracted from
# - attn_axes: passed to np.delete() as indices, added to a tuple, used with + operator
# - Both should be valid for numpy operations

# Let's create valid test cases
# rank should be an integer >= 2 (since rank-1 is used)
# attn_axes should be a tuple/array of valid axis indices less than rank

rank = 3
attn_axes = (1,)  # attention on axis 1, batch dims will be (0,), last dim is (2,)

ARGS = {
    "rank": rank,
    "attn_axes": attn_axes,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 float — 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
build_normalisation_equation Ran
ran on a synthesized input
xl402/performer/performer/networks/build_attention.py
code served (permissive licence) · get_code("26d17ff60efc0bc4")
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 float; 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 string
import numpy as np

ARGS = {
    'rank': 4,
    'attn_axes': [1, 3]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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 float — 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
causal_linear_attention Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lucidrains/performer-pytorch/performer_pytorch/performer_pytorch.py
code served (permissive licence) · get_code("0b9a5b455433ca64")
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, 5, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 as nn
from unittest.mock import MagicMock

torch.manual_seed(0)

# Mock APEX_AVAILABLE and amp module since they may not be present
APEX_AVAILABLE = False
amp = MagicMock()
amp.float_function = lambda fn: fn

# Mock the fast_transformers module
import sys
from unittest.mock import MagicMock

fast_transformers_mock = MagicMock()
causal_product_mock = MagicMock()

class MockCausalDotProduct:
    @staticmethod
    def apply(q, k, v):
        # Simple mock implementation that returns a tensor of appropriate shape
        # Output should be (..., N, D) like q
        batch, seq_len, dim = q.shape
        return torch.randn(batch, seq_len, dim)

causal_product_mock.CausalDotProduct = MockCausalDotProduct
fast_transformers_mock.causal_product = causal_product_mock

sys.modules['fast_transformers'] = fast_transformers_mock
sys.modules['fast_transformers.causal_product'] = causal_product_mock

# Create tensor arguments
# Shape: (batch=2, seq_len=5, dim=4)
batch_size = 2
seq_len = 5
dim = 4

q = torch.randn(batch_size, seq_len, dim)
k = torch.randn(batch_size, seq_len, dim)
v = torch.randn(batch_size, seq_len, dim)

ARGS = {
    'q': q,
    'k': k,
    'v': v,
    'eps': 1e-06
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
fast_transformers, 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, 5, 4) — shape (2, 5, 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
causal_linear_attention_noncuda Ran
ran; our contract draft was wrong, not the code
lucidrains/performer-pytorch/performer_pytorch/performer_pytorch.py
code served (permissive licence) · get_code("d512c905ae6d1fb7")
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 4, dtype family float, shape (2, 1, 8, 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 tiny tensors with distinct dimensions
# q, k, v all need shape (batch, heads, seq_len, dim)
# Using: batch=2, heads=1, seq_len=8, dim=4

batch_size = 2
num_heads = 1
seq_len = 8
dim = 4

q = torch.randn(batch_size, num_heads, seq_len, dim)
k = torch.randn(batch_size, num_heads, seq_len, dim)
v = torch.randn(batch_size, num_heads, seq_len, dim)

ARGS = {
    "q": q,
    "k": k,
    "v": v,
    "chunk_size": 128,
    "eps": 1e-06,
}
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 4, dtype family float, shape (2, 1, 8, 4) — shape (2, 1, 8, 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
gaussian_orthogonal_random_matrix Ran
ran, honoured the contract we drafted
lucidrains/performer-pytorch/performer_pytorch/performer_pytorch.py
code served (permissive licence) · get_code("678cef9796271045")
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 2, dtype family float, shape (8, 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 math

torch.manual_seed(0)

ARGS = {
    'nb_rows': 8,
    'nb_columns': 4,
    'scaling': 0,
    'device': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
distutils, 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 (8, 4) — shape (8, 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
null_context Ran
ran on a synthesized input
lucidrains/performer-pytorch/performer_pytorch/performer_pytorch.py
code served (permissive licence) · get_code("d859f1b3d3c7f242")
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 _GeneratorContextManager. 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 contextlib import contextmanager

@contextmanager
def null_context():
    yield

# This function takes no parameters, so ARGS should be an empty dict
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 _GeneratorContextManager — a _GeneratorContextManager output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a _GeneratorContextManager 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
phi Ran
ran; our contract draft was wrong, not the code
teddykoker/performer/performer.py
pointer only (licence: NONE) · get_code("d10e6f7a10a8b0d9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, teddykoker/performer when it was checked. 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.

softmax_kernel Ran
ran; our contract draft was wrong, not the code
lucidrains/performer-pytorch/performer_pytorch/performer_pytorch.py
code served (permissive licence) · get_code("829218b2f7e9682c")
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 4, dtype family float, shape (2, 3, 6, 5) 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, repeat

torch.manual_seed(0)

# Construct arguments for softmax_kernel
b, h = 2, 3  # batch size and number of heads
d = 4  # data dimension
j = 5  # projection dimension

# data: shape (b, h, seq_len, d)
data = torch.randn(b, h, 6, d)

# projection_matrix: shape (j, d)
projection_matrix = torch.randn(j, d)

# is_query: boolean flag
is_query = True

# normalize_data: boolean flag
normalize_data = True

# eps: small epsilon value
eps = 0.0001

# device: CPU device
device = 'cpu'

ARGS = {
    'data': data,
    'projection_matrix': projection_matrix,
    'is_query': is_query,
    'normalize_data': normalize_data,
    'eps': eps,
    'device': device,
}
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 4, dtype family float, shape (2, 3, 6, 5) — shape (2, 3, 6, 5) 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
FastAttention Not yet run
unverified (harvested, no recorded run)
lucidrains/performer-pytorch/performer_pytorch/performer_pytorch.py
code served (permissive licence) · get_code("03ed65c20de38e07")
How it ran

no invocation recorded.

att_hat Not yet run
unverified (harvested, no recorded run)
teddykoker/performer/performer.py
pointer only (licence: NONE) · get_code("d8628e15a7dc6add")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, teddykoker/performer when it was checked. 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. No invocation recorded.

build_quadratic_attention_equation Not yet run
unverified (harvested, no recorded run)
xl402/performer/performer/networks/build_attention.py
code served (permissive licence) · get_code("5e7a65b62164cc36")
How it ran

no invocation recorded.

get_fixed_sin_cos_encodings Not yet run
unverified (harvested, no recorded run)
google-research/google-research/COSTAR/src/models/utils_transformer.py
code served (permissive licence) · get_code("5365366fdf3b6d3b")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

orthogonal_random_matrix_ Not yet run
unverified (harvested, no recorded run)
idiap/fast-transformers/fast_transformers/feature_maps/fourier_features.py
pointer only (licence: NONE) · get_code("39aea8b96624e6f3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, idiap/fast-transformers when it was checked. 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. No invocation recorded.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 3 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 3 later) and 13 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
FeatureMap
brick of this paper's assembly: helper
2 other papers
2 later · 1 only as an assembly brick
2406.03919 (2024-06)
Vectorized Conditional Neural Fields: A Framework for Solving Time-dependent Parametric Partial Differential Equations
2506.05584 (2025-06)
TABFLEX: Scaling Tabular Learning to Millions with Linear Attention
gaussian_orthogonal_random_matrix
brick of this paper's assembly: helper
2 other papers
2 later
2201.03794 (2022-01)
Efficient Non-local Contrastive Attention for Image Super-resolution
2310.13225 (2023-10)
Scalable Neural Network Kernels
get_fixed_sin_cos_encodings 2 other papers
2 later
2107.05768 (2021-07)
Combiner: Full Attention Transformer with Sparse Computation Cost
2405.21012 (2024-05)
IGC-Net for conditional average potential outcome estimation over time

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

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 Performers, Transformer architectures which can estimate regular (softmax) full-rank-attention Transformers with provable accuracy, but using only linear (as opposed to quadratic) space and time complexity, without relying on any priors such as sparsity or low-rankness. To approximate softmax attentionkernels, Performers use a novel Fast Attention Via positive Orthogonal Random features approach (FAVOR+), which may be of independent interest for scalable kernel methods. FAVOR+ can also be used to efficiently model kernelizable attention mechanisms beyond softmax. This representational power is crucial to accurately compare softmax with other kernels for the first time on large-scale tasks, beyond the reach of regular Transformers, and investigate optimal attention-kernels. Performers are linear architectures fully compatible with regular Transformers and with strong theoretical guarantees: unbiased or nearly-unbiased estimation of the attention matrix, uniform convergence and low estimation variance. We tested Performers on a rich set of tasks stretching from pixel-prediction through text models to protein sequence modeling. We demonstrate competitive results with other examined efficient sparse and dense attention methods, showcasing effectiveness of the novel attention-learning paradigm leveraged by Performers.

For agents

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

get_harvested_code_for_paper("2009.14794")
get_code_for_paper("2009.14794")
have("2009.14794")

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

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

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

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

Connect an agent — have() is free.