SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2006.08877 · 2020

Practical Quasi-Newton Methods for Training Deep Neural Networks

arXiv · PDF · Open in the Atlas

Code that ran

7 of 18 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; 0 failures of our instrument; 11 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/2006.08877.json · badge: /api/ran/2006.08877.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
renyiryry/kbfgs_neurips2020_public canonical (classifier label)
classifier basis: census
7 ran · 11 no recorded run
FunctionStatusWhere it lives
extract_images Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/datasets_utils.py
code served (permissive licence) · get_code("851f949555ae8ab8")
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 4, dtype family int, shape (2, 28, 28, 1) 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
import gzip
import io
import struct

# Create a minimal valid MNIST image file in gzip format
def create_mnist_image_file():
    """Create a minimal valid MNIST image file in memory."""
    buffer = io.BytesIO()
    
    # MNIST image file format:
    # [offset] [type]          [value]
    # 0000     32 bit integer  0x00000803 (2051) - magic number
    # 0004     32 bit integer  num_images
    # 0008     32 bit integer  num_rows
    # 0012     32 bit integer  num_cols
    # 0016     unsigned byte   image data
    
    magic = 2051
    num_images = 2
    rows = 28
    cols = 28
    
    # Write magic number (big-endian)
    buffer.write(struct.pack('>I', magic))
    # Write num_images (big-endian)
    buffer.write(struct.pack('>I', num_images))
    # Write rows (big-endian)
    buffer.write(struct.pack('>I', rows))
    # Write cols (big-endian)
    buffer.write(struct.pack('>I', cols))
    
    # Write image data (2 images of 28x28 = 1568 bytes each)
    image_data = np.random.randint(0, 256, size=(num_images * rows * cols), dtype=np.uint8)
    buffer.write(image_data.tobytes())
    
    buffer.seek(0)
    return buffer

# Create gzip-compressed file
gzip_buffer = io.BytesIO()
with gzip.GzipFile(fileobj=gzip_buffer, mode='wb') as gz:
    mnist_buffer = create_mnist_image_file()
    gz.write(mnist_buffer.read())

gzip_buffer.seek(0)

# We need to save this to a temporary location that gzip.open can read
# Since we can't do file I/O, we'll create a mock filename and use a custom approach
# Actually, let's create the file properly in a way that works

import tempfile
import os

# Create a temporary gzip file
temp_fd, temp_path = tempfile.mkstemp(suffix='.gz')
try:
    with gzip.open(temp_path, 'wb') as f:
        # Write magic number
        f.write(struct.pack('>I', 2051))
        # Write num_images
        f.write(struct.pack('>I', 2))
        # Write rows
        f.write(struct.pack('>I', 28))
        # Write cols
        f.write(struct.pack('>I', 28))
        # Write image data
        image_data = np.random.randint(0, 256, size=(2 * 28 * 28), dtype=np.uint8)
        f.write(image_data.tobytes())
    
    filename = temp_path
finally:
    os.close(temp_fd)

ARGS = {
    'filename': filename
}
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 4, dtype family int, shape (2, 28, 28, 1) — shape (2, 28, 28, 1) 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
extract_labels Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/datasets_utils.py
code served (permissive licence) · get_code("253a267c45bbe249")
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 1, dtype family int, shape (10,) 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
import gzip
import io
import struct

# Create a minimal valid MNIST label file in memory
def create_mnist_label_file():
    """Create a valid gzip-compressed MNIST label file"""
    buffer = io.BytesIO()
    
    # Write magic number (2049 in big-endian)
    buffer.write(struct.pack('>I', 2049))
    
    # Write number of items (10 labels)
    num_items = 10
    buffer.write(struct.pack('>I', num_items))
    
    # Write label data (10 random labels 0-9)
    labels_data = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=np.uint8)
    buffer.write(labels_data.tobytes())
    
    # Compress with gzip
    buffer.seek(0)
    compressed_buffer = io.BytesIO()
    with gzip.GzipFile(fileobj=compressed_buffer, mode='wb') as gz:
        gz.write(buffer.read())
    
    compressed_buffer.seek(0)
    return compressed_buffer

# Create the gzip file content
gzip_file_buffer = create_mnist_label_file()
gzip_content = gzip_file_buffer.getvalue()

# Write to a temporary location that can be read
import tempfile
import os

temp_dir = tempfile.gettempdir()
temp_filename = os.path.join(temp_dir, 'test_mnist_labels.gz')

with open(temp_filename, 'wb') as f:
    f.write(gzip_content)

ARGS = {
    'filename': temp_filename,
    'one_hot': False
}
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 1, dtype family int, shape (10,) — shape (10,) 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
get_BFGS_PowellHDamping Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/kbfgs_utils.py
code served (permissive licence) · get_code("a18221d07d39fd01")
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
import torch.nn as nn

torch.manual_seed(0)

# Build s_l_a and y_l_a as 1D tensors
s_l_a = torch.randn(4)
y_l_a = torch.randn(4)

# Build alpha as a scalar
alpha = 0.5

# Build l as an index
l = 0

# Build params dict
params = {
    'device': 'cpu',
    'Kron_BFGS_action_a': 'LBFGS'
}

# Build s_y_pairs for LBFGS
s_y_pairs = {
    's': [torch.randn(4, 3)],
    'y': [torch.randn(4, 3)],
    'R_inv': [[torch.tensor(2.0)]],
    'yTy': [[torch.tensor(3.0)]],
    'D_diag': [torch.randn(3)],
    'gamma': -1,
    'left_matrix': torch.randn(4, 2),
    'right_matrix': torch.randn(2, 4)
}

# Build data_ dict with Kron_LBFGS_s_y_pairs and Kron_BFGS_matrices
data_ = {
    'Kron_LBFGS_s_y_pairs': {
        'a': {
            0: s_y_pairs
        }
    },
    'Kron_BFGS_matrices': {
        0: {
            'H': {
                'a_grad': torch.randn(4, 4)
            }
        }
    }
}

ARGS = {
    's_l_a': s_l_a,
    'y_l_a': y_l_a,
    'alpha': alpha,
    'l': l,
    'data_': data_,
    '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 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
get_layer_forward Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/models.py
code served (permissive licence) · get_code("c0a2398f1207cb43")
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
import torch.nn as nn

torch.manual_seed(0)

# Create a simple fully-connected layer
layer = nn.Linear(4, 3)

# Create input tensor (batch_size=2, input_dim=4)
input_tensor = torch.randn(2, 4)

# Define activation string
activation_str = 'relu'

# Define layer_params dict with required 'name' key
layer_params = {
    'name': 'fully-connected'
}

ARGS = {
    'input_': input_tensor,
    'layer_': layer,
    'activation_': activation_str,
    'layer_params': layer_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 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
get_layers_params Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/models.py
code served (permissive licence) · get_code("c9d6d71c4e0e2879")
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 torch
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

# Based on the function body, we need:
# - name_model: a string, should be 'fully-connected'
# - layersizes: a list of integers representing layer dimensions
# - activations: a list of activation function names/identifiers
# - params: a dict (not used in the function but required as parameter)

ARGS = {
    'name_model': 'fully-connected',
    'layersizes': [10, 8, 6, 4],
    'activations': ['relu', 'relu', 'softmax'],
    'params': {'learning_rate': 0.01, 'batch_size': 32}
}
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 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_loss_from_z Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/functions_utils.py
code served (permissive licence) · get_code("f5d2d8c64fcc767a")
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; no output shape is stated. It ran in syntology-harvest-sandbox:v5-deps (sha256:6a292aa1aed1) at 2026-09-27T00:55:27Z. 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 torch.nn as nn

torch.manual_seed(0)

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

# Test with multi-class classification
model_multiclass = SimpleModel('multi-class classification')
z_multiclass = torch.randn(2, 3)  # batch_size=2, num_classes=3
t_multiclass = torch.tensor([0, 2])  # class indices
reduction_multiclass = 'mean'

ARGS = {
    'model': model_multiclass,
    'z': z_multiclass,
    't': t_multiclass,
    'reduction': reduction_multiclass
}
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 0, dtype family float — 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
get_zero_torch Ran
ran on a synthesized input
renyiryry/kbfgs_neurips2020_public/functions_utils.py
code served (permissive licence) · get_code("9430a8a0000bd2e2")
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 torch

torch.manual_seed(0)

# Construct layers_params with distinct sizes for different dimensions
layers_params = [
    {
        'input_size': 4,
        'output_size': 3,
    },
    {
        'input_size': 3,
        'output_size': 5,
    },
    {
        'input_size': 5,
        'output_size': 2,
    }
]

device = 'cpu'

params = {
    'layers_params': layers_params,
    'device': device,
}

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 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
Kron_BFGS_update Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/kbfgs_utils.py
code served (permissive licence) · get_code("01ba2a48b31d58ff")
How it ran

no invocation recorded.

Kron_BFGS_update_per_layer Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/kbfgs_utils.py
code served (permissive licence) · get_code("d687b5eff2f1fa97")
How it ran

no invocation recorded.

RMSprop_update Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/first_order_methods.py
code served (permissive licence) · get_code("c77885d6ae47b66a")
How it ran

no invocation recorded.

SGD_update Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/first_order_methods.py
code served (permissive licence) · get_code("04af493428e001d6")
How it ran

no invocation recorded.

get_post_activation Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/models.py
code served (permissive licence) · get_code("6f85f9a4f0b2a34b")
How it ran

no invocation recorded.

get_second_order_caches Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/training_utils.py
code served (permissive licence) · get_code("9dcf57cd925b3499")
How it ran

no invocation recorded.

get_subtract Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/functions_utils.py
code served (permissive licence) · get_code("60c173061504e511")
How it ran

no invocation recorded.

kfac_update Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/kfac_utils.py
code served (permissive licence) · get_code("3ba907e6a27bff1d")
How it ran

no invocation recorded.

maybe_download Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/datasets_utils.py
code served (permissive licence) · get_code("e8a8b04a07deed58")
How it ran

no invocation recorded.

sample_from_pred_dist Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/training_utils.py
code served (permissive licence) · get_code("531e567a427b9d4b")
How it ran

no invocation recorded.

train_initialization Not yet run
unverified (harvested, no recorded run)
renyiryry/kbfgs_neurips2020_public/training_utils.py
code served (permissive licence) · get_code("3f82340f557f2fa2")
How it ran

no invocation recorded.

Also present in other papers' code

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

We consider the development of practical stochastic quasi-Newton, and in particular Kronecker-factored block-diagonal BFGS and L-BFGS methods, for training deep neural networks (DNNs). In DNN training, the number of variables and components of the gradient $n$ is often of the order of tens of millions and the Hessian has $n^2$ elements. Consequently, computing and storing a full $n \times n$ BFGS approximation or storing a modest number of (step, change in gradient) vector pairs for use in an L-BFGS implementation is out of the question. In our proposed methods, we approximate the Hessian by a block-diagonal matrix and use the structure of the gradient and Hessian to further approximate these blocks, each of which corresponds to a layer, as the Kronecker product of two much smaller matrices. This is analogous to the approach in KFAC, which computes a Kronecker-factored block-diagonal approximation to the Fisher matrix in a stochastic natural gradient method. Because the indefinite and highly variable nature of the Hessian in a DNN, we also propose a new damping approach to keep the upper as well as the lower bounds of the BFGS and L-BFGS approximations bounded. In tests on autoencoder feed-forward neural network models with either nine or thirteen layers applied to three datasets, our methods outperformed or performed comparably to KFAC and state-of-the-art first-order stochastic methods.

For agents

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

get_harvested_code_for_paper("2006.08877")
get_code_for_paper("2006.08877")
have("2006.08877")

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

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

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

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

Connect an agent — have() is free.