Quadratic Programs (QPs) are the mathematical backbone of everything from high-frequency trading to robotic motion planning. To solve these at scale, researchers often turn to first-order methods like the Alternating Direction Method of Multipliers (ADMM). While ADMM is computationally efficient per iteration, its overall convergence speed depends heavily on a step-size parameter called $\rho$.
Currently, choosing $\rho$ is a bit of a "dark art." Solvers typically rely on either solving a secondary, complex optimization problem to find the theoretical optimum, or using simple hand-crafted heuristics that balance primal and dual residuals. While robust, these heuristics often leave significant performance on the table. To address this, researchers introduce RLQP, a novel approach that uses Reinforcement Learning (RL) to dynamically tune the internal hyperparameters of the OSQP solver, achieving up to a 3x speedup in convergence time.
RLQP: Optimization as an MDP
The core insight of RLQP is treating the optimization process as a Markov Decision Process (MDP). The trajectory of an optimization algorithm is essentially a state-space path that can be optimized. In this framework, the "Agent" is a neural network policy, and the "Environment" is the internal state of the OSQP solver.
- The RL Agent: The system uses Twin-Delayed DDPG (TD3), an actor-critic algorithm well-suited for the continuous action space of parameter tuning.
- State and Reward: The policy observes features like primal/dual residuals, dual variables ($y$), and the distance of variables ($z$) from their constraint bounds. The agent receives a simple reward of $r = -1$ for every iteration until the problem is solved, directly incentivizing it to minimize solve time.
- Policy Formulations: The authors explore two approaches. Scalar Adaptation outputs a single global $\rho$ value. Vector Adaptation provides fine-grained control by updating individual $\rho_i$ values for every single constraint. To handle varying numbers of constraints, the vector approach uses a shared policy across constraints and ensures permutation invariance using techniques borrowed from Graph Neural Networks.
Key Insights and Performance
The model was trained and evaluated on a diverse set of benchmarks, including the OSQP Benchmark Suite, QPLIB, Netlib LP, and the Maros-Mészáros problems.
Generalization is Possible: One might expect an RL agent trained on "Random" QPs to fail on structured "Portfolio" QPs. However, by using normalized, log-scaled, and permutation-invariant features, the policy learns fundamental properties of the ADMM algorithm that apply across different problem structures.
Fine-Grained Control Wins: The vector adaptation (tuning $\rho$ per constraint) significantly outperformed the scalar version, suggesting that different constraints "bottleneck" the optimization at different stages.
Speedup and Warm-Starting: On standard benchmarks, RLQP reduced the number of iterations required to reach high-accuracy solutions by up to 3x compared to the standard OSQP heuristic. Furthermore, RLQP maintains the "warm-start" capability of OSQP, making it highly effective for Model Predictive Control (MPC) where solvers are run repeatedly on slightly changing problems. In zero-shot generalization tests on unseen datasets, RLQP was 1.8x faster than OSQP on the Maros-Mészáros dataset and 1.3x faster on the Netlib LP suite.
Limitations and Future Directions
To keep the solver fast, the authors used very small neural networks (3 layers of 48 neurons), ensuring the time spent on RL inference doesn't outweigh the time saved by reducing iterations. However, for extremely small problems where OSQP finishes in microseconds, the overhead of calling a neural network might still slow things down.
Additionally, training the RL policy is computationally expensive, making it a "train once, use many times" solution. While the policy is dimension-invariant, performance can dip if the test problem's dimensions are orders of magnitude larger than the training set. Future work may explore Hierarchical RL to decide when to adapt parameters (rather than every $N$ iterations) and Meta-Learning to allow the solver to adapt to specific problem classes on the fly.
Summary updated