Table of Contents
Fetching ...

A Fully First-Order Layer for Differentiable Optimization

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

TL;DR

The paper tackles the core bottleneck of differentiable optimization layers by removing Hessian-based hypergradient computations. It reframes the inner optimization as a bilevel problem and introduces an active-set Lagrangian hypergradient oracle that relies solely on first-order information, achieving near-constant inner-update cost and an overall $\tilde{O}(\delta^{-1}\epsilon^{-3})$ convergence rate. An objective-agnostic FFOLayer is implemented as a PyTorch module, along with a finite-difference hypergradient approximation, enabling drop-in replacement for existing solvers with minimal problem-specific customization. Empirical results on synthetic decision-focused tasks and Sudoku show competitive optimization performance and substantially faster backward passes compared to Hessian-based baselines, underscoring practical scalability for differentiable optimization in large-scale models.

Abstract

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 $\tilde{\oo}(1)$ time, leading to an overall complexity of $\tilde{\oo}(δ^{-1}ε^{-3})$ 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. Our code is available here: https://github.com/guaguakai/FFOLayer.

A Fully First-Order Layer for Differentiable Optimization

TL;DR

The paper tackles the core bottleneck of differentiable optimization layers by removing Hessian-based hypergradient computations. It reframes the inner optimization as a bilevel problem and introduces an active-set Lagrangian hypergradient oracle that relies solely on first-order information, achieving near-constant inner-update cost and an overall convergence rate. An objective-agnostic FFOLayer is implemented as a PyTorch module, along with a finite-difference hypergradient approximation, enabling drop-in replacement for existing solvers with minimal problem-specific customization. Empirical results on synthetic decision-focused tasks and Sudoku show competitive optimization performance and substantially faster backward passes compared to Hessian-based baselines, underscoring practical scalability for differentiable optimization in large-scale models.

Abstract

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 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. Our code is available here: https://github.com/guaguakai/FFOLayer.

Paper Structure

This paper contains 28 sections, 16 theorems, 58 equations, 3 figures, 1 algorithm.

Key Result

Theorem 4.1

For any given $\bar{x}$, let $\tilde{F}$ be constructed as in prob:ghost. Then $\nabla F(\bar{x})=\nabla \tilde{F}(\bar{x})$.

Figures (3)

  • Figure 1: Drop-in usage of our FFOLayer with the same interface as CvxpyLayer, mapping a CVXPY problem to a parameterized differentiable optimization layer in PyTorch.
  • Figure 2: Training convergence for the synthetic DFL task and Sudoku task.
  • Figure 3: Computation costs for the synthetic DFL task and Sudoku task.

Theorems & Definitions (29)

  • Theorem 4.1
  • proof
  • Theorem 4.4
  • Corollary 4.5
  • Theorem 4.7
  • Lemma A.1
  • proof
  • Lemma A.2
  • proof
  • Lemma A.3
  • ...and 19 more