arXiv:2610.34590cs.LGOct 2026

Manuscript Offprint

arXiv:2610.34590

Sparse Sum-of-Squares Layers for Certified Learning

Ege Gursoy, Nicolas Mansard

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

A central limitation of modern machine learning systems is the lack of formal certificates guaranteeing their behavior beyond empirical, sample-based evaluation. Sum-of-squares (SOS) methods provide such guarantees by certifying polynomial inequalities over continuous domains via semidefinite programming (SDP). While prior work has introduced SDP layers as differentiable components in neural networks, repeated learning calls can lose the computational benefit of the forward program’s sparse representation. We propose Sparse SOS Layers, differentiable value layers whose backward passes reuse the local coordinates of the forward solve. Under a fixed template and learned objective coefficients, each layer avoids building dense certificates and reuses its sparse structure across training steps. Compared with existing methods, our approach achieves up to 2.7×2.7\times speedup in total warm-call time, with nearly 100×100\times lower memory usage (1.7 vs. 160 GiB) for relatively large problem sizes for the tested dense parameterization. Experiments cover sparse polynomial certification, pendulum control, combinatorial relaxations, robotics projection, oscillator chains, and pose graph synchronization. A design study achieves zero certified violations across unseen problem instances and sizes, while requiring roughly 7×7\times fewer optimization solves that estimating gradients by perturbing the objective coefficients and re-solving the problem (finite differences). These results show that sparse certificate values can be effectively integrated into learning pipelines when the backward pass respects the verifier’s structure.

1 Introduction

Many learning systems are trained from finite data but used under continuous constraints that pointwise losses are hard to enforce. Certificates address this by converting such claims into checkable objects. Sum-of-squares (SOS) certificates provide one standard approach: a polynomial written as a sum of squares is guaranteed to be nonnegative. With a fixed monomial basis, searching for this representation becomes a semidefinite program (SDP) over positive semidefinite (PSD) matrices [1–5]. This makes SOS useful for polynomial constraints in control [6, 7], and also connects to SDP relaxations for quadratic and low-order polynomial optimization problems [8, 9].

The difficulty is that dense SOS programs grow quickly with dimension*. The key to scaling SOS to relevant size is to exhibit and exploit sparsity in the polynomial structure [10]. A dense matrix treats all variables as coupled, even when the underlying problem is local. Sparse SOS methods avoid this by exploiting structure that appears in chains, grids, robots, and graphs. Correlative sparsity limits each polynomial term to a small set of variables, while chordal sparsity replaces one large PSD matrix by smaller overlapping blocks tied by consistency constraints [11–13, 10, 14, 15]. This sparse representation is what makes the forward certificate solve practical in applications such as vision, perception, and robotics [16–19].

∗^{*}Dense SOS uses a PSD matrix of size (n+rr)\binom{n+r}{r} for degree 2r certificates in n variables.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

An appealing research direction in ML is to leverage positivity certificates by treating an SOS formulation as a differentiable optimization layer inside a neural network. Then one can learn by optimizing through its output, following the broader line of differentiable optimization layers [20–25]. A generic differentiable optimization layer differentiates the canonical cone program, which may lose the local block structure that made the forward solve tractable [21].

This paper asks whether that same sparse certificate can also be used during training. We consider a fixed sparse certificate template whose coefficients are predicted by a neural network. The layer solves the resulting sparse SDP and returns a scalar certified value, such as a margin. The training loss then differentiates through this solve. This is different from two common alternatives, which are: sampled surrogate which checks the certificate inequality only on finitely many points, and stop gradient method which solves the certificate forward but removes its gradient from learning. Both can be useful, but neither trains directly through the deployed sparse certificate.

Our contribution is to make the backward pass use the same sparse blocks as the forward certificate solve. The result is a sparse differentiable layer for structured SDP certificates, covering both quadratic relaxations and SOS certificates used for local polynomial constraints. For sparse SOS, the backward pass must preserve the representation that made the forward solve tractable. SDPRLayers [19] studies certifiable backpropagation through polynomial optimization problems in robotics using Shor relaxations, where products of variables are lifted into a PSD matrix and the rank constraint is dropped. CVXPYLayers provides a general differentiable convex programming interface and can also represent explicitly chordal models. Our layer targets the sparse certificate representation directly.

When the loss depends only on a scalar certified value, the gradient follows an envelope rule and contracts the optimal sparse blocks with the derivatives of the predicted coefficients. No explicit dense certificate needs to be reconstructed. These are standard ideas from sensitivity analysis, perturbation analysis, and value-function differentiation [26–28]. Our contribution is the fixed-template architecture that discovers the clique structure and objective feature map once, keeps the solver's local coordinates across the automatic differentiation boundary, and updates only the parameter-dependent objective coefficients between calls.

Our work is related to several approaches that reduce, replace, or complement exact SOS, including DSOS and SDSOS inner approximations [29], basis pursuit and column generation [30, 31], decomposed structured cones [32, 33], sample-based variants [34, 35], and kernel or infinite-dimensional alternatives [36–38]. Neural Lyapunov methods also use Lyapunov conditions as learning or verification signals [39–43]. These lines address different parts of the certificate problem. We focus on the case where the deployed verifier is already a sparse SOS program, and ask whether the solved relaxation can remain in the training loop without paying for dense backward algebra.

Our contributions are, (i) we define a differentiable sparse SOS value layer for fixed certificate templates and learned objective coefficients under standard regularity assumptions; (ii) we give a count-based cost statement for preserving local solver coordinates across repeated differentiation, supported by controlled sparse-baseline and large-scale comparisons; (iii) we evaluate the layer on sparse polynomial and semidefinite problems, pendulum control, and a design task that tests whether optimizing the certified value changes the learned outcome.

References (38)