A General and Streamlined Differentiable Optimization Framework

Andrew W. Rosemberg, Joaquim Dias Garcia, François Pacaud, Robert B. Parker, Benoît Legat, Kaarthik Sundar, Russell Bent, Pascal Van HentenryckarXiv 2025 · DOI

Introduction

In the evolving landscape of machine learning and engineering, the integration of optimization problems as differentiable layers within larger computational pipelines has become a critical frontier. This paper presents an updated version of DiffOpt.jl, a framework developed within the Julia programming language. The primary objective of DiffOpt.jl is to transition "differentiable optimization" from a niche research capability into a standard, accessible tool for researchers and practitioners. By bridging the gap between high-level mathematical modeling and low-level sensitivity analysis, the framework enables the embedding of complex, potentially nonconvex optimization problems directly into gradient-based learning and control systems.

The Challenge: The Interface Mismatch

Modern "end-to-end" learning often requires treating an optimization problem—such as finding an optimal robot trajectory or a financial portfolio—as a single node in a neural network. To train such networks, one must compute how the solution of the optimization problem changes in response to changes in its input parameters. While the mathematical foundation for this—the Implicit Function Theorem (IFT)—has been established for decades, its practical implementation is notoriously difficult.

Existing tools often suffer from an "interface mismatch." They are frequently limited to specific problem types (e.g., convex quadratic programs) or require users to manually track the relationship between high-level parameters and low-level constraint matrices. This "brittle bookkeeping" makes it nearly impossible to scale differentiable optimization to complex, industrial-grade pipelines. DiffOpt.jl addresses this by automating the sensitivity analysis process through a parameter-centric abstraction.

Methodology

The framework's core functionality relies on differentiating the Karush-Kuhn-Tucker (KKT) conditions, which represent the necessary requirements for a point to be an optimal solution.

1. Implicit Function Theorem (IFT)

By treating the KKT conditions as a system of nonlinear equations, the authors apply the IFT to compute how optimal primal and dual variables shift when parameters are perturbed. This allows the system to propagate gradients through the optimization layer.

2. Parameter-Centric API

The most significant software innovation is the introduction of a Parameter abstraction. Instead of requiring derivatives with respect to specific matrix indices, users define high-level parameters (e.g., demand or risk_limit). The framework automatically tracks how these parameters flow through the model, even if they appear simultaneously in the objective function and multiple constraints.

3. Support for Nonconvex and Nonlinear Programs

While previous iterations focused on convex conic problems, the updated DiffOpt.jl supports general smooth Nonlinear Programs (NLPs). It achieves this by operating on the local optima provided by standard solvers like Ipopt, extending the utility of differentiable optimization to a much broader class of engineering problems.

4. Forward and Reverse Mode Differentiation

The system is designed to support both forward-mode sensitivity (determining how the solution changes given an input change) and reverse-mode sensitivity (determining how to adjust inputs to achieve a desired output change). This dual support is essential for integration with modern automatic differentiation (AD) libraries.

Case Studies and Results

The framework was validated through several distinct applications, demonstrating its versatility across different domains:

  • Robotics: In a study of nonlinear robot inverse kinematics for a 2-link planar arm, the framework was used to map the "spectral-norm heat-map" of the workspace. This allowed for the identification of "near-singular" poses where the robot's control becomes unstable.
  • Finance: The authors applied the framework to Mean-Variance Portfolio Optimization. They demonstrated that a risk-tolerance parameter could be automatically tuned to minimize out-of-sample loss, effectively transforming a manual hyperparameter tuning task into an automated, gradient-based process.
  • Optimal Power Dispatch: The framework successfully handled synthetic energy grid models, proving its capability in large-scale infrastructure modeling.

From a performance standpoint, DiffOpt.jl leverages solver-side linear algebra, such as LU factorizations. This allows it to compute sensitivities efficiently by solving a single linear system rather than re-solving the entire optimization problem, significantly reducing computational overhead.

Key Insights and Limitations

The primary insight of this work is that the bottleneck in differentiable optimization is not the underlying theory, but the lack of usable software abstractions. By integrating with JuMP.jl (Julia’s standard modeling language), DiffOpt.jl makes differentiation a "first-class citizen" in the optimization workflow.

However, several limitations remain. The current methodology assumes "KKT-regularity," meaning it may struggle with degenerate solutions where constraints are redundant or multiple optima exist. Furthermore, the framework does not yet support nonsmooth regimes or mixed-integer programming (MIP), where discrete choices create discontinuities. Future work will focus on tighter solver integration to further accelerate computations for massive-scale problems and exploring methods to handle nonsmoothness.

Summary updated

BibTeX
@misc{rosemberg2025general,
  author = {Andrew W. Rosemberg and Joaquim Dias Garcia and François Pacaud and Robert B. Parker and Benoît Legat and Kaarthik Sundar and Russell Bent and Pascal Van Hentenryck},
  title = {{A General and Streamlined Differentiable Optimization Framework}},
  year = {2025},
  eprint = {2510.25986},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.25986},
}
Figure