SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1907.02893 · 2019

Invariant Risk Minimization

Ishaan Gulrajani, Léon Bottou, David Lopez-Paz, Martin Arjovsky

arXiv · PDF · Open in the Atlas

Code that ran

18 of 30 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 2 violated it and 6 have no contract verdict; 7 failures of our instrument; 12 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/1907.02893.json · badge: /api/ran/1907.02893.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
katoro8989/irm_variants_calibration community (classifier label)
classifier basis not recorded on the link
9 ran · 7 no recorded run
parshakova/IRM_ICP-IC_ERM community
Papers with Code archive
4 ran · 2 no recorded run
hasanjawad001/cglearn community
Papers with Code archive
2 ran · 0 no recorded run
ycq091044/manydg community
Papers with Code archive
1 ran · 0 no recorded run
chunyangx/IRM_research community
Papers with Code archive
1 ran · 0 no recorded run
aniquetahir/jax_ood community
Papers with Code archive
1 ran · 0 no recorded run
facebookresearch/DomainBed community
Papers with Code archive
0 ran · 1 no recorded run
claudiashi57/nice community
Papers with Code archive
0 ran · 1 no recorded run
reiinakano/invariant-risk-minimization community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
CGLBase Ran
ran on a synthesized input · constructed an object; no result was computed
hasanjawad001/cglearn/cglearn_linear.py
code served (permissive licence) · get_code("7901fe5f746966d4")
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 an instance of its own class, CGLBase: the run constructed the object and did not call it, so no result was computed. 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 math

torch.manual_seed(0)

# Create small training and validation environments
# Each environment is a tuple of (x, y) where x is features and y is targets
# dim_x = 4 (features), batch_size = 2 (samples)

# Training environment 1
x_train_1 = torch.randn(2, 4)
y_train_1 = torch.randn(2, 1)

# Training environment 2
x_train_2 = torch.randn(2, 4)
y_train_2 = torch.randn(2, 1)

# Validation environment
x_val = torch.randn(2, 4)
y_val = torch.randn(2, 1)

# Build environments list: [training_env_1, training_env_2, ..., validation_env]
environments = [
    (x_train_1, y_train_1),
    (x_train_2, y_train_2),
    (x_val, y_val)
]

ARGS = {
    'environments': environments,
    'lr': 0.01,
    'n_iterations': 3,
    'v_method': 0
}
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 CGLBase — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CGLBase 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
CGLearn Ran
ran on a synthesized input · constructed an object; no result was computed
hasanjawad001/cglearn/cglearn_linear.py
code served (permissive licence) · get_code("2f5e75c75135e52a")
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 an instance of its own class, CGLearn: the run constructed the object and did not call it, so no result was computed. 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 math

torch.manual_seed(0)

# Create small training and validation environments
# Each environment is a tuple of (x, y)
# x has shape (batch_size, dim_x)
# y has shape (batch_size, 1)

dim_x = 4
batch_size = 2

# Create 3 environments: 2 for training, 1 for validation
env1_x = torch.randn(batch_size, dim_x)
env1_y = torch.randn(batch_size, 1)

env2_x = torch.randn(batch_size, dim_x)
env2_y = torch.randn(batch_size, 1)

env3_x = torch.randn(batch_size, dim_x)
env3_y = torch.randn(batch_size, 1)

environments = [
    (env1_x, env1_y),
    (env2_x, env2_y),
    (env3_x, env3_y),
]

ARGS = {
    'environments': environments,
    'lr': 0.01,
    'n_iterations': 5,
}
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 CGLearn — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CGLearn 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
EarlyStopping Ran
ran on a synthesized input · constructed an object; no result was computed
parshakova/IRM_ICP-IC_ERM/code/models.py
pointer only (licence: NOASSERTION) · get_code("abbd8616af693ed0")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, parshakova/IRM_ICP-IC_ERM (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.

IRM Ran
ran on a synthesized input · constructed an object; no result was computed
ycq091044/manydg/model.py
pointer only (licence: NONE) · get_code("d67283e16e562ca6")
How it ran

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

InvariantRiskMinimization Ran
ran on a synthesized input · constructed an object; no result was computed
chunyangx/IRM_research/code/experiment_synthetic/models.py
pointer only (licence: NOASSERTION) · get_code("7f8756cacd48bc13")
How it ran

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

InvariantRiskMinimization Ran
ran on a synthesized input · constructed an object; no result was computed
aniquetahir/jax_ood/code/experiment_synthetic/models.py
pointer only (licence: NOASSERTION) · get_code("2017c3948be2287e")
How it ran

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

check_for_nans Ran
ran, violated the contract we drafted
parshakova/IRM_ICP-IC_ERM/code/models.py
pointer only (licence: NOASSERTION) · get_code("083ced6d4ac945b7")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, parshakova/IRM_ICP-IC_ERM (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.

conv3x3 Ran
ran; our contract draft was wrong, not the code
katoro8989/irm_variants_calibration/domainbed/networks.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from lixiaotong97/DSU, is pointer only (licence: NONE) · get_code("fac5364e2f53c6db")
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 lixiaotong97/DSU, 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.

getNumParams Ran
ran, honoured the contract we drafted
katoro8989/irm_variants_calibration/domainbed/lib/pair_opt.py
code served (permissive licence) · get_code("28077f9c052f7aed")
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, 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 torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Create a simple model with parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
    
    def forward(self, x):
        return self.linear2(self.linear1(x))

model = SimpleModel()

# Create a list of parameters with mixed requires_grad settings
params = list(model.parameters())
# Make the last parameter non-trainable
params[-1].requires_grad = False

ARGS = {
    "params": params
}
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 tuple, ndim 1, 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_kl_div Ran
ran, violated the contract we drafted
katoro8989/irm_variants_calibration/domainbed/lib/pair_opt.py
code served (permissive licence) · get_code("cb517763d1083872")
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 float64, 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)

# losses should be a 1D array/tensor that supports .dot() method
# preference should be a 1D array/tensor that supports .dot() method
# The function computes losses.dot(preference), so both need compatible shapes

losses = np.array([1.5, 2.3, 0.8, 1.2])
preference = np.array([0.5, 0.3, 0.1, 0.2])

ARGS = {
    "losses": losses,
    "preference": preference,
}
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 float64, 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_test_records Ran
ran; our contract draft was wrong, not the code
katoro8989/irm_variants_calibration/domainbed/model_selection.py
code served (permissive licence) · get_code("53fac8d8d949e72b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned MockRecords. 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.

class MockRecords:
    def __init__(self, data):
        self.data = data
    
    def filter(self, fn):
        filtered_data = [item for item in self.data if fn(item)]
        return MockRecords(filtered_data)
    
    def __iter__(self):
        return iter(self.data)
    
    def __len__(self):
        return len(self.data)
    
    def __getitem__(self, idx):
        return self.data[idx]

# Create sample records with test_envs
sample_records_data = [
    {
        'args': {
            'test_envs': [0]
        },
        'other_field': 'value1'
    },
    {
        'args': {
            'test_envs': [1]
        },
        'other_field': 'value2'
    },
    {
        'args': {
            'test_envs': [0, 1]
        },
        'other_field': 'value3'
    },
    {
        'args': {
            'test_envs': [2]
        },
        'other_field': 'value4'
    },
    {
        'args': {
            'test_envs': [0, 2, 3]
        },
        'other_field': 'value5'
    }
]

records = MockRecords(sample_records_data)

ARGS = {
    'records': records
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 MockRecords — a MockRecords output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockRecords output the recorded ndim 1 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
l2_between_dicts Ran
ran, honoured the contract we drafted
katoro8989/irm_variants_calibration/domainbed/lib/misc.py
code served (permissive licence) · get_code("1fdaff04251a0d51")
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)

# The function expects two dictionaries containing tensors
# It computes the L2 distance between flattened concatenations of tensor values

dict_1 = {
    'a': torch.randn(2, 4),
    'b': torch.randn(3, 5),
}

dict_2 = {
    'a': torch.randn(2, 4),
    'b': torch.randn(3, 5),
}

ARGS = {
    'dict_1': dict_1,
    'dict_2': dict_2,
}
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
make_weights_for_balanced_classes Ran
ran, honoured the contract we drafted
katoro8989/irm_variants_calibration/domainbed/lib/misc.py
code served (permissive licence) · get_code("5f576ed342c48a0a")
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 1, dtype family float, shape (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
from collections import Counter

torch.manual_seed(0)

# Create a minimal dataset-like object
# The function iterates over dataset with: for _, y in dataset
# So we need an iterable of (x, y) tuples where y can be converted to int

class MinimalDataset:
    def __init__(self):
        # Create a small dataset with 3 samples across 2 classes
        # Class 0: 2 samples, Class 1: 1 sample
        self.data = [
            (torch.randn(4), 0),
            (torch.randn(4), 0),
            (torch.randn(4), 1),
        ]
    
    def __iter__(self):
        return iter(self.data)
    
    def __len__(self):
        return len(self.data)

dataset = MinimalDataset()

ARGS = {
    "dataset": dataset
}
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 1, dtype family float, shape (3,) — shape (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
pair_selection Ran
ran; our contract draft was wrong, not the code
katoro8989/irm_variants_calibration/domainbed/lib/pair_opt.py
code served (permissive licence) · get_code("32a5b544ec6bebb1")
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, 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 numpy as np

# Create sample data for the function
np.random.seed(0)

# losses: shape (n_iterations, n_loss_components)
# Using 5 loss components as an example
losses = np.random.rand(10, 5) * 0.1

# val_accs: validation accuracies for each iteration
val_accs = np.linspace(0.7, 0.95, 10)

# test_accs: test accuracies for each iteration
test_accs = np.linspace(0.68, 0.93, 10)

# anneal_iter: starting iteration
anneal_iter = 0

# val_acc_bar: validation accuracy threshold (negative means auto-compute)
val_acc_bar = -1

# pood: optional custom preference array (None means use default)
pood = None

ARGS = {
    "losses": losses,
    "val_accs": val_accs,
    "test_accs": test_accs,
    "anneal_iter": anneal_iter,
    "val_acc_bar": val_acc_bar,
    "pood": pood,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy — 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
popul_erm_solution Ran
ran; our contract draft was wrong, not the code
parshakova/IRM_ICP-IC_ERM/code/models.py
pointer only (licence: NOASSERTION) · get_code("33b9f5baa6bc40fe")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, parshakova/IRM_ICP-IC_ERM (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.

pretty Ran
ran; our contract draft was wrong, not the code
parshakova/IRM_ICP-IC_ERM/code/models.py
pointer only (licence: NOASSERTION) · get_code("db4d05619d1e83d4")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, parshakova/IRM_ICP-IC_ERM (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.

remove_batch_norm_from_resnet Ran
ran; our contract draft was wrong, not the code
katoro8989/irm_variants_calibration/domainbed/networks.py
code served (permissive licence) · get_code("196cab71d7129d62")
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 MinimalResNet. 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 Identity(nn.Module):
    """An identity layer"""

    def __init__(self):
        super(Identity, self).__init__()

    def forward(self, x):
        return x

class BottleneckBlock(nn.Module):
    """Minimal bottleneck block for ResNet"""
    def __init__(self, in_channels, out_channels, downsample=False):
        super(BottleneckBlock, self).__init__()
        self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=1)
        self.bn1 = nn.BatchNorm2d(out_channels)
        self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=1)
        self.bn2 = nn.BatchNorm2d(out_channels)
        self.conv3 = nn.Conv2d(out_channels, out_channels * 4, kernel_size=1)
        self.bn3 = nn.BatchNorm2d(out_channels * 4)
        
        if downsample:
            self.downsample = nn.Sequential(
                nn.Conv2d(in_channels, out_channels * 4, kernel_size=1),
                nn.BatchNorm2d(out_channels * 4)
            )
        else:
            self.downsample = None

class MinimalResNet(nn.Module):
    """Minimal ResNet-like model for testing"""
    def __init__(self):
        super(MinimalResNet, self).__init__()
        self.conv1 = nn.Conv2d(3, 64, kernel_size=7, padding=3)
        self.bn1 = nn.BatchNorm2d(64)
        
        self.layer1 = nn.Sequential(
            BottleneckBlock(64, 64, downsample=False)
        )
        self.layer2 = nn.Sequential(
            BottleneckBlock(256, 128, downsample=True)
        )
        self.layer3 = nn.Sequential(
            BottleneckBlock(512, 256, downsample=False)
        )
        self.layer4 = nn.Sequential(
            BottleneckBlock(1024, 512, downsample=False)
        )

model = MinimalResNet()

ARGS = {
    "model": model
}
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 MinimalResNet — a MinimalResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MinimalResNet 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
resnet18 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
katoro8989/irm_variants_calibration/domainbed/networks.py
code served (permissive licence) · get_code("6784a79e7943e224")
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 MNIST_ResNet. 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)

ARGS = {
    "input_shape": (1, 28, 28),
}
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 MNIST_ResNet — a MNIST_ResNet output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MNIST_ResNet 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
BestParameters Not yet run
unverified (harvested, no recorded run)
parshakova/IRM_ICP-IC_ERM/code/models.py
pointer only (licence: NOASSERTION) · get_code("ac3dc229465a5881")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, parshakova/IRM_ICP-IC_ERM (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.

IRM Not yet run
unverified (harvested, no recorded run)
facebookresearch/DomainBed/domainbed/algorithms.py
code served (permissive licence) · get_code("f2e2ffafbf837990")
How it ran

no invocation recorded.

IRM Not yet run
unverified (harvested, no recorded run)
claudiashi57/nice/src/experiment_synthetic/models.py
pointer only (licence: NONE) · get_code("ccfb22f0237dbf06")
How it ran

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

InvariantRiskMinimization Not yet run
unverified (harvested, no recorded run)
parshakova/IRM_ICP-IC_ERM/code/models.py
pointer only (licence: NOASSERTION) · get_code("30536df61163084f")
How it ran

The body of this sample is withheld: GitHub could not classify the licence of this paper's repository, parshakova/IRM_ICP-IC_ERM (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.

build_calibration_metric Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/calibration/ece.py
code served (permissive licence) · get_code("9e81bbf308f5fd2b")
How it ran

no invocation recorded.

calc_ece Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/calibration/ece.py
code served (permissive licence) · get_code("4cc1b13edccacd97")
How it ran

no invocation recorded.

calibrate Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/calibration/ece.py
code served (permissive licence) · get_code("07696a6fad15378d")
How it ran

no invocation recorded.

compute_penalty Not yet run
unverified (harvested, no recorded run)
reiinakano/invariant-risk-minimization/minimum_irm.py
code served (permissive licence) · get_code("fe230835517bd55d")
How it ran

no invocation recorded.

get_algorithm_class Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/algorithms.py
code served (permissive licence) · get_code("b0bc80b1655a6802")
How it ran

no invocation recorded.

get_dataset_class Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/datasets.py
code served (permissive licence) · get_code("d0ea85d74c20dea9")
How it ran

no invocation recorded.

num_environments Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/datasets.py
code served (permissive licence) · get_code("73f32252eedba6a4")
How it ran

no invocation recorded.

print_row Not yet run
unverified (harvested, no recorded run)
katoro8989/irm_variants_calibration/domainbed/lib/misc.py
code served (permissive licence) · get_code("af3c9a80c8fd1f7a")
How it ran

no invocation recorded.

Also present in other papers' code

Of 30 samples lifted from this paper's linked repositories, 30 carry a function identity and 0 do not. Of the 30 distinct functions with an identity, 17 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 1 the same month, 17 later) and 13 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
conv3x3 686 other papers
137 dated earlier, 5 the same month, 544 later · 31 only as an assembly brick
1406.2661 (2014-06)
Generative Adversarial Networks
1409.0575 (2014-09)
ImageNet Large Scale Visual Recognition Challenge
1412.6572 (2014-12)
Explaining and Harnessing Adversarial Examples
and 683 more not named here
get_algorithm_class 39 other papers
39 later
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2007.02931 (2020-07)
Adaptive Risk Minimization: Learning to Adapt to Domain Shift
2104.09841 (2021-04)
SelfReg: Self-supervised Contrastive Regularization for Domain Generalization
and 36 more not named here
remove_batch_norm_from_resnet 23 other papers
23 later
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2205.09739 (2022-05)
Diverse Weight Averaging for Out-of-Distribution Generalization
and 20 more not named here
get_test_records 22 other papers
1 dated earlier, 21 later
1710.03077 (2017-10)
Deeper, Broader and Artier Domain Generalization
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
and 19 more not named here
get_dataset_class 21 other papers
21 later
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2106.06607 (2021-06)
Invariance Principle Meets Information Bottleneck for Out-of-Distribution Generalization
and 18 more not named here
num_environments 21 other papers
21 later
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2106.06607 (2021-06)
Invariance Principle Meets Information Bottleneck for Out-of-Distribution Generalization
and 18 more not named here
make_weights_for_balanced_classes 18 other papers
18 later
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2203.10789 (2022-03)
Domain Generalization by Mutual-Information Regularization with Pre-trained Models
and 15 more not named here
print_row 11 other papers
11 later
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
2111.12853 (2021-11)
Domain Prompt Learning for Efficiently Adapting CLIP to Unseen Domains
2205.13462 (2022-05)
FedBR: Improving Federated Learning on Heterogeneous Data via Local Learning Bias Reduction
and 8 more not named here
l2_between_dicts 9 other papers
9 later
2205.09739 (2022-05)
Diverse Weight Averaging for Out-of-Distribution Generalization
2205.13462 (2022-05)
FedBR: Improving Federated Learning on Heterogeneous Data via Local Learning Bias Reduction
2206.04046 (2022-06)
Sparse Mixture-of-Experts are Domain Generalizable Learners
and 6 more not named here
pretty
brick of this paper's assembly: helper
3 other papers
3 later
2010.16412 (2020-10)
Empirical or Invariant Risk Minimization? A Sample Complexity Perspective
2311.11114 (2023-11)
Environment-Aware Dynamic Graph Learning for Out-of-Distribution Generalization
2405.04715 (2024-05)
Causality Pursuit from Heterogeneous Environments via Neural Adversarial Invariance Learning
getNumParams 2 other papers
2 later
2206.07766 (2022-06)
Pareto Invariant Risk Minimization: Towards Mitigating the Optimization Dilemma in Out-of-Distribution Generalization
2412.01773 (2024-12)
FERERO: A Flexible Framework for Preference-Guided Multi-Objective Learning
build_calibration_metric 1 other paper
1 later
2307.08187 (2023-07)
An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration
calc_ece 1 other paper
1 later
2307.08187 (2023-07)
An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration
calibrate 1 other paper
1 later
2307.08187 (2023-07)
An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration
get_kl_div 1 other paper
1 later
2206.07766 (2022-06)
Pareto Invariant Risk Minimization: Towards Mitigating the Optimization Dilemma in Out-of-Distribution Generalization
pair_selection 1 other paper
1 later
2206.07766 (2022-06)
Pareto Invariant Risk Minimization: Towards Mitigating the Optimization Dilemma in Out-of-Distribution Generalization
resnet18 1 other paper
1 later
2307.08187 (2023-07)
An Empirical Study of Pre-trained Model Selection for Out-of-Distribution Generalization and Calibration

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

discards what information is stable across writers. However, shuffling the data is something that we do, not something that Nature does for us. When shuffling, we destroy information about how the data distribution changes when one varies the data sources or collection specifics. Yet, this information is precisely what tells us whether a property of the data is spurious or stable. Here we take a step back, and assume that the training data is collected into distinct, separate environments. These could represent different measuring circumstances, locations, times, experimental conditions, external interventions, contexts, and so forth. Then, we promote learning correlations that are stable across training environments, as these should (under conditions that we will study) also hold in novel testing environments. Returning to our motivational example, we would like to label pictures of cows and camels under different environments. For instance, the pictures of cows taken in the first environment may be located in green pastures 80% of the time. In the second environment, this proportion could be slightly different, say 90% of the time (since pictures were taken in a different country). These two datasets reveal that "cow" and "green background" are linked by a strong, but varying (spurious) correlation, which should be discarded in order to generalize to new environments. Learning machines which pool the data from the two environments together may still rely on the background bias when addressing the prediction task. But, we believe that all cows exhibit features that allow us to recognize them as so, regardless of their context. This suggests that invariant descriptions of objects relate to the causal explanation of the object itself ("Why is it a cow? ") [32]. As shown by [40,22], there exists an intimate link between invariance and causation useful for generalization. However, [40] assumes a meaningful causal graph relating the observed variables, an awkward assumption when dealing with perceptual inputs such as pixels. Furthermore, [40] only applies to linear models, and scales exponentially with respect to the number of variables in the learning problem. As such, the seamless integration of causation tools [41] into machine learning pipelines remains cumbersome, disallowing what we believe to be a powerful synergy. Here, we work to address these concerns. We propose Invariant Risk Minimization (IRM), a novel learning paradigm that estimates nonlinear, invariant, causal predictors from multiple training environments, to enable out-of-distribution (OOD) generalization. To this end, we first analyze in Section 2 how different learning techniques fail to generalize OOD. From this analysis, we derive our IRM principle in Section 3: To learn invariances across environments, find a data representation such that the optimal classifier on top of that representation matches for all environments. Section 4 examines the fundamental links between causation, invariance, and OOD generalization. Section 5 contains basic numerical simulations to validate our claims empirically. Section 6 concludes with a Socratic dialogue discussing directions for future research.

For agents

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

get_harvested_code_for_paper("1907.02893")
get_code_for_paper("1907.02893")
have("1907.02893")

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

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

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

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

Connect an agent — have() is free.