Semidefinite Relaxations: Lifting Without a Universal Ranking
Set up a lifted semidefinite relaxation, and separate what a PSD constraint, a moment constraint and a rank-one constraint each say -- because the third is the one that gets dropped.
What you will be able to do
- Derive a semidefinite relaxation of the layer-wise optimisation problem
- Distinguish a PSD constraint, a moment constraint and a rank-one constraint, and say which one a relaxation gives up
- Explain why no ordering by tightness holds between SDP, LP and multi-neuron relaxations, and what decides the comparison on an instance
Assumes you have read
Linear programming relaxations provide polynomial-time verification but sometimes yield loose bounds. Complete methods provide exact answers but don’t scale. What if you want tighter bounds than LP without the exponential cost of complete methods?
Semi-definite programming (SDP) offers a way to constrain quadratic relationships, which a linear relaxation cannot express at all. SDP-based verification lifts the problem to a matrix variable and imposes a PSD constraint on it. The tradeoff is cost---SDP solvers are slower than LP solvers---and the question of whether that cost buys anything is a property of the network rather than of the method.
This guide covers how the lifting is set up, what it keeps and what it gives up, and when the extra cost is justified.
Why Semi-Definite Programming?
Linear programs optimize over polytopes (linear constraints). Semi-definite programs optimize over spectrahedra (positive semi-definite matrix constraints). This richer geometry captures relationships that linear constraints cannot.
What changes: SDP can express quadratic constraints and products of variables, through positive semi-definite (PSD) matrix constraints. Whether that yields a tighter bound on a given network is a separate question, answered per instance rather than by the word “SDP” — see Lifting to Quadratic Form below.
Semi-Definite Program (SDP)
A semi-definite program has the form:
where:
- is a symmetric matrix variable
- means is positive semi-definite (all eigenvalues non-negative)
- is the matrix inner product
Complexity: SDP can be solved in polynomial time using interior-point methods. Practical solvers (CVXPY, SCS, Mosek) handle SDPs with thousands of variables.
SDP vs LP for Verification
LP relaxations use linear inequalities to over-approximate the neural network’s behavior. They’re fast (polynomial time) but conservative.
SDP relaxations replace the variables with a lifted matrix and impose a PSD constraint on it. They are slower, and whether the resulting bound is tighter is a property of the instance.
There is no ordering between the two, and the reason is worth being precise about. Every LP can be written in SDP form — a diagonal matrix variable makes the linear constraints matrix constraints — so the two formalisms are not incomparable. But that is a statement about how a program is written, not about which feasible set is smaller. The LP relaxation is a set of defined by linear inequalities in . The SDP relaxation is a set of lifted matrices defined by a PSD constraint and some linear constraints on the entries of . They are different objects over different variables, and neither contains the other. An SDP bound can come out tighter than an LP bound on one network and looser on the next, and the level of each is set by what the constraints leave free.
The one comparison that does hold is per-instance: on a given problem, solve both and compare. A method that can be looser on some instance and tighter on others is not ranked, and any table that puts “tight” in one column and “moderate” in the other is describing a tendency rather than a guarantee.
| Aspect | LP-Based Verification | SDP-Based Verification |
|---|---|---|
| Constraint variables | the directly | a lifted matrix |
| Constraints | linear inequalities | linear constraints on entries of , plus |
| Time Complexity | lower-degree polynomial | higher-degree polynomial |
| Cost per solve | a linear program | an interior-point solve on a PSD constraint |
| What limits it | the size of each individual LP | how many of them the network requires, and how tight each one has to be |
| What it can express | per-neuron and per-layer relations | products of variables, jointly |
SDP Formulation for Neural Networks
The SDP formulation for neural network verification extends the LP approach by introducing a matrix variable that captures second-order relationships between neurons.
Lifting to Quadratic Form
Standard approach: For a network with variables (all neuron activations), verify bounds on outputs.
SDP approach: Introduce a lifted variable , a matrix encoding all pairwise products of neuron activations.
Why this helps: ReLU and other non-linearities create quadratic relationships. By explicitly representing these products in , the SDP can encode tighter constraints.
Basic SDP Formulation
Given: Neural network , input region , output neuron to bound.
Variables:
- : All neuron pre/post-activations
- : Lifted matrix with
Objective: Minimize (output neuron )
Constraints:
-
Linear layer constraints: For :
-
Input bounds: for input
-
ReLU constraints: For with bounds :
- If : (inactive)
- If : (active)
- If : Use SDP relaxation
-
Lifted consistency: (exactly)
-
PSD constraint:
Key insight: The PSD constraint enforces that represents outer products, making without requiring exact equality (which would be non-convex).
ReLU Relaxation in SDP
For uncertain ReLUs (), the SDP formulation adds tighter constraints than LP:
LP triangle relaxation:
SDP quadratic relaxation (additional constraint beyond LP):
This constraint captures the fact that when ReLU is active (), both and are positive, so their product is positive. When inactive (), the product is zero.
Why it’s tighter: The quadratic constraint is non-linear, which LP cannot express. SDP encodes it via the lifted matrix with the PSD constraint.
Nuclear Norm and Rank Constraints
An alternative SDP formulation uses the nuclear norm (sum of singular values) to encourage low-rank structure in the lifted matrix .
Nuclear Norm Regularization
Motivation: The exact relationship implies is rank-1. Relaxing this constraint makes the problem convex, but allowing arbitrary can be loose.
The three things a lifting is not
It is easy to run these together, and they are the difference between a sound relaxation and a wrong one.
- is a constraint on the shape of . It says the matrix has no negative eigenvalues, equivalently that for some . It says nothing about which vector the entries of came from.
- The moment constraints are linear in . Writing is a statement that is the outer product of one specific with itself. Because these are quadratic in , they become linear in — which is the entire trick, and also why they are only equality constraints if you impose them exactly.
- is the constraint that gets dropped. It is equivalent to , which is not convex, so it cannot be imposed. A relaxation keeps the first two and drops the third.
So the relaxation is precisely: a that is PSD and whose -entries are consistent with some may still have a -row that corresponds to no . That freedom is what admits spurious points, and it is the same freedom an interval bound has when it forgets that two variables came from one input.
A two-dimensional case where the freed rank matters
Take one neuron pair, so the lifted matrix indexes , and let the moment constraints on the block be imposed exactly: , , . Fix , so the block is
and let the entries be whatever the relaxation allows, say and . Then
is positive semi-definite for every , and the first two rows coincide, so has rank at most 2. At it has rank exactly 2.
The true moment matrix of is , which has rank 1. The relaxation contains this rank-2 , so it contains configurations that no single produces. Note the direction: the block was pinned exactly and the freedom remained in the row. A relaxation is not “almost exact with a little slack” — it is exact on what it constrains and unconstrained on what it does not, and which is which has to be read off the formulation.
Middle ground: Minimize the nuclear norm where are singular values.
SDP formulation with nuclear norm:
Effect: The nuclear norm penalty encourages to be low-rank, closer to the rank-1 structure of true outer products. The parameter balances tightness (higher ) and conservativeness (lower ).
Nuclear norm as SDP: The nuclear norm minimization can be reformulated as an SDP constraint:
This makes nuclear norm optimization tractable within the SDP framework.
Tightness Improvements
What is worth claiming here, and what is not. Three things, of very different standing:
- Nuclear-norm regularisation tightens the bound — yes, by shrinking the feasible set with an additional valid constraint, so the bound cannot get worse. The mechanism is structural, not empirical.
- SDP can be tighter than LP — yes, on some networks, and this section has already said why there is no ordering between the two formalisms: they are different objects over different variables, so an SDP bound comes out tighter on one network and looser on the next. A percentage like “20-50% tighter for typical networks” claims a per-instance fact across a distribution, which is the one thing the earlier part of this chapter argues cannot be claimed.
- The gain is largest where many ReLUs are uncertain — plausible from the mechanism, since that is where the relaxation has the most freedom, and it is the right thing to check first when an SDP run underperforms.
So the practical guidance is a procedure rather than a number: run both, compare on the network at hand, and use the tighter bound. Where a reported percentage is the only evidence available, the report should say which network and which produced it.
Comparison with Other Methods
SDP vs LP-Based Methods
LP-based methods:
- Pros: Fast, scalable to large networks
- Cons: Loose bounds (misses quadratic relationships)
SDP-based methods:
- Pros: Tighter bounds (captures products via PSD constraints)
- Cons: Slower (cubic to quartic complexity)
When SDP wins: networks with strong neuron correlations, and properties where a looser bound would simply not answer the question. Network size is a cost consideration rather than a suitability criterion — the question is whether the extra expressiveness is needed, not whether the network is under a particular size.
SDP vs Multi-Neuron Relaxations
Multi-neuron relaxations (PRIMA (Mueller et al. 2022)):
- Approach: Add pairwise product terms explicitly for selected neuron pairs
- Complexity: Depends on number of pairs ; roughly where
- Tightness: Tight for selected pairs, but greedy pair selection may miss important correlations
SDP-based methods:
- Approach: Encode all pairwise products via lifted matrix
- Complexity: for general SDP solvers
- Tightness: Constrains all pairwise products at once, rather than a selected subset
Tradeoff: multi-neuron methods choose which pairs to relate and therefore pay for only those; SDP constrains the full lifted matrix and pays for it. Neither dominates: on a network where the relevant products are few and identifiable, a selective method can match or beat a full lifting; on one where they are not identifiable, lifting can be tighter.
SDP vs Complete Methods
Complete methods (Marabou (Katz et al. 2019), branch-and-bound):
- Pros: Exact answers (verified or counterexample)
- Cons: Exponential worst-case complexity, don’t scale to large networks
SDP methods:
- Pros: Solvable in polynomial time, and it can capture products a linear or per-neuron bound drops
- Cons: Still incomplete (might return “unknown”), and the lift has to be built whether or not the products in it turn out to matter
When to choose SDP over complete: When the network is too large for complete methods but LP/CROWN are too loose. SDP fills the gap between fast incomplete and slow complete methods.
| Method | Tightness | Time Complexity | Network Size Limit |
|---|---|---|---|
| IBP | Loosest | O(n) | Millions of neurons |
| CROWN | Moderate | O(n) | Millions of neurons |
| LP-based | Moderate-Tight | O(n^3) | Thousands of neurons |
| PRIMA | Tight | O(n + k pairs) | Thousands of neurons |
| SDP-based | Very Tight | O(n^4.5) | Hundreds to ~1000 |
| Complete (SMT/MILP) | Exact | Exponential | Hundreds of neurons |
Practical Implementation
Using SDP Solvers
Available solvers:
- CVXPY: High-level Python interface, supports multiple SDP solvers
- SCS: Splitting Conic Solver, fast for large-scale problems
- MOSEK: Commercial solver, highly optimized
- SDPT3/SeDuMi: MATLAB-based solvers
Typical workflow:
import cvxpy as cp
import numpy as np
# Define network layers, input bounds, etc.
n_neurons = 100 # Total neurons (all layers)
# Variables
z = cp.Variable(n_neurons) # Neuron activations
X = cp.Variable((n_neurons, n_neurons), symmetric=True) # Lifted matrix
# Objective: minimize output neuron
objective = cp.Minimize(z[-1])
# Constraints
constraints = []
# Linear layer constraints: z_j = W @ z + b
# (add for each layer)
# Input bounds
constraints.append(z[:input_dim] >= x_lower)
constraints.append(z[:input_dim] <= x_upper)
# ReLU constraints (triangle + quadratic)
# For each uncertain ReLU with pre-activation z_i, post-activation y_j:
# constraints.append(y_j * z_i >= 0) # SDP quadratic constraint
# PSD constraint (lifted consistency)
lifted = cp.bmat([[X, z.reshape(-1, 1)],
[z.reshape(1, -1), np.array([[1]])]])
constraints.append(lifted >> 0) # PSD
# Solve
problem = cp.Problem(objective, constraints)
problem.solve(solver=cp.SCS)
lower_bound = problem.valuePerformance Considerations
Scalability challenges:
- Matrix size: has entries. For , that’s 1 million variables.
- Solver time: SDP solvers have complexity. Doubling network size increases time by ~22x.
Optimizations:
Sparsity exploitation: Many entries of may be irrelevant (neurons in different layers don’t interact directly). Exploit this sparsity to reduce variable count.
Layer-by-layer solving: Similar to LP, solve SDP layer-by-layer rather than for the entire network. This keeps small (neurons per layer) rather than large (total neurons).
Warm-starting: When solving multiple similar SDPs (different output neurons, slightly different bounds), initialize solver with previous solution.
GPU acceleration: Some recent work explores GPU-accelerated SDP solving, though traditional SDP solvers are CPU-based.
When to Use SDP-Based Verification
Use SDP when:
- LP or CROWN return “unknown” and you need tighter bounds
- The network is small enough that the per-layer SDPs are affordable — which depends on your solver and budget, not on a fixed neuron count
- Properties are critical---extra computational cost justified for tightness
- Strong neuron correlations (convolutional layers, residual connections)
- Computational budget allows hours for verification
Don’t use when:
- Network is very large (thousands to millions of neurons)---LP/CROWN/PRIMA faster
- LP already verifies the property---no need for tighter bounds
- Need complete verification---use SMT or branch-and-bound instead
- Rapid iteration required---SDP too slow for tight feedback loops
When SDP earns its cost: SDP-based verification is incomplete, like the bound-based methods, and pays more per instance than they do. Whether that is worth it depends on whether the products it constrains are the ones the instance is short of. It is most useful when:
- Simple incomplete methods fail to verify
- Complete methods are too slow
- Network size is moderate (not tiny, not huge)
- Tightness matters more than speed
Current Research and Extensions
Active research directions:
Tighter SDP relaxations: Beyond basic nuclear norm, researchers explore additional constraints (e.g., exploiting network structure like convolution, adding higher-order tensor relaxations) to tighten bounds further.
Faster solvers: Developing specialized SDP solvers for neural network verification that exploit problem structure for faster solving.
Hybrid SDP-MILP: Combine SDP relaxations with integer programming for select neurons, balancing tightness and completeness.
Integration with training: Train networks that are easier to verify via SDP (e.g., encouraging low nuclear norm in activations).
Probabilistic SDP: Extend SDP to handle probabilistic guarantees, combining with randomized smoothing (Cohen et al. 2019).
Limitations
Computational cost: complexity limits SDP to moderately-sized networks. Large-scale verification requires faster methods.
Still incomplete: SDP provides tighter bounds than LP but might still return “unknown.” For definitive answers, complete methods are needed.
Solver numerical issues: SDP solvers can face numerical instability, especially for large problems or poorly-scaled constraints. Careful problem formulation and solver tuning are required.
No ordering between the methods: There is no theorem that an SDP bound is at most an LP bound on every network, and none in the other direction either. What decides it is which product terms a given instance actually needs. For some networks the gain is marginal, and for some it goes the other way.
Key Takeaways
SDP-based verification represents a sophisticated approach to incomplete verification: encoding neural networks as semi-definite programs captures quadratic relationships that simpler methods miss. The positive semi-definite constraint---a subtle but powerful tool from convex optimization---enables reasoning about products and correlations without sacrificing polynomial-time solvability.
While SDP doesn’t scale to massive networks like CROWN or IBP (Gowal et al. 2019) do, it fills an important niche. For critical properties on moderately-sized networks where LP is too loose and complete methods are too slow, SDP provides the right balance.
SDP-based verification shows why it is tempting to arrange these methods on a line: it expresses constraints an interval bound and a linear bound cannot, at higher cost. The line is a useful picture and an unreliable ranking — the levels differ in what they can express, not in a tightness that holds per instance, and a method lower down can beat one higher up on a given network. Choosing between them is per instance, and that is the subject of the next sections.
Further Reading
This guide provides comprehensive coverage of SDP-based verification for neural networks. For readers interested in diving deeper, we recommend the following resources organized by topic:
SDP-Based Verification Foundations:
Raghunathan, Steinhardt and Liang introduced the lifted matrix formulation for this problem and showed that it can be considerably tighter than the linear relaxation on the networks they evaluated, at polynomial-time cost. That is a result about what the relaxation admits, not a comparison that settles every instance: whether the extra tightness is realised depends on the network, which is what the section on what lifting drops is about.
Convex Optimization Background:
For readers unfamiliar with semi-definite programming, CVXPY provides an accessible introduction to convex optimization and SDP solving with practical Python implementations. Understanding SDP fundamentals---positive semi-definiteness, matrix inner products, duality theory---is essential for applying SDP-based verification effectively.
Comparison with LP-Based Methods:
LP-based verification provides the baseline for comparison. SDP extends LP by adding PSD constraints that capture quadratic relationships. Understanding LP formulations helps clarify what additional tightness SDP provides and why it costs more computationally.
Comparison with Multi-Neuron Methods:
PRIMA and other multi-neuron relaxations offer an alternative path to tighter bounds: selectively add product terms rather than lifting the entire problem to . In practice, PRIMA with careful pair selection often matches SDP tightness at lower computational cost. The tradeoff is theoretical: SDP provides worst-case tightness guarantees, while PRIMA’s tightness depends on heuristic pair selection.
Bound Propagation Baselines:
Fast incomplete methods---CROWN, DeepPoly, IBP---provide the lower bound on the tightness-speed spectrum. SDP trades their speed for tighter bounds. Understanding these baselines clarifies when SDP’s extra cost is justified.
Complete Verification for Context:
When SDP is still too loose or you need definitive answers, complete methods are necessary. Marabou provides SMT-based complete verification. MILP approaches formulate verification as mixed-integer programming. Branch-and-bound combines incomplete bounds (potentially from SDP) with systematic refinement for completeness.
Related Topics:
For understanding the LP methods that SDP extends, see LP verification. For multi-neuron alternatives to SDP, see PRIMA verification. For complete methods that SDP might replace or feed into, see Marabou and Reluplex and branch and bound. For faster incomplete methods, see bound propagation. For understanding Lipschitz-based approaches that complement SDP, see Lipschitz verification.
Primary references:
- Raghunathan, Steinhardt and Liang, “Semidefinite relaxations for certifying robustness to adversarial examples”, NeurIPS 2018 https://arxiv.org/abs/1811.01057
- Dathathri et al., “Enabling Certification of Verification-Agnostic Networks via Memory-Efficient Semidefinite Programming”, NeurIPS 2020 https://arxiv.org/abs/2010.11645
- Fazlyab, Robey, Hassani, Morari and Pappas, “Efficient and Accurate Estimation of Lipschitz Constants for Deep Neural Networks”, NeurIPS 2019 https://arxiv.org/abs/1906.04893
- Zhang, Weng, Chen, Hsieh and Daniel, “Efficient Neural Network Robustness Certification with General Activation Functions”, NeurIPS 2018 https://arxiv.org/abs/1811.00866
- Singh et al., “An Abstract Domain for Certifying Neural Networks”, PACMPL (POPL) 2019 https://dl.acm.org/doi/10.1145/3290354
- Cousot and Cousot, “Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs”, POPL 1977 https://dl.acm.org/doi/10.1145/512950.512973