WorksComputer Science
Efficient Learning of Differentiable MPC Policies on the GPU via Smoothed ADMM and First-Order Reinforcement Learning
Abstract
Differentiable model predictive control (MPC) enables structured, constraint-aware policies to be optimized end-to-end. However, learning MPC policies faces two bottlenecks: (1) nonsmooth sensitivities at active-set transitions and (2) expensive policy evaluation, since each requires an optimization solve. We first introduce SmoothedTurboMPC, a GPU-parallel differentiable MPC solver combining sequential quadratic programming (SQP) with a log-barrier-smoothed alternating direction method of multipliers (ADMM) inner solver. Its design enables smooth gradients, exact sensitivities at convergence, and efficient execution on GPUs. Second, to efficiently train MPC policies, we pair our solver with first-order reinforcement learning (FORL) using Short-Horizon Actor-Critic (SHAC), which reuses rollout MPC solutions instead of repeatedly re-evaluating them. Comparisons with state of the art solvers show that the approach achieves up to higher end-to-end training throughput. On a vehicle racing task, our method achieves higher returns than MPC PPO with a speedup, training on 3.3 million transitions in only 7 minutes. Finally, we use the framework to train a more reliable MPC racing policy via RL with domain randomization, and validate it on a full-scale race car. We integrate our advances into the open-source TurboMPC solver.
Code: https://github.com/ToyotaResearchInstitute/turbompc
Video: https://www.youtube.com/watch?v=aUvfUL85Mcg
Introduction
Model predictive control (MPC) is an attractive structured policy class for learning-based control. By solving optimization problems in real time, MPC incorporates model knowledge, plans over a finite horizon, and explicitly handles state and input constraints. Learning can adapt MPC cost and model parameters to task distributions while retaining this structure, with potential benefits for adaptation, generalization, and robustness [1, 2, 3, 4]. Differentiable MPC further enables these policies to be optimized end-to-end by combining an MPC solve (the forward pass) with sensitivities of its solution map to policy parameters (the backward pass) [5, 6, 7, 8, 9].
Two obstacles limit efficient learning with differentiable MPC. 1) Nonsmooth sensitivities. The solution of MPC’s underlying constrained nonlinear program (NLP) becomes nonsmooth as the constraint active set changes, resulting in discontinuous or noisy gradients near constraint boundaries [8], [10], [11], hindering learning. Existing methods primarily address this via log-barrier interior-point methods (IPMs) [7], [8], [10]. 2) Expensive policy evaluation. Evaluating a neural network policy is cheap, whereas evaluating an MPC policy requires an optimization solve. RL-MPC methods that repeatedly re-evaluate the policy on collected data reduce environment interactions, but overall increase training time because MPC solves can be expensive.
In this work, we co-design a differentiable MPC solver with its learning pipeline (Figure 1) to address these bottlenecks:
Figure 1. Overview. (Top) The proposed differentiable MPC solver uses log-barrier regularization to return smooth gradients. A first-order RL framework is co-designed to enable efficient RL training of MPC policies end-to-end. (Bottom) The resulting framework with domain randomization enables reliable vehicle racing of an MPC controller with a neural network cost map.
A log-barrier-smoothed SQP-ADMM differentiable solver. We introduce SmoothedTurboMPC, a GPU-parallel differentiable MPC solver that builds on TurboMPC [12] and returns smooth gradients, SmoothedTurboMPC replaces its projection-based inequality update with a log-barrier proximal update, enabling efficient solves while enforcing perturbed complementarity. To the best of our knowledge, this is the first integration of log-barrier smoothing with ADMM [13] for differentiable nonlinear MPC, providing a smooth implicit sensitivity model throughout SQP and exact smoothed-NLP sensitivities at convergence through implicit differentiation.
**A computation-efficient RL pipeline for differen-
Toyota Research Institute provided funds to support this work, but this article solely reflects the opinions and conclusions of its authors.
This project was supported by the National Science Foundation (Awards 2411369, 2535096). The opinions, findings, conclusions, and recommendations are those of the authors and do not necessarily reflect those of the funding organizations. tiable MPC. We pair SmoothedTurboMPC with solve-efficient FORL using Short-Horizon Actor-Critic (SHAC) [14], [15]. Our pipeline retains rollout MPC solutions for a single first-order policy update rather than repeatedly re-evaluating the policy on collected states.
Together, these choices enable efficient MPC policy learning. Across differentiable MPC benchmarks, SmoothedTurboMPC achieves up to 4.4× higher end-to-end training throughput. In simulated autonomous racing, MPC-SHAC achieves higher returns than PPO and a 46× wall-clock speedup, training 3.3 million steps in only 7.0 minutes. We deploy the learned policy on a full-scale Lexus LC500 in closed-course racing with a puddle at a corner’s entry or exit. Both controllers approach the puddle at comparable speeds, the learned policy completes all four trials, including 12 puddle passes, while the nominal MPC spins out in all four trials.
Background
Differentiable Optimization through Implicit Differentiation
MPC repeatedly solves optimization problems to compute control inputs actuating the system. Thus, learning with MPC policies requires a method for computing the gradients of the solutions to optimization problems, which we describe next.
At each control step, MPC solves a nonlinear program (NLP) of the form:
where are the decision variables, and define the constraints, and denotes problem parameters (e.g., cost weights). For multipliers , the Lagrangian of the NLP is:
Introducing slack variables , and defining and the Jacobians and , the Karush-Kuhn-Tucker (KKT) conditions [16] of the NLP are:
with , , and the elementwise product .
The solution of the NLP depends on the parameters . Implicit differentiation techniques [5]–[10] compute the gradient of this solution by differentiating the KKT conditions (3). Writing (3) as a root-finding problem , let , if is nonsingular at , the implicit function theorem (IFT) yields a locally unique map with
Learning introduces an outer scalar task loss , evaluated at the NLP solution, yielding the bilevel problem:
Assuming depends on only through , its parameter gradient can be computed without explicitly forming .
Let denote the Lagrangian Hessian evaluated at . We define the adjoint variables by:
with , . The outer gradient is thus:
Active-Set Changes and Barrier Smoothing
At an active-set transition where strict complementarity fails for constraint , both and . The column of in (6) associated with the th inequality multiplier then vanishes, making the KKT Jacobian singular and the standard IFT sensitivity undefined [5], [8]. This can produce discontinuous solution sensitivities as constraints enter or leave the active set. Log-barrier smoothing avoids this by replacing hard complementarity, , with a perturbed condition [8], [10]:
The barrier parameter trades approximation of the original NLP for smoothness. As , the perturbed problem approaches the hard-constrained problem, while prevents and from simultaneously vanishing.
We illustrate this change’s effect on learning via a double-integrator example, where the state is position and velocity, and input is acceleration. We learn a scalar tracking weight over horizon and choose an unreachable reference under the control bound to induce active-set changes. For fixed and initial state , the inner problem is
The outer objective evaluates the resulting plan with different tracking and control-effort weights,
We choose and , so learning balances tracking accuracy against control effort. We apply gradient descent with from .
Let denote the outer loss induced by the barrier-smoothed inner problem, with denoting the original hard NLP. Figure 2(a),(b) shows that the hard problem exhibits kinks in and jumps in its gradient at active-set changes, while increasing smooths these transitions. Consequently, the hard and weakly smoothed problems stall under gradient descent, whereas sufficient smoothing crosses the active-set transitions and converges to from both initializations (Figure 2(c)), accelerating convergence (Figure 2(d)). This example motivates log-barrier smoothing for more reliable gradient-based learning of MPC parameters.

Figure 2. Double-integrator parameter learning from . Barrier smoothing rounds active-set kinks in the outer loss (a) and gradient (b). This allows gradient descent to reach from both initializations (c) and accelerates convergence (d).
SmoothedTurboMPC: Smoothed SQP–ADMM
We propose an efficient solver returning smooth gradients, by incorporating log-barrier smoothing into TurboMPC’s SQP–ADMM solver [12]. Two design choices ensure efficient solves. First, in the SQP loop, we keep the log smoothing term when formulating the convex problems, instead of formulating a quadratic approximation. Second, the inner ADMM solver uses a custom splitting with a closed-form log-barrier proximal update to handle the log smoothing term for efficient updates.
Smoothed SQP Formulation
We incorporate log-barrier smoothing into TurboMPC’s SQP–ADMM solver [12]. For a fixed barrier parameter , we consider the smoothed NLP [8, 10],
Stationarity with respect to gives , replacing hard complementarity with , .
At each SQP iterate , we form a quadratic model of the original objective and linearize the constraints and [16], retaining the convex log-barrier term exactly:
Here and are evaluated at , approximates the Lagrangian Hessian, typically Gauss–Newton [16]. We define,
Although the retained log barrier makes (12) nonquadratic, the subproblem remains convex, enabling efficient ADMM updates through operator splitting [13, 17].
SAQP: Smoothed ADMM QP Solver
We solve (12) using SAQP (smoothed ADMM QP), which replaces the inequality projection in standard ADMM with a closed-form log-barrier proximal update (Algorithm 1). SAQP is the inner QP solver of SmoothedTurboMPC, whose outer SQP loop solves the smoothed NLP (11). We stack the constraint matrices, , and introduce . The constraint gives the equivalent split problem,
Here if , and otherwise. We use multipliers and a block-diagonal ADMM penalty , with . Following the over-relaxed ADMM updates of [12, 17], regularizes the primal solve and controls over-relaxation. We use the convergence check and adaptive update from [12].
SAQP updates: SAQP modifies standard ADMM’s slack update, replacing the projection with a closed-form update resulting from applying the proximal operator to the log-barrier term [13, 17]. One ADMM iteration is
Primal update
Log-barrier slack update
Dual update
(16) solves the proximal problem componentwise:
With , stationarity gives . Its positive root is
Remark 1 (Per-iteration smoothed complementarity). For , and , so the slack update is smooth and yields . Together with the dual update, it gives
Smoothed complementarity holds after every ADMM iteration within a SAQP solve for the split slack .
Remark 2 (Recovery of original NLP and QP). As , smoothed complementarity recovers , and any finite limit of smoothed KKT solutions satisfies the original NLP-KKT conditions [8, 10]. The smoothed subproblem recovers
For fixed , , so the slack update recovers the standard ADMM projection [17].
Remark 3 (Two-sided constraints). MPC constraints are often two-sided, , e.g., representing input and track bounds. Instead of stacking them as , which doubles the number of inequality rows, SmoothedTurboMPC applies the barrier per row, with and . The slack update (18) then becomes the unique root of a strictly monotone scalar equation. We compute it elementwise with a fixed number of safeguarded Newton steps, warm-started from , to machine precision (Appendix B). Remarks 1–2 hold per bound, and recovers the box projection of [17].
Implicit Differentiation and GPU Computation
For the backward pass (Algorithm 2), we use the exact NLP Lagrangian Hessian .
The KKT system of the smoothed subproblem (12):
At SQP convergence, (13) makes this residual equal to the smoothed NLP-KKT residual:
Assume twice continuously differentiable problem data, linear independence constraint qualification (LICQ), and second-order sufficient conditions (SOSC) for the smoothed problem at this solution. Together with and , these conditions make the KKT Jacobian nonsingular [8]. With the exact Hessian, the QP and NLP KKT linearizations coincide at convergence, yielding matching sensitivities of a locally solution map.
We exploit stagewise sparsity and batch parallelism to compute both solver passes efficiently on GPUs.
Forward pass. For fixed QP data and , the stage-sparse matrix in (15) is constant, enabling reuse of its factorization across iterations. The elementwise slack update preserves the per-iteration complexity of standard ADMM.
Backward pass. Eliminating , with , from (6) yields
where provides continuously varying inequality weights. With , the parameter VJP is
For cost-only parameters, the last two terms vanish.
Both systems retain the MPC problem’s stagewise sparsity. We refer readers to [12, 18, 19] for numerical methods that exploit this structure. SmoothedTurboMPC reuses TurboMPC’s structured GPU kernels and solves independent problems in parallel across the batch [12].
Remark 4 (MPC feasibility during training). To prevent inequality constraints from making MPC infeasible as the policy changes during training, we relax them to and add the penalty , , to the objective [20]. The slack update (16) remains closed form with , , and . The backward weights (24) become .
Efficient Reinforcement Learning with SmoothedTurboMPC
Next, we co-design the RL framework to enable efficient training of differentiable MPC policies.
MPC Policies for Reinforcement Learning
MPC policies incorporate model knowledge and explicit constraints through an optimal control problem (OCP) [12]:
Here are predicted states and controls, is the initial state, is the horizon, and specify costs, dynamics, and constraints. The policy applies the first control and then resolves (26) for the new at the next control step.
Given environment state , a neural network with weights predicts state-dependent MPC parameters . For exploration, we use a Gaussian policy [21]:
where is the exploration covariance. RL optimizes to maximize , with reward and discount . Differentiating the MPC solution map provides policy sensitivities to the learned parameters and initial state, enabling gradient propagation through both the parameter network and closed-loop rollouts.
The Computational Cost of Learning MPC Policies
For an MPC policy, each action evaluation requires a forward optimization solve, while differentiating that action requires a backward pass. Consequently, reusing collected states after the policy changes requires additional MPC solves.
We compare three learning strategies: FORL, which differentiates a rollout for one policy update [14]; PPO, which reuses on-policy data over multiple optimization epochs [21, 22]; and off-policy actor–critic methods, which repeatedly sample replayed states for critic and actor updates (e.g., TD3, SAC) [23, 24, 25].
We approximate the computation of one learning iteration:
where , , and are the average costs of an environment step, MPC forward solve, and MPC backward pass. The subscript terms count each operation.
SmoothedTurboMPC (Differentiable MPC Solver)
Alg. 1 SAQP (Smoothed QP Solver)
// Inner solve at each SQP iteration of the forward pass.
Inputs: P, q, A, c, h, σ, ρ̄_f, ρ_g, α, κ
Initial guess: x^0, z^0, y^0
1: while not converged do
2: Primal update Eq. 15a
3: Log-barrier slack update Eq. 15b
4: Dual update (15c) ▷ Smoothed complementarity holds
5: Check convergence; Update ρ [12]
6: Return: forward iterate ŵ
Alg. 2 Smoothed VJP (Backward Pass)
// Inputs: ŵ, θ, ∇_x L
1: Form exact-Hessian smoothed KKT linearization
2: Solve reduced adjoint system for (λ_x, λ_f) Eq. 22
3: λ̄_g ← W^{-1}Gλ_x
4: Compute parameter VJP Eq. 23
5: Return: gradient ∇_θ L
Alg. 3 FORL with SmoothedTurboMPC
// Inputs: π_ϕ, Σ, V_ψ, V_{\barψ}, env, T
Initialize: s_0 ← reset(B); seed warm plans
1: while training do
2: for t = 0, ..., T − 1 do
3: θ_t ← π_ϕ(s_t)
4: (x^*, u^*, y^*) ← SQP Inner: Alg. 1
5: a_t ∼ N(u_0^*, Σ) Eq. 25
6: (s_{t+1}, r_t) ← env(s_t, a_t)
7: Accumulate bootstrapped J(ϕ) Eq. 27
8: Shift warm plans; reset finished rows
9: Actor update: backpropagate through environment and the MPC solution map
Backward: Alg. 2
10: Critic update: fit TD(λ), update V_{\barψ} Eq. 28
11: s_0 ← s_T
12: Return: trained ϕ
Table I reports MPC solver-pass counts for the racing setup in § 5-B. FORL differentiates retained rollout solutions once per update; PPO repeats forward and backward passes over epochs, while TD3/SAC re-evaluates MPC for replayed critic targets and actor updates. Profiled PPO and TD3 updates take approximately and the wall-clock time of FORL, respectively (Figure 3). The expensive repeated MPC solves imply that data reuse can reduce environment interactions while increasing training time. This reverses the usual balance for direct neural policies, where environment interaction often dominates computation [26].
Figure 3. Measured wall-clock breakdown of one learning update (mean over five trials). Lighter blocks denote backward passes. FORL update is magnified.
Computationally Efficient First-Order RL with MPC
These observations motivate our choice of FORL, instantiated as Short-Horizon Actor-Critic (SHAC) [14]. Its actor is the MPC policy, and its critic learns the expected discounted return from state under that policy. The target
| Algorithm | Forward count | Forward time (s) | Backward count | Backward time (s) |
| MPC + FORL (ours) | 0.63 | 0.09 | ||
| MPC + PPO [22] | 7.39 | 0.96 | ||
| MPC + TD3 | 22.16 | 0.95 |
Table I. Profiled MPC solver work per learning iteration.
transitions; profile uses , , , , , and . Here, is the replay minibatch size, and the actor is updated every critic updates. The conservative update-to-data ratio understates the off-policy gap.
critic is a slowly updated copy of , used to stabilize both policy updates and critic training. SHAC differentiates short-rollout rewards plus the target critic’s estimate of the remaining return, avoiding full episode backpropagation. We get environment derivatives from a differentiable simulator and note that learned dynamics can provide surrogate gradients [15].
Actor update. Each update collects a differentiable rollout of steps in parallel environments. For a rollout without resets, the actor maximizes
We use reparameterized Gaussian actions and update once per rollout. Gradients flow through the environment, the MPC solution map, and the target critic’s state input while its weights remain fixed. We retain the MPC forward solutions and associated backward-pass data during rollouts, allowing the actor update to compute implicit sensitivities without additional MPC forward solves. States are detached between rollouts.
Critic update. Using the same rollout, we fit to TD() targets [27], with :
We bootstrap at rollout truncations, use zero continuation at true terminals, and update the target critic by exponential moving average (EMA). Critic fitting uses detached states and targets, and requires no additional MPC solves. Algorithm 3 summarizes the pipeline.
Experiments
We perform a three part evaluation of our approach. First we demonstrate the scalability and throughput of our solver on benchmark tasks. Then, we demonstrate efficient learning of MPC policies on a simulated autonomous racing benchmark. Finally, to assess policy robustness, we train with domain randomization and deploy the policy on a Lexus LC500.
Speed and Scalability
We evaluate on the constrained linear-system benchmark of TurboMPC [12] using a single NVIDIA RTX 5090 GPU and an Intel Core Ultra 9 285K CPU. The nominal settings are state and control dimensions , MPC horizon , rollout horizon , control bound , and solver tolerance . The scaling tests use problem batch size unless varied, while training uses .
1) Solver scaling: Figure 4(a)–(Figure 4c) compares SmoothedTurboMPC with acados [28] on the CPU and mpc.pytorch [6] on the GPU, measuring the combined time for a 50-step closed-loop rollout and differentiation of its cumulative reward. At problem batch size , acados is 2.0× faster than SmoothedTurboMPC. As the problem batch grows to (Figure 4(a)), SmoothedTurboMPC achieves speedups of 13.9× over acados and 7.1× over mpc.pytorch. Batched execution therefore benefits such parallel policy training workloads.
Figure 4. Constrained linear-system comparison of SmoothedTurboMPC, acados, and mpc.pytorch: (a)–(c) forward-plus-backward time versus batch size , horizon , and state–control dimension , respectively; (d) end-to-end SHAC throughput versus solver batch size ().
The horizon sweep in Figure 4(b) shows similar scaling benefits: at , SmoothedTurboMPC achieves speedups of 9.3× over acados and 57.8× over mpc.pytorch. At the largest state–control dimension, (Figure 4(c)), SmoothedTurboMPC is 8.1× faster than acados, while mpc.pytorch runs out of GPU memory. We also observe that SmoothedTurboMPC matches TurboMPC’s computational performance.
2) Training throughput: Figure 4(d) reports end-to-end throughput for SHAC training of the actor and critic neural networks at fixed problem batch size , varying the solver batch size , the number of OCPs processed together. Our throughput increases with , with the highest tested throughput at . The best tested solver batch sizes for acados and mpc.pytorch are and , respectively. Using the best batch size for each method, our pipeline achieves 3.5× the throughput of acados and 4.4× of mpc.pytorch. Thus our scaling advantage carries through to full learning updates.
Efficient MPC policy learning depends on both solver speed and the number of solves required by the learning algorithm. Reusing data for additional policy updates can reduce sample requirements while increasing costly MPC solves. Our approach addresses both: SmoothedTurboMPC accelerates batched solves, while FORL limits repeated MPC evaluations during policy updates (Figure 3).
Efficient RL of MPC Policies
Next, we consider the challenging problem of minimum-time racing of a vehicle with stiff nonlinear dynamics. The problem requires driving at the track bounds and actuator limits, with frequent changes in the active constraints that motivate using log-smoothed constraints. We train the policies in simulation using the same computer as § 5-A.
1) Racing setup: We first compare learning algorithms on a closed-oval trajectory-tracking task. The MPC problem is a single-track spatial-domain OCP [12 Section V]. The state comprises yaw rate, speed, sideslip, rear-wheel speed, lateral deviation, relative heading, and elapsed time. The control input comprises steering angle, signed rear drive/brake torque, and front braking torque. We use a quadratic running cost where are diagonal matrices. The terminal cost is . The weights are fixed and are output by a neural network.
To limit model mismatch when comparing learning algorithms, we use a simulator that omits load transfer and shares the MPC’s nominal vehicle parameters, with tire-friction coefficients (front) and (rear). The simulator uses fixed-step Tsit5 integration in Diffrax [29], whereas the MPC uses implicit trapezoidal integration.
The reward penalizes weighted squared tracking errors in , with soft penalties for low speed, track departure, and spinout, plus a penalty for early termination. We sample initial reference states uniformly along the track and add small perturbations. Episodes last up to 1,000 control steps (20 s) and terminate early if , , the vehicle remains off track for more than five simulation steps, or a transition becomes nonfinite.
2) Policies and training: The MPC policy uses a 44-dimensional observation of scaled vehicle states, lap-position encoding, a curvature preview covering 96 m ahead along the track, and last applied controls. Its cost network uses two fully connected hidden layers of 256 units with ReLU activations and a 17-dimensional linear output layer (81,681 parameters). We apply a sigmoid to the network’s raw output logits and use the resulting values to interpolate between lower and upper bounds and , ensuring and . The network’s high-dimensional parameter space would make applying Bayesian optimization techniques [12] challenging, motivating the use of RL and differentiable MPC.
For a fair comparison, direct neural policy baselines add bounded steering and drive/brake torque corrections to fixed PD lateral and PID longitudinal control, so both policy classes improve an existing tracking controller. We compare five methods to assess the benefits of our approach:
MPC SHAC (ours) trains the neural MPC cost map with Alg. 3.
MPC PPO (algorithm ablation) replaces SHAC with PPO [21, 22], using the same neural cost map and MPC solver.
Direct SHAC (policy ablation) trains the direct neural policy with SHAC (Alg. 3), replacing the MPC policy.
Direct PPO (baseline) trains the direct neural policy with PPO.
MPC Nominal (baseline) uses the same MPC solver with manually-tuned fixed weights as a cost adaptation baseline.
We adapt the PPO implementation from CleanRL [30]. Update horizons are 32 control steps for SHAC and 128 for PPO. We select each method’s learning rate by grid search.
3) Training efficiency: With the same neural cost map and MPC solver, MPC SHAC completes training in 7 min using 3.3 million transitions, showing the efficiency and scalability of the GPU-accelerated solver. In contrast, MPC PPO takes 5.35 h to train using 13 million transitions. MPC SHAC is thus approximately 46× faster and uses 4× fewer samples. Direct SHAC and Direct PPO each also use 13 million transitions and take 5.7 min and 2.7 min, respectively. Training times are averaged across five seeds and exclude evaluation. These results show that combining fast MPC solves with FORL updates that limit repeated solves (Figure 3) brings total MPC training time to the same order of magnitude as direct neural policy training, giving significant speedups over MPC PPO.
4) Final policy performance: MPC SHAC achieves a final normalized return of ≈ 0.98, versus 0.79 for MPC PPO and
0.72 for both direct policies (Figure 5). The scale assigns zero to the worst observed return and one to zero tracking error. MPC SHAC also achieves the lowest mean and upper-quartile absolute lateral and speed tracking errors, outperforming both the learned baselines and MPC with manually-tuned fixed weights. Thus, MPC structure improves performance over direct policies, while learned costs improve tracking over MPC with manually-tuned fixed weights.

Figure 5. Top: normalized return versus environment transitions (mean and 95% confidence interval across five seeds). Bottom: per-step absolute lateral and speed tracking errors, and . Diamonds indicate means and horizontal bars indicate quartiles.
5) Insights on enabling stable training of MPC policies: We observed that backpropagation through long rollouts, as in DiffMPC [9], did not lead to stable training for this racing task. Instead, SHAC learns successfully with short rollout backpropagation (Figure 5), as shorter gradient chains limit instability, while a terminal critic accounts for rewards beyond the rollout [14]. Using SHAC could also improve policy performance for TurboMPC [12]. However, as TurboMPC does not include complementarity smoothing, and batched rollouts, different environments and time steps sit on different active sets, the underlying hard NLP’s sensitivities will jump whenever a constraint enters or leaves the active set (Figure 2). This will result in noisy aggregated policy gradients [11], which can negatively impact training stability, reinforcing the benefits of SmoothedTurboMPC’s Log-barrier smoothing.
Robustness and Real-World Deployment
1) Training for robust deployment: We use domain randomization to improve policy robustness to unmodeled conditions and model mismatch for real-world deployment. Unlike learning from open-loop MPC prediction losses [11], RL with domain randomization directly optimizes closed-loop return. In particular, we train with randomized dry friction and localized puddles while retaining nominal MPC dynamics. We model load transfer in both the simulator and MPC and train with a 10% faster reference, 128-step SHAC rollouts, and 30 s episodes. The neural network also outputs linear state cost coefficients and , parameterized as , using interpretable bounded target offsets to reduce sensitivity differences between quadratic and linear terms. Also, we add path progress to the reward to promote faster racing, and the stall threshold is set to m/s.
Each episode independently samples a puddle center uniformly along the track, , and . The Gaussian puddle blends dry friction with 0.6 as , with . Here are longitudinal and lateral offsets from the puddle center, with standard deviations m and m. Neither the actor nor MPC observes these randomized parameters.
2) Real-world deployment: We evaluate the method on a 2019 Lexus LC 500 on an oval course. Its onboard computer uses an NVIDIA RTX 4070 Ti Super GPU and an Intel Xeon E-2278GE CPU. State estimates come from a GPS system. We compare MPC nominal (manually-tuned fixed weights) against MPC SHAC with puddles at corner entry or exit, using two trials per controller per scenario.
As shown in Figure 6, MPC SHAC completes all four trials, whereas the nominal MPC spins out in all four trials due to model mismatch from the water puddles, demonstrating robustness improvements from RL training with domain randomization. Across the four trials, max sideslip range is 3.5°–4.2° for MPC SHAC versus 35°–169° for MPC nominal; max absolute yaw rates are 0.77–0.85 versus 1.59–1.74 rad/s, respectively.
Figure 6. Real-world racing results. Top: one trial per controller per scenario, with puddles shaded blue and nominal trajectory endpoints marked by red crosses. Bottom: state and control traces for all trials.
Results show that MPC SHAC brakes earlier on the corner approach, produces smoother torques and steering inputs, and is able to maintain low sideslip throughout. On the initial puddle-free 38 m approach segment, the learned MPC is as fast as the nominal MPC. Over the 100 m puddle-corner segment, MPC SHAC completes all passes in 6 s with sideslip always below 3.2°, while nominal MPC’s completed passes have a mean peak absolute sideslip of 29.3° and take 8 s on average, demonstrating that RL training of MPC policies enables both faster and more robust racing performance.
Comparing the learned cost map with the nominal MPC weights shows that the learned reference yaw-rate and sideslip tracking weights are about 100× larger on average than the nominal ones. As a result, the learned MPC operates in a desired stable, low regime, so the policy avoids sliding and spinning out over puddles. Simultaneously, the learned reference speed profile is about 2 m/s faster on average, showing that RL training optimizes for both faster racing performance and robustness through domain randomization.
Conclusion and Future Work
We presented SmoothedTurboMPC, a smoothed SQP–ADMM solver and FORL pipeline for efficient learning of MPC policies on GPUs. Simulation and hardware experiments demonstrate higher training throughput and improved racing performance under model mismatch. In future work we are interested in expanding our evaluation to learn cost and dynamics parameters simultaneously. This raises an open question: how do we balance MPC planning performance with the physical fidelity of the learned model? Future work also envisions extending the approach to incorporate contact.
Acknowledgments
We used LLM tools, including Codex and Claude Code, to assist with software implementation, drafting, proofreading, and review. All final text, figures, code, and references were edited, revised, and reviewed by humans.
Appendix A: Quadratic Penalty Relaxation
The pure log-barrier formulation (11) can be augmented with a quadratically penalized inequality relaxation [20]:
Here relaxes the inequalities as the parameters vary during learning, preventing inequality infeasibility from stalling training, and is its quadratic penalty. The pure-barrier formulation (11) is recovered as .
Stationarity with respect to and gives and , respectively. Eliminating yields
The block in (6) then becomes . The pure-barrier solution has local primal error as , assuming twice continuously differentiable data, LICQ, SOSC, and strict complementarity at the solution of (1) [8 Theorem 3]. The additional relaxation satisfies exactly and vanishes as for bounded multipliers.
Slack-relaxed Smooth QP Subproblem
Applying the same relaxation to the local SQP model (12) gives
Its KKT system, after eliminating , is
Taking reduces (34)–(36) to the subproblem (12) and its KKT system (22).
Slack-relaxed SAQP Updates
For the slack-relaxed subproblem (34), the operator split in (14) becomes
where . The inequality-block proximal operator is, componentwise,
with . Stationarity gives and . The resulting closed-form update is
For , let denote componentwise projection onto the upper-bound set. The corresponding update is
Slack-relaxed KKT Consistency
At a converged SQP solution , define . By (13), the exact-Hessian QP-KKT residual (35) coincides with its NLP-KKT residual:
The reduced adjoint system (24) retains the same form, with

Figure 7. Relationships among the four inequality treatments.
Bounded Inequality Sensitivity and Limiting Cases
With slack relaxation enabled, the inequality-sensitivity map is uniformly bounded:
Hence , preventing unbounded inequality scaling in the reduced adjoint system.
The limit recovers . For bounded , the relaxation term vanishes as . Consequently, any finite limit of solutions to (32)–(33) as and satisfies the original NLP-KKT conditions (3). Likewise, makes the slack-relaxed log-barrier update (39) recover the projection update (38).
Effect on Example 1
We repeat Example 1 with inequality relaxation in the unsmoothed baseline, using . This stiff penalty approximates the hard NLP while retaining its active-set kinks.

Figure 8. Double-integrator parameter learning from with inequality relaxation enabled in the unsmoothed baseline (). The slack-relaxed NLP still stalls at active-set kinks, whereas sufficient barrier smoothing reaches from both initializations.
For comparison, Figure 9 uses the softer penalty . The relaxed surrogate deviates from the hard NLP: both initializations converge to a biased parameter whose deployment on the original hard problem remains suboptimal.

Figure 9. Double-integrator parameter learning from with a soft inequality-relaxation penalty . Both initializations converge on the relaxed surrogate, but the learned parameter is biased when deployed on the original hard NLP. The barrier-smoothed curves are shown for comparison.
Appendix B: Two-Sided Inequality Constraints
We extend SAQP to two-sided constraints .
For brevity, we assume that both bounds are finite as the one-sided formulation in Sec. III recovers the other cases. Linearizing as in (13) gives
with and defined analogously. Each constraint can therefore be arranged as
Two-Sided Proximal Update
The slack update (18) becomes,
with and . Stationarity requires the root of
where and its derivative is given by
Since as and as , the root is unique and lies strictly inside the bounds. By the implicit function theorem, the update is smooth in with derivative . The dual update (17) gives , with and . Hence after every ADMM iteration, generalizing Remark 1. As , the update tends to , the box projection of [17].
Safeguarded Newton Iteration
Eq. (46) is a cubic, which we solve with a fixed number of Newton steps, keeping the update branch-free and of constant cost on the GPU. At the midpoint , , so the barrier terms cancel and . Since is strictly increasing, the root lies on the same side of as . Hence, the nearer bound dominates the barrier, and we warm-start from its one-sided solution,
Since is singular at the bounds, a full Newton step may leave . We therefore update with
where is a fraction-to-boundary constant, so each step covers at most a fraction of the distance to the bound it approaches.
We use seven Newton steps with . To test this choice, we fix and run the Newton iteration for a distribution of log-barrier functions sampled in , with inputs inside, on, and up to outside the bounds. Figure 10 shows that seven steps suffice for machine precision across all of these inputs. The worst-case error is on the order of after five steps and reaches machine precision of the closest representable root after six.
Figure 10. Absolute error of the safeguarded Newton iterates. The black line is the worst case over all test inputs and values of .
Inequality Relaxation and Sensitivities
We next derive the slack update and implicit gradients for two-sided constraints with inequality relaxation. Applying the quadratic penalty from Appendix A changes the slack update (45) to
Substituting and minimizing over in closed form gives . After eliminating , the update reduces to
where is the effective quadratic penalty coefficient. The barrier and the center of the quadratic term are unchanged from (45); eliminating only replaces by . We therefore compute using the same safeguarded Newton iteration, with , and recover . With only an upper bound, the root has the closed form , and the update reduces to the one-sided update (39) with slack .
The backward pass combines the barrier curvatures of the lower and upper bounds, and , into . With relaxation, we evaluate these curvatures using and . The reduced adjoint system (24) retains its form, with inequality weights
without and with relaxation, respectively. For a single upper bound, and . Each diagonal entry of the relaxed weight matrix then reduces to , recovering the one-sided weight (43) in Appendix A.
For parameter gradients, we include derivatives of both bounds. The inequality term in (25) becomes
If only an upper bound is present, then and . Equation (51) therefore reduces to , the upper-bound term derived in (25) of Sec. III-C.
Appendix C: Racing Training Details
Learning Comparison
For the comparison in § 5-B, SmoothedTurboMPC uses 32 spatial intervals at 3 m spacing and one SQP iteration per 50 Hz control step. We warm-start from the previous solution and use merit-based step acceptance. The barrier parameter is , the inequality-relaxation penalty is , and the SAQP iteration limit is 500. All methods run on a single NVIDIA RTX 5090.
The actor and critic each use two hidden layers of 256 units. All learned policies use Adam [31], parallel environments, discount , , and critic learning rate . PPO uses ten optimization epochs and a clipping threshold of 0.2. Table II lists the settings that differ across methods. Every ten updates, we evaluate each policy without exploration for 1000 control steps from the start line.
| MPC | Direct | |||
| SHAC | PPO | SHAC | PPO | |
| Rollout steps | 32 | 128 | 32 | 128 |
| Updates | 100 | 100 | 400 | 100 |
| Actor learning rate | ||||
| Minibatches/epoch | – | 256 | – | 32 |
Table II. Hyperparameters for the learning comparison (§ 5-B). †Learning rate annealed to zero.
Deployment Training
For deployment in § 5-C, we train an MPC policy from scratch with SHAC on a single NVIDIA RTX 5090, using double precision throughout. Table III summarizes the training settings. The simulator uses two fixed Tsit5 steps of 0.01 s per 0.02 s control interval. Episodes continue across SHAC rollouts until termination or the time limit.
| Setting | Value |
| Parallel environments | |
| Control / simulation step | 0.02 s / 0.01 s |
| MPC horizon | m = 96 m |
| SQP / SAQP iteration limits | 1 / 500 |
| SHAC rollout horizon | steps (2.56 s) |
| Maximum episode | 1500 steps (30 s) |
| Training updates | 250 |
| Discount / TD() | , |
| Actor learning rate | to , linearly decayed |
| Critic learning rate | |
| Optimizer | Adam, |
| Gradient norm cap | 1.0 |
| Critic fitting per update | 16 passes, 4 minibatches each |
| Target critic EMA decay | 0.995 |
| Exploration standard deviations |
Table III. Hyperparameters for deployment training (§ 5-C).
Reference. The MPC and RL reward use the same reference lap of length m, with a 10% faster speed profile.
Randomization. At the start of each episode, we randomize the initial state and the simulated friction conditions. We sample the initial position uniformly along the lap and add independent uniform perturbations to the corresponding reference state. The perturbations in have symmetric bounds , respectively. We sample the front and rear dry-friction coefficients independently and uniformly within of their nominal values, , and sample the center of a Gaussian puddle uniformly along the lap. The puddle reduces friction toward 0.6, with longitudinal spread m and lateral spread m. The friction coefficients and puddle parameters remain fixed within each episode. The MPC retains nominal vehicle parameters, and neither the actor nor the MPC observes the friction or puddle parameters.
Policy parameterization. The actor and critic each have two hidden layers of 256 ReLU units. The actor has 38 outputs, and the critic predicts a scalar value. Their 45-dimensional observation contains seven scaled vehicle states, a sine–cosine encoding of lap position, 33 curvature samples at 3 m spacing, and three scaled previous controls. Running cost weights are shared across the MPC horizon.
The actor outputs quadratic cost weights and bounded offsets that parameterize the linear state cost coefficients and introduced in § 5-C. For both running and terminal costs, we compute these coefficients as . Here shifts the preferred tracking target in the MPC objective through the linear cost term. The offsets in speed, rear-wheel speed, lateral deviation, and relative heading satisfy , where . All other offsets are zero.
The quadratic weight on time is zero. In the racing cost function (§ 5-B), we use the fixed control-rate matrix and terminal-time weight .
Reward and termination. The reward encourages progress along the track and penalizes tracking errors and violations of the speed, track, and heading limits. For a transition with finite numerical values,
where is signed progress along the track in meters. The vector contains tracking errors in , and gives their nominalization scales. These errors are measured against the fixed reference, so the learned MPC offsets do not change the reward’s tracking target.
Let and denote the lateral track boundaries. The soft penalty is
The lateral penalties begin 0.15 m inside each track boundary, so they apply before the vehicle leaves the track.
Episodes end after 1500 control steps (30 s), or earlier if:
Speed falls below 5 m/s.
The vehicle leaves the track: or .
The heading error satisfies .
A transition produces NaN or infinite values.
The indicator equals one for the first three conditions and zero otherwise. Nonfinite transitions receive .
Optimization. We add Gaussian action noise with the standard deviations in Table III. Rewards are normalized by a running standard deviation of discounted returns, held fixed within each rollout, and clipped to . Critic targets use normalized rewards, and the actor objective is rescaled to the original reward units.
References
- [1]S. Gros and M. Zanon, “Data-driven economic NMPC using reinforcement learning,” IEEE Transactions on Automatic Control, vol. 65, no. 2, pp. 636–648, 2020.DOI
- [2]Y. Song and D. Scaramuzza, “Policy search for model predictive control with application to agile drone flight,” IEEE Transactions on Robotics, vol. 38, no. 4, pp. 2114–2130, 2022.arxiv.org/abs/2112.03850
- [3]B. Zarrouki, V. Klös, N. Heppner, S. Schwan, R. Ritschel, and R. Voßwinkel, “Weights-varying MPC for autonomous vehicle guidance: A deep reinforcement learning approach,” in Proc. European Control Conf. (ECC), 2021, pp. 119–125.DOI
- [4]L. P. Fröhlich, C. Küttel, E. Arcari, L. Hewing, M. N. Zeilinger, and A. Carron, “Contextual tuning of model predictive control for autonomous racing,” in Proc. IEEE/RSJ Int. Conf. Intelligent Robots and Systems (IROS), 2022, pp. 10555–10562.DOI
- [5]B. Amos and J. Z. Kolter, “OptNet: Differentiable optimization as a layer in neural networks,” in Proc. Int. Conf. Machine Learning (ICML), ser. PMLR, vol. 70, 2017, pp. 136–145.arxiv.org/abs/1703.00443
- [6]B. Amos, I. Jimenez, J. Sacks, B. Boots, and J. Z. Kolter, “Differentiable MPC for end-to-end planning and control,” in Proc. Advances in Neural Information Processing Systems (NeurIPS), vol. 31, 2018, pp. 8299–8310.arxiv.org/abs/1810.13400
- [7]R. Tao, S. Cheng, X. Wang, S. Wang, and N. Hovakimyan, “DiffTune-MPC: Closed-loop learning for model predictive control,” IEEE Robotics and Automation Letters, vol. 9, no. 8, pp. 7294–7301, 2024.DOI
- [8]J. Frey, K. Baumgärtner, G. Frison, D. Reinhardt, J. Hoffmann, L. Fichtner, S. Gros, and M. Diehl, “Differentiable nonlinear model predictive control,” arXiv:2501.03153, 2025.
- [9]E. Adabag, M. Greiff, J. Subosits, and T. Lew, “Differentiable model predictive control on the GPU,” in Proc. Int. Conf. Learning Representations (ICLR), 2026.arxiv.org/abs/2510.06179
- [10]K. Tracy and Z. Manchester, “On the differentiability of the primal-dual interior-point method,” arXiv:2406.11749, 2024.arxiv.org/abs/2406.11749
- [11]F. Jahncke, B. Zarrouki, M. Piccinini, J. D’sa, D. Isele, S. Bae, and J. Betz, “Differentiable weights-varying nonlinear MPC via gradient-based policy learning: An autonomous vehicle guidance example,” IEEE Robotics and Automation Letters, vol. 11, no. 3, pp. 3724–3731, 2026.DOI
- [12]G. Bravo-Palacios, J. Zhang, Z. Pestrikov, B. Plancher, and T. Lew, “TurboMPC: Fast, scalable, and differentiable model predictive control on the GPU,” arXiv:2606.24039, 2026.
- [13]S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein, “Distributed optimization and statistical learning via the alternating direction method of multipliers,” Foundations and Trends in Machine Learning, vol. 3, no. 1, pp. 1–122, 2011.
- [14]J. Xu, V. Makoviychuk, Y. Narang, F. Ramos, W. Matusik, A. Garg, and M. Macklin, “Accelerated policy learning with parallel differentiable simulation,” in Proc. Int. Conf. Learning Representations (ICLR), 2022.arxiv.org/abs/2204.07137
- [15]J. Amigo, R. Khoramrakhsh, E. Chane-Sane, N. Mansard, and L. Righetti, “First order model-based RL through decoupled backpropagation,” arXiv:2509.00215, 2025.arxiv.org/abs/2509.00215
- [16]J. Nocedal and S. J. Wright, Numerical Optimization, 2nd ed. Springer, 2006.
- [17]B. Stellato, G. Banjac, P. Goulart, A. Bemporad, and S. Boyd, “OSQP: An operator splitting solver for quadratic programs,” Mathematical Programming Computation, vol. 12, no. 4, pp. 637–672, 2020.
- [18]R. Schwan, D. Kuhn, and C. N. Jones, “Exploiting multistage optimization structure in proximal solvers,” in 2025 IEEE 64th Conference on Decision and Control (CDC), 2025, pp. 4677–4683.
- [19]A. Jordana, S. Kleff, A. Meduri, J. Carpentier, N. Mansard, and L. Righetti, “Structure-exploiting sequential quadratic programming for model-predictive control,” IEEE Transactions on Robotics, vol. 41, pp. 4960–4974, 2025.DOI
- [20]T. Lew, M. Greiff, J. Subosits, and B. Plancher, “Solving quadratic programs with slack variables via ADMM without increasing the problem size,” European Journal of Control, p. 101557, 2026.arxiv.org/abs/2511.08451
- [21]J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, “Proximal policy optimization algorithms,” arXiv:1707.06347, 2017.arxiv.org/abs/1707.06347
- [22]A. Romero, Y. Song, and D. Scaramuzza, “Actor-critic model predictive control,” in Proc. IEEE Int. Conf. Robotics and Automation (ICRA), 2024, pp. 14777–14784.
- [23]S. Fujimoto, W. van Hoof, and D. Meger, “Addressing function approximation error in actor-critic methods,” in Proc. Int. Conf. Machine Learning (ICML), ser. PMLR, vol. 80, 2018, pp. 1587–1596.
- [24]T. Haarnoja, A. Zhou, P. Abbeel, and S. Levine, “Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor,” in Proc. Int. Conf. Machine Learning (ICML), ser. PMLR, vol. 80, 2018, pp. 1861–1870.arxiv.org/abs/1801.01290
- [25]X. Chen, C. Wang, Z. Zhou, and K. W. Ross, “Randomized ensembled double q-learning: Learning fast without a model,” in Proc. Int. Conf. Learning Representations (ICLR), 2021.arxiv.org/abs/2101.05982
- [26]J. Gleeson, S. Krishnan, M. Gabel, V. Janapa Reddi, E. de Lara, and G. Pekhimenko, “RL-Scope: Cross-stack profiling for deep reinforcement learning workloads,” in Proceedings of Machine Learning and Systems, vol. 3, 2021, pp. 783–799.arxiv.org/abs/2102.04285
- [27]R. S. Sutton, “Learning to predict by the methods of temporal differences,” Machine Learning, vol. 3, no. 1, pp. 9–44, 1988.DOI
- [28]R. Verschueren, G. Frison, D. Kouzoupis, J. Frey, N. van Duijkeren, A. Zanelli, B. Novoselnik, T. Albin, R. Quirynen, and M. Diehl, “acados—a modular open-source framework for fast embedded optimal control,” Mathematical Programming Computation, vol. 14, no. 1, pp. 147–183, 2022.arxiv.org/abs/1910.13753
- [29]P. Kidger, “On neural differential equations,” Ph.D. dissertation, University of Oxford, 2021.arxiv.org/abs/2202.02435
- [30]S. Huang, R. F. J. Dossa, C. Ye, J. Braga, D. Chakraborty, K. Mehta, and J. G. Araújo, “CleanRL: High-quality single-file implementations of deep reinforcement learning algorithms,” Journal of Machine Learning Research, vol. 23, no. 274, pp. 1–18, 2022.
- [31]D. P. Kingma and J. Ba, “Adam: A method for stochastic optimization,” in Proc. Int. Conf. Learning Representations (ICLR), 2015.arxiv.org/abs/1412.6980




