Backpropagation of Unrolled Solvers with Folded Optimization

James Kotary, My H. Dinh, Ferdinando Fioretto

Introduction

Integrating optimization problems directly into neural networks as "layers" allows models to respect hard constraints and domain-specific logic. This capability is crucial for applications ranging from physics-informed machine learning to financial portfolio management. However, backpropagating through these layers—calculating how the solution to an optimization problem changes with respect to its input parameters—is notoriously difficult.

In their paper, "Backpropagation of Unrolled Solvers with Folded Optimization," James Kotary and colleagues introduce Folded Optimization, a framework that treats the backward pass of an iterative solver as a linear fixed-point problem. This approach offers a faster, more flexible middle ground between traditional unrolling and analytical differentiation.

The Challenge of Differentiable Optimization

To train a network with an optimization layer, one needs the gradient of the solution $x^\star$ with respect to the input parameters $c$. Currently, two main strategies dominate:

  1. Algorithm Unrolling: This involves treating every iteration of an optimization algorithm (e.g., Gradient Descent) as a layer in the network and applying Automatic Differentiation (AD). While flexible, it is memory-intensive and prone to vanishing or exploding gradients.
  2. Analytical Differentiation: This uses the Implicit Function Theorem to find the derivative at the optimal point. While memory-efficient, it is often "rigid," requiring the problem to be convex and forcing the use of specific, sometimes slower, solvers.

The gap lies in the need for a method that combines the flexibility of unrolling with the efficiency of analytical differentiation, particularly one that can leverage high-performance black-box solvers.

Methods: Fixed-Point Folding

The authors bridge this gap by demonstrating that backpropagating through an unrolled solver is mathematically equivalent to solving a specific linear system—the differential fixed-point conditions.

Evolution of the framework from unrolling to fixed-point folding.

As illustrated in the figure above, the framework evolves through three stages:

  • Unrolling: Every operation is recorded on the computational graph.
  • Unfolding: Segments of the graph are replaced with analytical derivatives of sub-problems.
  • Fixed-Point Folding: The forward pass is handled by a black-box solver (like Gurobi). The backward pass then iteratively solves the linear system derived from the solver's update rule.

By focusing on the "fixed point" (the optimal solution), the authors prove that the backward pass converges correctly even if the forward and backward passes are disentangled. This allows researchers to wrap existing solvers into differentiable layers using the fold-opt library.

Key Insights

  • The Equivalence Principle: The core theoretical contribution is the proof that unrolling is essentially an iterative linear solver for the implicit derivative. This justifies replacing a complex unrolled graph with a clean, iterative linear system.
  • Disentangling the Passes: Because the backward pass only depends on the fixed point, one can use a world-class solver for the forward pass and a simple Jacobian-based iteration for the backward pass.
  • Breaking the Convexity Barrier: Unlike standard frameworks like cvxpy, Folded Optimization can differentiate through local optima of non-convex problems, provided the update function is differentiable at that point.

Experimental Results

The authors evaluated Folded Optimization across tasks including non-convex bilinear programming, Total Variation (TV) denoising, and portfolio optimization.

Performance Gains

The experiments demonstrated significant gains in both speed and expressiveness. For TV denoising, the folded solver (f-FDPG) was up to 40 times faster than standard differentiable quadratic programming (QP) solvers. In portfolio optimization, Folded Optimization outperformed cvxpy because it could utilize more accurate solvers that do not require approximating the problem into "canonical forms."

Non-convex Optimization

The paper provides a pioneering demonstration of decision-focused learning with non-convex decision models. As shown in the regret curves below, the integrated approach significantly reduces test-set regret compared to traditional two-stage models.

Regret curves comparing two-stage and integrated decision models in non-convex settings.

Conclusion and Future Work

Folded Optimization provides a powerful tool for building differentiable optimization layers. While the method's speed is tied to the spectral radius of the update function's Jacobian, it opens the door to using sophisticated black-box solvers in end-to-end learning pipelines. Future work may explore more advanced linear system solvers to further accelerate the backward pass.

For implementation, the authors have released the fold-opt Python library to automate the creation of these folded layers.

Summary updated

BibTeX
@inproceedings{kotary2023backpropagation,
  author = {James Kotary and My H. Dinh and Ferdinando Fioretto},
  title = {{Backpropagation of Unrolled Solvers with Folded Optimization}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2023},
  doi = {10.24963/ijcai.2023/218},
}
Figure