Abstract
We show how to efficiently compute the derivative (when it exists) of the solution map of log-log convex programs (LLCPs). These are nonconvex, nonsmooth optimization problems with positive variables that become convex when the variables, objective functions, and constraint functions are replaced with their logs. We focus specifically on LLCPs generated by disciplined geometric programming, a grammar consisting of a set of atomic functions with known log-log curvature and a composition rule for combining them. We represent a parametrized LLCP as the composition of a smooth transformation of parameters, a convex optimization problem, and an exponential transformation of the convex optimization problem's solution. The derivative of this composition can be computed efficiently, using recently developed methods for differentiating through convex optimization problems. We implement our method in CVXPY, a Python-embedded modeling language and rewriting system for convex optimization. In just a few lines of code, a user can specify a parametrized LLCP, solve it, and evaluate the derivative or its adjoint at a vector. This makes it possible to conduct sensitivity analyses of solutions, given perturbations to the parameters, and to compute the gradient of a function of the solution with respect to the parameters. We use the adjoint of the derivative to implement differentiable log-log convex optimization layers in PyTorch and TensorFlow. Finally, we present applications to designing queuing systems and fitting structured prediction models.
Introduction
In many engineering and machine learning tasks, solving an optimization problem is only the first step. Often, researchers and engineers need to understand how the solution changes in response to tweaks in input parameters—a process known as sensitivity analysis. While sensitivity analysis is well-understood for standard convex programs, it is significantly more complex for Log-Log Convex Programs (LLCPs).
LLCPs, which include the well-known class of Geometric Programs (GPs), are technically non-convex and frequently non-smooth. However, they possess a "hidden" convex structure: if the variables, objective functions, and constraints are replaced with their logarithms, the problem becomes convex. This paper introduces a general, efficient, and software-integrated method to differentiate through the solution map of these broader LLCP classes.
Methodology
The core contribution of this work is the representation of the LLCP solution map as a composition of three distinct stages, allowing for the application of the chain rule to compute derivatives.
- Canonicalization ($\mathcal{C}$): This stage involves a smooth transformation that maps the LLCP's high-level parameters (such as coefficients and exponents) into the parameters of a standard cone program.
- Convex Solve ($\phi$): The resulting convex problem is solved. To differentiate through this step, the authors utilize recent breakthroughs in differentiating through cone programs. This involves applying the implicit function theorem to the optimality conditions (KKT conditions) of the problem.
- Recovery ($\mathcal{R}$): Finally, an exponential transformation converts the convex solution back into the original variable space of the LLCP.
By differentiating through this pipeline, the method can compute the derivative of the final solution with respect to the initial parameters. To ensure memory efficiency, the implementation utilizes abstract linear operators, avoiding the need to store large, dense derivative matrices.
Disciplined Geometric Programming (DGP)
The method relies on the Disciplined Geometric Programming (DGP) grammar. DGP is a set of formal rules that ensures a problem is log-log convex. By adhering to this grammar, users are guaranteed that their problems can be solved globally and, crucially, differentiated using the proposed framework. This integration into the CVXPY ecosystem allows for a "zero-overhead" domain-specific language (DSL). By caching the mapping between the high-level description and the low-level solver data, the overhead of using CVXPY is kept to less than 1% of the total computation time.
Experimental Results
The authors evaluated the method across several structured numerical experiments, focusing on speed, accuracy, and practical application.
Computational Performance
In a synthetic GP instance involving 5,000 variables and over 25,000 parameters, the method demonstrated remarkable efficiency. While the initial solve took approximately 2.7 seconds, computing the derivative or its adjoint (the "backward pass") required only 3ms to 20ms. This suggests that in many contexts, the gradient computation is essentially "free" relative to the cost of the forward solve.
Sensitivity Analysis in Queuing Systems
To test accuracy, the authors performed a sensitivity analysis on a numerical model of an M/M/N queuing system. The first-order approximation provided by the derivative closely matched the "true" change observed by re-solving the entire problem with perturbed parameters. For instance, the method predicted a 2.3% change in the solution where the actual change was 2.0%.
Structured Prediction and Deep Learning
The framework enables the creation of differentiable log-log convex optimization layers in PyTorch and TensorFlow. In a structured prediction task using a synthetic dataset, an LLCP layer was used to enforce a monotonicity constraint. While a standard least-squares approach violated this constraint, the LLCP layer successfully enforced it, resulting in a significantly lower validation error (0.0077 compared to 0.014).
Discussion and Limitations
While the method provides a robust path for differentiating through LLCPs, certain limitations remain. The derivative only exists when the solution map is single-valued and meets specific regularity conditions. There are "pathological cases" where the solution may not be differentiable, the formal characterization of which is a subject for future research. Additionally, the efficiency of the forward pass remains dependent on the underlying convex solver (such as SCS or ECOS), which can become a bottleneck for extremely large-scale problems. Finally, the DGP grammar imposes specific rules on parameters—such as exponents in power atoms—to maintain log-log convexity, which may restrict certain model architectures.
Conclusion
By providing an efficient, analytical method for differentiating through LLCPs and integrating it into popular optimization and deep learning libraries, this work opens new doors for end-to-end learning through complex, non-convex constraints. It bridges the gap between high-level modeling and high-performance gradient-based optimization, making sensitivity analysis and optimization layers accessible for a wide range of engineering applications.
Summary updated