SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2009.00329 · 2020

Learning explanations that are hard to vary

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 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 4 have no contract verdict; 0 failures of our instrument; 1 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/2009.00329.json · badge: /api/ran/2009.00329.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
pytorch/ignite canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
FunctionStatusWhere it lives
apply_to_tensor Ran
ran on a synthesized input
pytorch/ignite/ignite/utils.py
code served (permissive licence) · get_code("184b5d454726edda")
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 3, 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
import collections.abc as collections
from collections.abc import Callable

torch.manual_seed(0)

# Simple function that doubles a tensor
def double_tensor(t: torch.Tensor) -> torch.Tensor:
    return t * 2

# Test with a single tensor
x_single = torch.randn(2, 4)

# Test with a list of tensors
x_list = [torch.randn(2, 4), torch.randn(2, 4)]

# Test with a dict of tensors
x_dict = {
    'a': torch.randn(2, 4),
    'b': torch.randn(2, 4)
}

# Test with nested structure (dict containing lists)
x_nested = {
    'tensors': [torch.randn(2, 4), torch.randn(2, 4)],
    'single': torch.randn(2, 4)
}

# Test with a named tuple containing tensors
from collections import namedtuple
TensorPair = namedtuple('TensorPair', ['x', 'y'])
x_namedtuple = TensorPair(torch.randn(2, 4), torch.randn(2, 4))

ARGS = {
    'x': x_list,
    'func': double_tensor
}
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 list, ndim 3, 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
apply_to_type Ran
ran on a synthesized input
pytorch/ignite/ignite/utils.py
code served (permissive licence) · get_code("2e98a4328eaffa86")
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 int; 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
import collections.abc as collections
from collections import OrderedDict

torch.manual_seed(0)

def dummy_func(x):
    """Simple function that returns the input multiplied by 2"""
    if isinstance(x, torch.Tensor):
        return x * 2
    elif isinstance(x, (int, float)):
        return x * 2
    return x

# Test case 1: Direct tensor matching input_type
tensor_input = torch.randn(2, 4)
ARGS_1 = {
    "x": tensor_input,
    "input_type": torch.Tensor,
    "func": dummy_func
}

# Test case 2: Nested list of tensors
list_input = [torch.randn(2, 4), torch.randn(3, 5)]
ARGS_2 = {
    "x": list_input,
    "input_type": torch.Tensor,
    "func": dummy_func
}

# Test case 3: Dictionary with tensor values
dict_input = {
    "a": torch.randn(2, 4),
    "b": torch.randn(3, 5)
}
ARGS_3 = {
    "x": dict_input,
    "input_type": torch.Tensor,
    "func": dummy_func
}

# Test case 4: Nested structure (list of dicts with tensors)
nested_input = [
    {"key1": torch.randn(2, 4)},
    {"key2": torch.randn(3, 5)}
]
ARGS_4 = {
    "x": nested_input,
    "input_type": torch.Tensor,
    "func": dummy_func
}

# Test case 5: Named tuple
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])
named_tuple_input = Point(torch.randn(2, 4), torch.randn(3, 5))
ARGS_5 = {
    "x": named_tuple_input,
    "input_type": torch.Tensor,
    "func": dummy_func
}

# Primary test case with simple list of integers
ARGS = {
    "x": [1, 2, 3, 4],
    "input_type": int,
    "func": lambda x: x * 2
}
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 list, ndim 1, dtype family int — 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
keep_random_state Ran
ran on a synthesized input
pytorch/ignite/ignite/engine/deterministic.py
code served (permissive licence) · get_code("c5a5d2073ddf5d69")
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 function. 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 random
import torch
import numpy as np

torch.manual_seed(0)
np.random.seed(0)

# Define a simple function to decorate
def simple_function(x: int, y: str = "default") -> None:
    """A simple test function that does some random operations."""
    _ = random.random()
    _ = torch.rand(2, 3)
    _ = np.random.rand(2, 3)

# Create the ARGS dictionary with all parameters for keep_random_state
ARGS = {
    "func": simple_function
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
update_dataloader Ran
ran on a synthesized input
pytorch/ignite/ignite/engine/deterministic.py
code served (permissive licence) · get_code("bbdae9be673b6958")
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 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
from torch.utils.data import DataLoader, TensorDataset
from torch.utils.data.sampler import BatchSampler, SequentialSampler

torch.manual_seed(0)

# Create a small dataset
x = torch.randn(10, 4)
y = torch.randn(10, 3)
dataset = TensorDataset(x, y)

# Create an initial dataloader
dataloader = DataLoader(
    dataset,
    batch_size=2,
    shuffle=False,
    num_workers=0
)

# Create a new batch sampler
sampler = SequentialSampler(dataset)
new_batch_sampler = BatchSampler(
    sampler=sampler,
    batch_size=3,
    drop_last=False
)

ARGS = {
    "dataloader": dataloader,
    "new_batch_sampler": new_batch_sampler
}
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 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
convert_tensor Not yet run
unverified (harvested, no recorded run)
pytorch/ignite/ignite/utils.py
code served (permissive licence) · get_code("d8322fb4b8af1ea8")
How it ran

no invocation recorded.

Also present in other papers' code

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

In this paper, we investigate the principle that `good explanations are hard to vary' in the context of deep learning. We show that averaging gradients across examples -- akin to a logical OR of patterns -- can favor memorization and `patchwork' solutions that sew together different strategies, instead of identifying invariances. To inspect this, we first formalize a notion of consistency for minima of the loss surface, which measures to what extent a minimum appears only when examples are pooled. We then propose and experimentally validate a simple alternative algorithm based on a logical AND, that focuses on invariances and prevents memorization in a set of real-world tasks. Finally, using a synthetic dataset with a clear distinction between invariant and spurious mechanisms, we dissect learning signals and compare this approach to well-established regularizers.

For agents

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

get_harvested_code_for_paper("2009.00329")
get_code_for_paper("2009.00329")
have("2009.00329")

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

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

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

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

Connect an agent — have() is free.