SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.18705 · NeurIPS · 2024

Exploiting Interpretable Capabilities with Concept-Enhanced Diffusion and Prototype Networks

Julia Vogt, Moritz Vandenhirtz, Sonia Laguna, Alba Carballo-Castro

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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; 6 failures of our instrument; 3 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/2410.18705.json · badge: /api/ran/2410.18705.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
acarballocastro/ConceptEnhanced canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
cramers_v Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
acarballocastro/ConceptEnhanced/CGProtoPNet/utils/CUB_correlation.py
code served (permissive licence) · get_code("7ff7e1347c2cd6cb")
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 float64, ndim 0, 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.stats import chi2_contingency

# Create a small confusion matrix for testing
# A confusion matrix is typically 2D and represents counts
# Using a 4x3 shape to have distinct dimensions
confusion_matrix = np.array([
    [50, 10, 5],
    [8, 45, 2],
    [3, 7, 40],
    [2, 5, 38]
], dtype=np.float64)

ARGS = {
    "confusion_matrix": confusion_matrix
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
generate_concept_matrix Ran
ran; our contract draft was wrong, not the code
acarballocastro/ConceptEnhanced/CGCondDiff/utils.py
code served (permissive licence) · get_code("931f67e0ca8b7337")
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 int, 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

torch.manual_seed(0)

# The function takes a mask tensor m as input
# It finds non-zero indices, generates all binary combinations, and creates a matrix
# The mask should be a 1D tensor with some True/False or non-zero/zero values

m = torch.tensor([1, 0, 1, 0], dtype=torch.int32)

ARGS = {
    "m": m
}
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 int, 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_concept_groups Ran
ran; our contract draft was wrong, not the code
acarballocastro/ConceptEnhanced/CGProtoPNet/utils/CUB_correlation.py
code served (permissive licence) · get_code("1a92b9a476932efd")
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 torch
import numpy as np
from types import SimpleNamespace
import tempfile

torch.manual_seed(0)

# Create a temporary directory structure for the test
temp_dir = tempfile.mkdtemp()
cub_dir = os.path.join(temp_dir, 'CUB_200_2011')
os.makedirs(cub_dir, exist_ok=True)

# Create a minimal concept_names.txt file
concept_names_content = """bird_type::red
bird_type::blue
bird_type::green
body_part::wing
body_part::beak
body_part::tail
color::red
color::blue
color::yellow
color::green
size::small
size::large
pattern::striped
pattern::solid
"""

with open(os.path.join(cub_dir, 'concept_names.txt'), 'w') as f:
    f.write(concept_names_content)

# Create config with the temporary directory
config = SimpleNamespace(
    seed=25,
    img_size=224,
    num_classes=112,
    data_path=temp_dir,
    train_path=temp_dir,
    test_path=temp_dir,
    train_batch_size=80,
    test_batch_size=100,
    train_push_batch_size=75,
    gpuid=0,
    attr_index=None,
    group_by='color',
    num_groups=3,
    num_groups_tot=5,
    random_groups=False,
    masked_groups=[]
)

ARGS = {
    'config': config
}
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 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_data Ran
ran; our contract draft was wrong, not the code
acarballocastro/ConceptEnhanced/CGCondDiff/utils.py
code served (permissive licence) · get_code("8ed1e4f5ec9412d1")
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, 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 os
import tempfile
import torch
import torchvision
from torch.utils.data import DataLoader
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a temporary directory structure with dummy image data
temp_dir = tempfile.mkdtemp()
train_dir = os.path.join(temp_dir, "train")
val_dir = os.path.join(temp_dir, "val")

os.makedirs(os.path.join(train_dir, "class_0"), exist_ok=True)
os.makedirs(os.path.join(train_dir, "class_1"), exist_ok=True)
os.makedirs(os.path.join(val_dir, "class_0"), exist_ok=True)
os.makedirs(os.path.join(val_dir, "class_1"), exist_ok=True)

# Create dummy images for training
for i in range(4):
    img = Image.fromarray(np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8))
    img.save(os.path.join(train_dir, "class_0", f"img_{i}.jpg"))
    img.save(os.path.join(train_dir, "class_1", f"img_{i}.jpg"))

# Create dummy images for validation
for i in range(2):
    img = Image.fromarray(np.random.randint(0, 256, (64, 64, 3), dtype=np.uint8))
    img.save(os.path.join(val_dir, "class_0", f"img_{i}.jpg"))
    img.save(os.path.join(val_dir, "class_1", f"img_{i}.jpg"))

# Create args object as a simple class
class Args:
    def __init__(self):
        self.img_size = 32
        self.dataset_path = temp_dir
        self.train_folder = "train"
        self.val_folder = "val"
        self.slice_size = 1
        self.batch_size = 2
        self.num_workers = 0

ARGS = {"args": Args()}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch, torchvision — 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: none by the harness; any seed is in the setup block
get_empirical_covariance Ran
ran, honoured the contract we drafted
acarballocastro/ConceptEnhanced/CGProtoPNet/utils/CUB_correlation.py
code served (permissive licence) · get_code("81197ee39f87dc5f")
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, ndim 3, 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 torch
import numpy as np
from scipy.stats import chi2_contingency

torch.manual_seed(0)

# Create a minimal dataloader
# The function expects an iterable of (_, concepts) tuples
# where concepts are tensors that can be concatenated
batch_size = 2
num_concepts = 4

# Create sample concept data (batch_size x num_concepts)
concept_data_1 = torch.randn(batch_size, num_concepts)
concept_data_2 = torch.randn(batch_size, num_concepts)

# Dataloader is a list of (dummy_x, concepts) tuples
dataloader = [
    (None, concept_data_1),
    (None, concept_data_2)
]

ARGS = {
    "dataloader": dataloader
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, 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: none by the harness; any seed is in the setup block
one_batch Ran
ran; our contract draft was wrong, not the code
acarballocastro/ConceptEnhanced/CGCondDiff/utils.py
code served (permissive licence) · get_code("af6b550b075c56c0")
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 data loader as a list of batches
# Each batch is a tuple of (x, y) where x and y are tensors
x = torch.randn(2, 4)  # batch size 2, feature dim 4
y = torch.randint(0, 2, (2,))  # batch size 2, binary labels

dl = [(x, y)]

ARGS = {
    "dl": dl
}
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
one_param Ran
ran, honoured the contract we drafted
acarballocastro/ConceptEnhanced/CGCondDiff/modules.py
code served (permissive licence) · get_code("4b602b0867bad430")
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 Parameter, ndim 2, 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 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):
        return self.linear(x)

m = SimpleModel()

ARGS = {
    "m": m
}
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 Parameter, ndim 2, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 2, which disagrees with the fixture run
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
train_test_split_AwA Ran
ran; our contract draft was wrong, not the code
acarballocastro/ConceptEnhanced/CGProtoPNet/datasets/AwA2_dataset.py
code served (permissive licence) · get_code("5cea6959c9c2a71b")
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 os
import tempfile
from PIL import Image
import torch

# Create a temporary directory structure mimicking the AwA dataset
temp_dir = tempfile.mkdtemp()
data_path = temp_dir
awa_dir = os.path.join(data_path, 'Animals_with_Attributes2')
os.makedirs(awa_dir, exist_ok=True)

# Create classes.txt
classes_content = """1\tdog
2\tcat
3\tbird"""
with open(os.path.join(awa_dir, 'classes.txt'), 'w') as f:
    f.write(classes_content)

# Create trainclasses.txt (as an example classes_file)
trainclasses_content = """1\tdog
2\tcat"""
with open(os.path.join(awa_dir, 'trainclasses.txt'), 'w') as f:
    f.write(trainclasses_content)

# Create predicate-matrix-binary.txt (3 animals x 85 predicates)
predicate_matrix = np.random.randint(0, 2, size=(3, 85))
np.savetxt(os.path.join(awa_dir, 'predicate-matrix-binary.txt'), predicate_matrix, fmt='%d')

# Create image directories and dummy images
jpg_dir = os.path.join(awa_dir, 'JPEGImages')
os.makedirs(jpg_dir, exist_ok=True)

for animal_class in ['dog', 'cat', 'bird']:
    animal_dir = os.path.join(jpg_dir, animal_class)
    os.makedirs(animal_dir, exist_ok=True)
    # Create 3 dummy images per class
    for i in range(3):
        img = Image.new('RGB', (64, 64), color=(i*50, i*50, i*50))
        img.save(os.path.join(animal_dir, f'image_{i}.jpg'))

# Define ARGS for train_test_split_AwA function
ARGS = {
    'classes_file': 'trainclasses.txt',
    'data_path': data_path,
    'train_ratio': 0.6,
    'val_ratio': 0.2,
    'seed': 42,
    'partial_predicates': False,
    'num_predicates': 85,
    'preload': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, sklearn, torch, tqdm — 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
densenet121_features Not yet run
unverified (harvested, no recorded run)
acarballocastro/ConceptEnhanced/CGProtoPNet/utils/densenet_features.py
code served (permissive licence) · get_code("82a30936aad6d427")
How it ran

no invocation recorded.

densenet169_features Not yet run
unverified (harvested, no recorded run)
acarballocastro/ConceptEnhanced/CGProtoPNet/utils/densenet_features.py
code served (permissive licence) · get_code("cf20cbc234ba341a")
How it ran

no invocation recorded.

densenet201_features Not yet run
unverified (harvested, no recorded run)
acarballocastro/ConceptEnhanced/CGProtoPNet/utils/densenet_features.py
code served (permissive licence) · get_code("3803a12204298d72")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 0 later) and 8 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
densenet169_features 4 other papers
4 dated earlier
1902.03368 (2019-02)
Skin Lesion Analysis Toward Melanoma Detection 2018: A Challenge Hosted by the International Skin Imaging Collaboration (ISIC)
2108.10612 (2021-08)
ProtoMIL: Multiple Instance Learning with Prototypical Parts for Whole-Slide Image Classification
2111.15000 (2021-11)
Deformable ProtoPNet: An Interpretable Image Classifier Using Deformable Prototypes
and 1 more not named here
densenet201_features 4 other papers
4 dated earlier
1902.03368 (2019-02)
Skin Lesion Analysis Toward Melanoma Detection 2018: A Challenge Hosted by the International Skin Imaging Collaboration (ISIC)
2108.10612 (2021-08)
ProtoMIL: Multiple Instance Learning with Prototypical Parts for Whole-Slide Image Classification
2111.15000 (2021-11)
Deformable ProtoPNet: An Interpretable Image Classifier Using Deformable Prototypes
and 1 more not named here
one_param 1 other paper
1 dated earlier
2312.08200 (2023-12)
SPD-DDPM: Denoising Diffusion Probabilistic Models in the Symmetric Positive Definite Space

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

Concept-based machine learning methods have increasingly gained importance due to the growing interest in making neural networks interpretable. However, concept annotations are generally challenging to obtain, making it crucial to leverage all their prior knowledge. By creating concept-enriched models that incorporate concept information into existing architectures, we exploit their interpretable capabilities to the fullest extent. In particular, we propose Concept-Guided Conditional Diffusion, which can generate visual representations of concepts, and Concept-Guided Prototype Networks, which can create a concept prototype dataset and leverage it to perform interpretable concept prediction. These results open up new lines of research by exploiting pre-existing information in the quest for rendering machine learning more human-understandable. Contributions This work contributes to the line of research on concept-based methods in several ways by introducing concept-enhanced methods to leverage concept knowledge and exploit their interpretable capabilities. (i) We present Concept-Guided Conditional Diffusion, a generative method that incorporates concept knowledge to guide the generation of concept-based samples. (ii) We introduce Concept-Guided Prototype Networks, which allow us to (a) obtain interpretable concept predictions and (b) create a concept prototype dataset including a visual representation of the concepts. (iii) We illustrate the success of these methods through real-world dataset applications.

For agents

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

get_harvested_code_for_paper("2410.18705")
get_code_for_paper("2410.18705")
have("2410.18705")

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

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

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

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

Connect an agent — have() is free.