SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1911.08731 · 2019

Distributionally Robust Neural Networks for Group Shifts: On the Importance of Regularization for Worst-Case Generalization

Percy Liang, Wei Pang, Koh, Tatsunori Hashimoto, Shiori Sagawa

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 4 failures of our instrument; 1 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/1911.08731.json · badge: /api/ran/1911.08731.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
haoxiang-wang/isr community
Papers with Code archive
7 ran · 0 no recorded run
ssagawa/overparam_spur_corr community
Papers with Code archive
1 ran · 0 no recorded run
orparask/VS-Loss community
Papers with Code archive
1 ran · 0 no recorded run
facebookresearch/DomainBed community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
ISRClassifier Ran
ran on a synthesized input · constructed an object; no result was computed
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("ee24fe60820363aa")
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, ISRClassifier: 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 numpy as np
import torch
from sklearn.linear_model import LogisticRegression

torch.manual_seed(0)

# Create minimal test data
n_samples = 10
n_features = 4
n_classes = 2
n_envs = 2

# Generate simple features, labels, and environments
features = np.random.randn(n_samples, n_features).astype(np.float32)
labels = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
envs = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])

# Create a simple torch.nn.Linear classifier
linear_clf = torch.nn.Linear(n_features, n_classes)

# Create a dict-based classifier
dict_clf = {
    'weight': np.random.randn(n_classes, n_features).astype(np.float32),
    'bias': np.random.randn(n_classes).astype(np.float32)
}

# Create sklearn classifiers
lr_clf = LogisticRegression(C=1, max_iter=1000, random_state=0)
lr_clf.fit(features, labels)

ARGS = {
    'version': 'mean',
    'pca_dim': -1,
    'd_spu': 1,
    'spu_scale': 0.5,
    'chosen_class': 0,
    'clf_type': 'LogisticRegression',
    'clf_kwargs': {'C': 1, 'max_iter': 1000, 'random_state': 0}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ISRClassifier — 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 ISRClassifier 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
LossComputer Ran
ran on a synthesized input · constructed an object; no result was computed
ssagawa/overparam_spur_corr/loss.py
pointer only (licence: NONE) · get_code("c42a893093b6fd69")
How it ran

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

LossComputer Ran
ran on a synthesized input · constructed an object; no result was computed
orparask/VS-Loss/group_imbalance/loss.py
pointer only (licence: NONE) · get_code("d1ceae741f009c45")
How it ran

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

check_clf Ran
ran; our contract draft was wrong, not the code
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("e4aa557c0470b486")
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 LogisticRegression. 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
from sklearn.linear_model import LogisticRegression, RidgeClassifier, SGDClassifier

torch.manual_seed(0)

# Test case 1: sklearn LogisticRegression classifier
clf_sklearn = LogisticRegression()
X_train = np.random.randn(10, 4)
y_train = np.array([0, 1, 0, 1, 0, 1, 0, 1, 0, 1])
clf_sklearn.fit(X_train, y_train)
n_classes_binary = 2

# Test case 2: torch.nn.Linear for multiclass
clf_linear = torch.nn.Linear(4, 3)

n_classes_multiclass = 3

# Test case 3: dict with weight and bias tensors
weight_dict = torch.randn(3, 4)
bias_dict = torch.randn(3)
clf_dict = {'weight': weight_dict, 'bias': bias_dict}

# Test case 4: dict with numpy arrays
weight_np = np.random.randn(2, 4)
bias_np = np.random.randn(2)
clf_dict_np = {'weight': weight_np, 'bias': bias_np}

ARGS = {
    'clf': clf_sklearn,
    'n_classes': n_classes_binary
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type LogisticRegression — a LogisticRegression output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a LogisticRegression 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
check_labels Ran
ran, honoured the contract we drafted
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("c66e837fdb8da4e1")
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 numpy as np

# The function check_labels expects a labels argument that is array-like
# It calls np.unique(labels) and np.all() on it
# It checks that the unique classes are exactly 0, 1, 2, ..., n_classes-1

# Create valid labels: a numpy array with classes 0, 1, 2
labels = np.array([0, 1, 2, 0, 1, 2, 0, 1])

ARGS = {
    "labels": labels
}
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 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
estimate_covs Ran
ran; our contract draft was wrong, not the code
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("953fdd3b2318ba41")
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 numpy as np

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

# Create small sample data
n_envs = 2
n_classes = 3
n_samples = 6
z_dim = 4

# zs: array of shape (n_samples, z_dim) - latent representations
zs = np.random.randn(n_samples, z_dim).astype(np.float32)

# ys: array of shape (n_samples,) - class labels
ys = np.array([0, 1, 2, 0, 1, 2], dtype=np.int32)

# gs: array of shape (n_samples,) - environment labels
gs = np.array([0, 0, 0, 1, 1, 1], dtype=np.int32)

ARGS = {
    "zs": zs,
    "ys": ys,
    "gs": gs,
    "n_envs": n_envs,
    "n_classes": n_classes
}
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 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
estimate_means Ran
ran; our contract draft was wrong, not the code
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("a26fa43681625cbf")
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 numpy as np

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

# Define parameters
n_envs = 3
n_classes = 2
batch_size = 6

# Create zs: feature vectors (batch_size x feature_dim)
zs = np.random.randn(batch_size, 4)

# Create ys: class labels (batch_size,) with values in range [0, n_classes)
ys = np.array([0, 1, 0, 1, 0, 1])

# Create gs: environment assignments (batch_size,) with values in range [0, n_envs)
gs = np.array([0, 0, 1, 1, 2, 2])

ARGS = {
    'zs': zs,
    'ys': ys,
    'gs': gs,
    'n_envs': n_envs,
    'n_classes': n_classes
}
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 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
feature_transform Ran
ran; our contract draft was wrong, not the code
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("30fd09a08819dcf5")
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

# Create small test arrays
Z = np.random.randn(2, 4)  # batch_size=2, features=4
u = np.random.randn(4, 4)  # square matrix for Z @ u operation
d_spu = 1
scale = 0.5

ARGS = {
    "Z": Z,
    "u": u,
    "d_spu": d_spu,
    "scale": scale,
}
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
to_numpy Ran
ran, honoured the contract we drafted
haoxiang-wang/isr/real_datasets/isr.py
code served (permissive licence) · get_code("78b0af73923a5d41")
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 torch
import numpy as np

torch.manual_seed(0)

# Test case 1: torch.Tensor
tensor_input = torch.randn(2, 4)

# Test case 2: numpy.ndarray
numpy_input = np.random.randn(2, 4)

# For the function signature, there's only one parameter: tensor
# We'll test with a torch.Tensor
ARGS = {
    "tensor": tensor_input
}
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 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
GroupDRO Not yet run
unverified (harvested, no recorded run)
facebookresearch/DomainBed/domainbed/algorithms.py
code served (permissive licence) · get_code("e944e38b6f666c5d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 10 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.

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

Overparameterized neural networks can be highly accurate on average on an i.i.d. test set yet consistently fail on atypical groups of the data (e.g., by learning spurious correlations that hold on average but not in such groups). Distributionally robust optimization (DRO) allows us to learn models that instead minimize the worst-case training loss over a set of pre-defined groups. However, we find that naively applying group DRO to overparameterized neural networks fails: these models can perfectly fit the training data, and any model with vanishing average training loss also already has vanishing worst-case training loss. Instead, the poor worst-case performance arises from poor generalization on some groups. By coupling group DRO models with increased regularization-a stronger-than-typical 2 penalty or early stopping-we achieve substantially higher worst-group accuracies, with 10-40 percentage point improvements on a natural language inference task and two image tasks, while maintaining high average accuracies. Our results suggest that regularization is important for worst-group generalization in the overparameterized regime, even if it is not needed for average generalization. Finally, we introduce a stochastic optimization algorithm, with convergence guarantees, to efficiently train group DRO models.

For agents

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

get_harvested_code_for_paper("1911.08731")
get_code_for_paper("1911.08731")
have("1911.08731")

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

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

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

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

Connect an agent — have() is free.