SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.02245 · ICLR · 2024

Set Learning for Accurate and Calibrated Models

Robert Vandermeulen, Richard Zhang, Thomas Unterthiner, Klaus-Robert Müller, Lukas Muttenthaler

arXiv · PDF · Open in the Atlas

Code that ran

9 of 13 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 6 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/2307.02245.json · badge: /api/ran/2307.02245.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
lukasmut/oko canonical (classifier label)
classifier basis: census
9 ran · 4 no recorded run
FunctionStatusWhere it lives
accuracy Ran
ran, honoured the contract we drafted
lukasmut/oko/training/loss_funs.py
code served (permissive licence) · get_code("d6f08a78f6040a0e")
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 ArrayImpl, 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 jax
import jax.numpy as jnp
import numpy as np

# Create small batch of logits and targets
batch_size = 2
num_classes = 4

# Logits: shape (batch_size, num_classes)
# For each sample, we have logits for each class
logits = jnp.array([
    [0.1, 0.9, 0.5, 0.2],  # batch 0: class 1 has highest logit
    [0.3, 0.2, 0.8, 0.1]   # batch 1: class 2 has highest logit
], dtype=jnp.float32)

# Targets: shape (batch_size, num_classes)
# One-hot encoded targets
targets = jnp.array([
    [0.0, 1.0, 0.0, 0.0],  # batch 0: true class is 1
    [0.0, 0.0, 1.0, 0.0]   # batch 1: true class is 2
], dtype=jnp.float32)

ARGS = {
    'logits': logits,
    'targets': targets
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, 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
class_hits Ran
ran; our contract draft was wrong, not the code
lukasmut/oko/training/loss_funs.py
code served (permissive licence) · get_code("408c4b6d1bf044bf")
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 defaultdict. 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 jax.numpy as jnp
import numpy as np

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

# Create sample data
batch_size = 2
num_classes = 4

# Create logits: shape (#batch, num_cls)
logits = jnp.array([
    [0.1, 0.5, 0.2, 0.2],  # batch 0
    [0.3, 0.1, 0.4, 0.2]   # batch 1
], dtype=jnp.float32)

# Create targets for soft labels: shape (#batch, num_cls)
targets_soft = jnp.array([
    [0.0, 1.0, 0.0, 0.0],  # batch 0, class 1
    [0.0, 0.0, 1.0, 0.0]   # batch 1, class 2
], dtype=jnp.float32)

# Alternative targets for hard labels (one-hot encoded)
targets_hard = jnp.array([
    [0.0, 1.0, 0.0, 0.0],  # batch 0, class 1
    [0.0, 0.0, 1.0, 0.0]   # batch 1, class 2
], dtype=jnp.float32)

ARGS = {
    'logits': logits,
    'targets': targets_soft,
    'target_type': 'soft'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type defaultdict — a defaultdict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a defaultdict 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_data_statistics Ran
ran, honoured the contract we drafted
lukasmut/oko/utils.py
code served (permissive licence) · get_code("c23ff4a1bdfee069")
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 2, 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 jax.numpy as jnp

ARGS = {
    'dataset': 'cifar10'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 2, 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
get_results Ran
ran; our contract draft was wrong, not the code
lukasmut/oko/visualize_results.py
code served (permissive licence) · get_code("63f61a0824532ff2")
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 pickle
import tempfile
import shutil
from collections import defaultdict

# Create a temporary directory structure that mimics the expected path layout
temp_dir = tempfile.mkdtemp()

# Create the nested directory structure:
# PATH/something/something/n_samples/distribution/seed/something/training/performance.pkl
base_path = temp_dir

# Create sample directory structure
dist_value = "gaussian"
n_samples_value = "n_samples_100"
seed_value = "seed_42"
training_value = "finetuning"

# Build path: /base/x/x/n_samples_100/gaussian/seed_42/x/finetuning
subdir = os.path.join(base_path, "exp", "run", n_samples_value, dist_value, seed_value, "model", training_value)
os.makedirs(subdir, exist_ok=True)

# Create a performance pickle file
performance_data = {
    "accuracy": 0.95,
    "loss": 0.1234
}
pkl_path = os.path.join(subdir, "performance.pkl")
with open(pkl_path, 'wb') as f:
    pickle.dump(performance_data, f)

# Create another entry with pretraining and frozen
subdir_frozen = os.path.join(base_path, "exp", "run", n_samples_value, dist_value, "seed_43", "model", "pretraining_frozen")
os.makedirs(subdir_frozen, exist_ok=True)
pkl_path_frozen = os.path.join(subdir_frozen, "performance.pkl")
with open(pkl_path_frozen, 'wb') as f:
    pickle.dump({"accuracy": 0.92, "loss": 0.1567}, f)

# Create another entry with different n_samples
subdir2 = os.path.join(base_path, "exp", "run", "n_samples_200", dist_value, "seed_42", "model", "finetuning")
os.makedirs(subdir2, exist_ok=True)
pkl_path2 = os.path.join(subdir2, "performance.pkl")
with open(pkl_path2, 'wb') as f:
    pickle.dump({"accuracy": 0.87, "loss": 0.2345}, f)

ARGS = {
    "PATH": base_path,
    "dist": dist_value
}
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 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
get_tf_split Ran
ran; our contract draft was wrong, not the code
lukasmut/oko/utils.py
code served (permissive licence) · get_code("720aebc656dd7b45")
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 str. 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 = {
    'split': 'train'
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
kl_divergence Ran
ran, violated the contract we drafted
lukasmut/oko/training/loss_funs.py
code served (permissive licence) · get_code("84c83fbd0d15c014")
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 ArrayImpl, ndim 1, dtype family float, shape (2,) 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 jax
import jax.numpy as jnp
import numpy as np

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

# Create small sample data
batch_size = 2
num_classes = 4

# targets: probability distribution over classes (must sum to 1 per sample)
targets = jnp.array([
    [0.1, 0.2, 0.3, 0.4],
    [0.25, 0.25, 0.25, 0.25]
], dtype=jnp.float32)

# log_probs: log probabilities over classes
log_probs = jnp.array([
    [-2.3, -1.6, -1.2, -0.9],
    [-1.4, -1.4, -1.4, -1.4]
], dtype=jnp.float32)

ARGS = {
    'targets': targets,
    'log_probs': log_probs
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, jaxtyping, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 1, dtype family float, shape (2,) — shape (2,) 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
slice_variables Ran
ran; our contract draft was wrong, not the code
lukasmut/oko/models/common.py
code served (permissive licence) · get_code("99eeec0b0b049192")
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 FrozenDict. 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 flax
import flax.core
import numpy as np

# Create a realistic variables dict structure for a Sequential model with Flax
# The function expects nested dicts with keys like 'params', 'batch_stats', etc.
# and within each group, layer-indexed sub-dicts like 'layers_0', 'layers_1', etc.

# Build parameter arrays for several layers
layer_0_params = {
    'Dense_0': {
        'kernel': np.random.randn(4, 8).astype(np.float32),
        'bias': np.random.randn(8).astype(np.float32),
    }
}

layer_1_params = {
    'Dense_0': {
        'kernel': np.random.randn(8, 6).astype(np.float32),
        'bias': np.random.randn(6).astype(np.float32),
    }
}

layer_2_params = {
    'Dense_0': {
        'kernel': np.random.randn(6, 3).astype(np.float32),
        'bias': np.random.randn(3).astype(np.float32),
    }
}

layer_3_params = {
    'Dense_0': {
        'kernel': np.random.randn(3, 2).astype(np.float32),
        'bias': np.random.randn(2).astype(np.float32),
    }
}

# Build batch_stats for layers (optional state)
layer_0_batch_stats = {
    'mean': np.random.randn(8).astype(np.float32),
    'var': np.random.randn(8).astype(np.float32),
}

layer_1_batch_stats = {
    'mean': np.random.randn(6).astype(np.float32),
    'var': np.random.randn(6).astype(np.float32),
}

layer_2_batch_stats = {
    'mean': np.random.randn(3).astype(np.float32),
    'var': np.random.randn(3).astype(np.float32),
}

layer_3_batch_stats = {
    'mean': np.random.randn(2).astype(np.float32),
    'var': np.random.randn(2).astype(np.float32),
}

# Construct the full variables dict with 'params' and 'batch_stats' groups
variables_dict = {
    'params': {
        'layers_0': layer_0_params,
        'layers_1': layer_1_params,
        'layers_2': layer_2_params,
        'layers_3': layer_3_params,
    },
    'batch_stats': {
        'layers_0': layer_0_batch_stats,
        'layers_1': layer_1_batch_stats,
        'layers_2': layer_2_batch_stats,
        'layers_3': layer_3_batch_stats,
    }
}

# Freeze into FrozenDict as the function expects
variables = flax.core.freeze(variables_dict)

ARGS = {
    'variables': variables,
    'start': 1,
    'end': 3,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
flax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FrozenDict — a FrozenDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a FrozenDict 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
sort_results Ran
ran; our contract draft was wrong, not the code
lukasmut/oko/visualize_results.py
code served (permissive licence) · get_code("f33380db79e5e08f")
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 torch

# Construct a valid nested dictionary structure for results
# Dict[str, Dict[str, Dict[str, float]]]
results = {
    "training_run_1": {
        "split_a": {
            "metric_1": 0.85,
            "metric_2": 0.92,
            "metric_3": 0.78,
        },
        "split_b": {
            "metric_1": 0.88,
            "metric_2": 0.90,
        },
    },
    "training_run_2": {
        "split_x": {
            "accuracy": 0.95,
            "loss": 0.15,
        },
        "split_y": {
            "accuracy": 0.91,
            "loss": 0.22,
        },
    },
}

ARGS = {
    "results": results,
}
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 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
unpickle Ran
ran; our contract draft was wrong, not the code
lukasmut/oko/cifar10_preprocessing.py
code served (permissive licence) · get_code("9863251d401d43c3")
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 pickle
import tempfile
import os

# Create a temporary pickle file with sample data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.pkl")

# Create sample data to pickle
sample_data = {
    b'key1': b'value1',
    b'key2': [1, 2, 3],
    b'key3': {'nested': 'dict'}
}

# Write the pickle file
with open(temp_file, 'wb') as f:
    pickle.dump(sample_data, f)

ARGS = {
    'file': temp_file
}
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 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
dict2df Not yet run
unverified (harvested, no recorded run)
lukasmut/oko/visualize_results.py
code served (permissive licence) · get_code("af81f24e2bec3af8")
How it ran

no invocation recorded.

img_to_patch Not yet run
unverified (harvested, no recorded run)
lukasmut/oko/models/vit.py
code served (permissive licence) · get_code("128493cd99d835a8")
How it ran

no invocation recorded.

normalize_images Not yet run
unverified (harvested, no recorded run)
lukasmut/oko/cifar10_preprocessing.py
code served (permissive licence) · get_code("386e205c9a797d9a")
How it ran

no invocation recorded.

preproc_cifar_10 Not yet run
unverified (harvested, no recorded run)
lukasmut/oko/cifar10_preprocessing.py
code served (permissive licence) · get_code("169b94c502ea8466")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 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 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.

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

Model overconfidence and poor calibration are common in machine learning and difficult to account for when applying standard empirical risk minimization. In this work, we propose a novel method to alleviate these problems that we call odd-k-out learning (OKO), which minimizes the cross-entropy error for sets rather than for single examples. This naturally allows the model to capture correlations across data examples and achieves both better accuracy and calibration, especially in limited training data and class-imbalanced regimes. Perhaps surprisingly, OKO often yields better calibration even when training with hard labels and dropping any additional calibration parameter tuning, such as temperature scaling. We demonstrate this in extensive experimental analyses and provide a mathematical theory to interpret our findings. We emphasize that OKO is a general framework that can be easily adapted to many settings and a trained model can be applied to single examples at inference time, without significant run-time overhead or architecture changes. * Equal contributions. † Work partly done while a Student Researcher at Google DeepMind.

For agents

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

get_harvested_code_for_paper("2307.02245")
get_code_for_paper("2307.02245")
have("2307.02245")

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

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

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

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

Connect an agent — have() is free.