SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.04753 · ACL · 2021

On Sample Based Explanation Methods for NLP: Efficiency, Faithfulness, and Semantic Evaluation

Fan Zhang, Wei Zhang, Yada Zhu, Xiaodong Cui, Guangnan Ye, Ziming Huang

arXiv · PDF · Open in the Atlas

Code that ran

6 of 10 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, 0 violated it and 0 have no contract verdict; 5 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/2106.04753.json · badge: /api/ran/2106.04753.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
IBM/TracInF community
Papers with Code archive
6 ran · 4 no recorded run
FunctionStatusWhere it lives
calc_loss Ran
ran; our contract draft was wrong, not the code
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("726d0822a9e90aaf")
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
import torch.nn as nn

torch.manual_seed(0)

# Create a mock outputs object with a logits attribute
class MockOutputs:
    def __init__(self, logits):
        self.logits = logits

# Test case 1: multi-class cross entropy
# Create outputs with logits of shape (batch_size=2, num_classes=4)
logits_multiclass = torch.randn(2, 4)
outputs_multiclass = MockOutputs(logits_multiclass)
labels_multiclass = torch.tensor([0, 2], dtype=torch.long)

# Test case 2: binary cross entropy
# Create outputs with logits of shape (batch_size=2, num_classes=1)
logits_binary = torch.randn(2, 1)
outputs_binary = MockOutputs(logits_binary)
labels_binary = torch.tensor([[1.0], [0.0]], dtype=torch.float)

# Use the multi-class case as default
ARGS = {
    'outputs': outputs_multiclass,
    'labels': labels_multiclass,
    'loss_func': 'cross_entropy'
}
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
conjugate_gradient Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("f4c9f096d90e61e3")
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
from scipy.optimize import fmin_ncg

# Define a simple ax_fn that performs matrix-vector multiplication
# We'll create a simple linear operator: Ax where A is a small matrix
def create_ax_fn():
    # Create a small 4x4 matrix for the linear operator
    A = np.array([
        [4.0, 1.0, 0.5, 0.2],
        [1.0, 3.0, 0.3, 0.1],
        [0.5, 0.3, 2.0, 0.4],
        [0.2, 0.1, 0.4, 1.5]
    ])
    
    def ax_fn(x):
        """Compute Ax for a given vector x"""
        return np.dot(A, x)
    
    return ax_fn

# Create the b vector (same dimension as the matrix is 4x4)
b = np.array([1.0, 2.0, 1.5, 0.5])

# Create a debug callback function
def debug_callback_fn(x, linear_part, quadratic_part):
    """Optional debug callback that receives current solution and objective parts"""
    pass

# Construct the ARGS dictionary
ARGS = {
    'ax_fn': create_ax_fn(),
    'b': b,
    'debug_callback': debug_callback_fn,
    'avextol': 1e-6,
    'maxiter': 100
}
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 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
grad_z Ran
ran; our contract draft was wrong, not the code
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("6ec180448a5aaa8a")
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. 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 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 SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x, attention_mask=None):
        logits = self.linear(x)
        return type('Output', (), {'logits': logits})()

model = SimpleModel()

# Training data: batch_size=2, feature_dim=4
x = torch.randn(2, 4)

# Attention mask: batch_size=2, seq_len=4
m = torch.ones(2, 4)

# Labels: batch_size=2, with values in range [0, 3) for cross_entropy
y = torch.tensor([0, 2])

ARGS = {
    'x': x,
    'm': m,
    'y': y,
    'model': model,
    'gpu': -1,
    'loss_func': 'cross_entropy'
}
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 — 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
make_functional Ran
ran; our contract draft was wrong, not the code
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("194db402fdfd8a1d")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple model with parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.layer1 = nn.Linear(4, 3)
        self.layer2 = nn.Linear(3, 2)
    
model = SimpleModel()

ARGS = {
    "model": model
}
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 — 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
parameters_to_vector Ran
ran, honoured the contract we drafted
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("5b72c46a260d3754")
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 (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

torch.manual_seed(0)

# Create a simple model with a few parameters of different shapes
model = nn.Sequential(
    nn.Linear(4, 3),
    nn.ReLU(),
    nn.Linear(3, 2)
)

# Extract the parameters from the model
parameters = list(model.parameters())

ARGS = {
    "parameters": parameters
}
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 1, dtype family float, shape (23,) — shape (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
tensor_to_tuple Ran
ran; our contract draft was wrong, not the code
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("1521d8f9fa289d3f")
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 torch

torch.manual_seed(0)

# Create a vector that represents flattened parameters
# We'll create a vector of size 10 (2 + 3 + 5 elements from different parameter tensors)
vec = torch.randn(10)

# Create an iterable of parameter tensors with different shapes
# These will be split from the vector
param1 = torch.randn(2)  # 2 elements
param2 = torch.randn(3)  # 3 elements
param3 = torch.randn(5)  # 5 elements

parameters = [param1, param2, param3]

ARGS = {
    'vec': vec,
    'parameters': parameters
}
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 — 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
del_attr Not yet run
unverified (harvested, no recorded run)
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("07957dd70a5d4a77")
How it ran

no invocation recorded.

load_weights Not yet run
unverified (harvested, no recorded run)
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("046062e4ea7ca7df")
How it ran

no invocation recorded.

s_test_cg Not yet run
unverified (harvested, no recorded run)
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("78cbcb281155ca8c")
How it ran

no invocation recorded.

set_attr Not yet run
unverified (harvested, no recorded run)
IBM/TracInF/code/pif/influence_functions/hvp_grad.py
code served (permissive licence) · get_code("36495d54d434df01")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 4 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 4 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.

FunctionAlso present inEarliest-datedOthers named
conjugate_gradient
brick of this paper's assembly: helper
1 other paper
1 later
2409.05208 (2024-09)
Influence-based Attributions can be Manipulated
make_functional
brick of this paper's assembly: helper
1 other paper
1 later
2409.05208 (2024-09)
Influence-based Attributions can be Manipulated
set_attr
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2109.01903 (2021-09)
Robust fine-tuning of zero-shot models
tensor_to_tuple
brick of this paper's assembly: helper
1 other paper
1 later
2409.05208 (2024-09)
Influence-based Attributions can be Manipulated

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

In the recent advances of natural language processing, the scale of the state-of-the-art models and datasets is usually extensive, which challenges the application of sample-based explanation methods in many aspects, such as explanation interpretability, efficiency, and faithfulness. In this work, for the first time, we can improve the interpretability of explanations by allowing arbitrary text sequences as the explanation unit. On top of this, we implement a hessian-free method with a model faithfulness guarantee. Finally, to compare our method with the others, we propose a semantic-based evaluation metric that can better align with humans' judgment of explanations than the widely adopted diagnostic or retraining measures. The empirical results on multiple real data sets demonstrate the proposed method's superior performance to popular explanation techniques such as Influence Function or TracIn on semantic evaluation.

For agents

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

get_harvested_code_for_paper("2106.04753")
get_code_for_paper("2106.04753")
have("2106.04753")

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

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

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

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

Connect an agent — have() is free.