SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2107.07436 · ICLR · 2022

FastSHAP: Real-Time Shapley Value Estimation

Ian Covert, Su-In Lee, Rajesh Ranganath, Neil Jethani, Mukund Sudarshan, English Springer, Fastshap Kernelshap, Kernelshap-S Gradcam, Integrated Gradients, Smoothgrad Cxplain

arXiv · PDF · Open in the Atlas

Code that ran

8 of 17 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 5 failures of our instrument; 9 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/2107.07436.json · badge: /api/ran/2107.07436.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
iancovert/fastshap canonical (classifier label)
classifier basis: classifier_2025
3 ran · 1 no recorded run
iclr1814/fastshap canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
neiljethani/fastshap canonical (classifier label)
classifier basis: census
1 ran · 1 no recorded run
davidenapolitano/bones community
Papers with Code archive
2 ran · 4 no recorded run
tml-tuebingen/nshap community
Papers with Code archive
0 ran · 2 no recorded run
FunctionStatusWhere it lives
DatasetRepeat Ran
ran on a synthesized input · constructed an object; no result was computed
davidenapolitano/bones/bones/sv/image/explainers/fastshap/fastshap.py
pointer only (licence: NONE) · get_code("03059e06ad890351")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, davidenapolitano/bones 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.

ShapleySampler Ran
ran on a synthesized input · constructed an object; no result was computed
davidenapolitano/bones/bones/sv/image/explainers/fastshap/fastshap.py
pointer only (licence: NONE) · get_code("199c28206c728459")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, davidenapolitano/bones 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.

additive_efficient_normalization Ran
ran; our contract draft was wrong, not the code
iclr1814/fastshap/fastshap_torch/fastshap.py
pointer only (licence: NONE) · get_code("06435d9aa451885d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, iclr1814/fastshap 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.

additive_efficient_normalization Ran
ran; our contract draft was wrong, not the code
iancovert/fastshap/fastshap/fastshap.py
code served (permissive licence) · get_code("5b767f2708a31ef1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors with distinct dimensions
# pred: model predictions, shape (batch_size, num_features)
# The function does torch.sum(pred, dim=1) and pred.shape[1]
pred = torch.randn(2, 4)

# grand: grand coalition value, shape (batch_size,)
# Used in: grand - null - torch.sum(pred, dim=1)
grand = torch.randn(2)

# null: null coalition value, shape (batch_size,)
# Used in: grand - null - torch.sum(pred, dim=1)
null = torch.randn(2)

ARGS = {
    "pred": pred,
    "grand": grand,
    "null": null,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_grand_coalition Ran
ran; our contract draft was wrong, not the code
iclr1814/fastshap/fastshap_torch/fastshap.py
pointer only (licence: NONE) · get_code("358ac40db44f149b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, iclr1814/fastshap 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.

convert_to_linkTF Ran
ran on a synthesized input
neiljethani/fastshap/fastshap/utils.py
code served (permissive licence) · get_code("037b77174710c143")
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 IdentityLinkTF. 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 tensorflow as tf

class Link:
    def __init__(self):
        pass

class IdentityLinkTF(Link):
    def __init__(self):
        pass

    def __str__(self):
        return 'identity'

    @staticmethod
    def f(x):
        return x

    @staticmethod
    def finv(x):
        return x

class LogitLinkTF(Link):
    def __init__(self):
        pass

    def __str__(self):
        return 'logit'

    @staticmethod
    def f(x):
        return tf.math.log(x / (1 - x))

    @staticmethod
    def finv(x):
        return 1 / (1 + tf.math.exp(-x))

def convert_to_linkTF(val):
    if isinstance(val, Link):
        return val
    elif val == 'identity':
        return IdentityLinkTF()
    elif val == 'logit':
        return LogitLinkTF()
    else:
        assert False, 'Passed link object must be a subclass of iml.Link'

ARGS = {
    'val': 'identity'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type IdentityLinkTF — a IdentityLinkTF output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a IdentityLinkTF output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not 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
evaluate_explainer Ran
ran; our contract draft was wrong, not the code
iancovert/fastshap/fastshap/fastshap.py
code served (permissive licence) · get_code("6005c5a15fab0e21")
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
import torch.nn as nn

torch.manual_seed(0)

# Create a simple explainer model that outputs predictions
class SimpleExplainer(nn.Module):
    def __init__(self, output_size):
        super().__init__()
        self.linear = nn.Linear(4, output_size)
    
    def forward(self, x):
        return self.linear(x)

# Create normalization function
def normalization_fn(pred, grand, null):
    # Normalize predictions based on grand and null coalition values
    normalized = (pred - null) / (grand - null + 1e-8)
    return torch.clamp(normalized, 0, 1)

# Test case 1: 4D tensor (image-like) output
explainer_4d = SimpleExplainer(output_size=2 * 3 * 4)  # Will reshape to (batch, 4, 2*3)

# Test case 2: 3D tensor output
explainer_3d = SimpleExplainer(output_size=5 * 4)  # Will reshape to (batch, 4, 5)

# Input tensor: batch_size=2, feature_dim=4
x = torch.randn(2, 4)

# Grand coalition value (scalar or tensor)
grand = torch.tensor(1.0)

# Null coalition value (scalar or tensor)
null = torch.tensor(0.0)

# Number of players
num_players = 4

# Test with 4D output (image case)
ARGS = {
    "explainer": explainer_4d,
    "normalization": normalization_fn,
    "x": x,
    "grand": grand,
    "null": null,
    "num_players": num_players,
    "inference": False
}
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
multiplicative_efficient_normalization Ran
ran; our contract draft was wrong, not the code
iancovert/fastshap/fastshap/fastshap.py
code served (permissive licence) · get_code("fe249de8c0fc0cfc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for the function arguments
# pred: model predictions, shape (batch_size, num_features)
# The function uses torch.sum(pred, dim=1) so we need at least 2D
pred = torch.randn(2, 4)

# grand: grand coalition value, shape (batch_size,)
# Used in subtraction with null and division
grand = torch.tensor([1.5, 2.0])

# null: null coalition value, shape (batch_size,)
# Used in subtraction from grand
null = torch.tensor([0.5, 0.3])

ARGS = {
    "pred": pred,
    "grand": grand,
    "null": null,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FastSHAP Not yet run
unverified (harvested, no recorded run)
davidenapolitano/bones/bones/sv/image/explainers/fastshap/fastshap.py
pointer only (licence: NONE) · get_code("42ef60c2b0ecb9e0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, davidenapolitano/bones when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

FastSHAP Not yet run
unverified (harvested, no recorded run)
iancovert/fastshap/fastshap/fastshap.py
code served (permissive licence) · get_code("8b43828947a6b7c7")
How it ran

no invocation recorded.

calculate_grand_coalition Not yet run
unverified (harvested, no recorded run)
davidenapolitano/bones/bones/sv/image/explainers/fastshap/fastshap.py
pointer only (licence: NONE) · get_code("77cf20ef4a967db3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, davidenapolitano/bones when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

convert_to_link Not yet run
unverified (harvested, no recorded run)
neiljethani/fastshap/fastshap/utils.py
code served (permissive licence) · get_code("33d1e5512f0ec7db")
How it ran

no invocation recorded.

generate_validation_data Not yet run
unverified (harvested, no recorded run)
davidenapolitano/bones/bones/sv/image/explainers/fastshap/fastshap.py
pointer only (licence: NONE) · get_code("cb7acdc5c56bb613")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, davidenapolitano/bones when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

shapley_values Not yet run
unverified (harvested, no recorded run)
tml-tuebingen/nshap/src/nshap/functions.py
code served (permissive licence) · get_code("5fbfb8cc1069b5d8")
How it ran

no invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
iclr1814/fastshap/fastshap_torch/fastshap.py
pointer only (licence: NONE) · get_code("b2c2b9597b4b23d6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, iclr1814/fastshap when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

validate Not yet run
unverified (harvested, no recorded run)
davidenapolitano/bones/bones/sv/image/explainers/fastshap/fastshap.py
pointer only (licence: NONE) · get_code("437f02dec06a9d31")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, davidenapolitano/bones when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

validate_inputs Not yet run
unverified (harvested, no recorded run)
tml-tuebingen/nshap/src/nshap/functions.py
code served (permissive licence) · get_code("1e573273e29afab1")
How it ran

no invocation recorded.

Also present in other papers' code

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

Although Shapley values are theoretically appealing for explaining black-box models, they are costly to calculate and thus impractical in settings that involve large, high-dimensional models. To remedy this issue, we introduce FastSHAP, a new method for estimating Shapley values in a single forward pass using a learned explainer model. To enable efficient training without requiring ground truth Shapley values, we develop an approach to train FastSHAP via stochastic gradient descent using a weighted least squares objective function. In our experiments with tabular and image datasets, we compare FastSHAP to existing estimation approaches and find that it generates accurate explanations with an orders-of-magnitude speedup.

For agents

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

get_harvested_code_for_paper("2107.07436")
get_code_for_paper("2107.07436")
have("2107.07436")

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

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

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

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

Connect an agent — have() is free.