SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2408.07268 · 2024

Fast Unconstrained Optimization via Hessian Averaging and Adaptive Gradient Sampling Methods

arXiv · PDF · Open in the Atlas

Code that ran

4 of 8 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 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/2408.07268.json · badge: /api/ran/2408.07268.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
tomoleary/hessianaveraging canonical (classifier label)
classifier basis: census
4 ran · 4 no recorded run
FunctionStatusWhere it lives
adaHessian_update Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tomoleary/hessianaveraging/hessavg/adaHessian.py
code served (permissive licence) · get_code("cf5d6f3b8700ab87")
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 jax
import jax.numpy as jnp
from jax import random

# Define a simple loss function that takes params, batch, and optionally batch_stats
def loss_fn(params, batch, batch_stats=None):
    # params is a dict-like structure
    # batch is a tuple of (x, y)
    x, y = batch
    # Simple MSE-like loss
    pred = params['w'] @ x + params['b']
    loss_val = jnp.sum((pred - y) ** 2)
    if batch_stats is not None:
        # Return loss and updated batch_stats
        return loss_val, batch_stats
    return loss_val

# Initialize parameters as a nested dict structure
params = {
    'w': jnp.array([[1.0, 2.0, 3.0, 4.0],
                    [5.0, 6.0, 7.0, 8.0],
                    [9.0, 10.0, 11.0, 12.0]]),
    'b': jnp.array([0.1, 0.2, 0.3])
}

# Create a small batch: (x, y) where x is (4,) and y is (3,)
batch = (jnp.array([1.0, 2.0, 3.0, 4.0]), 
         jnp.array([5.0, 6.0, 7.0]))

# Create a hessian batch (optional, different from batch)
hess_batch = (jnp.array([0.5, 1.5, 2.5, 3.5]), 
              jnp.array([4.0, 5.5, 6.5]))

# Initialize first moment estimate (m) - same structure as flattened params
m = jnp.zeros(4 * 3 + 3)

# Initialize second moment estimate (v) - same structure as flattened params
v = jnp.zeros(4 * 3 + 3)

# Iteration counters
iteration = jnp.array(1)
h_iteration = jnp.array(1)

# Batch stats (optional)
batch_stats = {'mean': jnp.array([0.0, 0.0, 0.0, 0.0]), 
               'var': jnp.array([1.0, 1.0, 1.0, 1.0])}

# RNG key for random operations
rng_key = random.PRNGKey(42)

ARGS = {
    'loss': loss_fn,
    'params': params,
    'batch': batch,
    'm': m,
    'v': v,
    'iteration': iteration,
    'h_iteration': h_iteration,
    'hess_batch': hess_batch,
    'rng_key': rng_key,
    'k_rank': 1,
    'random_diagonal': True,
    'step_size': 0.0001,
    'beta_1': 0.9,
    'beta_2': 0.999,
    'epsilon': 1e-8,
    'take_abs': True,
    'batch_stats': batch_stats,
    'weight_decay': 0.001,
    'update_hessian': True
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — 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
diagonal_Newton_update Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tomoleary/hessianaveraging/hessavg/diagonalNewton.py
code served (permissive licence) · get_code("af37aae9d5a1ff1e")
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 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 jax
import jax.numpy as jnp
from jax import random
from functools import partial

# Define a simple loss function that works with the function signature
def simple_loss(params, batch, batch_stats=None):
    """Simple quadratic loss function"""
    x, y = batch
    # params is a dict with a 'w' key containing a flattened weight vector
    pred = jnp.dot(x, params['w'][:x.shape[1]])
    loss_val = jnp.mean((pred - y) ** 2)
    if batch_stats is not None:
        return loss_val, batch_stats
    return loss_val

# Create small parameter dictionary
params = {
    'w': jnp.array([0.1, 0.2, 0.3, 0.4])
}

# Create a small batch: (features, targets)
batch_x = jnp.array([[1.0, 2.0, 3.0, 4.0],
                      [2.0, 3.0, 4.0, 5.0]])
batch_y = jnp.array([1.5, 2.5])
batch = (batch_x, batch_y)

# Create hess_batch (different batch for Hessian computation)
hess_batch_x = jnp.array([[1.5, 2.5, 3.5, 4.5]])
hess_batch_y = jnp.array([2.0])
hess_batch = (hess_batch_x, hess_batch_y)

# Create batch_stats (simple dict)
batch_stats = {'mean': jnp.array([0.0, 0.0, 0.0, 0.0]),
               'var': jnp.array([1.0, 1.0, 1.0, 1.0])}

# RNG key
rng_key = random.PRNGKey(42)

# Define ARGS dictionary with all parameters
ARGS = {
    'loss': simple_loss,
    'params': params,
    'batch': batch,
    'hess_batch': hess_batch,
    'rng_key': rng_key,
    'k_rank': 2,
    'gamma_damping': 0.0001,
    'step_size': 0.0001,
    'batch_stats': batch_stats,
    'weight_decay': 0.001
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, 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
numpy_collate Ran
ran, honoured the contract we drafted
tomoleary/hessianaveraging/applications/resnet/dataUtilities.py
code served (permissive licence) · get_code("b683ce54519b23b0")
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 int, 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

# Test case 1: batch of numpy arrays
batch_arrays = [np.array([1, 2, 3, 4]), np.array([5, 6, 7, 8])]

# Test case 2: batch of tuples (each tuple contains arrays and scalars)
batch_tuples = [
    (np.array([1, 2, 3, 4]), np.array([10, 20])),
    (np.array([5, 6, 7, 8]), np.array([30, 40]))
]

# Test case 3: batch of lists
batch_lists = [
    [np.array([1.0, 2.0, 3.0]), 100],
    [np.array([4.0, 5.0, 6.0]), 200]
]

# Choose one batch to test - using arrays as the primary test case
ARGS = {
    "batch": batch_arrays
}
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 int, 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
ravel_adam_update Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tomoleary/hessianaveraging/hessavg/adam.py
code served (permissive licence) · get_code("f0ae0b39189495eb")
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 jax
import jax.numpy as jnp
from functools import partial

# Set seed for reproducibility
jax.config.update("jax_platform_name", "cpu")

# Define a simple loss function that works with the raveled parameters
def simple_loss(params, batch, batch_stats=None):
    """
    Simple loss function for testing.
    params: unraveled pytree of parameters
    batch: tuple of (x, y) data
    batch_stats: optional auxiliary statistics
    """
    x, y = batch
    # Simple MSE-like loss: sum((params * x - y)^2)
    pred = jnp.sum(params['w'] * x + params['b'])
    loss_val = jnp.sum((pred - y) ** 2)
    
    if batch_stats is not None:
        # Return loss and updated batch_stats
        new_batch_stats = {'count': batch_stats['count'] + 1}
        return loss_val, new_batch_stats
    return loss_val

# Create parameter pytree
params = {
    'w': jnp.array([0.1, 0.2, 0.3, 0.4]),
    'b': jnp.array([0.05])
}

# Create a batch of data (x, y)
batch = (
    jnp.array([1.0, 2.0, 3.0, 4.0]),
    jnp.array(5.0)
)

# Initialize momentum and velocity states (same shape as raveled params)
from jax.flatten_util import ravel_pytree
rav_param, _ = ravel_pytree(params)
param_size = rav_param.shape[0]

m = jnp.zeros(param_size)
v = jnp.zeros(param_size)

# Iteration counter
iteration = jnp.array(1)

# Batch statistics (optional)
batch_stats = {'count': jnp.array(0)}

# Construct ARGS dictionary
ARGS = {
    'loss': simple_loss,
    'params': params,
    'batch': batch,
    'm': m,
    'v': v,
    'iteration': iteration,
    'beta_1': 0.9,
    'beta_2': 0.999,
    'epsilon': 1e-08,
    'step_size': 0.001,
    'batch_stats': batch_stats,
    'weight_decay': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — 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
diagonally_averaged_Newton_update Not yet run
unverified (harvested, no recorded run)
tomoleary/hessianaveraging/hessavg/diagonalNewton.py
code served (permissive licence) · get_code("5a40341434cd861c")
How it ran

no invocation recorded.

get_cifar10_dataset Not yet run
unverified (harvested, no recorded run)
tomoleary/hessianaveraging/applications/resnet/dataUtilities.py
code served (permissive licence) · get_code("4e118497a397a8e2")
How it ran

no invocation recorded.

get_cifar10_dataset_unmodified Not yet run
unverified (harvested, no recorded run)
tomoleary/hessianaveraging/applications/resnet/dataUtilities.py
code served (permissive licence) · get_code("306859531f723b14")
How it ran

no invocation recorded.

ravel_adagrad_update Not yet run
unverified (harvested, no recorded run)
tomoleary/hessianaveraging/hessavg/adaGrad.py
code served (permissive licence) · get_code("844041b8dc400cf1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 7 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
numpy_collate 5 other papers
5 dated earlier
2111.04706 (2021-11)
Bayesian Framework for Gradient Leakage
2304.04307 (2023-04)
PriorCVAE: scalable MCMC parameter inference with Bayesian deep generative modelling
2307.01583 (2023-07)
Learning Lie Group Symmetry Transformations with Neural Networks
and 2 more not named here

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

We consider minimizing finite-sum and expectation objective functions via Hessian-averaging based subsampled Newton methods. These methods allow for gradient inexactness and have fixed per-iteration Hessian approximation costs. The recent work (Na et al. 2023) demonstrated that Hessian averaging can be utilized to achieve fast $\mathcal{O}\left(\sqrt{\tfrac{\log k}{k}}\right)$ local superlinear convergence for strongly convex functions in high probability, while maintaining fixed per-iteration Hessian costs. These methods, however, require gradient exactness and strong convexity, which poses challenges for their practical implementation. To address this concern we consider Hessian-averaged methods that allow gradient inexactness via norm condition based adaptive-sampling strategies. For the finite-sum problem we utilize deterministic sampling techniques which lead to global linear and sublinear convergence rates for strongly convex and nonconvex functions respectively. In this setting we are able to derive an improved deterministic local superlinear convergence rate of $\mathcal{O}\left(\tfrac{1}{k}\right)$. For the %expected risk expectation problem we utilize stochastic sampling techniques, and derive global linear and sublinear rates for strongly convex and nonconvex functions, as well as a $\mathcal{O}\left(\tfrac{1}{\sqrt{k}}\right)$ local superlinear convergence rate, all in expectation. We present novel analysis techniques that differ from the previous probabilistic results. Additionally, we propose scalable and efficient variations of these methods via diagonal approximations and derive the novel diagonally-averaged Newton (Dan) method for large-scale problems. Our numerical results demonstrate that the Hessian averaging not only helps with convergence, but can lead to state-of-the-art performance on difficult problems such as CIFAR100 classification with ResNets.

For agents

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

get_harvested_code_for_paper("2408.07268")
get_code_for_paper("2408.07268")
have("2408.07268")

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

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

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

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

Connect an agent — have() is free.