SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.02157 · NeurIPS · 2021

Learning with Holographic Reduced Representations

Ashwinkumar Ganesan, Hang Gao, Sunil Gandhi, Edward Raff, Tim Oates, James Holt, Mark Mclean

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 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; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 0 failures of our instrument; 4 no recorded run), 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/2109.02157.json · badge: /api/ran/2109.02157.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
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations canonical (classifier label)
classifier basis: census
7 ran · 4 no recorded run
FunctionStatusWhere it lives
baseline_train Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/model.py
code served (permissive licence) · get_code("528eac8c11f5eb28")
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 float, 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 torch.nn as nn
from collections import defaultdict

torch.manual_seed(0)

# Timer class to track timing
class Timer:
    def __init__(self):
        self.start_time = None
    
    def start(self):
        self.start_time = 0
    
    def end(self):
        pass

# Small model that satisfies the function's usage
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
        self.time = defaultdict(Timer)
        for key in ['train', 'data_load', 'train_forward_pass', 'train_loss', 'optimization']:
            self.time[key] = Timer()
    
    def forward(self, x):
        output = self.linear(x)
        return output, None
    
    def train(self):
        super().train()

# Create model
model = SimpleModel()

# Create device
device = 'cpu'

# Create a small train loader (list of (data, target) tuples)
train_loader = [
    (torch.randn(2, 4), torch.randn(2, 3)),
    (torch.randn(2, 4), torch.randn(2, 3))
]

# Create optimizer
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)

# Define arguments
ARGS = {
    'log_interval': 10,
    'model': model,
    'device': device,
    'train_loader': train_loader,
    'optimizer': optimizer,
    'epoch': 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
complex_division Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/mathops.py
code served (permissive licence) · get_code("5c9ad0b9818d84e5")
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, 4, 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)

# Construct arguments for complex_division
# The function expects two tensors with shape (..., 2) where last dimension contains [real, complex]

left = torch.randn(2, 4, 2)  # batch=2, features=4, [real, complex]
right = torch.randn(2, 4, 2)  # batch=2, features=4, [real, complex]

ARGS = {
    "left": left,
    "right": right,
}
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, 4, 2) — shape (2, 4, 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
complex_multiplication Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/mathops.py
code served (permissive licence) · get_code("a01531e7c5e28798")
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, 4, 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 two complex-valued vectors
# Shape: (2, 4, 2) where last dimension is [real, imag]
left = torch.randn(2, 4, 2)
right = torch.randn(2, 4, 2)

ARGS = {
    "left": left,
    "right": right,
}
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, 4, 2) — shape (2, 4, 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
generate_vectors Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/embeddings.py
code served (permissive licence) · get_code("35040e193c018346")
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 torch

torch.manual_seed(0)

ARGS = {
    'num_vectors': 2,
    'dims': 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 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
mbprecision Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/metrics.py
code served (permissive licence) · get_code("6470efd911336ea8")
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 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

torch.manual_seed(0)

# The function expects:
# - y_true: a tensor that supports bitwise & operation and sum along axis 1
# - y_pred: a tensor that supports bitwise & operation and sum along axis 1
# Both should be boolean tensors for the bitwise & to make sense
# Shape: (batch_size, num_classes) where batch_size=2, num_classes=4

y_true = torch.tensor([
    [True, False, True, False],
    [False, True, True, True]
], dtype=torch.bool)

y_pred = torch.tensor([
    [True, False, True, True],
    [False, True, False, True]
], dtype=torch.bool)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred
}
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 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
mbrecall Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/metrics.py
code served (permissive licence) · get_code("ffdd5ec12ec03c09")
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 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

torch.manual_seed(0)

# y_true and y_pred are used with:
# - & operator (bitwise AND, works on bool tensors)
# - torch.sum(..., axis=1)
# - torch.mean()
# These should be boolean tensors with shape (batch_size, num_features)

batch_size = 2
num_features = 4

y_true = torch.tensor([
    [True, False, True, False],
    [False, True, True, True]
], dtype=torch.bool)

y_pred = torch.tensor([
    [True, False, True, True],
    [False, True, False, True]
], dtype=torch.bool)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred
}
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 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
spp_loss Ran
ran on a synthesized input
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/model.py
code served (permissive licence) · get_code("364b63d35d4fd454")
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 torch.nn as nn

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embedding_dim = 4
        self.num_classes = 3
        
    def class_vec(self, target):
        """Returns class vectors for targets"""
        batch_size = target.shape[0]
        return torch.randn(batch_size, self.num_classes, self.embedding_dim)
    
    def class_weights(self, target):
        """Returns class weights for targets"""
        batch_size = target.shape[0]
        return torch.ones(batch_size, self.num_classes, 1)
    
    def inference(self, s, batch_size, positive=True):
        """Returns convolution results"""
        return torch.randn(batch_size, self.num_classes, self.embedding_dim)

def complexMagProj(x):
    """Mock implementation for complex magnitude projection"""
    return torch.abs(x)

# Construct arguments
s = torch.randn(2, 5, 5)  # Some latent representation
model = MockModel()
data = torch.randn(2, 3, 4)  # batch_size=2
target = torch.tensor([0, 1])  # batch_size=2, class indices
device = 'cpu'
without_negative = False
normalize = False

ARGS = {
    's': s,
    'model': model,
    'data': data,
    'target': target,
    'device': device,
    'without_negative': without_negative,
    'normalize': normalize,
}
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 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
baseline_test Not yet run
unverified (harvested, no recorded run)
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/model.py
code served (permissive licence) · get_code("d2bfb4dfdeec9aee")
How it ran

no invocation recorded.

circular_conv Not yet run
unverified (harvested, no recorded run)
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/mathops.py
code served (permissive licence) · get_code("9f884a4269a73b4e")
How it ran

no invocation recorded.

gen_rand_vec Not yet run
unverified (harvested, no recorded run)
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/lib/embeddings.py
code served (permissive licence) · get_code("6cac5107499ce4f4")
How it ran

no invocation recorded.

reduce_dimensions Not yet run
unverified (harvested, no recorded run)
NeuromorphicComputationResearchProgram/Learning-with-Holographic-Reduced-Representations/build_label_vectors.py
code served (permissive licence) · get_code("79f411e19bb4fac3")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 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 11 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-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

Holographic Reduced Representations (HRR) are a method for performing symbolic AI on top of real-valued vectors [1] by associating each vector with an abstract concept, and providing mathematical operations to manipulate vectors as if they were classic symbolic objects. This method has seen little use outside of older symbolic AI work and cognitive science. Our goal is to revisit this approach to understand if it is viable for enabling a hybrid neural-symbolic approach to learning as a differentiable component of a deep learning architecture. HRRs today are not effective in a differentiable solution due to numerical instability, a problem we solve by introducing a projection step that forces the vectors to exist in a well behaved point in space. In doing so we improve the concept retrieval efficacy of HRRs by over 100×. Using multi-label classification we demonstrate how to leverage the symbolic HRR properties to develop an output layer and loss function that is able to learn effectively, and allows us to investigate some of the pros and cons of an HRR neuro-symbolic learning approach. Our code can be found at https://github.com/NeuromorphicComputationResearchProgram/ Learning-with-Holographic-Reduced-Representations * Research work completed prior to joining Amazon.

For agents

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

get_harvested_code_for_paper("2109.02157")
get_code_for_paper("2109.02157")
have("2109.02157")

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

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

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

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

Connect an agent — have() is free.