Differentiation Through Black-Box Quadratic Programming Solvers
Connor W. Magoon, Fengyu Yang, Noam Aigerman, Shahar Z. Kovalsky
TL;DR
The paper tackles differentiating the solution of Quadratic Programs (QPs) with respect to problem parameters in a solver-agnostic, modular fashion. It introduces dQP, a differentiable layer built on a local active-set analysis that reduces the problem to a single symmetric linear system, enabling closed-form derivative computation after a forward solve with any QP solver accessible via qpsolvers. The key contributions include a rigorous active-set based sensitivity framework, a locally equivalent equality-constrained reformulation, explicit derivative formulas, and an open-source PyTorch implementation compatible with 15+ solvers. Empirical results show strong robustness and scalability, especially for large-scale sparse QPs and bi-level geometry optimization, outperforming several existing differentiable QP methods on CPU. This approach significantly broadens the applicability of differentiable optimization in neural networks and bi-level optimization by decoupling optimization from differentiation and enabling solver flexibility.
Abstract
Differentiable optimization has attracted significant research interest, particularly for quadratic programming (QP). Existing approaches for differentiating the solution of a QP with respect to its defining parameters often rely on specific integrated solvers. This integration limits their applicability, including their use in neural network architectures and bi-level optimization tasks, restricting users to a narrow selection of solver choices. To address this limitation, we introduce dQP, a modular and solver-agnostic framework for plug-and-play differentiation of virtually any QP solver. A key insight we leverage to achieve modularity is that, once the active set of inequality constraints is known, both the solution and its derivative can be expressed using simplified linear systems that share the same matrix. This formulation fully decouples the computation of the QP solution from its differentiation. Building on this result, we provide a minimal-overhead, open-source implementation ( https://github.com/cwmagoon/dQP ) that seamlessly integrates with over 15 state-of-the-art solvers. Comprehensive benchmark experiments demonstrate dQP's robustness and scalability, particularly highlighting its advantages in large-scale sparse problems.
