Papers › A Fully First-Order Layer for Differentiable Optimization

A Fully First-Order Layer for Differentiable Optimization

2 Dec 2025ICMLarXiv:2512.02494added by Syntology

Zihao Zhao, Kai-Chia Mo, Shing-Hei Ho, Brandon Amos, Kai Wang

Title, abstract, authors and date from arXiv's metadata (CC0); this paper is not in the Papers with Code archive (frozen 2025-07-28).

Differentiable optimization layers enable learning systems to make decisions by solving embedded optimization problems. However, computing gradients via implicit differentiation requires solving a linear system with Hessian terms, which is both compute- and memory-intensive. To address this challenge, we propose a novel algorithm that computes the gradient using only first-order information. The key insight is to rewrite the differentiable optimization as a bilevel optimization problem and leverage recent advances in bilevel methods. Specifically, we introduce an active-set Lagrangian hypergradient oracle that avoids Hessian evaluations and provides finite-time, non-asymptotic approximation guarantees. We show that an approximate hypergradient can be computed using only first-order information in Õ(1) time, leading to an overall complexity of Õ(δ⁻¹ε⁻³) for constrained bilevel optimization, which matches the best known rate for non-smooth non-convex optimization. Furthermore, we release an open-source Python library that can be easily adapted from existing solvers. The source code is available at https://github.com/guaguakai/FFOLayer.

PaperPDFCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 27 code samples harvested from 1 repository linked to this paper: 24 ran (of which 0 constructed an object rather than computing a result; 18 with no instrument failure: 1 honoured, 0 violated, 17 with no contract checked; 6 where Syntology's instrument failed) · 3 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 4 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: found in paper text by Syntology: 27 samples from 1 repository, 24 ran (18 with no instrument failure; 6 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-26 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

GT-KOALA/FFOLayer found in paper text by SyntologyMITSyntology: 27 samples, 24 ran (6 instrument-failed) · 3 unverified report

Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

27 samples harvested: 24 ran (of which 0 constructed an object rather than computing a result; 18 with no instrument failure: 1 honoured, 0 violated, 17 with no contract checked; 6 where Syntology's instrument failed) · 3 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · honoured contract
2ran · our draft was wrong
4ran; the contract check could not run
17ran
3unverified

Licence: 0 of the 27 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from GT-KOALA/FFOLayer. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

GT-KOALA/FFOLayer found in paper text by Syntology 27 samples, 24 ran (6 instrument-failed) · 3 unverified
AltDiffLayer baselines/AltDiff_my.py ran MIT (permissive) · 5da01a2cfc6e4a3c · report fixture: signature eps:float/0/float, max_iter:int/0/int, rho:float/0/float, reg_fwd:float/0/float, active_tol:float/0/float, reg_bwd:float/0/float, sym_P:bool/0/bool · returned method · level recorded 2026-09-26
AltDiffLayer baselines/AltDiff_socp.py ran MIT (permissive) · 721a2edf0c8c6c88 · report fixture: signature eps:float/0/float, max_iter:int/0/int, rho:float/0/float · returned method · level recorded 2026-09-26
BPQPLayer baselines/BPQP_cvxpy.py ran MIT (permissive) · f059057e92cf65ce · report fixture: signature sign:int/0/int, act_tol:float/0/float · returned method · level recorded 2026-09-26
alt_diff_qp_ball baselines/AltDiff_socp.py ran MIT (permissive) · 0ed505c799b8ab88 · report fixture: signature P:Tensor/2/float, q:Tensor/1/float, A:Tensor/2/float, b:Tensor/1/float, G:Tensor/2/float, h:Tensor/1/float, rho:float/0/float, eps:float/0/float, max_iter:int/0/int · returned tuple · level recorded 2026-09-26
alt_qp_solve_batched baselines/AltDiff_my.py ran MIT (permissive) · 965a326c258ca206 · report fixture: signature P:Tensor/3/float, q:Tensor/2/float, A:Tensor/3/float, b:Tensor/2/float, G:Tensor/3/float, h:Tensor/2/float, rho:float/0/float, eps:float/0/float, max_iter:int/0/int, reg:float/0/float · returned tuple · level recorded 2026-09-26
bpqp_backward baselines/BPQP.py ran MIT (permissive) · 51a84d27ffe9312e · report fixture: signature xn:ndarray/1/float, yn:ndarray/1/float, P_csc:csc_matrix/2/float, Gn:ndarray/2/float, hn:ndarray/1/float, An:ndarray/2/float, gnp:ndarray/1/float, m:int/0/int, p:int/0/int, act_tol:float/0/float, backward_eps:float/0/float · returned tuple · level recorded 2026-09-26
bpqp_backward baselines/BPQP_cvxpy.py ran MIT (permissive) · bc3853e5579d499e · report fixture: signature xn:ndarray/1/float, yn:ndarray/1/float, Pn:ndarray/2/float, Gn:ndarray/2/float, hn:ndarray/1/float, An:ndarray/2/float, gnp:ndarray/1/float, m:int/0/int, p:int/0/int, act_tol:float/0/float · returned tuple · level recorded 2026-09-26
compact_active_rows src/ffolayer/ffoqp_eq.py ran; the contract check could not run (RAISES) MIT (permissive) · 9073396df5ed4d7f · report fixture: signature A:Tensor/3/float · returned tuple · level recorded 2026-09-26
ffoqp src/ffolayer/ffoqp.py ran MIT (permissive) · 472594fac39e3ee0 · report fixture: signature eps:float/0/float, verbose:int/0/int, notImprovedLim:int/0/int, maxIter:int/0/int, lamb:int/0/int, check_Q_spd:bool/0/bool, solver:str/0/str, solver_opts:dict/0/? · returned method · level recorded 2026-09-26
get_feasible_b sudoku/models_sudoku.py ran · our draft was wrong fingerprinted MIT (permissive) · a007b5cf56c8bae4 · report fixture: signature A:Tensor/2/float, z0:Tensor/1/float · returned Tensor · level recorded 2026-09-26
get_feasible_h sudoku/models_sudoku.py ran MIT (permissive) · cb22acf193c96cee · report fixture: signature G:Tensor/2/float, z0:Tensor/1/float, s0:Tensor/1/float · returned Tensor · level recorded 2026-09-26
kkt_schur_complement src/ffolayer/ffoqp_eq.py ran MIT (permissive) · 2b5d032faf67c537 · report fixture: signature Q:Tensor/3/float, A:Tensor/3/float, delta:Tensor/2/float · returned tuple · level recorded 2026-09-26
make_schur_op src/ffolayer/ffoqp_eq.py ran MIT (permissive) · ad95d972f968bea3 · report fixture: signature A:list/1/Tensor, L:Tensor/2/float, eps_s:float/0/float · returned function · level recorded 2026-09-26
osqp_solve baselines/BPQP.py ran MIT (permissive) · 72e51987bf0b497f · report fixture: signature P_csc:csc_matrix/2/float, q_np:ndarray/1/float, A_csc:csc_matrix/2/float, l_np:ndarray/1/float, u_np:ndarray/1/float, eps:float/0/float · returned tuple · level recorded 2026-09-26
pack_osqp baselines/BPQP.py ran MIT (permissive) · e79ddef8d0f4a1b9 · report fixture: signature P:Tensor/2/float, q:Tensor/1/float, G:Tensor/2/float, h:Tensor/1/float, A:Tensor/2/float, b:Tensor/1/float · returned tuple · level recorded 2026-09-26
proj in 38 papers baselines/AltDiff.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) · cdcb4c4d2efd9bcd · report fixture: signature s:list/1/float · returned list · level recorded 2026-09-26
relu in 58 papers
census: 8 implementations from 11 papers, 4 distinct outputs across 2 buckets, one shared input per bucket
baselines/AltDiff.py ran; the contract check could not run (RAISES) MIT (permissive) · 75a806c121e013d2 · report fixture: signature s:list/1/float · returned list · level recorded 2026-09-26
setup_cvxpy_synthetic_problem synthetic_task/models.py ran MIT (permissive) · 6e7c154f827b7fea · report fixture: signature n:int/0/int, n_ineq_constraints:int/0/int, unconstrained:bool/0/bool · returned tuple · level recorded 2026-09-26
setup_cvxpy_synthetic_problem_with_cones synthetic_task/models.py ran MIT (permissive) · a2a1f2f1f52d1afe · report fixture: signature n:int/0/int, n_ineq_constraints:int/0/int, cone_dim:int/0/int, num_cones:int/0/int, unconstrained:bool/0/bool · returned tuple · level recorded 2026-09-26
sgn in 5 papers baselines/AltDiff.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) · b7c2cacc2ff70644 · report fixture: signature s:Tensor/1/float · returned Tensor · level recorded 2026-09-26
slice_params_for_batch src/ffolayer/utils.py ran MIT (permissive) · e9c8c0ade37ae3f5 · report fixture: signature params_req:list/1/Tensor, batch_sizes:list/1/int, i:int/0/int · returned list · level recorded 2026-09-26
to_numpy in 103 papers
census: 24 implementations from 29 papers, 2 distinct outputs across 2 buckets, one shared input per bucket
src/ffolayer/ffoqp.py ran · our draft was wrong MIT (permissive) · 61f11299147431ec · report fixture: signature x:Tensor/2/float · returned ndarray · level recorded 2026-09-26
to_numpy in 103 papers
census: 24 implementations from 29 papers, 2 distinct outputs across 2 buckets, one shared input per bucket
src/ffolayer/utils.py ran · honoured contract MIT (permissive) · 00d531ce728a6d76 · report fixture: signature x:Tensor/2/float · returned ndarray · level recorded 2026-09-26
to_torch in 53 papers
census: 5 implementations from 6 papers, 2 distinct outputs across 2 buckets, one shared input per bucket
src/ffolayer/utils.py ran MIT (permissive) · ed333bcc321221bc · report fixture: signature x:ndarray/2/float, dtype:dtype/0/?, device:str/0/str · returned Tensor · level recorded 2026-09-26
FFOLayer src/ffolayer/ffocp_eq.py unverified MIT (permissive) · 5ae4fc2c87a7123b · report
active_counts_dict src/ffolayer/ffocp_eq.py unverified MIT (permissive) · 40c8b005ce29c676 · report
solve_loss ffo_sdp.py unverified MIT (permissive) · ffbf19d3814db061 · report

Results from the paper

The Papers with Code archive ends with its 2025-07-28 snapshot. This paper's arXiv identifier, 2512.02494, was issued in December 2025, after that date, so the archive has no leaderboard rows for it.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections