SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.19055 · NeurIPS · 2024

Newton Losses: Using Curvature Information for Learning with Differentiable Algorithms

Stefano Ermon, Felix Petersen, Christian Borgelt, Hilde Kuehne, Oliver Deussen, Tobias Sutter

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 0 have no contract verdict; 4 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2410.19055.json · badge: /api/ran/2410.19055.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
cvxgrp/cvxpylayers canonical (classifier label)
classifier basis: census
4 ran · 1 no recorded run
FunctionStatusWhere it lives
convert_csc_structure_to_csr_structure Ran
ran; our contract draft was wrong, not the code
cvxgrp/cvxpylayers/src/cvxpylayers/utils/solver_utils.py
code served (permissive licence) · get_code("83c5e4ba96168073")
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 numpy as np
import scipy.sparse as sp

# Create a small CSC structure for testing
# We'll create a 4x5 sparse matrix in CSC format
n1, n2 = 4, 5
nnz = 6

# CSC format: indices (row indices), indptr (column pointers)
# Let's create a simple sparse matrix with some non-zero elements
indices = np.array([0, 2, 1, 2, 0, 3], dtype=np.int32)
indptr = np.array([0, 2, 3, 4, 5, 6], dtype=np.int32)

structure = (indices, indptr, (n1, n2))

ARGS = {
    "structure": structure,
    "extract_last_column": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
convert_to_csr Ran
ran; our contract draft was wrong, not the code
cvxgrp/cvxpylayers/src/cvxpylayers/utils/solver_utils.py
code served (permissive licence) · get_code("a3fdd2a4c4f1cc3f")
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 numpy as np
import scipy.sparse as sp
from dataclasses import dataclass

@dataclass
class MockReducedMatrix:
    """Mock for param_prob.reduced_P or param_prob.reduced_A"""
    problem_data_index: tuple[np.ndarray, np.ndarray, tuple[int, int]] | None
    reduced_mat: np.ndarray

@dataclass
class MockParamProb:
    """Mock parametrized problem from CVXPY canonicalization"""
    reduced_P: MockReducedMatrix
    reduced_A: MockReducedMatrix

# Create a simple case with both P and A structures
# P: 3x3 matrix in CSC format
# A: 4x4 matrix (3x3 for constraints + 1 column for b)

# P structure: 3x3 with 5 nonzeros
P_indices = np.array([0, 1, 2, 0, 1], dtype=np.int64)
P_indptr = np.array([0, 2, 3, 5], dtype=np.int64)
P_structure_csc = (P_indices, P_indptr, (3, 3))
P_reduced_mat = np.random.randn(5, 2)  # 5 nonzeros, 2 parameters

# A structure: 4x4 (including b column) in CSC format
# We'll have 6 nonzeros in the constraint matrix part
A_indices = np.array([0, 1, 2, 0, 1, 2, 0], dtype=np.int64)
A_indptr = np.array([0, 2, 3, 5, 7], dtype=np.int64)
A_structure_csc = (A_indices, A_indptr, (3, 4))
A_reduced_mat = np.random.randn(7, 2)  # 7 values total (constraint + b), 2 parameters

param_prob = MockParamProb(
    reduced_P=MockReducedMatrix(
        problem_data_index=P_structure_csc,
        reduced_mat=P_reduced_mat
    ),
    reduced_A=MockReducedMatrix(
        problem_data_index=A_structure_csc,
        reduced_mat=A_reduced_mat
    )
)

ARGS = {
    "param_prob": param_prob
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — 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
scipy_csr_to_jax_bcsr Ran
ran; our contract draft was wrong, not the code
cvxgrp/cvxpylayers/src/cvxpylayers/jax/cvxpylayer.py
code served (permissive licence) · get_code("d370793812341d1b")
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 BCSR. 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.experimental.sparse
import jax.numpy as jnp
import scipy.sparse
import numpy as np

# Test case 1: Non-empty sparse matrix
data = np.array([1.0, 2.0, 3.0], dtype=np.float32)
col_indices = np.array([0, 2, 1], dtype=np.int32)
row_ptr = np.array([0, 1, 3], dtype=np.int32)
scipy_csr_nonempty = scipy.sparse.csr_array(
    (data, col_indices, row_ptr),
    shape=(2, 4),
    dtype=np.float32
)

# Test case 2: Empty sparse matrix (0 rows)
scipy_csr_empty = scipy.sparse.csr_array(
    (np.array([], dtype=np.float32), np.array([], dtype=np.int32), np.array([0], dtype=np.int32)),
    shape=(0, 4),
    dtype=np.float32
)

# Test case 3: None input
scipy_csr_none = None

ARGS = {
    "scipy_csr": scipy_csr_nonempty,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BCSR — a BCSR 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
scipy_csr_to_torch_csr Ran
ran; our contract draft was wrong, not the code
cvxgrp/cvxpylayers/src/cvxpylayers/torch/cvxpylayer.py
code served (permissive licence) · get_code("9a90c7c8fba54973")
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. 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 scipy.sparse
import numpy as np

torch.manual_seed(0)

# Create a small sparse CSR matrix using scipy
# 4 rows, 5 columns with some non-zero values
row = np.array([0, 0, 1, 2, 3, 3])
col = np.array([0, 2, 1, 3, 1, 4])
data = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])

scipy_csr_matrix = scipy.sparse.csr_array((data, (row, col)), shape=(4, 5))

ARGS = {
    "scipy_csr": scipy_csr_matrix
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, shape (4, 5) — shape (4, 5) as a later run recorded it
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
JuliaCuVector2CuPyArray Not yet run
unverified (harvested, no recorded run)
cvxgrp/cvxpylayers/src/cvxpylayers/interfaces/cuclarabel_if.py
code served (permissive licence) · get_code("4866bc7126487c52")
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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

When training neural networks with custom objectives, such as ranking losses and shortest-path losses, a common problem is that they are, per se, non-differentiable. A popular approach is to continuously relax the objectives to provide gradients, enabling learning. However, such differentiable relaxations are often non-convex and can exhibit vanishing and exploding gradients, making them (already in isolation) hard to optimize. Here, the loss function poses the bottleneck when training a deep neural network. We present Newton Losses, a method for improving the performance of existing hard to optimize losses by exploiting their second-order information via their empirical Fisher and Hessian matrices. Instead of training the neural network with second-order techniques, we only utilize the loss function's second-order information to replace it by a Newton Loss, while training the network with gradient descent. This makes our method computationally efficient. We apply Newton Losses to eight differentiable algorithms for sorting and shortest-paths, achieving significant improvements for less-optimized differentiable algorithms, and consistent improvements, even for well-optimized differentiable algorithms.

For agents

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

get_harvested_code_for_paper("2410.19055")
get_code_for_paper("2410.19055")
have("2410.19055")

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

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

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

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

Connect an agent — have() is free.