SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2204.03230 · NeurIPS · 2022

What You See is What You Get: Principled Deep Learning via Distributional Generalization

U Berkeley, Preetum Nakkiran, Yaodong Yu, Bogdan Kulynych, Yao-Yuan Yang, Jarosław Błasiok, U San Diego

arXiv · PDF · Open in the Atlas

Code that ran

6 of 7 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 3 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2204.03230.json · badge: /api/ran/2204.03230.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
yangarbiter/dp-dg canonical (classifier label)
classifier basis not recorded on the link
6 ran · 1 no recorded run
FunctionStatusWhere it lives
acc_and_f1 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
yangarbiter/dp-dg/utils_glue.py
pointer only (licence: MIT); the stored copy get_code serves, from danrsc/bert_brain_neurips_2019, is pointer only (licence: NONE) · get_code("cac113ca87b9d9f3")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from danrsc/bert_brain_neurips_2019, 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.

convert_examples_to_features Ran
ran on a synthesized input
yangarbiter/dp-dg/utils_glue.py
code served (permissive licence) · get_code("ee0b944a7be8b14a")
How it ran

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

logging.basicConfig(level=logging.INFO)

class SimpleTokenizer:
    def __init__(self):
        self.vocab = {
            '[CLS]': 101,
            '[SEP]': 102,
            'hello': 1,
            'world': 2,
            'this': 3,
            'is': 4,
            'a': 5,
            'test': 6,
            'sample': 7,
            'text': 8,
        }
    
    def tokenize(self, text):
        if text is None:
            return []
        tokens = text.lower().split()
        return tokens
    
    def convert_tokens_to_ids(self, tokens):
        ids = []
        for token in tokens:
            ids.append(self.vocab.get(token, 999))
        return ids

class InputExample:
    def __init__(self, guid, text_a, text_b=None, label=None):
        self.guid = guid
        self.text_a = text_a
        self.text_b = text_b
        self.label = label

examples = [
    InputExample(guid="0", text_a="hello world", text_b="this is", label="positive"),
    InputExample(guid="1", text_a="test sample", text_b=None, label="negative"),
]

label_list = ["positive", "negative"]

tokenizer = SimpleTokenizer()

ARGS = {
    'examples': examples,
    'label_list': label_list,
    'max_seq_length': 16,
    'tokenizer': tokenizer,
    'output_mode': 'classification',
    'cls_token_at_end': False,
    'pad_on_left': False,
    'cls_token': '[CLS]',
    'sep_token': '[SEP]',
    'pad_token': 0,
    'sequence_a_segment_id': 0,
    'sequence_b_segment_id': 1,
    'cls_token_segment_id': 1,
    'pad_token_segment_id': 0,
    'mask_padding_with_zero': True,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_eval_loader Ran
ran; our contract draft was wrong, not the code
yangarbiter/dp-dg/wilds/common/data_loaders.py
code served (permissive licence) · get_code("e32762f7bf5137a0")
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 DataLoader. 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
from torch.utils.data import DataLoader, Dataset

torch.manual_seed(0)

# Create a minimal WILDSDataset-like class
class MinimalWILDSDataset(Dataset):
    def __init__(self, num_samples=4):
        self.num_samples = num_samples
        self.data = torch.randn(num_samples, 4)
        self.labels = torch.randint(0, 2, (num_samples,))
    
    def __len__(self):
        return self.num_samples
    
    def __getitem__(self, idx):
        return self.data[idx], self.labels[idx]
    
    def collate(self, batch):
        # Standard collate function that stacks tensors
        xs = torch.stack([item[0] for item in batch])
        ys = torch.stack([item[1] for item in batch])
        return xs, ys

# Create dataset instance
dataset = MinimalWILDSDataset(num_samples=4)

# Define ARGS dictionary with all required parameters
ARGS = {
    'loader': 'standard',
    'dataset': dataset,
    'batch_size': 2,
    'grouper': None,
}
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 DataLoader — a DataLoader output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataLoader 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
maximum Ran
ran on a synthesized input
yangarbiter/dp-dg/wilds/common/utils.py
code served (permissive licence) · get_code("1a3497a30026487f")
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
import numpy as np

torch.manual_seed(0)

# Test case 1: torch.Tensor with values (including NaN)
tensor_with_values = torch.tensor([1.0, 2.0, float('nan'), 4.0])

# Test case 2: empty torch.Tensor
empty_tensor = torch.tensor([])

# Test case 3: numpy array with values
numpy_array = np.array([3.0, 1.0, 2.0])

# Test case 4: empty numpy array
empty_numpy = np.array([])

# Test case 5: Python list with values
python_list = [5, 2, 8, 1]

# Test case 6: empty Python list
empty_list = []

# We'll use the tensor_with_values as the primary test
ARGS = {
    "numbers": tensor_with_values,
    "empty_val": 0.0
}
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 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
minimum Ran
ran on a synthesized input
yangarbiter/dp-dg/wilds/common/utils.py
code served (permissive licence) · get_code("40658ea354a61525")
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
import numpy as np

torch.manual_seed(0)

# Test case 1: torch.Tensor with values
tensor_with_values = torch.tensor([1.0, 2.0, 3.0, 4.0])

# Test case 2: torch.Tensor with NaN values
tensor_with_nan = torch.tensor([1.0, float('nan'), 3.0, 4.0])

# Test case 3: Empty torch.Tensor
empty_tensor = torch.tensor([])

# Test case 4: numpy array with values
numpy_with_values = np.array([1.0, 2.0, 3.0, 4.0])

# Test case 5: numpy array with NaN values
numpy_with_nan = np.array([1.0, np.nan, 3.0, 4.0])

# Test case 6: Empty numpy array
empty_numpy = np.array([])

# Test case 7: Python list with values
list_with_values = [1.0, 2.0, 3.0, 4.0]

# Test case 8: Empty Python list
empty_list = []

# Create ARGS with one representative case for each parameter combination
# Using torch.Tensor with values as the primary test case
ARGS = {
    "numbers": tensor_with_values,
    "empty_val": 0.0
}
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 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
split_into_groups Ran
ran; our contract draft was wrong, not the code
yangarbiter/dp-dg/wilds/common/utils.py
code served (permissive licence) · get_code("38caa1a2f1c313ce")
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

torch.manual_seed(0)

# Create a small tensor with group labels
# Using values like [0, 1, 0, 2] to have multiple groups with repeated elements
g = torch.tensor([0, 1, 0, 2, 1, 0], dtype=torch.long)

ARGS = {
    "g": g
}
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 — 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
simple_accuracy Not yet run
unverified (harvested, no recorded run)
yangarbiter/dp-dg/utils_glue.py
code served (permissive licence) · get_code("3c241ecfe3749a6d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 2 the same month, 3 later) and 0 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
simple_accuracy 59 other papers
42 dated earlier, 2 the same month, 15 later
1506.05865 (2015-06)
LCSTS: A Large Scale Chinese Short Text Summarization Dataset
1509.01626 (2015-09)
Character-level Convolutional Networks for Text Classification *
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 56 more not named here
acc_and_f1 22 other papers
12 dated earlier, 1 the same month, 9 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1905.12866 (2019-05)
Semantically Conditioned Dialog Response Generation via Hierarchical Disentangled Self-Attention
1908.09355 (2019-08)
Patient Knowledge Distillation for BERT Model Compression
and 19 more not named here
get_eval_loader 3 other papers
3 dated earlier
2012.07421 (2020-12)
Wilds: A Benchmark of in-the-Wild Distribution Shifts
2111.04724 (2021-11)
SUSTAINBENCH: Benchmarks for Monitoring the Sustainable Development Goals with Machine Learning
2111.13733 (2021-11)
Failure Modes of Domain Generalization Algorithms
split_into_groups 3 other papers
1 dated earlier, 2 later
2111.04724 (2021-11)
SUSTAINBENCH: Benchmarks for Monitoring the Sustainable Development Goals with Machine Learning
2305.00650 (2023-05)
Discover and Cure: Concept-aware Mitigation of Spurious Correlation
2509.26045 (2025-09)
Scaling Up Temporal Domain Generalization via Temporal Experts Averaging
convert_examples_to_features 1 other paper
1 dated earlier
2021.emnlp-main.721 (2021 (year only))
YASO: A Targeted Sentiment Analysis Evaluation Dataset for Open-Domain Reviews
maximum 1 other paper
1 dated earlier
2111.04724 (2021-11)
SUSTAINBENCH: Benchmarks for Monitoring the Sustainable Development Goals with Machine Learning
minimum 1 other paper
1 dated earlier
2111.04724 (2021-11)
SUSTAINBENCH: Benchmarks for Monitoring the Sustainable Development Goals with Machine Learning

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

Having similar behavior at training time and test time-what we call a "What You See Is What You Get" (WYSIWYG) property-is desirable in machine learning. Models trained with standard stochastic gradient descent (SGD), however, do not necessarily have this property, as their complex behaviors such as robustness or subgroup performance can differ drastically between training and test time. In contrast, we show that Differentially-Private (DP) training provably ensures the high-level WYSIWYG property, which we quantify using a notion of distributional generalization. Applying this connection, we introduce new conceptual tools for designing deep-learning methods by reducing generalization concerns to optimization ones: to mitigate unwanted behavior at test time, it is provably sufficient to mitigate this behavior on the training data. By applying this novel design principle, which bypasses "pathologies" of SGD, we construct simple algorithms that are competitive with SOTA in several distributional-robustness applications, significantly improve the privacy vs. disparate impact trade-off of DP-SGD, and mitigate robust overfitting in adversarial training. Finally, we also improve on theoretical bounds relating DP, stability, and distributional generalization. 36th Conference on Neural Information Processing Systems (NeurIPS 2022).

For agents

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

get_harvested_code_for_paper("2204.03230")
get_code_for_paper("2204.03230")
have("2204.03230")

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

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

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

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

Connect an agent — have() is free.