SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.10722 · 2023

Discffusion: Discriminative Diffusion Models as Few-shot Vision and Language Learners

arXiv · PDF · Open in the Atlas

Code that ran

16 of 20 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; 0 honoured the contract we drafted, 0 violated it and 16 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-23; 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.10722.json · badge: /api/ran/2305.10722.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
eric-ai-lab/dsd canonical (classifier label)
classifier basis: census
16 ran · 4 no recorded run
FunctionStatusWhere it lives
average_score Ran
ran on a synthesized input
eric-ai-lab/dsd/dsd_infer.py
code served (permissive licence) · get_code("4294cf0378461ad2")
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 float, 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

torch.manual_seed(0)

# The function expects tensor_lists: a list of lists of tensor containers
# Each tensor_container should support indexing with [0] to get a tensor
# The tensor will have torch.mean() called on it

# Create some simple tensor containers (can be lists or tuples)
tensor_container_1 = [torch.randn(2, 4)]
tensor_container_2 = [torch.randn(2, 4)]
tensor_container_3 = [torch.randn(2, 4)]

# Create inner lists containing these containers
inner_list_1 = [tensor_container_1, tensor_container_2]
inner_list_2 = [tensor_container_3]

# Create the main tensor_lists structure
tensor_lists = [inner_list_1, inner_list_2]

ARGS = {
    "tensor_lists": tensor_lists
}
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 float, 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
average_score Ran
ran on a synthesized input
eric-ai-lab/dsd/dsd_train.py
code served (permissive licence) · get_code("0ca47b5cf6386db5")
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

torch.manual_seed(0)

# Analyzing the function:
# - tensor_lists is iterated over (outer loop)
# - For each inner_list in tensor_lists, we iterate
# - For each tensors in inner_list, we iterate
# - For each tensor in tensors, we call torch.mean(tensor[0])
# - tensor[0] means we need tensors to be indexable and have at least 1 element
# - We need to build a nested structure: list of lists of lists of tensors

# Structure: tensor_lists -> list
#            inner_list -> list
#            tensors -> list
#            tensor -> torch.Tensor with at least 1 element

# Creating small tensors
tensor1 = torch.randn(2, 4)  # 2D tensor
tensor2 = torch.randn(3, 4)  # different first dim
tensor3 = torch.randn(2, 5)  # different second dim

# Building the nested structure
# tensor_lists is a list of inner_lists
# Each inner_list is a list of tensors_lists
# Each tensors_list is a list of tensors

tensor_lists = [
    [  # inner_list 1
        [tensor1, tensor2],  # tensors 1
        [tensor3],           # tensors 2
    ],
    [  # inner_list 2
        [torch.randn(4, 3)],  # tensors 3
    ],
]

ARGS = {
    "tensor_lists": tensor_lists
}
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
compute_loss Ran
ran on a synthesized input
eric-ai-lab/dsd/utils/losses.py
code served (permissive licence) · get_code("2aa969a20b25a144")
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

torch.manual_seed(0)

# Construct valid arguments for compute_loss function
# The function expects:
# - args: some object (not directly used in function body)
# - scores: a tensor of shape (batch_size, num_items) with scores
# - img_idx: an integer (though it's overwritten to 0 in function)
# - margin: a float (default 0.2)

# Create a small scores tensor: batch_size=2, num_items=4
scores = torch.randn(2, 4)

# args is not used in the function body, so we can pass any object
args = None

# img_idx is overwritten to 0 in the function, but we provide it anyway
img_idx = 1

# margin has a default value, but we can explicitly set it
margin = 0.2

ARGS = {
    "args": args,
    "scores": scores,
    "img_idx": img_idx,
    "margin": margin,
}
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
compute_score Ran
ran on a synthesized input
eric-ai-lab/dsd/utils/losses.py
code served (permissive licence) · get_code("5bc35c622beca1cc")
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 (2, 4) 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

torch.manual_seed(0)

class MockModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 2)
    
    def forward(self, prompt, image, guidance_scale, sampling_steps, layer_mask, use_bias, sampled_timestep, level):
        # Return a score tensor of shape (batch_size,)
        batch_size = image.shape[0]
        return torch.randn(batch_size)

class MockArgs:
    def __init__(self):
        self.guidance_scale = 7.5
        self.sampling_time_steps = 50
        self.bias = True

# Create mock batch with structure: (imgs, texts)
# imgs = (img_names, imgs_resize)
# imgs_resize is a list of tensors
# texts is a list of tuples, each containing text strings

img_names = ["image_1.jpg", "image_2.jpg"]
imgs_resize = [
    torch.randn(2, 3, 32, 32),  # batch_size=2, channels=3, height=32, width=32
    torch.randn(2, 3, 64, 64),  # different size for distinction
]

texts = [
    ("hello world",),
    ("another test",),
]

imgs = (img_names, imgs_resize)
batch = (imgs, texts)

ARGS = {
    "i": 0,
    "args": MockArgs(),
    "batch": batch,
    "model": MockModel(),
    "save_path": "./saved_images"
}
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 (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
evaluate_comvg Ran
ran on a synthesized input
eric-ai-lab/dsd/eval_score.py
code served (permissive licence) · get_code("61dde694c9bb23c2")
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, ndim 1, dtype family int; 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

torch.manual_seed(0)

# Construct arguments for evaluate_comvg
# The function takes args, scores, and img_idx

# args: appears to be unused in the function body, so a simple dict works
args = {}

# scores: can be either a list of arrays or a torch tensor
# The function checks type(scores) != list
# If not a list, it calls .detach().cpu().numpy() and .cpu().numpy()
# Then it does np.stack(scores, axis=0)
# For each row i, it compares img_idx[i] with np.argmax(scores[i])

# Let's create scores as a torch tensor (batch_size=2, num_classes=4)
scores = torch.randn(2, 4)

# img_idx: should be a tensor or array that can be indexed
# It needs to have length matching scores.shape[0]
# Values should be class indices (0 to 3 for 4 classes)
img_idx = torch.tensor([0, 2])

ARGS = {
    'args': args,
    'scores': scores,
    'img_idx': img_idx
}
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 list, ndim 1, dtype family int — a list 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
evaluate_retrieval Ran
ran on a synthesized input
eric-ai-lab/dsd/eval_score.py
code served (permissive licence) · get_code("3c5ed43dcafc5436")
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 2, dtype family int; 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

torch.manual_seed(0)

# Create sample arguments for evaluate_retrieval
# args: can be any object, the function doesn't use it
args = {}

# scores: can be either a list of arrays or a torch tensor
# The function checks `if type(scores) != list`, so we'll test with a tensor
# Shape: (batch_size=2, num_candidates=4)
scores = torch.randn(2, 4)

# img_idx: indices that will be compared with argmax/argsort results
# Should be array-like or tensor with shape (batch_size=2,)
img_idx = torch.tensor([1, 2])

ARGS = {
    "args": args,
    "scores": scores,
    "img_idx": img_idx,
}
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, ndim 2, dtype family int — 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
evaluate_vqa Ran
ran on a synthesized input
eric-ai-lab/dsd/eval_score.py
code served (permissive licence) · get_code("e1b88fc15ff00272")
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 2, dtype family int; 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

torch.manual_seed(0)

# Construct arguments for evaluate_vqa
args = {}

# scores: can be a list of numpy arrays or a torch tensor
scores = torch.randn(2, 5)  # batch_size=2, num_scores=5

# img_idx: indices that should match argmax or be in top-5
img_idx = torch.tensor([1, 3])

ARGS = {
    'args': args,
    'scores': scores,
    'img_idx': img_idx
}
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, ndim 2, dtype family int — 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_timesteps Ran
ran on a synthesized input
eric-ai-lab/dsd/dsd_train.py
code served (permissive licence) · get_code("9f228a3f87edcf83")
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)

class MockScheduler:
    def __init__(self):
        # Create timesteps tensor - the function indexes into this
        self.timesteps = torch.tensor([999, 799, 599, 399, 199, 99, 49, 0])
        self.order = 1

class MockPipeline:
    def __init__(self):
        self.scheduler = MockScheduler()
    
    def get_timesteps(self, num_inference_steps, strength, device):
        init_timestep = min(int(num_inference_steps * strength), num_inference_steps)
        t_start = max(num_inference_steps - init_timestep, 0)
        timesteps = self.scheduler.timesteps[t_start * self.scheduler.order:]
        return (timesteps, num_inference_steps - t_start)

# Create instance and prepare arguments
pipeline = MockPipeline()

ARGS = {
    "self": pipeline,
    "num_inference_steps": 50,
    "strength": 0.75,
    "device": "cpu"
}
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
get_train_dataset Ran
ran on a synthesized input
eric-ai-lab/dsd/custom_datasets.py
code served (permissive licence) · get_code("be7a240b9dcc2368")
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 pandas as pd
import numpy as np
from PIL import Image
import io
import torchvision.transforms as transforms

torch.manual_seed(0)

# Create stand-in functions that are called in the dataset
def tokenize(text):
    return torch.tensor([1, 2, 3])

class Relation:
    def __init__(self):
        self.predicate = "on"
    
    def get_sub_name(self):
        return "cat"
    
    def get_obj_name(self):
        return "table"
    
    def get_predicate(self):
        return "on"

def read_relation(relation_filename, image_id, relation_idx):
    return Relation()

def prepare_cropped_image(image, relation, with_black):
    # Return cropped images
    if with_black:
        return image, image, image, None
    else:
        return image, image

# Create minimal pickle file content - a DataFrame with required columns
def create_test_dataframe():
    data = {
        'text': ["cat on table"],
        'image_id': [1],
        'relation_json_path': ["dummy_path.json"],
        'relation_idx': [0]
    }
    return pd.DataFrame(data)

# Create a small test image
def create_test_image():
    img = Image.new('RGB', (64, 64), color='red')
    return img

# Create mock pickle file by storing DataFrame
text_df = create_test_dataframe()

# Create temporary directories and files
import tempfile
import os

temp_dir = tempfile.mkdtemp()
relationship_dir = os.path.join(temp_dir, "relationships")
image_dir = os.path.join(temp_dir, "images")
os.makedirs(relationship_dir, exist_ok=True)
os.makedirs(image_dir, exist_ok=True)

# Save test image
test_img = create_test_image()
test_img.save(os.path.join(image_dir, "1.jpg"))

# Save DataFrame as pickle
text_csv_path = os.path.join(temp_dir, "text_data.pkl")
text_df.to_pickle(text_csv_path)

# Create args object
class Args:
    def __init__(self):
        self.relation_folder = relationship_dir
        self.text_path = text_csv_path
        self.image_folder = image_dir
        self.with_black = True

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, pandas, torch, torchvision — 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
image_preprocess Ran
ran on a synthesized input
eric-ai-lab/dsd/playground.py
code served (permissive licence) · get_code("3cacd5275cbd348c")
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 3, dtype family float, shape (3, 96, 96) 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
from PIL import Image
import numpy as np

torch.manual_seed(0)

# Create a small test image using PIL
# The function expects a PIL Image object
# Make it slightly larger than 32 pixels so the resize logic has an effect
test_image = Image.new('RGB', (100, 96), color=(128, 64, 200))

ARGS = {
    'image': test_image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (3, 96, 96) — shape (3, 96, 96) 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
image_preprocess Ran
ran on a synthesized input
eric-ai-lab/dsd/utils/process_dataset.py
code served (permissive licence) · get_code("831f5bc2bdeba8c9")
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 3, dtype family float, shape (3, 96, 128) 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
import numpy as np
import PIL.Image

torch.manual_seed(0)

# Create a small test image using PIL
# The function expects a PIL Image object with .size attribute and .resize method
image_array = np.random.randint(0, 256, (96, 128, 3), dtype=np.uint8)
image = PIL.Image.fromarray(image_array, mode='RGB')

ARGS = {
    'image': image
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (3, 96, 128) — shape (3, 96, 128) 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
load_json Ran
ran on a synthesized input
eric-ai-lab/dsd/utils/helper_functions.py
code served (permissive licence) · get_code("02a978e30e225398")
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. 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 json
import tempfile
import os

# Create a temporary JSON file with sample content
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.json")

sample_data = {
    "key1": "value1",
    "key2": 42,
    "key3": [1, 2, 3],
    "nested": {"inner": "data"}
}

with open(temp_file, 'w') as f:
    json.dump(sample_data, f)

ARGS = {
    "filename": temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
next_available_dirpath Ran
ran on a synthesized input
eric-ai-lab/dsd/dsd_infer.py
code served (permissive licence) · get_code("03616619ada8dbef")
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 str. 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 tempfile
import shutil

# Create a temporary directory for testing
temp_base = tempfile.mkdtemp()

# The function takes a target_dir parameter (string path)
# It checks if the directory exists using os.path.exists()
# and constructs new directory paths by appending indices
# We need to provide a path that may or may not exist

target_dir = os.path.join(temp_base, "test_dir")

ARGS = {
    "target_dir": target_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
read_svo Ran
ran on a synthesized input
eric-ai-lab/dsd/utils/helper_functions.py
code served (permissive licence) · get_code("248696bec32990b5")
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.

from nltk.stem import PorterStemmer

svo = "running,jumps,quickly"
stemmer = PorterStemmer()

ARGS = {
    "svo": svo,
    "stemmer": stemmer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — 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
sanitize_text Ran
ran on a synthesized input
eric-ai-lab/dsd/dsd_infer.py
code served (permissive licence) · get_code("fc89a1b3e420c811")
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 str. 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 re

def sanitize_text(text):
    text = re.sub('[^\\w\\s]', '', text)
    text = text.replace(' ', '_')
    return text[:50]

ARGS = {
    'text': 'Hello, World! This is a test string with special characters @#$%.'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
show_cropped_image Ran
ran on a synthesized input
eric-ai-lab/dsd/utils/helper_functions.py
code served (permissive licence) · get_code("42c588f76987fa6f")
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 Image. 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 tempfile
from PIL import Image
import os

# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple test image (100x100 RGB image)
test_image = Image.new('RGB', (100, 100), color='red')
test_image.save(temp_image_path)

# Define arguments for the function
ARGS = {
    'path': temp_image_path,
    'location': (10, 20, 30, 40),  # x=10, y=20, w=30, h=40
    'show': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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_full_repo_name Not yet run
unverified (harvested, no recorded run)
eric-ai-lab/dsd/dsd_train.py
pointer only (licence: MIT); the stored copy get_code serves, from isno0907/isodiff, is pointer only (licence: NONE) · get_code("6431708d8f3ff177")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from isno0907/isodiff, and GitHub detected no licence in that repository 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.

normalize_word Not yet run
unverified (harvested, no recorded run)
eric-ai-lab/dsd/utils/glossary.py
code served (permissive licence) · get_code("8f1a44ab20956301")
How it ran

no invocation recorded.

preprocess Not yet run
unverified (harvested, no recorded run)
eric-ai-lab/dsd/diffusers/src/diffusers/pipelines/stable_diffusion/pipeline_dsd.py
code served (permissive licence) · get_code("be2fda5ca6ae10b0")
How it ran

no invocation recorded.

process_word Not yet run
unverified (harvested, no recorded run)
eric-ai-lab/dsd/utils/glossary.py
code served (permissive licence) · get_code("c04400bfa2c2f6e0")
How it ran

no invocation recorded.

Also present in other papers' code

Of 20 samples lifted from this paper's linked repositories, 20 carry a function identity and 0 do not. Of the 20 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 2 later) and 18 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
get_full_repo_name 17 other papers
6 dated earlier, 2 the same month, 9 later
2210.09477 (2022-10)
UniTune: Text-Driven Image Editing by Fine Tuning a Diffusion Model on a Single Image
2211.15388 (2022-11)
Shifted Diffusion for Text-to-image Generation
2302.07944 (2023-02)
Effective Data Augmentation With Diffusion Models
and 14 more not named here
normalize_word 6 other papers
6 later
2310.00582 (2023-10)
Pink: Unveiling the Power of Referential Comprehension for Multi-modal LLMs
2404.13039 (2024-04)
LaPA: Latent Prompt Assist Model For Medical Visual Question Answering
2405.17461 (2024-05)
EMR-MERGING: Tuning-Free High-Performance Model Merging
and 3 more not named here

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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Diffusion models, such as Stable Diffusion, have shown incredible performance on text-to-image generation. Since text-to-image generation often requires models to generate visual concepts with fine-grained details and attributes specified in text prompts, can we leverage the powerful representations learned by pre-trained diffusion models for discriminative tasks such as image-text matching? To answer this question, we propose a novel approach, Discriminative Stable Diffusion (DSD), which turns pre-trained text-to-image diffusion models into few-shot discriminative learners. Our approach mainly uses the cross-attention score of a Stable Diffusion model to capture the mutual influence between visual and textual information and fine-tune the model via efficient attention-based prompt learning to perform image-text matching. By comparing DSD with state-of-the-art methods on several benchmark datasets, we demonstrate the potential of using pre-trained diffusion models for discriminative tasks with superior results on few-shot image-text matching.

For agents

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

get_harvested_code_for_paper("2305.10722")
get_code_for_paper("2305.10722")
have("2305.10722")

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

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

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

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

Connect an agent — have() is free.