SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2010.16412 · 2020

Empirical or Invariant Risk Minimization? A Sample Complexity Perspective

arXiv · PDF · Open in the Atlas

Code that ran

12 of 14 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 10 have no contract verdict; 2 failures of our instrument; 2 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/2010.16412.json · badge: /api/ran/2010.16412.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
IBM/OoD canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
IBM/IRM-games canonical (classifier label)
classifier basis: census
5 ran · 1 no recorded run
FunctionStatusWhere it lives
ERM_Tblock Ran
ran on a synthesized input
IBM/IRM-games/IRM_ITE/models.py
code served (permissive licence) · get_code("a7f23fec9f83e15e")
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
from sklearn.linear_model import LinearRegression, RidgeCV

np.random.seed(0)

# Create small sample data
n_train = 10
n_test = 4
n_features = 3

# X_train: training features (n_train x n_features)
X_train = np.random.randn(n_train, n_features)

# T_train: training treatment (n_train,) - binary treatment assignment
T_train = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])

# X_test: test features (n_test x n_features)
X_test = np.random.randn(n_test, n_features)

# y_train: training observed outcome (n_train x 1)
y_train = np.random.randn(n_train, 1)

# model_type: either 'LinearRegression' or 'RidgeCV'
model_type = 'LinearRegression'

ARGS = {
    'X_train': X_train,
    'T_train': T_train,
    'X_test': X_test,
    'y_train': y_train,
    'model_type': model_type
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
IRM_Sblock Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/irm_block.py
code served (permissive licence) · get_code("4dbfd6b03c7a8067")
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 numpy as np

torch.manual_seed(0)

# Create small tensors for environments
# Each environment is a tuple of (x, y) where x has shape (batch, features) and y has shape (batch, 1)
batch_size = 2
n_features = 4
n_outputs = 1

# Create 3 environments for training + 1 for validation
environments = []
for env_idx in range(4):
    x_e = torch.randn(batch_size, n_features)
    y_e = torch.randn(batch_size, n_outputs)
    environments.append((x_e, y_e))

# Test features for control and treatment branches
featuresTest_control = torch.randn(3, n_features)  # 3 test samples
featuresTest_treatment = torch.randn(3, n_features)  # 3 test samples

# Create args object with required attributes
class Args:
    def __init__(self):
        self.lr = 0.01
        self.number_IRM_iterations = 5

args = Args()

ARGS = {
    "environments": environments,
    "featuresTest_control": featuresTest_control,
    "featuresTest_treatment": featuresTest_treatment,
    "args": args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — 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
PEHE Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/metrics.py
code served (permissive licence) · get_code("3ef447ce6417f2a3")
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 float32, 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 numpy as np

# Create small sample data for test and predicted potential outcomes
# Shape: (batch_size, num_treatments) where num_treatments=2
np.random.seed(0)

# Test potential outcomes: true outcomes for control (col 0) and treatment (col 1)
test_potential_outcome = np.array([
    [0.5, 1.2],
    [0.8, 1.5],
], dtype=np.float32)

# Predicted potential outcomes: estimated outcomes for control and treatment
pred_potential_outcome = np.array([
    [0.6, 1.1],
    [0.7, 1.6],
], dtype=np.float32)

ARGS = {
    "test_potential_outcome": test_potential_outcome,
    "pred_potential_outcome": pred_potential_outcome,
}
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 float32, 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
ate_error Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/metrics.py
code served (permissive licence) · get_code("91d3cbc506dacd10")
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 float64, ndim 0, 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 small numpy arrays representing true and predicted average treatment effects
test_ate = np.array(0.5)
pred_ate = np.array(0.45)

ARGS = {
    "test_ate": test_ate,
    "pred_ate": pred_ate,
}
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 float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
convert_regn_np_format Ran
ran on a synthesized input
IBM/IRM-games/LRG_games/irm_games_regression.py
code served (permissive licence) · get_code("cabc72b51279fac0")
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. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function expects all_environments to be a list where:
# - all_environments[0] is a list of environments
# - each environment is a tuple (x, y) where x and y are torch tensors
# - x.numpy() and y.numpy() should work (so they need .numpy() method)

# Create sample tensor data
x_tensor_0 = torch.randn(2, 4)  # 2 samples, 4 features
y_tensor_0 = torch.randn(2, 3)  # 2 samples, 3 targets

x_tensor_1 = torch.randn(3, 4)  # 3 samples, 4 features
y_tensor_1 = torch.randn(3, 3)  # 3 samples, 3 targets

# Create environments as (x, y) tuples
environment_0 = (x_tensor_0, y_tensor_0)
environment_1 = (x_tensor_1, y_tensor_1)

# Create all_environments structure: list containing a list of environments
all_environments = [
    [environment_0, environment_1]
]

ARGS = {
    "all_environments": all_environments
}
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 — a list 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
envs_irm_S Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/irm_block.py
code served (permissive licence) · get_code("c84217ccfbad36a6")
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
import torch

torch.manual_seed(0)

# Create small sample data
n_train = 8
n_test = 4
n_features = 3
n_environments = 2

# X_train: training features (n_train x n_features)
X_train = np.random.randn(n_train, n_features).astype(np.float32)

# X_test: test features (n_test x n_features)
X_test = np.random.randn(n_test, n_features).astype(np.float32)

# T_train: training treatment (n_train x 1)
T_train = np.random.randint(0, 2, size=(n_train, 1)).astype(np.float32)

# y_train: training outcome (n_train x 1)
y_train = np.random.randn(n_train, 1).astype(np.float32)

# E: environment assignment for each training sample (n_train,)
E = np.array([0, 0, 0, 0, 1, 1, 1, 1])

# number_environments: number of distinct environments
number_environments = 2

ARGS = {
    'X_train': X_train,
    'X_test': X_test,
    'T_train': T_train,
    'y_train': y_train,
    'E': E,
    'number_environments': number_environments
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — 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
envs_irm_T Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/irm_block.py
code served (permissive licence) · get_code("57e301bf69860e40")
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. 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
import torch

torch.manual_seed(0)

# Create small sample data
n_samples = 6
n_features = 4
n_environments = 2

# X_train: shape (6, 4) - training features
X_train = np.random.randn(n_samples, n_features).astype(np.float32)

# y_train: shape (6, 1) - training outcomes
y_train = np.random.randn(n_samples, 1).astype(np.float32)

# E: shape (6,) - environment assignments (0 or 1)
E = np.array([0, 0, 0, 1, 1, 1], dtype=np.int32)

# number_environments: scalar
number_environments = 2

ARGS = {
    "X_train": X_train,
    "y_train": y_train,
    "E": E,
    "number_environments": number_environments,
}
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 — a list 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
errors Ran
ran on a synthesized input
IBM/IRM-games/LRG_games/ERM_per_env/IRM_exhaustive_argparse_hper_wo_disc_Sep8.py
code served (permissive licence) · get_code("b73c6efcdaeee963")
How it ran

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

import torch

torch.manual_seed(0)

# w: a tensor with some zero and non-zero values
# w_hat: a tensor with predicted/estimated values
# Both will be viewed as 1D, so shape doesn't matter much, but let's make them 2D for realism

w = torch.tensor([
    [1.5, 0.0, 2.3, 0.0],
    [0.0, -0.8, 0.0, 1.2]
], dtype=torch.float32)

w_hat = torch.tensor([
    [1.4, 0.1, 2.5, 0.05],
    [0.02, -0.9, 0.03, 1.1]
], dtype=torch.float32)

ARGS = {
    "w": w,
    "w_hat": w_hat
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, 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
generate_T Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/generate_synthetic_data.py
code served (permissive licence) · get_code("b46d230fde0188cd")
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 int, shape (10, 1) 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

np.random.seed(0)

ARGS = {
    "number_obeservations": 10
}
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 int, shape (10, 1) — shape (10, 1) 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
generate_mixture_indicator Ran
ran on a synthesized input
IBM/OoD/IRM_ITE/generate_synthetic_data.py
code served (permissive licence) · get_code("e39c919dc88468e7")
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 int, shape (5, 1) 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

ARGS = {
    "number_obeservations": 5
}
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 int, shape (5, 1) — shape (5, 1) 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
pretty Ran
ran; our contract draft was wrong, not the code
IBM/IRM-games/ERM-IRM/models_crossval_Sep8.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from parshakova/IRM_ICP-IC_ERM, is pointer only (licence: NOASSERTION) · get_code("db4d05619d1e83d4")
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 parshakova/IRM_ICP-IC_ERM, and GitHub could not classify the licence of that repository (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
IBM/IRM-games/LRG_games/ERM_per_env/IRM_exhaustive_argparse_hper_wo_disc_Sep8.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from capybaralet/REx_code_release, is pointer only (licence: NONE) · get_code("1463989a26f3aa4f")
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 capybaralet/REx_code_release, 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.

ERM_Sblock Not yet run
unverified (harvested, no recorded run)
IBM/IRM-games/IRM_ITE/models.py
code served (permissive licence) · get_code("a2f985068c422b43")
How it ran

no invocation recorded.

generate_synthetic_data Not yet run
unverified (harvested, no recorded run)
IBM/OoD/IRM_ITE/generate_synthetic_data.py
code served (permissive licence) · get_code("fc6dfd875f58ef25")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 12 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
pretty 3 other papers
1 dated earlier, 2 later
1907.02893 (2019-07)
Invariant Risk Minimization
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
pretty 1 other paper
1 dated earlier
2003.00688 (2020-03)
Out-of-Distribution Generalization via Risk Extrapolation (REx)

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

Recently, invariant risk minimization (IRM) was proposed as a promising solution to address out-of-distribution (OOD) generalization. However, it is unclear when IRM should be preferred over the widely-employed empirical risk minimization (ERM) framework. In this work, we analyze both these frameworks from the perspective of sample complexity, thus taking a firm step towards answering this important question. We find that depending on the type of data generation mechanism, the two approaches might have very different finite sample and asymptotic behavior. For example, in the covariate shift setting we see that the two approaches not only arrive at the same asymptotic solution, but also have similar finite sample behavior with no clear winner. For other distribution shifts such as those involving confounders or anti-causal variables, however, the two approaches arrive at different asymptotic solutions where IRM is guaranteed to be close to the desired OOD solutions in the finite sample regime, while ERM is biased even asymptotically. We further investigate how different factors -- the number of environments, complexity of the model, and IRM penalty weight -- impact the sample complexity of IRM in relation to its distance from the OOD solutions

For agents

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

get_harvested_code_for_paper("2010.16412")
get_code_for_paper("2010.16412")
have("2010.16412")

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

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

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

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

Connect an agent — have() is free.