SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.01384 · ACL · 2023

Class based Influence Functions for Error Detection

Nguyen Ngoc-Hieu, Hoang, Quan Tran, Nghi Bui, Anh Dau, Nguyen Duc-Thang, Huu-Tien Dang

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 2 failures of our instrument; 2 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/2305.01384.json · badge: /api/ran/2305.01384.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
Fsoft-AIC/Class-Based-Influence-Functions marked official in Papers with Code
Papers with Code archive
4 ran · 2 no recorded run
FunctionStatusWhere it lives
IF Ran
ran, honoured the contract we drafted
Fsoft-AIC/Class-Based-Influence-Functions/influencer/IF.py
code served (permissive licence) · get_code("a2c1e36ee81e372f")
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 ndarray, ndim 2, dtype family float, shape (2, 2) 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 torch.autograd import grad

torch.manual_seed(0)

# Define a simple inference function that returns predictions and labels
class SimpleModel(nn.Module):
    def __init__(self, input_dim=4, output_dim=3):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel(input_dim=4, output_dim=3)

def inference_fn(data):
    """Returns predictions and labels from data"""
    x, y = data
    preds = model(x)
    return preds, y

def loss_fn(preds, labels):
    """Simple cross-entropy loss"""
    return nn.functional.cross_entropy(preds, labels)

# Create small datasets
def create_small_loader(batch_size=2, num_batches=2):
    """Create a simple data loader with tiny tensors"""
    loader = []
    for _ in range(num_batches):
        x = torch.randn(batch_size, 4)
        y = torch.randint(0, 3, (batch_size,))
        loader.append((x, y))
    return loader

test_loader = create_small_loader(batch_size=2, num_batches=2)
train_loader = create_small_loader(batch_size=2, num_batches=2)

# Get model parameters
params = list(model.parameters())

# Compute test gradients
test_gradients = []
for data in test_loader:
    x, y = data
    preds = model(x)
    loss = loss_fn(preds, y)
    grads = list(grad(loss, params, create_graph=False, retain_graph=True))
    test_gradients.append(grads)

# Compute train gradients
train_gradients = []
for data in train_loader:
    x, y = data
    preds = model(x)
    loss = loss_fn(preds, y)
    grads = list(grad(loss, params, create_graph=False, retain_graph=True))
    train_gradients.append(grads)

ARGS = {
    'test_loader': test_loader,
    'train_loader': train_loader,
    'test_gradients': test_gradients,
    'train_gradients': train_gradients,
    'inference_fn': inference_fn,
    'loss_fn': loss_fn,
    'params': params,
    'use_exact_hessian': True,
    'eps': 0.1,
    'device': 'cpu'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, tqdm — 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, 2) — shape (2, 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
exact_hessian Ran
ran, honoured the contract we drafted
Fsoft-AIC/Class-Based-Influence-Functions/influencer/IF.py
code served (permissive licence) · get_code("a58b6792cd8478ec")
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 (23, 23) 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 torch.autograd import grad

torch.manual_seed(0)

# Define a simple neural network model
class SimpleModel(nn.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        x = torch.relu(self.linear1(x))
        x = self.linear2(x)
        return x

# Create model instance
model = SimpleModel()

# Define inference function that returns predictions and labels
def inference_fn(sample):
    x, y = sample
    preds = model(x)
    return preds, y

# Create a simple sample (batch_size=2, input_dim=4, output_dim=2)
sample_x = torch.randn(2, 4, requires_grad=True)
sample_y = torch.randint(0, 2, (2,))
sample = (sample_x, sample_y)

# Get parameters for which we want to compute Hessian
params = list(model.parameters())

# Define a loss function
loss_fn = nn.CrossEntropyLoss()

ARGS = {
    'sample': sample,
    'inference_fn': inference_fn,
    'params': params,
    'loss_fn': loss_fn
}
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 (23, 23) — shape (23, 23) 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
grad_z Ran
ran; our contract draft was wrong, not the code
Fsoft-AIC/Class-Based-Influence-Functions/influencer/IF.py
code served (permissive licence) · get_code("47d46fc1438d3331")
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. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a simple inference function that takes data and returns prediction and label
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

def inference_fn(data):
    x, y = data
    prediction = model(x)
    return prediction, y

# Define a simple loss function
loss_fn = nn.MSELoss()

# Create small tensors for data (batch_size=2, feature_dim=4, output_dim=3)
x = torch.randn(2, 4)
y = torch.randn(2, 3)
data = (x, y)

# Get parameters that we want to compute gradients for
params = list(model.parameters())

ARGS = {
    "inference_fn": inference_fn,
    "loss_fn": loss_fn,
    "params": params,
    "data": data,
    "create_graph": False
}
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 list — a list 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
hvp Ran
ran; our contract draft was wrong, not the code
Fsoft-AIC/Class-Based-Influence-Functions/influencer/IF.py
code served (permissive licence) · get_code("784eafbc7603a144")
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 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 torch
from torch.autograd import grad

torch.manual_seed(0)

# Create a simple quadratic function to compute Hessian for
# y = 0.5 * w[0]^T * A * w[0] + 0.5 * w[1]^T * w[1]
# This will have a well-defined Hessian

# Define parameters w (what we compute Hessian with respect to)
w0 = torch.randn(4, 3, requires_grad=True)
w1 = torch.randn(2, 5, requires_grad=True)
w = [w0, w1]

# Define the vector v to multiply with Hessian (same shape as w)
v0 = torch.randn(4, 3)
v1 = torch.randn(2, 5)
v = [v0, v1]

# Create a scalar output y that depends on w
# y = 0.5 * sum(w[0]^2) + 0.3 * sum(w[1]^2)
# This is a simple quadratic with Hessian = diag([1, 1, ...])
A = torch.eye(4, 3)
y = 0.5 * torch.sum(w[0] ** 2) + 0.3 * torch.sum(w[1] ** 2)

ARGS = {
    'y': y,
    'w': w,
    'v': v
}
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 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
build_stest Not yet run
unverified (harvested, no recorded run)
Fsoft-AIC/Class-Based-Influence-Functions/influencer/IF.py
code served (permissive licence) · get_code("a7ebbcf617c212b4")
How it ran

no invocation recorded.

s_test Not yet run
unverified (harvested, no recorded run)
Fsoft-AIC/Class-Based-Influence-Functions/influencer/IF.py
code served (permissive licence) · get_code("a972b3691a74c1c1")
How it ran

no invocation recorded.

Also present in other papers' code

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

Influence functions (IFs) are a powerful tool for detecting anomalous examples in large scale datasets. However, they are unstable when applied to deep networks. In this paper, we provide an explanation for the instability of IFs and develop a solution to this problem. We show that IFs are unreliable when the two data points belong to two different classes. Our solution leverages class information to improve the stability of IFs. Extensive experiments show that our modification significantly improves the performance and stability of IFs while incurring no additional computational cost.

For agents

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

get_harvested_code_for_paper("2305.01384")
get_code_for_paper("2305.01384")
have("2305.01384")

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

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

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

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

Connect an agent — have() is free.