Introduction
Integrating domain-specific knowledge into neural networks often involves embedding optimization problems—such as shortest-path solvers, physical simulations, or logic puzzles—as internal layers. This bi-level optimization approach allows models to respect hard constraints and structural priors. However, training these architectures is notoriously difficult. Many optimization problems, particularly those with discrete or combinatorial solutions, exhibit "degenerate" gradients: the output is either locally constant (zero gradient) or jumps discontinuously (undefined gradient). Standard backpropagation fails in these scenarios, as the chain rule cannot provide informative signals for weight updates.
The LPGD Framework
To address these challenges, we introduce Lagrangian Proximal Gradient Descent (LPGD), a unified framework for differentiating through optimization layers. Instead of attempting to compute the exact gradient of a potentially non-smooth or discontinuous loss function, LPGD optimizes a smoothed envelope of the loss.
Core Components
The framework relies on several key technical innovations:
- Lagrangian Divergence: A generalized distance metric that measures sub-optimality, replacing standard Euclidean distances to better suit constrained optimization landscapes.
- Lagrange-Moreau Envelopes: LPGD defines lower, upper, and average envelopes that approximate the true loss function. These envelopes are inherently smoother and easier to differentiate than the original objective.
- Perturbation-based Updates: A significant practical advantage of LPGD is its implementation simplicity. To compute a gradient update, the framework performs a "proximal" step by evaluating the forward solver on a slightly perturbed version of the input (e.g., $c + \tau \nabla \ell$). This treats the optimization layer as a black box, requiring only the ability to solve the forward problem.
Crucially, LPGD serves as a unifying theory. It demonstrates that several existing specialized methods—including Blackbox Backpropagation, SPO+, Direct Loss Minimization, and Fenchel-Young Losses—are specific instances of the LPGD framework under different parameter configurations.
Experimental Evaluation
We evaluated LPGD against standard Gradient Descent (GD) on two complex tasks: learning the rules of 9x9 Sudoku from board pairs and optimizing Markowitz Portfolios using historical trading data.
Key Results
In the Sudoku task, LPGD demonstrated superior convergence and computational efficiency. While standard GD struggled with the discrete nature of the constraints, LPGD converged to a significantly lower Mean Squared Error (MSE).
As shown in the performance metrics, LPGD achieves a much lower loss in fewer epochs and less total wall-clock time. A key factor in this efficiency is the warm-starting capability: because the backward pass involves solving a problem nearly identical to the forward pass, solvers can be initialized with the previous solution, drastically reducing backward computation time. In the Markowitz portfolio task, LPGD achieved a 35% improvement over baseline initialization, outperforming the 23% improvement seen with standard GD.
Insights and Limitations
LPGD's success stems from its use of finite perturbations ($\tau$). Unlike infinitesimal calculus, finite perturbations allow the gradient to "see" across local discontinuities, capturing structural information that local derivatives miss. Furthermore, the framework's robustness allows for higher learning rates without the instability or divergence common in standard bi-level optimization.
However, some limitations remain. The "augmented" version of LPGD requires solvers that can handle quadratic objectives, which may not be available for all specialized combinatorial solvers. Additionally, the performance of LPGD is sensitive to hyperparameters like the perturbation temperature $\tau$ and smoothing strength $\rho$. Future research into adaptive methods for automatically tuning these parameters during training will be essential for broader adoption.
Summary updated