SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2211.08583 · 2022

Empirical Study on Optimizer Selection for Out-of-Distribution Generalization

arXiv · PDF · Open in the Atlas

Code that ran

7 of 11 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 2 have no contract verdict; 5 failures of our instrument; 4 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/2211.08583.json · badge: /api/ran/2211.08583.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
hiroki11x/optimizer_comparison_ood canonical (classifier label)
classifier basis: plan_row
7 ran · 4 no recorded run
FunctionStatusWhere it lives
Classifier Ran
ran; our contract draft was wrong, not the code
hiroki11x/optimizer_comparison_ood/domainbed/networks.py
code served (permissive licence) · get_code("ce7990d7ad5821ff")
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 Linear. 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

torch.manual_seed(0)

ARGS = {
    "in_features": 16,
    "out_features": 4,
    "is_nonlinear": False,
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
conv1x1 Ran
ran; our contract draft was wrong, not the code
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/imagenet_models/leaky_resnet.py
code served (permissive licence) · get_code("d9def42110729a85")
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 Conv2d. 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)

# The function conv1x1 takes in_planes, out_planes, and stride as parameters
# It returns an nn.Conv2d layer configured for 1x1 convolution
# We need to provide valid integer arguments for these parameters

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Conv2d — a Conv2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv2d 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
conv3x3 Ran
ran; our contract draft was wrong, not the code
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/imagenet_models/leaky_resnet.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.

get_test_records Ran
ran; our contract draft was wrong, not the code
hiroki11x/optimizer_comparison_ood/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
load_configs Ran
ran on a synthesized input
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/challenge_eval_with_wandb.py
code served (permissive licence) · get_code("7655baef76214ea3")
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 dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import yaml
import tempfile
import shutil

# Create a temporary directory structure with a configs.yaml file
temp_dir = tempfile.mkdtemp()
log_dir = temp_dir
task_name = "test_task"
exp_name = "test_exp"

# Create the nested directory structure
config_dir = os.path.join(log_dir, task_name, exp_name)
os.makedirs(config_dir, exist_ok=True)

# Create a valid configs.yaml file
config_data = {
    "model": "test_model",
    "learning_rate": 0.001,
    "batch_size": 32,
    "epochs": 100,
    "layers": [64, 128, 256]
}

config_path = os.path.join(config_dir, 'configs.yaml')
with open(config_path, 'w') as f:
    yaml.dump(config_data, f)

ARGS = {
    "log_dir": log_dir,
    "task_name": task_name,
    "exp_name": exp_name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
make_layers Ran
ran on a synthesized input
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/imagenet_models/vgg.py
code served (permissive licence) · get_code("4663dbc405f4ebb7")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# cfg is a list that can contain integers (channel counts) and 'M' (MaxPool markers)
# This represents a typical VGG-like architecture configuration
cfg = [64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512]

# batch_norm is a boolean flag
batch_norm = False

ARGS = {
    'cfg': cfg,
    'batch_norm': batch_norm
}
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 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 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
remove_batch_norm_from_resnet Ran
ran; our contract draft was wrong, not the code
hiroki11x/optimizer_comparison_ood/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
get_algorithm_class Not yet run
unverified (harvested, no recorded run)
hiroki11x/optimizer_comparison_ood/domainbed/algorithms.py
code served (permissive licence) · get_code("b0bc80b1655a6802")
How it ran

no invocation recorded.

leaky_resnet18 Not yet run
unverified (harvested, no recorded run)
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/imagenet_models/leaky_resnet.py
code served (permissive licence) · get_code("d5b851531e5607ed")
How it ran

no invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/imagenet_models/resnet.py
code served (permissive licence) · get_code("e80f6253f6063a60")
How it ran

no invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
hiroki11x/optimizer_comparison_ood/backgrounds_challenge/imagenet_models/wide_resnet.py
code served (permissive licence) · get_code("129dbbdab666ace4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 8 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 3 the same month, 7 later) and 2 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
425 dated earlier, 9 the same month, 241 later, 11 same year, order not determinable · 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
conv1x1 431 other papers
217 dated earlier, 5 the same month, 197 later, 11 same year, order not determinable, 1 undated · 38 only as an assembly brick
1409.1556 (2014-09)
Very Deep Convolutional Networks for Large-Scale Image Recognition
1506.01186 (2015-06)
Cyclical Learning Rates for Training Neural Networks
1507.05717 (2015-07)
An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition
and 428 more not named here
resnet18 89 other papers
55 dated earlier, 2 the same month, 30 later, 2 same year, order not determinable
1705.09759 (2017-05)
CASENet: Deep Category-Aware Semantic Edge Detection
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
1803.00839 (2018-03)
Pose-Robust Face Recognition via Deep Residual Equivariant Mapping
and 86 more not named here
get_algorithm_class 39 other papers
17 dated earlier, 22 later
1907.02893 (2019-07)
Invariant Risk Minimization
2007.01434 (2020-07)
In Search of Lost Domain Generalization
2007.02931 (2020-07)
Adaptive Risk Minimization: Learning to Adapt to Domain Shift
and 36 more not named here
Classifier 24 other papers
7 dated earlier, 17 later · 4 only as an assembly brick
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 21 more not named here
remove_batch_norm_from_resnet 23 other papers
8 dated earlier, 15 later
1907.02893 (2019-07)
Invariant Risk Minimization
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 20 more not named here
get_test_records 22 other papers
10 dated earlier, 12 later
1710.03077 (2017-10)
Deeper, Broader and Artier Domain Generalization
1907.02893 (2019-07)
Invariant Risk Minimization
2106.02266 (2021-06)
SAND-mask: An Enhanced Gradient Masking Strategy for the Discovery of Invariances in Domain Generalization
and 19 more not named here
leaky_resnet18 1 other paper
1 dated earlier
2104.01231 (2021-04)
Diverse Gaussian Noise Consistency Regularization for Robustness and Uncertainty 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

Modern deep learning systems do not generalize well when the test data distribution is slightly different to the training data distribution. While much promising work has been accomplished to address this fragility, a systematic study of the role of optimizers and their out-of-distribution generalization performance has not been undertaken. In this study, we examine the performance of popular first-order optimizers for different classes of distributional shift under empirical risk minimization and invariant risk minimization. We address this question for image and text classification using DomainBed, WILDS, and Backgrounds Challenge as testbeds for studying different types of shifts -- namely correlation and diversity shift. We search over a wide range of hyperparameters and examine classification accuracy (in-distribution and out-of-distribution) for over 20,000 models. We arrive at the following findings, which we expect to be helpful for practitioners: i) adaptive optimizers (e.g., Adam) perform worse than non-adaptive optimizers (e.g., SGD, momentum SGD) on out-of-distribution performance. In particular, even though there is no significant difference in in-distribution performance, we show a measurable difference in out-of-distribution performance. ii) in-distribution performance and out-of-distribution performance exhibit three types of behavior depending on the dataset -- linear returns, increasing returns, and diminishing returns. For example, in the training of natural language data using Adam, fine-tuning the performance of in-distribution performance does not significantly contribute to the out-of-distribution generalization performance.

For agents

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

get_harvested_code_for_paper("2211.08583")
get_code_for_paper("2211.08583")
have("2211.08583")

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

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

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

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

Connect an agent — have() is free.