Second-Order Sensitivity Analysis for Bilevel Optimization

Robert Dyro, Edward Schmerling, Nikos Aréchiga, Marco Pavone

Abstract

In this work, we derive a second-order approach to bilevel optimization, a type of mathematical programming in which the solution to a parameterized optimization problem (the “lower” problem) is itself to be optimized (in the “upper” problem) as a function of the parameters. Many existing approaches employ first-order sensitivity analysis based on the implicit function theorem (IFT) to derive a gradient; this paper extends this to provide second-order derivative information (the IFT Hessian), enabling faster-converging second-order optimization methods. Our analysis shows that much of the computation used for the IFT gradient can be reused for the Hessian, and computing IFT Hessians can significantly reduce overall computation by extracting more information from each lower-level solve. We demonstrate the broad range of applications by applying it to least squares hyperparameter auto-tuning, multi-class SVM auto-tuning, and inverse optimal control.

Introduction

Bilevel optimization is a framework where one optimization problem (the "upper" problem) contains another optimization problem (the "lower" problem) as a constraint. This structure is ubiquitous in modern AI, appearing in hyperparameter tuning, meta-learning, and inverse optimal control. The core challenge is that the solution to the lower problem depends on the parameters in a complex, implicit way. While the Implicit Function Theorem (IFT) is commonly used to find first-order gradients, first-order methods like Gradient Descent can be slow to converge. To utilize faster second-order methods like Newton’s Method, the Hessian is required, but it has historically been considered too computationally expensive to derive and compute.

Methodology: The IFT Hessian

The authors extend standard sensitivity analysis to provide a Second-Order IFT. They derive a closed-form expression for the second derivative of the lower-level solution with respect to the parameters. A key insight is that the computational bottleneck for the Hessian is the same as for the gradient: a large matrix inversion or factorization. If the gradient has already been computed, much of the work for the Hessian is already done.

Figure 1: Comparison of the true loss landscape (blue) with the first-order IFT linear approximation (red) and the proposed second-order quadratic approximation (black). The quadratic approximation captures the local curvature much more accurately.

By using "sensitivity vectors," the complexity of the Hessian calculation scales quadratically with the number of parameters rather than cubically. Furthermore, the authors provide theoretical bounds on how error propagates when the lower-level solution is only approximate and show that using log-barrier functions can restore the smoothness needed for IFT in constrained problems.

Empirical Results

The method was evaluated on several tasks, including auto-tuning regression models on MNIST and tuning multi-class SVMs on Fashion-MNIST. The results demonstrate that the second-order approach (Sequential Quadratic Programming or SQP) requires significantly fewer evaluations of the expensive lower-level problem to converge compared to first-order optimizers like Adam or L-BFGS.

Figure 3: Convergence of test loss versus the number of lower-level solves (z* evaluations) for Ridge Regression (RR), Diagonal Tikhonov (diag), and Convolutional (conv) models. The proposed SQP method (black) converges significantly faster than first-order alternatives.

In the SVM tuning experiments, Newton's Method (enabled by this work) reached maximum test accuracy significantly faster in terms of wall-clock time. The visualization of the loss landscape confirms that the quadratic approximation accurately captures local curvature where first-order methods struggle.

Conclusion and Future Work

This research demonstrates that second-order sensitivity analysis is not only mathematically feasible but also computationally efficient. By extracting more information from each lower-level solve, the IFT Hessian drastically reduces the total computational budget required for complex optimization tasks. Future directions include investigating "truncated" versions of the IFT Hessian to further reduce costs and exploring more complex, constrained bilevel problems in robotics.

Summary updated

BibTeX
@inproceedings{dyro2022second,
  author = {Robert Dyro and Edward Schmerling and Nikos Aréchiga and Marco Pavone},
  title = {{Second-Order Sensitivity Analysis for Bilevel Optimization}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2022},
  url = {https://openreview.net/forum?id=PJpXDP-VDR},
}
Figure