SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2111.05498 · 2021

Attention Approximates Sparse Distributed Memory

arXiv · PDF · Open in the Atlas

Code that ran

12 of 19 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 5 have no contract verdict; 5 failures of our instrument; 7 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/2111.05498.json · badge: /api/ran/2111.05498.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
trentbrick/attention-approximates-sdm canonical (classifier label)
classifier basis not recorded on the link
12 ran · 7 no recorded run
FunctionStatusWhere it lives
check_number_comma Ran
ran, violated the contract we drafted
trentbrick/attention-approximates-sdm/HugFace/src/transformers/convert_slow_tokenizer.py
pointer only (licence: MIT); the stored copy get_code serves, from UW-Madison-Lee-Lab/looped-tf, is pointer only (licence: NONE) · get_code("a727df5fd2f5599a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from UW-Madison-Lee-Lab/looped-tf, and GitHub detected no licence in that repository 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.

cosine_to_hamm Ran
ran on a synthesized input
trentbrick/attention-approximates-sdm/SDM_Circ_Inter_Funcs.py
code served (permissive licence) · get_code("0a85051c7ca5e520")
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 float, shape (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 numpy as np

torch.manual_seed(0)

# Create valid cosine similarity values (between -1 and 1)
cosines_torch = torch.tensor([0.5, 0.9, -0.3, 0.1], dtype=torch.float32)
n = 10

ARGS = {
    "cosines": cosines_torch,
    "n": n
}
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 Tensor, ndim 1, dtype family float, shape (4,) — shape (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
ensure_valid_input Ran
ran; our contract draft was wrong, not the code
trentbrick/attention-approximates-sdm/HugFace/src/transformers/convert_graph_to_onnx.py
pointer only (licence: MIT); the stored copy get_code serves, from UW-Madison-Lee-Lab/looped-tf, is pointer only (licence: NONE) · get_code("d770e1dd1d799a47")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from UW-Madison-Lee-Lab/looped-tf, and GitHub detected no licence in that repository 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.

f Ran
ran on a synthesized input
trentbrick/attention-approximates-sdm/HugFace/SDM_Circ_Inter_Funcs.py
code served (permissive licence) · get_code("7cedca63fc0c0ef4")
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 float64, ndim 0, 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 numpy as np

# Analyze the function:
# f(x, c_p) takes two parameters:
# - x: used in arithmetic operations (1-x, np.sqrt(x*(1-x)))
#      should be a scalar or array of floats in (0, 1)
# - c_p: used in arithmetic operations (c_p ** 2)
#        should be a scalar or array of floats

# Create valid arguments
x = np.array(0.5)  # scalar in valid range (0, 1)
c_p = np.array(2.0)  # scalar value

ARGS = {
    "x": x,
    "c_p": c_p
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
gelu_fast Ran
ran; our contract draft was wrong, not the code
trentbrick/attention-approximates-sdm/HugFace/src/transformers/activations.py
code served (permissive licence) · get_code("a4475703ff58ecf9")
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 (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)

# gelu_fast takes a single parameter 'x' which is used in arithmetic operations
# It should be a tensor that supports multiplication, addition, and tanh operations
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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 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
gelu_new Ran
ran; our contract draft was wrong, not the code
trentbrick/attention-approximates-sdm/HugFace/src/transformers/activations.py
pointer only (licence: MIT); the stored copy get_code serves, from astro-jon/LCWL, is pointer only (licence: NONE) · get_code("45bb87451230d5e8")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from astro-jon/LCWL, and GitHub detected no licence in that repository 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.

generate_identified_filename Ran
ran; our contract draft was wrong, not the code
trentbrick/attention-approximates-sdm/HugFace/src/transformers/convert_graph_to_onnx.py
pointer only (licence: MIT); the stored copy get_code serves, from UW-Madison-Lee-Lab/looped-tf, is pointer only (licence: NONE) · get_code("7efe3db5c9e2f94d")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from UW-Madison-Lee-Lab/looped-tf, and GitHub detected no licence in that repository 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.

hamm_to_cosine Ran
ran on a synthesized input
trentbrick/attention-approximates-sdm/SDM_Circ_Inter_Funcs.py
code served (permissive licence) · get_code("02bdc6d03c9e9398")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np

torch.manual_seed(0)

# Create small hamming distances (integers between 0 and n)
hamms = np.array([0, 2, 4, 6])
n = 8

ARGS = {
    'hamms': hamms,
    'n': n
}
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 ndarray, ndim 1, dtype family float, shape (4,) — shape (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
mish Ran
ran, honoured the contract we drafted
trentbrick/attention-approximates-sdm/HugFace/src/transformers/activations_tf.py
pointer only (licence: MIT); the stored copy get_code serves, from VITA-Group/READ-ME, is pointer only (licence: NONE) · get_code("cc8c8c3ebf0c343f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from VITA-Group/READ-ME, and GitHub detected no licence in that repository 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.

optimal_p_and_ham Ran
ran on a synthesized input
trentbrick/attention-approximates-sdm/HugFace/SDM_Circ_Inter_Funcs.py
code served (permissive licence) · get_code("c0614eb63596689f")
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 torch
import numpy as np
from scipy.stats import binom, norm

torch.manual_seed(0)

# Analyzing the function optimal_p_and_ham:
# - m: used in arithmetic (1 / (2 * m * r) ** (1 / 3)), expects numeric type
# - r: used in arithmetic (1 / (2 * m * r) ** (1 / 3)), expects numeric type
# - n: passed to space_frac_to_hamm_dist as space dimension, expects int

# The function performs mathematical operations on m and r
# n is used as the dimension parameter for binomial distribution

ARGS = {
    "m": 2,
    "r": 3,
    "n": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, 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 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
quick_gelu Ran
ran; our contract draft was wrong, not the code
trentbrick/attention-approximates-sdm/HugFace/src/transformers/activations.py
pointer only (licence: MIT); the stored copy get_code serves, from openai/summarize-from-feedback, is pointer only (licence: NOASSERTION) · get_code("e21f72f1a9834aef")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from openai/summarize-from-feedback, and GitHub could not classify the licence of that repository (NOASSERTION). 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 Ran
ran on a synthesized input
trentbrick/attention-approximates-sdm/SDM_Circ_Inter_Funcs.py
code served (permissive licence) · get_code("df0360e77dc451b9")
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 ndarray, ndim 1, dtype family float, shape (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 numpy as np

# Create a small vector for x parameter
x = np.array([1.0, 2.0, 3.0, 4.0])

# Create a scalar beta parameter
beta = 0.5

# Define arguments dict
ARGS = {
    'x': x,
    'beta': beta
}
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 ndarray, ndim 1, dtype family float, shape (4,) — shape (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
convert_slow_tokenizer Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/HugFace/src/transformers/convert_slow_tokenizer.py
code served (permissive licence) · get_code("9339ca51cea1f469")
How it ran

no invocation recorded.

fit_beta Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/Implementations_Associative_Memory.py
code served (permissive licence) · get_code("4ffbc66e592539d9")
How it ran

no invocation recorded.

infer_shapes Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/HugFace/src/transformers/convert_graph_to_onnx.py
pointer only (licence: MIT); the stored copy get_code serves, from UW-Madison-Lee-Lab/looped-tf, is pointer only (licence: NONE) · get_code("3449d7d975edfb89")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from UW-Madison-Lee-Lab/looped-tf, and GitHub detected no licence in that repository 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.

test_projection Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/utils_LearnProjections.py
code served (permissive licence) · get_code("53ca5e262920709d")
How it ran

no invocation recorded.

train_projection Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/utils_LearnProjections.py
code served (permissive licence) · get_code("ad63033a1bd00f97")
How it ran

no invocation recorded.

update_Binary_Neuron_SDM Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/Implementations_Associative_Memory.py
code served (permissive licence) · get_code("26f72e9fdbfa1b09")
How it ran

no invocation recorded.

update_Cont_Attention Not yet run
unverified (harvested, no recorded run)
trentbrick/attention-approximates-sdm/Implementations_Associative_Memory.py
code served (permissive licence) · get_code("7380c3067187ef0e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 9 are also present in other papers whose code we hold (9 with at least one paper dated earlier, 9 the same month, 9 later) and 10 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
mish 25 other papers
6 dated earlier, 1 the same month, 18 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2104.08400 (2021-04)
Structure-Aware Abstractive Conversation Summarization via Discourse and Action Graphs
2106.00420 (2021-06)
Dialogue-oriented Pre-training
and 22 more not named here
gelu_new 24 other papers
8 dated earlier, 1 the same month, 15 later
2004.10964 (2020-04)
Don't Stop Pretraining: Adapt Language Models to Domains and Tasks
2104.08066 (2021-04)
Effect of Visual Extensions on Natural Language Understanding in Vision-and-Language Models
2104.08400 (2021-04)
Structure-Aware Abstractive Conversation Summarization via Discourse and Action Graphs
and 21 more not named here
gelu_fast 22 other papers
8 dated earlier, 1 the same month, 13 later
2010.03957 (2020-10)
Transformers for Modeling Physical Systems
2104.08066 (2021-04)
Effect of Visual Extensions on Natural Language Understanding in Vision-and-Language Models
2104.08400 (2021-04)
Structure-Aware Abstractive Conversation Summarization via Discourse and Action Graphs
and 19 more not named here
ensure_valid_input 14 other papers
2 dated earlier, 1 the same month, 11 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 11 more not named here
generate_identified_filename 14 other papers
2 dated earlier, 1 the same month, 11 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 11 more not named here
infer_shapes 14 other papers
2 dated earlier, 1 the same month, 11 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 11 more not named here
check_number_comma 13 other papers
2 dated earlier, 1 the same month, 10 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 10 more not named here
convert_slow_tokenizer 13 other papers
2 dated earlier, 1 the same month, 10 later
2007.07779 (2020-07)
AdapterHub: A Framework for Adapting Transformers
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
and 10 more not named here
quick_gelu 6 other papers
1 dated earlier, 1 the same month, 4 later
2110.04366 (2021-10)
Towards a Unified View of Parameter-Efficient Transfer Learning
2111.00160 (2021-11)
DSEE: Dually Sparsity-embedded Efficient Tuning of Pre-trained Language Models
2022.naacl-main.130 (2022 (year only))
BAD-X: Bilingual Adapters Improve Zero-Shot Cross-Lingual Transfer
and 3 more not named here

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

While Attention has come to be an important mechanism in deep learning, there remains limited intuition for why it works so well. Here, we show that Transformer Attention can be closely related under certain data conditions to Kanerva's Sparse Distributed Memory (SDM), a biologically plausible associative memory model. We confirm that these conditions are satisfied in pre-trained GPT2 Transformer models. We discuss the implications of the Attention-SDM map and provide new computational and biological interpretations of Attention.

For agents

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

get_harvested_code_for_paper("2111.05498")
get_code_for_paper("2111.05498")
have("2111.05498")

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

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

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

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

Connect an agent — have() is free.