SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1802.08241 · 2018

Hessian-based Analysis of Large Batch Training and Robustness to Adversaries

arXiv · PDF · Open in the Atlas

Code that ran

9 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 7 have no contract verdict; 2 failures of our instrument; 2 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/1802.08241.json · badge: /api/ran/1802.08241.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
noahgolmant/pytorch-hessian-eigenthings community (classifier label)
classifier basis not recorded on the link
7 ran · 2 no recorded run
ABadCandy/HessianDL extension (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
deflated_power_iteration Ran
ran; our contract draft was wrong, not the code
ABadCandy/HessianDL/hessian_eigenthings/power_iter.py
code served (permissive licence) · get_code("4532c973ff280886")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 numpy as np

torch.manual_seed(0)

class SimpleOperator(torch.nn.Module):
    """
    A simple linear operator that applies a matrix multiplication
    """
    def __init__(self, size):
        super().__init__()
        self.size = size
        # Create a small matrix for the linear operator
        self.matrix = torch.randn(size, size)
    
    def apply(self, vec):
        """
        Apply the linear operator: L(vec) = matrix @ vec
        """
        return self.matrix @ vec

# Create a simple operator with size 4
operator = SimpleOperator(size=4)

ARGS = {
    "operator": operator,
    "num_eigenthings": 2,
    "power_iter_steps": 5,
    "power_iter_err_threshold": 0.0001,
    "momentum": 0.0,
    "use_gpu": False,
}
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 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
move_batch_to_device Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/batching.py
code served (permissive licence) · get_code("2aad088de22e5375")
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

torch.manual_seed(0)

# Create a complex batch structure with tensors, dicts, lists, tuples, and non-tensor values
batch = {
    "input_ids": torch.randn(2, 4),
    "attention_mask": torch.ones(2, 4),
    "nested_dict": {
        "embeddings": torch.randn(2, 3),
        "metadata": "some_string"
    },
    "list_of_tensors": [torch.randn(2, 5), torch.randn(2, 6)],
    "tuple_of_tensors": (torch.randn(2, 7), torch.randn(2, 8)),
    "scalar_value": 42,
    "none_value": None,
    "mixed_list": [torch.randn(2, 9), "text", 3.14]
}

device = torch.device("cpu")

ARGS = {
    "batch": batch,
    "device": device
}
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
params_to_vector Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/param_utils.py
code served (permissive licence) · get_code("afb38db4bcfbd007")
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 1, dtype family float, shape (29,) 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
from collections.abc import Mapping

torch.manual_seed(0)

# Create a small mapping of parameter names to tensors
params = {
    'weight_1': torch.randn(4, 3),
    'bias_1': torch.randn(5),
    'weight_2': torch.randn(2, 6),
}

ARGS = {
    'params': params
}
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 Tensor, ndim 1, dtype family float, shape (29,) — shape (29,) 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
power_iteration Ran
ran; our contract draft was wrong, not the code
ABadCandy/HessianDL/hessian_eigenthings/power_iter.py
code served (permissive licence) · get_code("604f7701e0559dac")
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. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 numpy as np

torch.manual_seed(0)

class SimpleOperator:
    """A simple linear operator that implements matrix-vector products."""
    def __init__(self, size, matrix=None):
        self.size = size
        if matrix is None:
            # Create a simple symmetric matrix for testing
            self.matrix = torch.randn(size, size)
            self.matrix = (self.matrix + self.matrix.t()) / 2
        else:
            self.matrix = matrix
    
    def apply(self, vec):
        """Apply the linear operator (matrix-vector product)."""
        return torch.matmul(self.matrix, vec)

# Create a small operator
vector_size = 4
operator = SimpleOperator(size=vector_size)

ARGS = {
    'operator': operator,
    'steps': 10,
    'error_threshold': 0.0001,
    'momentum': 0.0,
    'use_gpu': False
}
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 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
select_parameters Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/param_utils.py
code served (permissive licence) · get_code("73fdac2eac4bb1ca")
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
import torch.nn as nn

torch.manual_seed(0)

# Build a simple model with some parameters
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        # Add a parameter that doesn't require grad
        self.register_parameter('frozen_param', nn.Parameter(torch.randn(2)))
        self.frozen_param.requires_grad = False
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

# Define a param_filter that selects only parameters containing 'linear1'
def param_filter(name: str, param: nn.Parameter) -> bool:
    return 'linear1' in name

ARGS = {
    'model': model,
    'param_filter': param_filter,
}
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
supervised_forward Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/loss_fns/standard.py
code served (permissive licence) · get_code("1ff9aef5e997ef41")
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 2, dtype family float, shape (2, 3) 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
from torch import nn

torch.manual_seed(0)

class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

x = torch.randn(2, 4)
y = torch.randn(2, 3)
batch = (x, y)

ARGS = {
    "model": model,
    "batch": batch,
}
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 Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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
supervised_loss Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/loss_fns/standard.py
code served (permissive licence) · get_code("631fe6f0c718ea1f")
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 torch
from torch import nn

torch.manual_seed(0)

# Define a simple model that takes input and produces output
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Define a simple criterion (loss function)
criterion = nn.MSELoss()

# Create the model instance
model = SimpleModel()

# Create a small batch: (input, target)
x = torch.randn(2, 4)  # batch size 2, input dim 4
y = torch.randn(2, 3)  # batch size 2, output dim 3
batch = (x, y)

ARGS = {
    "criterion": criterion
}
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 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
supervised_loss_of_output Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/loss_fns/standard.py
code served (permissive licence) · get_code("c6d693d00d07065a")
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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a simple criterion that takes (output, target) and returns a scalar loss
def simple_mse_criterion(output: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
    """Simple MSE criterion for testing"""
    return torch.mean((output - target) ** 2)

ARGS = {
    "criterion": simple_mse_criterion
}
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 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
total_size Ran
ran on a synthesized input
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/param_utils.py
code served (permissive licence) · get_code("2a6e6bf2f11014cd")
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; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-26T21:52:49Z. 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
from collections.abc import Mapping, Iterable

torch.manual_seed(0)

# Test case 1: Using a Mapping (dict) of tensors
mapping_params = {
    'layer1': torch.randn(2, 4),
    'layer2': torch.randn(3, 5),
    'bias': torch.randn(6),
}

# Test case 2: Using an Iterable of tensors
iterable_params = [
    torch.randn(2, 4),
    torch.randn(3, 5),
    torch.randn(6),
]

# Define ARGS with both test cases - use the mapping version as primary
ARGS = {
    'params': mapping_params,
}
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 int, ndim 0, dtype family int — no output shape is stated: no later run recorded an output shape for this sample (observed_output and metamorphic_properties carry none; shape_contract and output_contract record ndim only)
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 syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1); 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
compiled_ce_hvp Not yet run
unverified (harvested, no recorded run)
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/loss_fns/_fused_ce_hvp.py
code served (permissive licence) · get_code("14b80a5196e7bbc3")
How it ran

no invocation recorded.

triton_ce_hvp Not yet run
unverified (harvested, no recorded run)
noahgolmant/pytorch-hessian-eigenthings/hessian_eigenthings/loss_fns/_fused_ce_hvp.py
code served (permissive licence) · get_code("48740a084aa48f93")
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 11 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 9 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
deflated_power_iteration 1 other paper
1 dated earlier
1707.02670 (2017-07)
Accelerated Stochastic Power Iteration
power_iteration 1 other paper
1 dated earlier
1707.02670 (2017-07)
Accelerated Stochastic Power Iteration

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

Large batch size training of Neural Networks has been shown to incur accuracy loss when trained with the current methods. The exact underlying reasons for this are still not completely understood. Here, we study large batch size training through the lens of the Hessian operator and robust optimization. In particular, we perform a Hessian based study to analyze exactly how the landscape of the loss function changes when training with large batch size. We compute the true Hessian spectrum, without approximation, by back-propagating the second derivative. Extensive experiments on multiple networks show that saddle-points are not the cause for generalization gap of large batch size training, and the results consistently show that large batch converges to points with noticeably higher Hessian spectrum. Furthermore, we show that robust training allows one to favor flat areas, as points with large Hessian spectrum show poor robustness to adversarial perturbation. We further study this relationship, and provide empirical and theoretical proof that the inner loop for robust training is a saddle-free optimization problem \textit{almost everywhere}. We present detailed experiments with five different network architectures, including a residual network, tested on MNIST, CIFAR-10, and CIFAR-100 datasets. We have open sourced our method which can be accessed at [1].

For agents

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

get_harvested_code_for_paper("1802.08241")
get_code_for_paper("1802.08241")
have("1802.08241")

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

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

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

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

Connect an agent — have() is free.