SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.19164 · NeurIPS · 2023

LANCE: Stress-testing Visual Models by Generating Language-guided Counterfactual Images

Judy Hoffman, Viraj Prabhu, Sriram Yenamandra, Prithvijit Chattopadhyay

arXiv · PDF · Open in the Atlas

Code that ran

10 of 10 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 4 have no contract verdict; 4 failures of our instrument; 0 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.19164.json · badge: /api/ran/2305.19164.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
virajprabhu/lance canonical (classifier label)
classifier basis: census
10 ran · 0 no recorded run
FunctionStatusWhere it lives
diffusion_step Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
virajprabhu/lance/lance/utils/ptp_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from TFNTF/PostEdit, is pointer only (licence: NONE) · get_code("a042902caede448b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from TFNTF/PostEdit, 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. A run is recorded.

get_matrix Ran
ran; our contract draft was wrong, not the code
virajprabhu/lance/lance/utils/seq_aligner.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Supercomputing-System-AI-Lab/InstantEdit, is pointer only (licence: NONE) · get_code("d167441d997c52ce")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Supercomputing-System-AI-Lab/InstantEdit, 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. A run is recorded.

get_matrix Ran
ran, honoured the contract we drafted
virajprabhu/lance/lance/utils/seq_aligner.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Supercomputing-System-AI-Lab/InstantEdit, is pointer only (licence: NONE) · get_code("81db21bf982ca0fe")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Supercomputing-System-AI-Lab/InstantEdit, 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. A run is recorded.

get_traceback_matrix Ran
ran, honoured the contract we drafted
virajprabhu/lance/lance/utils/seq_aligner.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Supercomputing-System-AI-Lab/InstantEdit, is pointer only (licence: NONE) · get_code("beb8f6a30678a4d9")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Supercomputing-System-AI-Lab/InstantEdit, 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. A run is recorded.

init_latent Ran
ran; our contract draft was wrong, not the code
virajprabhu/lance/lance/utils/ptp_utils.py
code served (permissive licence) · get_code("caadc5c4b7627e0c")
How it ran

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

import torch
import torch.nn as nn

torch.manual_seed(0)

# Build a minimal model with a unet that has in_channels and device
class MinimalUNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.in_channels = 4
        self.linear = nn.Linear(10, 10)  # dummy layer to have parameters
    
    def forward(self, x):
        return x

class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.unet = MinimalUNet()
        self.device = torch.device("cpu")
    
    def forward(self, x):
        return x

# Create instances
model = MinimalModel()
generator = torch.Generator()
generator.manual_seed(42)

# Parameters for init_latent
latent = None  # Will be generated inside the function
height = 32
width = 24
batch_size = 2

ARGS = {
    "latent": latent,
    "model": model,
    "height": height,
    "width": width,
    "generator": generator,
    "batch_size": batch_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
latent2image Ran
ran; our contract draft was wrong, not the code
virajprabhu/lance/lance/utils/ptp_utils.py
code served (permissive licence) · get_code("e3c3bb87bbe9b4a7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ndarray, ndim 4, dtype family int, shape (2, 32, 32, 3) 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

torch.manual_seed(0)

class MockVAE(nn.Module):
    def __init__(self):
        super().__init__()
        self.decoder_layer = nn.Linear(4, 768)
    
    def decode(self, latents):
        # latents shape: (batch, channels, height, width)
        # We need to return a dict with 'sample' key containing decoded image
        batch_size = latents.shape[0]
        # Return a tensor of shape (batch, 3, 32, 32) for RGB image
        sample = torch.randn(batch_size, 3, 32, 32)
        return {'sample': sample}

vae = MockVAE()
latents = torch.randn(2, 4, 8, 8)

ARGS = {
    'vae': vae,
    'latents': latents
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 4, dtype family int, shape (2, 32, 32, 3) — shape (2, 32, 32, 3) 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_512 Ran
ran on a synthesized input
virajprabhu/lance/lance/utils/edit_utils.py
code served (permissive licence) · get_code("1cdd757aa2ba4142")
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 3, dtype family int, shape (512, 512, 3) 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 numpy as np
from PIL import Image

# Create a small test image as a numpy array
# The function expects image_path to be either a string or a numpy array
# We'll create a small numpy array directly to avoid file I/O
test_image = np.random.randint(0, 256, (256, 256, 3), dtype=np.uint8)

ARGS = {
    "image_path": test_image,
    "left": 0,
    "right": 0,
    "top": 0,
    "bottom": 0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family int, shape (512, 512, 3) — shape (512, 512, 3) 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
path_to_image_html Ran
ran on a synthesized input
virajprabhu/lance/lance/utils/misc_utils.py
code served (permissive licence) · get_code("9180abd2d8f751d5")
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

def path_to_image_html(path):
    return '<img src="' + os.path.join(os.getcwd(), path) + '" width="512" >'

ARGS = {
    "path": "images/sample.png"
}
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
predict Ran
ran on a synthesized input
virajprabhu/lance/lance/utils/inference_utils.py
code served (permissive licence) · get_code("b4c696f803c68a65")
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
from PIL import Image
import tempfile
import os

torch.manual_seed(0)

# Create a minimal model that outputs 1000 class logits
class MinimalModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3 * 224 * 224, 1000)
    
    def forward(self, x):
        x = x.view(x.size(0), -1)
        return self.linear(x)

# Create a temporary image file
def create_temp_image():
    img = Image.new('RGB', (256, 256), color=(73, 109, 137))
    with tempfile.NamedTemporaryFile(suffix='.png', delete=False) as f:
        img.save(f.name)
        return f.name

# Create idx_to_class mapping
idx_to_class = {i: f"class_{i}, variant_a" for i in range(1000)}

ARGS = {
    'model': MinimalModel(),
    'image_path': create_temp_image(),
    'device': 'cpu',
    'idx_to_class': idx_to_class
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, 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
render_as_html Ran
ran on a synthesized input
virajprabhu/lance/lance/utils/misc_utils.py
code served (permissive licence) · get_code("982d727eb760f359")
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 pandas as pd
import numpy as np

# Create a minimal DataFrame that satisfies the function's requirements
df = pd.DataFrame({
    'Image': ['image1.jpg', 'image2.jpg'],
    'Label': ['cat', 'dog'],
    'Prediction': ['cat', 'dog'],
    'Caption': ['a cat', 'a dog'],
    'Edited Caption': ['the cat', 'the dog'],
    'Edit Type': ['article', 'article'],
    'LANCE': ['lance1.jpg', 'lance2.jpg'],
    'LANCE prediction': ['cat', 'dog'],
    'Sensitivity': [0.95, 0.87],
    'Reconstruction': ['recon1.jpg', 'recon2.jpg']
})

ARGS = {
    'df': df,
    'sort_by': ['Sensitivity']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 6 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 2 the same month, 6 later) and 4 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
latent2image 13 other papers
1 the same month, 12 later
2305.15581 (2023-05)
Unsupervised Semantic Correspondence Using Stable Diffusion
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
2309.14494 (2023-09)
Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator
and 10 more not named here
get_matrix 11 other papers
1 dated earlier, 10 later
2208.01626 (2022-08)
Prompt-to-Prompt Image Editing with Cross Attention Control
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
and 8 more not named here
diffusion_step 10 other papers
10 later
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
2309.14494 (2023-09)
Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator
2311.16491 (2023-11)
$Z^*$: Zero-shot Style Transfer via Attention Rearrangement
and 7 more not named here
get_traceback_matrix 10 other papers
10 later
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
2309.14494 (2023-09)
Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator
and 7 more not named here
get_matrix 9 other papers
9 later
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
2309.14494 (2023-09)
Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator
and 6 more not named here
init_latent 3 other papers
2 the same month, 1 later
2305.15581 (2023-05)
Unsupervised Semantic Correspondence Using Stable Diffusion
2305.18729 (2023-05)
Real-World Image Variation by Aligning Diffusion Inversion Chain
2405.01008 (2024-05)
On Mechanistic Knowledge Localization in Text-to-Image Generative Models

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

We propose an automated algorithm to stress-test a trained visual model by generating language-guided counterfactual test images (LANCE). Our method leverages recent progress in large language modeling and text-based image editing to augment an IID test set with a suite of diverse, realistic, and challenging test images without altering model weights. We benchmark the performance of a diverse set of pretrained models on our generated data and observe significant and consistent performance drops. We further analyze model sensitivity across different types of edits, and demonstrate its applicability at surfacing previously unknown class-level model biases in ImageNet. Code: https://github.com/virajprabhu/lance.

For agents

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

get_harvested_code_for_paper("2305.19164")
get_code_for_paper("2305.19164")
have("2305.19164")

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

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

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

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

Connect an agent — have() is free.