SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2008.06775 · 2020

Model Patching: Closing the Subgroup Performance Gap with Data Augmentation

arXiv · PDF · Open in the Atlas

Code that ran

18 of 24 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 14 have no contract verdict; 4 failures of our instrument; 6 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/2008.06775.json · badge: /api/ran/2008.06775.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
HazyResearch/model-patching canonical (classifier label)
classifier basis: census
18 ran · 6 no recorded run
FunctionStatusWhere it lives
build_gan_loss_fn Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/methods/cyclegan/utils.py
code served (permissive licence) · get_code("ec4bd27e017d99d6")
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 function. 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 tensorflow as tf

def wgan_loss(targets, predictions):
    return tf.reduce_mean((-2 * targets + 1.0) * predictions)

def build_gan_loss_fn(loss_name):
    if loss_name == 'bce':
        return tf.keras.losses.BinaryCrossentropy(from_logits=True)
    elif loss_name == 'lsgan':
        return tf.keras.losses.MeanSquaredError()
    elif loss_name == 'wgan':
        return wgan_loss
    else:
        raise NotImplementedError

ARGS = {
    'loss_name': 'wgan'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
compose_augmentations Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/augment/utils.py
code served (permissive licence) · get_code("2a61e37e02826736")
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. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small tensor to augment
x = torch.randn(2, 4)

# Define some simple augmentation functions
def augmentation_1(tensor):
    """Add a constant to the tensor"""
    return tensor + 0.1

def augmentation_2(tensor):
    """Scale the tensor"""
    return tensor * 2.0

def augmentation_3(tensor):
    """Apply a simple transformation"""
    return torch.sin(tensor)

# Create a list of augmentation functions
augmentations = [augmentation_1, augmentation_2, augmentation_3]

# Define the arguments dictionary
ARGS = {
    "x": x,
    "augmentations": augmentations
}
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
consistency_penalty Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/methods/robust/utils.py
code served (permissive licence) · get_code("030f94ea5ad5bd25")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create small probability distributions (batch_size=2, num_classes=4)
# Using softmax to ensure valid probability distributions
batch_size = 2
num_classes = 4

# Generate random logits and convert to probabilities
logits_orig = tf.random.normal((batch_size, num_classes))
logits_1 = tf.random.normal((batch_size, num_classes))
logits_2 = tf.random.normal((batch_size, num_classes))

predictions_orig = tf.nn.softmax(logits_orig)
predictions_1 = tf.nn.softmax(logits_1)
predictions_2 = tf.nn.softmax(logits_2)

ARGS = {
    'predictions_orig': predictions_orig,
    'predictions_1': predictions_1,
    'predictions_2': predictions_2,
    'consistency_type': 'camel',
    'scale': 1.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
create_cutout_mask Ran
ran; our contract draft was wrong, not the code
HazyResearch/model-patching/augmentation/autoaugment/augmentation_transforms.py
code served (permissive licence) · get_code("20601a513934db43")
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

np.random.seed(0)

ARGS = {
    "img_height": 32,
    "img_width": 32,
    "num_channels": 3,
    "size": 8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
create_loss_fn Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/utilities/losses.py
code served (permissive licence) · get_code("e63a91f1aab1dcda")
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 SparseCategoricalCrossentropy. 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 tensorflow as tf
import tensorflow.keras as keras

# The function create_loss_fn takes a single parameter: loss_name (a string)
# We'll test it with one of the valid loss names

ARGS = {
    'loss_name': 'sparse_categorical_crossentropy'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SparseCategoricalCrossentropy — a SparseCategoricalCrossentropy output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SparseCategoricalCrossentropy 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
dataflow_len Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/dataflows/utils.py
code served (permissive licence) · get_code("fd8ccd0936eb0e95")
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 int, ndim 0, dtype family int, 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 iterates over dataflow and accesses data[0].shape[0]
# So dataflow should be an iterable of tuples/lists where the first element is a tensor

# Create a small dataflow: list of batches, each batch is (features, labels)
batch1 = (torch.randn(2, 4), torch.randint(0, 2, (2,)))
batch2 = (torch.randn(3, 4), torch.randint(0, 2, (3,)))
batch3 = (torch.randn(1, 4), torch.randint(0, 2, (1,)))

dataflow = [batch1, batch2, batch3]

ARGS = {
    "dataflow": dataflow
}
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 int, ndim 0, dtype family int, 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
dataset_len Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/datasets/utils.py
code served (permissive licence) · get_code("e0fde3fe1791c1c0")
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 int, ndim 0, dtype family int, 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 tensorflow as tf
import numpy as np

# Create a small TF dataset
def create_tf_dataset():
    # Create simple numpy arrays
    data = np.random.randn(256, 4).astype(np.float32)  # 256 samples, 4 features
    labels = np.random.randint(0, 2, 256).astype(np.int32)  # 256 binary labels
    
    # Create TF dataset from tensors
    dataset = tf.data.Dataset.from_tensor_slices((data, labels))
    return dataset

tf_dataset = create_tf_dataset()

ARGS = {
    'tf_dataset': tf_dataset,
    'verbose': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, 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
decay_weights Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/utilities/losses.py
code served (permissive licence) · get_code("fbc6e36eb3a7dc37")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

class SimpleModel(tf.Module):
    def __init__(self):
        super(SimpleModel, self).__init__()
        self._trainable_weights = [
            tf.Variable(tf.random.normal([4, 3]), trainable=True),
            tf.Variable(tf.random.normal([3, 2]), trainable=True),
            tf.Variable(tf.random.normal([2]), trainable=True),
        ]
    
    @property
    def trainable_weights(self):
        return self._trainable_weights


model = SimpleModel()
weight_decay_rate = 0.01

ARGS = {
    "model": model,
    "weight_decay_rate": weight_decay_rate,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
gradient_penalty Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/methods/cyclegan/utils.py
code served (permissive licence) · get_code("1eb22022906e8429")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Create a simple discriminator model that takes input and returns predictions
class SimpleDiscriminator(tf.keras.Model):
    def __init__(self):
        super(SimpleDiscriminator, self).__init__()
        self.dense1 = tf.keras.layers.Dense(8)
        self.dense2 = tf.keras.layers.Dense(1)
    
    def call(self, x):
        x = self.dense1(x)
        x = tf.nn.relu(x)
        x = self.dense2(x)
        return x

# Instantiate the discriminator
discriminator = SimpleDiscriminator()

# Create sample tensors with batch size 2 and feature dimension 4
real_data = tf.constant(np.random.randn(2, 4).astype(np.float32))
fake_data = tf.constant(np.random.randn(2, 4).astype(np.float32))

# Test with different modes
ARGS = {
    'f': discriminator,
    'real': real_data,
    'fake': fake_data,
    'mode': 'wgan-gp',
    'scale': 10.0
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
random_flip Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/autoaugment/augmentation_transforms.py
code served (permissive licence) · get_code("6e1198a9c8c47438")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 2, dtype family float, shape (2, 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 numpy as np

# Set random seed for reproducibility
np.random.seed(0)

# Create a small 2D array to use as input
# Using shape (2, 4) - batch of 2, width of 4
x = np.random.rand(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (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
resnet_layer Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
HazyResearch/model-patching/augmentation/models/resnet.py
code served (permissive licence) · get_code("c4bb2cc4f4fe1b02")
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 EagerTensor, ndim 4, dtype family float, shape (2, 4, 4, 16) 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 tensorflow as tf
import numpy as np

# Create a small input tensor for the function
# Shape: (batch_size=2, height=4, width=4, channels=3)
input_tensor = tf.keras.Input(shape=(4, 4, 3))

# Create a simple model to get a concrete tensor to pass through
class SimpleModel(tf.keras.Model):
    def call(self, x):
        return x

model = SimpleModel()
# Generate a concrete tensor by building the model
concrete_inputs = tf.random.normal((2, 4, 4, 3))

ARGS = {
    'inputs': concrete_inputs,
    'num_filters': 16,
    'kernel_size': 3,
    'strides': 1,
    'activation': 'relu',
    'batch_normalization': True,
    'conv_first': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 4, dtype family float, shape (2, 4, 4, 16) — shape (2, 4, 4, 16) 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
resnet_v1 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
HazyResearch/model-patching/augmentation/models/resnet.py
code served (permissive licence) · get_code("9e1df2116f5f12de")
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 Functional. 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 tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import AveragePooling2D, Input, Flatten
from tensorflow.keras.layers import Dense, Conv2D, BatchNormalization, Activation
from tensorflow.keras.models import Model
from tensorflow.keras.regularizers import l2

# Set seed for reproducibility
tf.random.set_seed(0)

# Define ARGS dict with valid arguments for resnet_v1
ARGS = {
    'input_shape': (32, 32, 3),  # Standard CIFAR-10 input shape: height, width, channels
    'depth': 20,                  # Valid depth: 6n+2, so 20 = 6*3+2
    'num_classes': 10             # CIFAR-10 has 10 classes
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Functional — a Functional output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Functional 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
resnet_v2 Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/models/resnet.py
code served (permissive licence) · get_code("10983517a862cfee")
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 Functional. 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 tensorflow.keras as keras

ARGS = {
    'input_shape': (32, 32, 3),
    'depth': 20,
    'num_classes': 10,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Functional — a Functional output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Functional 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
simple_cnn_model Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/models/models.py
code served (permissive licence) · get_code("7730ae831bb01b7e")
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 Sequential. 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 tensorflow.keras as keras

# The function expects:
# - input_shape: tuple specifying the input shape (height, width, channels)
# - n_classes: integer specifying the number of output classes

ARGS = {
    "input_shape": (28, 28, 3),
    "n_classes": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Sequential — a Sequential output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Sequential 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
simple_model Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/models/models.py
code served (permissive licence) · get_code("34007c8abd15fb91")
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 Functional. 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 tensorflow.keras as keras

ARGS = {
    'input_shape': (28, 28),
    'n_classes': 10,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Functional — a Functional output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Functional 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
split_batch_size Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/augment/static.py
code served (permissive licence) · get_code("26f24fe261bd5178")
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)

# Analyze the function:
# split_batch_size(total_batch_size, n_groups)
# - total_batch_size: an integer representing total batch size
# - n_groups: an integer representing number of groups to split into
# The function divides total_batch_size by n_groups and distributes remainder

ARGS = {
    "total_batch_size": 100,
    "n_groups": 4,
}
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
wgan_loss Ran
ran on a synthesized input
HazyResearch/model-patching/augmentation/methods/cyclegan/utils.py
code served (permissive licence) · get_code("6314c87eb9f70b97")
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 EagerTensor, 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 tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create small tensor arguments for wgan_loss
# targets: binary labels (0 or 1), shape (batch_size, features)
targets = tf.constant([[1.0, 0.0, 1.0, 0.0],
                       [0.0, 1.0, 0.0, 1.0]], dtype=tf.float32)

# predictions: model output scores, shape (batch_size, features)
predictions = tf.constant([[0.8, -0.3, 0.5, -0.2],
                           [-0.1, 0.9, -0.4, 0.7]], dtype=tf.float32)

ARGS = {
    'targets': targets,
    'predictions': predictions
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, 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
zero_pad_and_crop Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
HazyResearch/model-patching/augmentation/autoaugment/augmentation_transforms.py
code served (permissive licence) · get_code("c5c143c5b39b3c1a")
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 float, shape (8, 6, 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

# Create a small test image with shape (height, width, channels)
# Using distinct dimensions: 8x6x3 (height x width x channels)
img = np.random.rand(8, 6, 3).astype(np.float32)

ARGS = {
    "img": img,
    "amount": 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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 float, shape (8, 6, 3) — shape (8, 6, 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
apply_modifier_to_dataset Not yet run
unverified (harvested, no recorded run)
HazyResearch/model-patching/augmentation/datasets/utils.py
code served (permissive licence) · get_code("98c19e8ea2a7308a")
How it ran

no invocation recorded.

create_augmentation_pipeline Not yet run
unverified (harvested, no recorded run)
HazyResearch/model-patching/augmentation/augment/utils.py
code served (permissive licence) · get_code("fbb0bdc2392bddaf")
How it ran

no invocation recorded.

create_augmentation_pipelines Not yet run
unverified (harvested, no recorded run)
HazyResearch/model-patching/augmentation/augment/utils.py
code served (permissive licence) · get_code("333a830b360f3ea9")
How it ran

no invocation recorded.

create_static_augmentation_pipeline Not yet run
unverified (harvested, no recorded run)
HazyResearch/model-patching/augmentation/augment/static.py
code served (permissive licence) · get_code("b2de24ddcad94133")
How it ran

no invocation recorded.

get_dataset_from_list_files_dataset Not yet run
unverified (harvested, no recorded run)
HazyResearch/model-patching/augmentation/datasets/utils.py
code served (permissive licence) · get_code("7331bb97aea96bf8")
How it ran

no invocation recorded.

rewrite_config_for_resumption Not yet run
unverified (harvested, no recorded run)
HazyResearch/model-patching/augmentation/methods/robust/utils.py
code served (permissive licence) · get_code("04e4f19c8f00a35f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 24 samples lifted from this paper's linked repositories, 24 carry a function identity and 0 do not. Of the 24 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 0 later) and 19 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
resnet_layer 5 other papers
5 dated earlier
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition
1807.06521 (2018-07)
CBAM: Convolutional Block Attention Module
1905.10626 (2019-05)
Rethinking Softmax Cross-Entropy Loss for Adversarial Robustness
and 2 more not named here
create_cutout_mask 3 other papers
3 dated earlier
1708.04552 (2017-08)
Improved Regularization of Convolutional Neural Networks with Cutout
1904.12848 (2019-04)
Unsupervised Data Augmentation for Consistency Training
1905.05393 (2019-05)
Population Based Augmentation: Efficient Learning of Augmentation Policy Schedules
random_flip 3 other papers
3 dated earlier
1805.09501 (2018-05)
AutoAugment: Learning Augmentation Policies from Data
1904.12848 (2019-04)
Unsupervised Data Augmentation for Consistency Training
1905.05393 (2019-05)
Population Based Augmentation: Efficient Learning of Augmentation Policy Schedules
zero_pad_and_crop 3 other papers
3 dated earlier
1805.09501 (2018-05)
AutoAugment: Learning Augmentation Policies from Data
1904.12848 (2019-04)
Unsupervised Data Augmentation for Consistency Training
1905.05393 (2019-05)
Population Based Augmentation: Efficient Learning of Augmentation Policy Schedules
resnet_v1 1 other paper
1 dated earlier
1512.03385 (2015-12)
Deep Residual Learning for Image Recognition

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

Classifiers in machine learning are often brittle when deployed. Particularly concerning are models with inconsistent performance on specific subgroups of a class, e.g., exhibiting disparities in skin cancer classification in the presence or absence of a spurious bandage. To mitigate these performance differences, we introduce model patching, a two-stage framework for improving robustness that encourages the model to be invariant to subgroup differences, and focus on class information shared by subgroups. Model patching first models subgroup features within a class and learns semantic transformations between them, and then trains a classifier with data augmentations that deliberately manipulate subgroup features. We instantiate model patching with CAMEL, which (1) uses a CycleGAN to learn the intra-class, inter-subgroup augmentations, and (2) balances subgroup performance using a theoretically-motivated subgroup consistency regularizer, accompanied by a new robust objective. We demonstrate CAMEL's effectiveness on 3 benchmark datasets, with reductions in robust error of up to 33% relative to the best baseline. Lastly, CAMEL successfully patches a model that fails due to spurious features on a real-world skin cancer dataset.

For agents

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

get_harvested_code_for_paper("2008.06775")
get_code_for_paper("2008.06775")
have("2008.06775")

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

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

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

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

Connect an agent — have() is free.