SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.00650 · ICML · 2023

Discover and Cure: Concept-aware Mitigation of Spurious Correlation

James Zou, Linjun Zhang, Mert Yuksekgonul, Shirley Wu

arXiv · PDF · Open in the Atlas

Code that ran

6 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 1 failure 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.00650.json · badge: /api/ran/2305.00650.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
Wuyxin/DISC canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
wuyxin/disc canonical (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
FunctionStatusWhere it lives
EasyDict Ran
ran on a synthesized input · constructed an object; no result was computed
wuyxin/disc/disc/concept_utils/cce_utils.py
code served (permissive licence) · get_code("a7b900ca7bc073c2")
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 an instance of its own class, EasyDict: the run constructed the object and did not call it, so no result was computed. 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)

# EasyDict is a dict subclass that allows attribute-style access
# It inherits from dict, so its __init__ is dict.__init__
# The parameters are the same as dict's __init__

# dict() can be called with:
# - no arguments: dict()
# - a mapping: dict({'a': 1})
# - keyword arguments: dict(a=1, b=2)
# - an iterable of pairs: dict([('a', 1)])

# Let's construct a simple dict to pass as the first argument
test_dict = {'key1': 'value1', 'key2': 42, 'nested': {'inner': 'data'}}

ARGS = {
    'args': (),  # positional arguments to dict.__init__
    'kwargs': test_dict  # keyword arguments, or could pass a mapping as first arg
}

# Actually, EasyDict inherits from dict, so we instantiate it like:
# EasyDict() or EasyDict(mapping) or EasyDict(**kwargs)
# The function signature is just the class definition itself
# For setup code, we need to provide arguments to construct an EasyDict instance

# Since the question asks for ARGS to construct valid arguments FOR the function,
# and EasyDict is a class (not a regular function), we construct it:

ARGS = {
    'mapping': {'test_key': 'test_value', 'number': 123}
}
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 EasyDict — the run constructed an instance of its own class and did not call it; no shape 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
coral_penalty Ran
ran on a synthesized input
Wuyxin/DISC/disc/run_epoch_baselines.py
code served (permissive licence) · get_code("61685f28827abaa9")
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 two sample tensors with distinct shapes
# x: batch_size=2, feature_dim=4
x = torch.randn(2, 4)

# y: batch_size=2, feature_dim=4
y = torch.randn(2, 4)

ARGS = {
    "x": x,
    "y": y,
}
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
get_cavs Ran
ran on a synthesized input
Wuyxin/DISC/disc/concept_utils/cav_utils.py
code served (permissive licence) · get_code("095426112fc9eb68")
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 dict. 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
import numpy as np

torch.manual_seed(0)

class SimpleBackbone(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3, 4)
    
    def forward(self, x):
        return self.linear(x)

backbone = SimpleBackbone()

# Create simple data loaders that yield only images (tensors)
# Each batch is a tensor of shape (batch_size, feature_dim)
pos_data = [torch.randn(2, 3) for _ in range(4)]  # 4 batches of 2 samples each
neg_data = [torch.randn(2, 3) for _ in range(4)]  # 4 batches of 2 samples each

pos_loader = pos_data
neg_loader = neg_data

n_samples = 2
c = 1.0
device = 'cpu'

ARGS = {
    'pos_loader': pos_loader,
    'neg_loader': neg_loader,
    'backbone': backbone,
    'n_samples': n_samples,
    'c': c,
    'device': device
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
get_concept_info Ran
ran on a synthesized input
Wuyxin/DISC/disc/concept_utils/cav_utils.py
code served (permissive licence) · get_code("458291289542bff7")
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.svm import SVC

# Create small synthetic activation data
np.random.seed(0)

# X_train: (n_samples_train, n_features)
X_train = np.random.randn(8, 4).astype(np.float32)

# y_train: binary labels
y_train = np.array([0, 1, 0, 1, 1, 0, 1, 0], dtype=np.int32)

# X_val: (n_samples_val, n_features)
X_val = np.random.randn(6, 4).astype(np.float32)

# y_val: binary labels
y_val = np.array([0, 1, 0, 1, 1, 0], dtype=np.int32)

# C: regularization parameter
C = 1.0

ARGS = {
    "X_train": X_train,
    "y_train": y_train,
    "X_val": X_val,
    "y_val": y_val,
    "C": C,
}
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
get_embeddings Ran
ran on a synthesized input
Wuyxin/DISC/disc/concept_utils/cav_utils.py
code served (permissive licence) · get_code("87689c095e68cee7")
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, 8) 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
import numpy as np

torch.manual_seed(0)

# Create a simple backbone model that outputs embeddings
class SimpleBackbone(nn.Module):
    def __init__(self, input_dim=3, output_dim=8):
        super().__init__()
        self.linear = nn.Linear(input_dim, output_dim)
    
    def forward(self, x):
        # Flatten input and pass through linear layer
        batch_size = x.shape[0]
        x = x.reshape(batch_size, -1)
        return self.linear(x)

# Create model instance
model = SimpleBackbone(input_dim=12, output_dim=8)
model.eval()

# Create a simple data loader that returns only images (not labels)
# The function expects loader to yield images directly
loader = [
    torch.randn(2, 3, 2, 2),  # batch of 2 images, 3 channels, 2x2 spatial
    torch.randn(2, 3, 2, 2),  # another batch of 2 images
]

# Define arguments dict
ARGS = {
    'loader': loader,
    'model': model,
    'device': 'cpu'
}
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, 8) — shape (4, 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
split_into_groups Ran
ran; our contract draft was wrong, not the code
Wuyxin/DISC/disc/run_epoch_baselines.py
code served (permissive licence) · get_code("38caa1a2f1c313ce")
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 small tensor with group labels
# Using values like [0, 1, 0, 2] to have multiple groups with repeated elements
g = torch.tensor([0, 1, 0, 2, 1, 0], dtype=torch.long)

ARGS = {
    "g": g
}
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
conceptual_counterfactual Not yet run
unverified (harvested, no recorded run)
wuyxin/disc/disc/concept_utils/cce_utils.py
code served (permissive licence) · get_code("2cff9ce39f4b849e")
How it ran

no invocation recorded.

irm_penalty Not yet run
unverified (harvested, no recorded run)
Wuyxin/DISC/disc/run_epoch_baselines.py
code served (permissive licence) · get_code("fbb43ea0bbe069f8")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 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
split_into_groups 3 other papers
2 dated earlier, 1 later
2111.04724 (2021-11)
SUSTAINBENCH: Benchmarks for Monitoring the Sustainable Development Goals with Machine Learning
2204.03230 (2022-04)
What You See is What You Get: Principled Deep Learning via Distributional Generalization
2509.26045 (2025-09)
Scaling Up Temporal Domain Generalization via Temporal Experts Averaging
EasyDict
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2106.12723 (2021-06)
Meaningfully Debugging Model Mistakes using Conceptual Counterfactual Explanations

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

Deep neural networks often rely on spurious correlations to make predictions, which hinders generalization beyond training environments. For instance, models that associate cats with bed backgrounds can fail to predict the existence of cats in other environments without beds. Mitigating spurious correlations is crucial in building trustworthy models. However, the existing works lack transparency to offer insights into the mitigation process. In this work, we propose an interpretable framework, Discover and Cure (DISC), to tackle the issue. With human-interpretable concepts, DISC iteratively 1) discovers unstable concepts across different environments as spurious attributes, then 2) intervenes on the training data using the discovered concepts to reduce spurious correlation. Across systematic experiments, DISC provides superior generalization ability and interpretability than the existing approaches. Specifically, it outperforms the state-of-the-art methods on an object recognition task and a skin-lesion classification task by 7.5% and 9.6%, respectively. Additionally, we offer theoretical analysis and guarantees to understand the benefits of models trained by DISC. Code and data are available at https://github.com/Wuyxin/DISC.

For agents

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

get_harvested_code_for_paper("2305.00650")
get_code_for_paper("2305.00650")
have("2305.00650")

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

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

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

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

Connect an agent — have() is free.