SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.00194 · NeurIPS · 2023

Robust Concept Erasure via Kernelized Rate-Distortion Maximization

Nicholas Monath, Avinava Dubey, Amr Ahmed, Snigdha Chaturvedi, Somnath Basu Roy Chowdhury

arXiv · PDF · Open in the Atlas

Code that ran

20 of 21 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; 4 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 13 failures of our instrument; 1 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/2312.00194.json · badge: /api/ran/2312.00194.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
brcsomnath/KRaM canonical (classifier label)
classifier basis: census
18 ran · 1 no recorded run
brcsomnath/kram canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
RateDistortion Ran
ran on a synthesized input
brcsomnath/kram/src/loss.py
code served (permissive licence) · get_code("49a93e98ae41a86f")
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 0, dtype family float; no output shape is stated. 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 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

INIT_ARGS = {
    'gam1': 1.0,
    'gam2': 1.0,
    'eps': 0.01,
}

ARGS = {
    'W': torch.randn(4, 3),
    'device': 'cpu',
}

METHOD = 'rate'

if __name__ == '__main__':
    model = torch.nn.Module()
    from __main__ import RateDistortion
    
    rd = RateDistortion(**INIT_ARGS)
    result = getattr(rd, METHOD)(**ARGS)
    print(f"Result shape: {result.shape if hasattr(result, 'shape') else 'scalar'}")
    print(f"Result: {result}")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
__main__, 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 — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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)
RateDistortionContinuous Ran
ran on a synthesized input
brcsomnath/kram/src/loss.py
code served (permissive licence) · get_code("efd704682a41f0a3")
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 tuple, ndim 1, dtype family float; no output shape is stated. 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 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

# Construct the class
class RateDistortion(torch.nn.Module):

    def __init__(self, gam1=1.0, gam2=1.0, eps=0.01):
        super(RateDistortion, self).__init__()
        self.gam1 = gam1
        self.gam2 = gam2
        self.eps = eps

    def rate(self, W, device='cpu'):
        """Empirical Discriminative Loss."""
        p, m = W.shape
        I = torch.eye(p).to(device)
        scalar = p / (m * self.eps)
        logdet = torch.logdet(I + self.gam1 * scalar * W.matmul(W.T))
        return logdet / 2.0

    def rate_for_mixture(self, W, Pi, device='cpu'):
        """Empirical Compressive Loss."""
        p, m = W.shape
        k, _, _ = Pi.shape
        I = torch.eye(p).to(device)
        compress_loss = 0.0
        for j in range(k):
            trPi = torch.trace(Pi[j]) + 1e-08
            scalar = p / (trPi * self.eps)
            log_det = torch.logdet(I + scalar * W.matmul(Pi[j]).matmul(W.T))
            compress_loss += log_det * trPi / m
        return compress_loss / 2.0

    def rate_for_continuous(self, W, kernel, device='cpu'):
        """Empirical Discriminative Loss with a continuous kernel."""
        p, m = W.shape
        I = torch.eye(p).to(device)
        scalar = p / (m * self.eps)
        cov = W.matmul(W.T)
        kernalized_cov = torch.mul(cov, kernel)
        logdet = torch.logdet(I + self.gam1 * scalar * kernalized_cov)
        return logdet / 2.0

class RateDistortionContinuous(RateDistortion):
    """
    Rate distortion loss for deleting continuous
    protected attribute with a kernel function. 
    """

    def forward(self, X, X_raw, kernel, device='cpu', scale=1.0):
        const = self.rate(X_raw.T, device)
        R_z = self.rate(X.T, device)
        eq_const = torch.abs(R_z - scale * const)
        R_z_K = self.rate_for_continuous(X, kernel, device)
        return (-R_z_K, eq_const)


INIT_ARGS = {
    'gam1': 1.0,
    'gam2': 1.0,
    'eps': 0.01
}

ARGS = {
    'X': torch.randn(4, 3),
    'X_raw': torch.randn(4, 3),
    'kernel': torch.randn(4, 4),
    'device': 'cpu',
    'scale': 1.0
}

if __name__ == '__main__':
    model = RateDistortionContinuous(**INIT_ARGS)
    output = model(**ARGS)
    print("Output:", output)
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 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
cauchy_kernel Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/metrics.py
code served (permissive licence) · get_code("8e8e1bf9b627b971")
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 (8, 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)

# Create a small tensor with shape (2, 4)
# The function reshapes it to (-1, 1) and computes pairwise distances
tensor = torch.randn(2, 4)

# Define ARGS with all parameters
ARGS = {
    'tensor': tensor,
    'sigma': 0.1,
    'data_type': 'continuous'
}
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 (8, 8) — shape (8, 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
classify Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
brcsomnath/KRaM/src/utils.py
code served (permissive licence) · get_code("590b4d2c85eae0a0")
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 numpy as np
from sklearn.neural_network import MLPRegressor, MLPClassifier

# Set random seed for reproducibility
np.random.seed(42)

# Create small synthetic training data
# x_train: 2 samples, 4 features
x_train = np.random.randn(2, 4).astype(np.float32)
# y_train: 2 labels (binary classification: 0 or 1)
y_train = np.array([0, 1], dtype=np.int64)

# Create small synthetic test data
# x_test: 2 samples, 4 features
x_test = np.random.randn(2, 4).astype(np.float32)
# y_test: 2 labels
y_test = np.array([1, 0], dtype=np.int64)

ARGS = {
    "x_train": x_train,
    "y_train": y_train,
    "x_test": x_test,
    "y_test": y_test,
    "seed": 42
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
correlation Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/evaluate.py
code served (permissive licence) · get_code("8a14ef4db6394aa7")
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 list, 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 numpy as np
from scipy.spatial.distance import pdist
from scipy.spatial.distance import squareform

# Set random seed for reproducibility
np.random.seed(0)

# Create small sample representations
# Z_before: n=5 samples, d=4 dimensions
Z_before = np.random.randn(5, 4).astype(np.float32)

# Z_after: same number of samples, same dimensionality
Z_after = np.random.randn(5, 4).astype(np.float32)

# k: number of neighbours
k = 2

ARGS = {
    "Z_before": Z_before,
    "Z_after": Z_after,
    "k": k
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
debias_by_specific_directions Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/baselines/inlp.py
code served (permissive licence) · get_code("8913e4e11f92191f")
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 2, dtype family float, shape (5, 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 numpy as np
import scipy

# Set random seed for reproducibility
np.random.seed(0)

# Create small example directions (vectors)
input_dim = 5
num_directions = 3

# Generate a few random direction vectors
directions = []
for i in range(num_directions):
    # Create random direction vectors of dimension input_dim
    direction = np.random.randn(input_dim)
    directions.append(direction)

# Build ARGS dict with all required parameters
ARGS = {
    "directions": directions,
    "input_dim": input_dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (5, 5) — shape (5, 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
evaluate_regression Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
brcsomnath/KRaM/src/utils.py
code served (permissive licence) · get_code("b5e6d7d6e3f5eb54")
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. 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 numpy as np
from sklearn.neural_network import MLPRegressor
from sklearn.metrics import mean_squared_error

# Create small synthetic datasets
np.random.seed(42)

# Training data: 2 samples, 4 features
x_train = np.random.randn(2, 4).astype(np.float32)
z_train = np.random.randn(2, 1).astype(np.float32).ravel()

# Test data: 2 samples, 4 features
x_test = np.random.randn(2, 4).astype(np.float32)
z_test = np.random.randn(2, 1).astype(np.float32).ravel()

ARGS = {
    'x_train': x_train,
    'z_train': z_train,
    'x_test': x_test,
    'z_test': z_test,
    'seed': 42
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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: none by the harness; any seed is in the setup block
gaussian_kernel Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/metrics.py
code served (permissive licence) · get_code("c4b2effb5d8110a1")
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 (8, 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)

# Create a small tensor for the gaussian_kernel function
# The function reshapes it to (-1, 1), so we need a 1D or 2D tensor
tensor = torch.randn(2, 4)

# Define ARGS dict with all parameters
ARGS = {
    'tensor': tensor,
    'sigma': 0.1,
    'data_type': 'continuous'
}
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 (8, 8) — shape (8, 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
get_projection_to_intersection_of_nullspaces Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/baselines/inlp.py
code served (permissive licence) · get_code("b26df1b3be7a084e")
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 2, dtype family float, shape (4, 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
import scipy

# Create a list of small rowspace projection matrices
# These represent projections onto rowspaces of different weight matrices

# Create a sample weight matrix W1
W1 = np.array([[1.0, 0.0, 0.0, 0.0],
               [0.0, 1.0, 0.0, 0.0],
               [0.0, 0.0, 0.5, 0.0]])

# Create a sample weight matrix W2
W2 = np.array([[1.0, 0.0, 0.0, 0.0],
               [0.0, 0.0, 1.0, 0.0]])

# Helper function to compute rowspace projection (same as in the module)
def get_rowspace_projection(W: np.ndarray) -> np.ndarray:
    if np.allclose(W, 0):
        w_basis = np.zeros_like(W.T)
    else:
        w_basis = scipy.linalg.orth(W.T)
    P_W = w_basis.dot(w_basis.T)
    return P_W

# Compute rowspace projections for both weight matrices
P_R_W1 = get_rowspace_projection(W1)
P_R_W2 = get_rowspace_projection(W2)

# Create list of rowspace projection matrices
rowspace_projection_matrices = [P_R_W1, P_R_W2]

# Input dimension
input_dim = 4

ARGS = {
    "rowspace_projection_matrices": rowspace_projection_matrices,
    "input_dim": input_dim
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (4, 4) — shape (4, 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
get_representations_from_loader Ran
ran, honoured the contract we drafted
brcsomnath/KRaM/src/baselines/farm.py
code served (permissive licence) · get_code("3f72ad49af8d0e6b")
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 2, dtype family float, shape (6, 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)

# The function expects a loader that:
# 1. Is iterable
# 2. Yields tuples where batch[0] is a tensor
# 3. The tensor has .detach(), .cpu(), .numpy() methods

# Create a simple loader as a list of (tensor, label) tuples
batch_size = 2
feature_dim = 4

# Create a few batches of data
loader = [
    (torch.randn(batch_size, feature_dim), torch.randint(0, 2, (batch_size,))),
    (torch.randn(batch_size, feature_dim), torch.randint(0, 2, (batch_size,))),
    (torch.randn(batch_size, feature_dim), torch.randint(0, 2, (batch_size,))),
]

ARGS = {
    "loader": loader
}
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 2, dtype family float, shape (6, 4) — shape (6, 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
get_representations_from_loader Ran
ran, honoured the contract we drafted
brcsomnath/KRaM/src/baselines/mi_debiasing.py
code served (permissive licence) · get_code("4484e72f4b964121")
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 2, dtype family float, shape (4, 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)

# The function iterates over a loader, unpacking tuples of (batch_embs, batch_y, batch_z)
# It calls .detach(), .cpu(), .numpy() on batch_embs, then extends a list
# batch_embs must be a torch tensor
# batch_y and batch_z can be anything (they're not used)

# Create a simple loader as a list of tuples
batch_1_embs = torch.randn(2, 4)  # batch size 2, embedding dim 4
batch_1_y = torch.tensor([0, 1])
batch_1_z = torch.tensor([1, 0])

batch_2_embs = torch.randn(2, 4)
batch_2_y = torch.tensor([1, 0])
batch_2_z = torch.tensor([0, 1])

loader = [
    (batch_1_embs, batch_1_y, batch_1_z),
    (batch_2_embs, batch_2_y, batch_2_z),
]

ARGS = {
    "loader": loader
}
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 2, dtype family float, shape (4, 4) — shape (4, 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
get_rowspace_projection Ran
ran, honoured the contract we drafted
brcsomnath/KRaM/src/baselines/inlp.py
code served (permissive licence) · get_code("f75e44f7fc419025")
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 2, dtype family float, shape (3, 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 numpy as np
import scipy.linalg

# Create a small non-zero matrix with distinct dimensions
# W will be used with W.T, so shape (4, 3) means rowspace is 3D
W = np.random.randn(4, 3)

ARGS = {
    "W": W
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (3, 3) — shape (3, 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
knn Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/evaluate.py
code served (permissive licence) · get_code("0ff8884ceed2cb83")
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 2, dtype family int, shape (5, 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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create a small set of representations
# Z should be R^{n x d} - n samples, d dimensions
n_samples = 5
d_dimensions = 4
Z = np.random.randn(n_samples, d_dimensions).astype(np.float32)

# Set k (number of neighbours)
k = 2

ARGS = {
    "Z": Z,
    "k": k,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (5, 2) — shape (5, 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
label_to_membership Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/loss.py
pointer only (licence: MIT); the stored copy get_code serves, from brcsomnath/farm, is pointer only (licence: NONE) · get_code("abef5bdd6d4d119a")
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 brcsomnath/farm, 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.

laplace_kernel Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/metrics.py
code served (permissive licence) · get_code("4b0b366504cec402")
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 (8, 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)

# Create a small tensor for testing
# The function reshapes it to (-1, 1), so shape doesn't matter much
# but let's use a 1D tensor of size 8 to get a 8x1 matrix after reshape
tensor = torch.randn(8)

# Define ARGS with all parameters
ARGS = {
    'tensor': tensor,
    'sigma': 0.1,
    'data_type': 'continuous'
}
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 (8, 8) — shape (8, 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
load_data Ran
ran on a synthesized input
brcsomnath/KRaM/src/data_load.py
code served (permissive licence) · get_code("69fd31f5a04ad9e2")
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. 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 numpy as np
import tempfile
import os

# Create a temporary directory with dummy .npy files
tmpdir = tempfile.mkdtemp()

# Create dummy numpy arrays for each of the 4 files
# Each file will contain small dummy data
fnames = ['neg_neg.npy', 'neg_pos.npy', 'pos_neg.npy', 'pos_pos.npy']
for fname in fnames:
    # Create dummy data with shape (100, 4) - 100 samples, 4 features
    dummy_data = np.random.randn(100, 4).astype(np.float32)
    np.save(os.path.join(tmpdir, fname), dummy_data)

ARGS = {
    'path': tmpdir,
    'size': 40,
    'ratio': 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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: none by the harness; any seed is in the setup block
load_deepmoji Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/data_load.py
code served (permissive licence) · get_code("55c2f56cc152566e")
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. 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 os
import os.path
import numpy as np
import tempfile
import shutil

# Create a temporary directory structure with fake .npy files
temp_dir = tempfile.mkdtemp()
base_path = os.path.join(temp_dir, 'deepmoji')
os.makedirs(base_path, exist_ok=True)

ratio = 0.5
train_path = os.path.join(base_path, f'emoji_sent_race_{ratio}', 'train')
test_path = os.path.join(base_path, f'emoji_sent_race_{ratio}', 'test')
os.makedirs(train_path, exist_ok=True)
os.makedirs(test_path, exist_ok=True)

# Create fake data files
fnames = ['neg_neg.npy', 'neg_pos.npy', 'pos_neg.npy', 'pos_pos.npy']

# For train set
n1_train = int(100000 * ratio / 2)
n2_train = int(100000 * (1 - ratio) / 2)
counts_train = [n1_train, n2_train, n2_train, n1_train]

for fname, count in zip(fnames, counts_train):
    data = np.random.randn(count, 50).astype(np.float32)
    np.save(os.path.join(train_path, fname), data)

# For test set
n1_test = int(100000 * ratio / 2)
n2_test = int(100000 * (1 - ratio) / 2)
counts_test = [n1_test, n2_test, n2_test, n1_test]

for fname, count in zip(fnames, counts_test):
    data = np.random.randn(count, 50).astype(np.float32)
    np.save(os.path.join(test_path, fname), data)

ARGS = {
    'path': base_path,
    'ratio': 0.5
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple 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: none by the harness; any seed is in the setup block
one_hot Ran
ran; our contract draft was wrong, not the code
brcsomnath/KRaM/src/loss.py
pointer only (licence: MIT); the stored copy get_code serves, from brcsomnath/farm, is pointer only (licence: NONE) · get_code("62dfecd92146a155")
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 brcsomnath/farm, 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.

pairwise_dist Ran
ran, honoured the contract we drafted
brcsomnath/KRaM/src/baselines/farm.py
code served (permissive licence) · get_code("c27d027c708f2a99")
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 2, dtype family int, shape (5, 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 numpy as np

# Create a small set of representations
# Z should be R^{n x d} where n is number of samples and d is dimension
np.random.seed(0)
Z = np.random.randn(5, 3).astype(np.float32)

ARGS = {
    "Z": Z
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (5, 5) — shape (5, 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
regression_predict Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
brcsomnath/KRaM/src/utils.py
code served (permissive licence) · get_code("e6ca500737cb0b1c")
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 2, dtype family float, shape (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 numpy as np
from sklearn.neural_network import MLPRegressor

np.random.seed(0)

# Create small training data
x_train = np.random.randn(2, 4).astype(np.float32)  # 2 samples, 4 features
z_train = np.random.randn(2, 3).astype(np.float32)  # 2 samples, 3 targets

# Create small test data
x_test = np.random.randn(2, 4).astype(np.float32)   # 2 samples, 4 features
z_test = np.random.randn(2, 3).astype(np.float32)   # 2 samples, 3 targets

ARGS = {
    'x_train': x_train,
    'z_train': z_train,
    'x_test': x_test,
    'z_test': z_test,
    'seed': 42
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 3) — shape (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
read_dataset Not yet run
unverified (harvested, no recorded run)
brcsomnath/KRaM/src/data_load.py
code served (permissive licence) · get_code("d127dafd8f5d0f8a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 21 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 3 later) and 17 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
get_projection_to_intersection_of_nullspaces 6 other papers
4 dated earlier, 1 later, 1 same year, order not determinable
1901.09451 (2019-01)
Bias in Bios: A Case Study of Semantic Representation Bias in a High-Stakes Setting
2007.00049 (2020-07)
OSCaR: Orthogonal Subspace Correction and Rectification of Biases in Word Embeddings
2203.07893 (2022-03)
Gold Doesn't Always Glitter: Spectral Removal of Linear and Nonlinear Guarded Attribute Information
and 3 more not named here
get_rowspace_projection 4 other papers
4 dated earlier
1901.09451 (2019-01)
Bias in Bios: A Case Study of Semantic Representation Bias in a High-Stakes Setting
2007.00049 (2020-07)
OSCaR: Orthogonal Subspace Correction and Rectification of Biases in Word Embeddings
2203.07893 (2022-03)
Gold Doesn't Always Glitter: Spectral Removal of Linear and Nonlinear Guarded Attribute Information
and 1 more not named here
label_to_membership 2 other papers
1 dated earlier, 1 later
2202.00035 (2022-02)
Learning Fair Representations via Rate-Distortion Maximization
2605.14654 (2026-05)
Beyond Instance-Level Self-Supervision in 3D Multi-Modal Medical Imaging
one_hot 2 other papers
1 dated earlier, 1 later
2202.00035 (2022-02)
Learning Fair Representations via Rate-Distortion Maximization
2605.14654 (2026-05)
Beyond Instance-Level Self-Supervision in 3D Multi-Modal Medical Imaging

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

Distributed representations provide a vector space that captures meaningful relationships between data instances. The distributed nature of these representations, however, entangles together multiple attributes or concepts of data instances (e.g., the topic or sentiment of a text, characteristics of the author (age, gender, etc), etc). Recent work has proposed the task of concept erasure [50,52], in which rather than making a concept predictable, the goal is to remove an attribute from distributed representations while retaining other information from the original representation space as much as possible. In this paper, we propose a new distance metric learningbased objective, the Kernelized Rate-Distortion Maximizer (KRaM), for performing concept erasure. KRaM fits a transformation of representations to match a specified distance measure (defined by a labeled concept to erase) using a modified ratedistortion function. Specifically, KRaM's objective function aims to make instances with similar concept labels dissimilar in the learned representation space while retaining other information. We find that optimizing KRaM effectively erases various types of concepts-categorical, continuous, and vector-valued variables-from data representations across diverse domains. We also provide a theoretical analysis of several properties of KRaM's objective. To assess the quality of the learned representations, we propose an alignment score to evaluate their similarity with the original representation space. Additionally, we conduct experiments to showcase KRaM's efficacy in various settings, from erasing binary gender variables in word embeddings to vector-valued variables in GPT-3 representations.

For agents

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

get_harvested_code_for_paper("2312.00194")
get_code_for_paper("2312.00194")
have("2312.00194")

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

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

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

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

Connect an agent — have() is free.