SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.14356 · NeurIPS · 2023

COCO-Counterfactuals: Automatically Constructed Counterfactual Examples for Image-Text Pairs

Tiep Le, Vasudev Lal, Phillip Howard

arXiv · PDF · Open in the Atlas

Code that ran

5 of 8 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; 3 failures of our instrument; 3 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-23; 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/2309.14356.json · badge: /api/ran/2309.14356.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
UKPLab/sentence-transformers canonical (classifier label)
classifier basis: census
3 ran · 0 no recorded run
timothybrooks/instruct-pix2pix canonical (classifier label)
classifier basis: census
2 ran · 3 no recorded run
FunctionStatusWhere it lives
append_dims Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
timothybrooks/instruct-pix2pix/dataset_creation/generate_img_dataset.py
pointer only (licence: NONE); the stored copy get_code serves, from layer6ai-labs/direct-cms, is pointer only (licence: NONE) · get_code("30befb7e4327e615")
How it ran

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

format_duration Ran
ran; our contract draft was wrong, not the code
UKPLab/sentence-transformers/sentence_transformers/base/model_card.py
code served (permissive licence) · get_code("e12c9d90a7538793")
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 torch
import numpy as np

# The function format_duration takes a single parameter: seconds (a float)
# It formats a duration in seconds to a human-readable string
# We need to test it with various duration values

ARGS = {
    'seconds': 45.5
}
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 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
format_log Ran
ran, honoured the contract we drafted
UKPLab/sentence-transformers/sentence_transformers/base/model_card.py
code served (permissive licence) · get_code("fd50038f6df25d57")
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
import numpy as np

torch.manual_seed(0)

# The function format_log takes a single parameter 'value' which can be float, int, or str
# It returns a rounded float if value is float, otherwise returns value as-is

# Test with a float value
ARGS = {
    "value": 3.14159
}
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 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
get_ancestral_step Ran
ran, honoured the contract we drafted
timothybrooks/instruct-pix2pix/dataset_creation/generate_img_dataset.py
pointer only (licence: NOASSERTION) · get_code("1921ebc84491b22c")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, timothybrooks/instruct-pix2pix (NOASSERTION). 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.

get_losses Ran
ran; our contract draft was wrong, not the code
UKPLab/sentence-transformers/sentence_transformers/base/model_card.py
code served (permissive licence) · get_code("2a68339364737323")
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 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
from torch import nn

torch.manual_seed(0)

# Create a simple loss module with nested loss attributes
class SimpleLoss(nn.Module):
    def __init__(self, name="loss"):
        super().__init__()
        self.name = name
    
    def forward(self, x):
        return x.sum()

class ComplexLoss(nn.Module):
    def __init__(self):
        super().__init__()
        self.loss = SimpleLoss("inner_loss")
        self.document_regularizer = SimpleLoss("doc_reg")
        self.query_regularizer = SimpleLoss("query_reg")
    
    def forward(self, x):
        return x.sum()

class SingleLoss(nn.Module):
    def __init__(self):
        super().__init__()
    
    def forward(self, x):
        return x.sum()

# Test case 1: Single nn.Module
single_loss = SingleLoss()

# Test case 2: nn.Module with nested attributes
complex_loss = ComplexLoss()

# Test case 3: Dict of nn.Module instances
loss_dict = {
    "main": complex_loss,
    "auxiliary": SingleLoss()
}

# Use the dict case as the primary test argument
ARGS = {
    "loss": loss_dict
}
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 list, ndim 1, dtype family float — 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
download_models Not yet run
unverified (harvested, no recorded run)
timothybrooks/instruct-pix2pix/stable_diffusion/notebook_helpers.py
pointer only (licence: NONE) · get_code("4533e43e06a12dc5")
How it ran

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

generate Not yet run
unverified (harvested, no recorded run)
timothybrooks/instruct-pix2pix/dataset_creation/generate_txt_dataset.py
pointer only (licence: NOASSERTION) · get_code("096488ca08edf235")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, timothybrooks/instruct-pix2pix (NOASSERTION). 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.

to_d Not yet run
unverified (harvested, no recorded run)
timothybrooks/instruct-pix2pix/dataset_creation/generate_img_dataset.py
pointer only (licence: NOASSERTION) · get_code("042cd250dc4b2a67")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, timothybrooks/instruct-pix2pix (NOASSERTION). 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.

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, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 2 later) and 5 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
append_dims 27 other papers
4 dated earlier, 23 later · 2 only as an assembly brick
2204.06125 (2022-04)
Hierarchical Text-Conditional Image Generation with CLIP Latents
2304.09787 (2023-04)
NeuralField-LDM: Scene Generation with Hierarchical Latent Diffusion Models
2307.12493 (2023-07)
TF-ICON: Diffusion-Based Training-Free Cross-Domain Image Composition
and 24 more not named here
download_models 17 other papers
7 dated earlier, 9 later, 1 same year, order not determinable
2211.01324 (2022-11)
eDiff-I: Text-to-Image Diffusion Models with an Ensemble of Expert Denoisers
Dombrowski_Foreground-Background_Separation_through_Concept_Distillation_from_Generative_Image_Foundation_Models_ICCV_2023_paper (2023 (year only))
Foreground-Background Separation through Concept Distillation from Generative Image Foundation Models
2303.00836 (2023-03)
Ensemble flow reconstruction in the atmospheric boundary layer from spatially limited measurements through latent diffusion models
and 14 more not named here
to_d 1 other paper
1 dated earlier
2305.02463 (2023-05)
Shap-E: Generating Conditional 3D Implicit Functions

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

Counterfactual examples have proven to be valuable in the field of natural language processing (NLP) for both evaluating and improving the robustness of language models to spurious correlations in datasets. Despite their demonstrated utility for NLP, multimodal counterfactual examples have been relatively unexplored due to the difficulty of creating paired image-text data with minimal counterfactual changes. To address this challenge, we introduce a scalable framework for automatic generation of counterfactual examples using text-to-image diffusion models. We use our framework to create COCO-Counterfactuals, a multimodal counterfactual dataset of paired image and text captions based on the MS-COCO dataset. We validate the quality of COCO-Counterfactuals through human evaluations and show that existing multimodal models are challenged by our counterfactual image-text pairs. Additionally, we demonstrate the usefulness of COCO-Counterfactuals for improving out-of-domain generalization of multimodal vision-language models via training data augmentation. We make our code 2 and the COCO-Counterfactuals dataset 3 publicly available.

For agents

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

get_harvested_code_for_paper("2309.14356")
get_code_for_paper("2309.14356")
have("2309.14356")

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

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

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

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

Connect an agent — have() is free.