betaFeedback

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 4.4×4.4\times higher end-to-end training throughput. On a vehicle racing task, our method achieves higher returns than MPC PPO with a 46×46\times 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.

  1. 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.

  1. **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:

min⁡xℓ(x;θ)s.t.f(x;θ)=0,g(x;θ)≤h(θ),(1)\min_x \ell(x;\theta) \quad\text{s.t.}\quad f(x;\theta)=0,\quad g(x;\theta)\le h(\theta), \tag*{(1)}

where x∈Rnx \in\mathbb{R}^{n} are the decision variables, f(x;θ)∈Rmf(x;\theta) \in\mathbb{R}^{m} and g(x;θ),h(θ)∈Rpg(x;\theta), h(\theta) \in\mathbb{R}^{p} define the constraints, and θ∈Rnθ\theta\in\mathbb{R}^{n_\theta} denotes problem parameters (e.g., cost weights). For multipliers (yf,yg)(y_f,y_g), the Lagrangian of the NLP is:

L:=ℓ+yfTf+ygT(g−h).(2)\mathcal{L}:=\ell+y_f^{\mathsf{T}}f+y_g^{\mathsf{T}}(g-h). \tag*{(2)}

Introducing slack variables ν:=h−g(x)\nu:=h-g(x), and defining w:=(x,yf,yg)w:=(x,y_f,y_g) and the Jacobians C:=∂f/∂xC:=\partial f/\partial x and G:=∂g/∂xG:=\partial g/\partial x, the Karush-Kuhn-Tucker (KKT) conditions [16] of the NLP are:

FNLP(w;θ):=[∇xℓ+CTyf+GTygfν∘yg]=0,(3)F^{\mathrm{NLP}}(w;\theta):= \begin{bmatrix} \nabla_x\ell+C^{\mathsf{T}}y_f+G^{\mathsf{T}}y_g\\ f\\ \nu\circ y_g \end{bmatrix}=0, \tag*{(3)}

with ν≥0\nu\ge0, yg≥0y_g\ge0, and the elementwise product ∘\circ.

The solution w⋆(θ)w^{\star}(\theta) of the NLP depends on the parameters θ\theta. Implicit differentiation techniques [5]–[10] compute the gradient of this solution by differentiating the KKT conditions (3). Writing (3) as a root-finding problem FNLP(w;θ)=0F^{\mathrm{NLP}}(w;\theta)=0, let M:=∂FNLP/∂w\mathcal{M}:=\partial F^{\mathrm{NLP}}/\partial w, if M\mathcal{M} is nonsingular at (w⋆,θ)(w^{\star},\theta), the implicit function theorem (IFT) yields a locally unique C1C^1 map θ↦w(θ)\theta\mapsto w(\theta) with

∂w∂θ=−M−1∂FNLP∂θ.(4)\frac{\partial w}{\partial\theta}=-\mathcal{M}^{-1}\frac{\partial F^{\mathrm{NLP}}}{\partial\theta}. \tag*{(4)}

Learning introduces an outer scalar task loss L:Rn→RL:\mathbb{R}^{n}\to\mathbb{R}, evaluated at the NLP solution, yielding the bilevel problem:

min⁡θL(x⋆(θ))s.t.x⋆(θ) solves (1).(5)\min_{\theta} L(x^{\star}(\theta))\quad\text{s.t.}\quad x^{\star}(\theta)\text{ solves (1)}. \tag*{(5)}

Assuming LL depends on θ\theta only through x⋆(θ)x^{\star}(\theta), its parameter gradient can be computed without explicitly forming ∂w/∂θ\partial w/\partial\theta.

Let H:=∇xx2L\mathcal{H}:=\nabla^2_{xx}\mathcal{L} denote the Lagrangian Hessian evaluated at w⋆(θ)w^{\star}(\theta). We define the adjoint variables λ:=(λx,λf,λg)\lambda:=(\lambda_x,\lambda_f,\lambda_g) by:

[HCT−GTYC00G0D]⏟MT[λxλfλg]=−[∇xL00],(6)\underbrace{\begin{bmatrix} \mathcal{H} & C^{\mathsf{T}} & -G^{\mathsf{T}}Y\\ C & 0 & 0\\ G & 0 & D \end{bmatrix}}_{\mathcal{M}^{\mathsf{T}}} \begin{bmatrix} \lambda_x\\ \lambda_f\\ \lambda_g \end{bmatrix} = -\begin{bmatrix} \nabla_x L\\ 0\\ 0 \end{bmatrix}, \tag*{(6)}

with D:=diag⁡(ν)D:=\operatorname{diag}(\nu), Y:=diag⁡(yg)Y:=\operatorname{diag}(y_g). The outer gradient is thus:

∇θL=(∂FNLP∂θ)Tλ.(7)\nabla_\theta L=\left(\frac{\partial F^{\mathrm{NLP}}}{\partial\theta}\right)^{\mathsf{T}}\lambda. \tag*{(7)}

Active-Set Changes and Barrier Smoothing

At an active-set transition where strict complementarity fails for constraint ii, both νi=0\nu_i=0 and yg,i=0y_{g,i}=0. The column of MT\mathcal{M}^{\mathsf{T}} in (6) associated with the iith 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, ν∘yg=0\nu\circ y_g=0, with a perturbed condition [8], [10]:

ν∘yg=κ1,ν>0,yg>0,κ>0.(8)\nu\circ y_g=\kappa\mathbf{1},\qquad\nu>0,\qquad y_g>0,\qquad\kappa>0. \tag*{(8)}

The barrier parameter κ\kappa trades approximation of the original NLP for smoothness. As κ→0+\kappa\to0^{+}, the perturbed problem approaches the hard-constrained problem, while κ>0\kappa>0 prevents νi\nu_i and yg,iy_{g,i} from simultaneously vanishing.

We illustrate this change’s effect on learning via a double-integrator example, where the state xk=(pk,vk)x_k=(p_k,v_k) is position and velocity, and input uku_k is acceleration. We learn a scalar tracking weight θ\theta over horizon H=6H=6 and choose an unreachable reference under the control bound to induce active-set changes. For fixed θ\theta and initial state x0x_0, the inner problem is

min⁡x,u∑k=0H−1(12Qkinner(pk−pˉk)2+12Rkinneruk2)+12QHinner(pH−pˉH)2s.t.xk+1=[1101]xk+[0.51]uk,−1≤uk≤1.(9)\begin{aligned} \min_{x,u}\quad&\sum_{k=0}^{H-1}\left(\frac{1}{2}Q_k^{\mathrm{inner}}(p_k-\bar p_k)^2+\frac{1}{2}R_k^{\mathrm{inner}}u_k^2\right)+\frac{1}{2}Q_H^{\mathrm{inner}}(p_H-\bar p_H)^2\\ \mathrm{s.t.}\quad&x_{k+1}=\begin{bmatrix}1&1\\0&1\end{bmatrix}x_k+\begin{bmatrix}0.5\\1\end{bmatrix}u_k,\quad-1\leq u_k\leq1. \tag*{(9)} \end{aligned}

The outer objective evaluates the resulting plan with different tracking and control-effort weights,

min⁡θL(θ)=∑k=0H−1(12Qkouter(pk(θ)−pˉk)2+12Rkouteruk(θ)2)+12QHouter(pH(θ)−pˉH)2.(10)\min_{\theta}\quad L(\theta)=\sum_{k=0}^{H-1}\left(\frac{1}{2}Q_k^{\mathrm{outer}}(p_k(\theta)-\bar p_k)^2+\frac{1}{2}R_k^{\mathrm{outer}}u_k(\theta)^2\right)+\frac{1}{2}Q_H^{\mathrm{outer}}(p_H(\theta)-\bar p_H)^2. \tag*{(10)}

We choose Qouter≠QinnerQ^{\mathrm{outer}}\ne Q^{\mathrm{inner}} and Router≠RinnerR^{\mathrm{outer}}\ne R^{\mathrm{inner}}, so learning θ\theta balances tracking accuracy against control effort. We apply gradient descent with η=0.1\eta=0.1 from θ0∈{0.1,10}\theta_0\in\{0.1,10\}.

Let LκL_\kappa denote the outer loss induced by the barrier-smoothed inner problem, with κ=0\kappa=0 denoting the original hard NLP. Figure 2(a),(b) shows that the hard problem exhibits kinks in LκL_\kappa and jumps in its gradient at active-set changes, while increasing κ\kappa 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 θ⋆=1.1\theta^\star=1.1 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.

Double-integrator parameter learning

Figure 2. Double-integrator parameter learning from θ0∈{0.1,10}\theta_0\in\{0.1,10\}. Barrier smoothing rounds active-set kinks in the outer loss (a) and gradient (b). This allows gradient descent to reach θ⋆=1.10\theta^{\star}=1.10 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 κ>0\kappa>0, we consider the smoothed NLP [8, 10],

min⁡x,νℓ(x;θ)−κ∑i=1plog⁡νis.t.f(x;θ)=0,g(x;θ)+ν=h(θ),ν>0.(11)\begin{aligned} \min_{x,\nu}\quad&\ell(x;\theta)-\kappa\sum_{i=1}^{p}\log\nu_i\\ \mathrm{s.t.}\quad&f(x;\theta)=0,\\ &g(x;\theta)+\nu=h(\theta),\quad\nu>0. \tag*{(11)} \end{aligned}

Stationarity with respect to ν\nu gives yg=κ/νy_g=\kappa/\nu, replacing hard complementarity with ν∘yg=κ1\nu\circ y_g=\kappa\mathbf{1}, ν,yg>0\nu,y_g>0.

At each SQP iterate xjx^j, we form a quadratic model of the original objective ℓ\ell and linearize the constraints ff and gg [16], retaining the convex log-barrier term exactly:

min⁡x,ν12xTPx+qTx−κ∑i=1plog⁡νis.t.Cx=c,ν=hˉ−Gx>0.(12)\begin{aligned} \min_{x,\nu}\quad&\frac{1}{2}x^\mathsf{T}Px+q^\mathsf{T}x-\kappa\sum_{i=1}^{p}\log\nu_i\\ \mathrm{s.t.}\quad&Cx=c,\quad\nu=\bar h-Gx>0. \tag*{(12)} \end{aligned}

Here CC and GG are evaluated at xjx^j, P⪰0P\succeq0 approximates the Lagrangian Hessian, typically Gauss–Newton [16]. We define,

q:=∇xℓ(xj;θ)−Pxj,c:=Cxj−f(xj;θ),q:=\nabla_x\ell(x^j;\theta)-Px^j,\qquad c:=Cx^j-f(x^j;\theta),
hˉ:=h(θ)−g(xj;θ)+Gxj.(13)\bar h:=h(\theta)-g(x^j;\theta)+Gx^j. \tag*{(13)}

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, A:=[CG]A:=\begin{bmatrix}C\\G\end{bmatrix}, and introduce z:=(zf,zg)z:=(z_f,z_g). The constraint Ax=zAx=z gives the equivalent split problem,

min⁡x,z,ν12xTPx+qTz+I{c}(zf)−κ∑i=1plog⁡νis.t.Ax−z=0,ν=hˉ−zg>0.(14)\begin{aligned} \min_{x,z,\nu}\quad&\frac{1}{2}x^\mathsf{T}Px+q^\mathsf{T}z+\mathcal{I}_{\{c\}}(z_f)-\kappa\sum_{i=1}^{p}\log\nu_i\\ \mathrm{s.t.}\quad&Ax-z=0,\qquad\nu=\bar h-z_g>0. \tag*{(14)} \end{aligned}

Here I{c}(zf)=0\mathcal{I}_{\{c\}}(z_f)=0 if zf=cz_f=c, and +∞+\infty otherwise. We use multipliers y=(yf,yg)y=(y_f,y_g) and a block-diagonal ADMM penalty ρ:=blkdiag⁡(ρfIm,ρgIp)\rho:=\operatorname{blkdiag}(\rho_fI_m,\rho_gI_p), with ρf,ρg>0\rho_f,\rho_g>0. Following the over-relaxed ADMM updates of [12, 17], σ>0\sigma>0 regularizes the primal solve and α∈(0,2)\alpha\in(0,2) controls over-relaxation. We use the convergence check and adaptive ρ\rho 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

S:=P+σI+ATρA≻0,S:=P+\sigma I+A^\mathsf{T}\rho A\succ0,
Sx~k+1=σxk−q+AT(ρzk−yk),z~k+1=Ax~k+1,S\tilde{x}^{k+1}=\sigma x^k-q+A^\mathsf{T}(\rho z^k-y^k),\qquad\tilde{z}^{k+1}=A\tilde{x}^{k+1},
(x^,z^)k+1=α(x~,z~)k+1+(1−α)(x,z)k,xk+1=x^k+1.(15)(\hat{x},\hat{z})^{k+1}=\alpha(\tilde{x},\tilde{z})^{k+1}+(1-\alpha)(x,z)^k,\qquad x^{k+1}=\hat{x}^{k+1}. \tag*{(15)}

Log-barrier slack update

z~gk+1=z^gk+1+ρg−1ygk,rk+1=hˉ−z~gk+1,\tilde{z}_g^{k+1}=\hat{z}_g^{k+1}+\rho_g^{-1}y_g^k,\qquad r^{k+1}=\bar h-\tilde{z}_g^{k+1},
νk+1=bΓ(rk+1),Γ:=κρg−1,\nu^{k+1}=b_{\Gamma}(r^{k+1}),\qquad\Gamma:=\kappa\rho_g^{-1},
zgk+1=hˉ−νk+1,zfk+1=c.(16)z_g^{k+1}=\bar h-\nu^{k+1},\qquad z_f^{k+1}=c. \tag*{(16)}

Dual update

yk+1=yk+ρ(z^k+1−zk+1).(17)y^{k+1}=y^k+\rho(\hat{z}^{k+1}-z^{k+1}). \tag*{(17)}

(16) solves the proximal problem componentwise:

zgk+1=arg⁡min⁡z<hˉ  −κlog⁡(hˉ−z)+ρg2(z−z~gk+1)2.(18)z_g^{k+1}=\underset{z<\bar h}{\arg\min}\;-\kappa\log(\bar h-z)+\frac{\rho_g}{2}(z-\tilde{z}_g^{k+1})^2. \tag*{(18)}

With ν=hˉ−z\nu=\bar h-z, stationarity gives ν2−rk+1ν−Γ=0\nu^2-r^{k+1}\nu-\Gamma=0. Its positive root is

bΓ(v):=v+v2+4Γ2,Γ>0.(19)b_{\Gamma}(v):=\frac{v+\sqrt{v^2+4\Gamma}}{2},\qquad\Gamma>0. \tag*{(19)}

Remark 1 (Per-iteration smoothed complementarity). For Γ>0\Gamma>0, bΓ(v)>0b_{\Gamma}(v)>0 and bΓ′(v)∈(0,1)b'_{\Gamma}(v)\in(0,1), so the slack update is smooth and yields νk+1>0\nu^{k+1}>0. Together with the dual update, it gives

ygk+1=κνk+1⟹νk+1∘ygk+1=κ1.(20)y_g^{k+1}=\frac{\kappa}{\nu^{k+1}}\quad\Longrightarrow\quad\nu^{k+1}\circ y_g^{k+1}=\kappa\mathbf{1}. \tag*{(20)}

Smoothed complementarity holds after every ADMM iteration within a SAQP solve for the split slack νk+1=hˉ−zgk+1\nu^{k+1}=\bar h-z_g^{k+1}.

Remark 2 (Recovery of original NLP and QP). As κ→0+\kappa\to0^+, smoothed complementarity recovers ν∘yg=0\nu\circ y_g=0, and any finite limit of smoothed KKT solutions satisfies the original NLP-KKT conditions [8, 10]. The smoothed subproblem recovers

min⁡x 12xTPx+qTxs.t.Cx=c,Gx≤hˉ.(21)\min_{x}\ \frac{1}{2}x^{\mathsf T}Px+q^{\mathsf T}x\quad\text{s.t.}\quad Cx=c,\quad Gx\le\bar{h}. \tag*{(21)}

For fixed ρg>0\rho_g>0, bΓ(v)→max⁡(v,0)b_{\Gamma}(v)\to\max(v,0), so the slack update recovers the standard ADMM projection [17].

Remark 3 (Two-sided constraints). MPC constraints are often two-sided, hl(θ)≤g(x;θ)≤hu(θ)h_l(\theta)\le g(x;\theta)\le h_u(\theta), e.g., representing input and track bounds. Instead of stacking them as [G−G]\begin{bmatrix}G\\-G\end{bmatrix}, which doubles the number of inequality rows, SmoothedTurboMPC applies the barrier −κlog⁡νl−κlog⁡νu-\kappa\log\nu_l-\kappa\log\nu_u per row, with νl:=zg−hˉl\nu_l:=z_g-\bar{h}_l and νu:=hˉu−zg\nu_u:=\bar{h}_u-z_g. 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 bΓb_{\Gamma}, to machine precision (Appendix B). Remarks 1–2 hold per bound, and κ→0+\kappa\to0^{+} recovers the box projection of [17].

Implicit Differentiation and GPU Computation

For the backward pass (Algorithm 2), we use the exact NLP Lagrangian Hessian P=HP=\mathcal{H}.

The KKT system of the smoothed subproblem (12):

FκQP(w;θ):=[Px+q+CTyf+GTygCx−cν∘yg−κ1]=0,ν:=hˉ−Gx>0,yg>0.(22)F_{\kappa}^{\mathrm{QP}}(w;\theta):= \begin{bmatrix} Px+q+C^{\mathsf T}y_f+G^{\mathsf T}y_g\\ Cx-c\\ \nu\circ y_g-\kappa\mathbf{1} \end{bmatrix} =0, \qquad \nu:=\bar{h}-Gx>0,\qquad y_g>0. \tag*{(22)}

At SQP convergence, (13) makes this residual equal to the smoothed NLP-KKT residual:

FκQP(w∗;θ)=FκNLP(w∗;θ)=0.(23)F_{\kappa}^{\mathrm{QP}}(w^{\ast};\theta)=F_{\kappa}^{\mathrm{NLP}}(w^{\ast};\theta)=0. \tag*{(23)}

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 ν∘yg=κ1\nu\circ y_g=\kappa\mathbf{1} and ν,yg>0\nu,y_g>0, 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 C1C^1 solution map.

We exploit stagewise sparsity and batch parallelism to compute both solver passes efficiently on GPUs.

Forward pass. For fixed QP data and ρ\rho, the stage-sparse matrix SS 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 λg=−D−1Gλx\lambda_g=-D^{-1}G\lambda_x, with D:=diag⁡(ν)D:=\operatorname{diag}(\nu), from (6) yields

\begin{bmatrix} \mathcal{H}+G^{\mathsf T}W^{-1}G & C^{\mathsf T}\\ C & 0 \end{bmatrix} \begin{bmatrix} \lambda_x\\ \lambda_f \end{bmatrix} = -\begin{bmatrix} \nabla_x L\\ 0 \end{bmatrix}, \tag*{(24)}\end{bmatrix}

where W−1:=diag⁡(yg/ν)=diag⁡(κ/ν2)W^{-1}:=\operatorname{diag}(y_g/\nu)=\operatorname{diag}(\kappa/\nu^2) provides continuously varying inequality weights. With λˉg:=W−1Gλx\bar{\lambda}_g:=W^{-1}G\lambda_x, the parameter VJP is

∇θL=[∂θ∇xL]Tλx+[∂θf]Tλf+[∂θ(g−h)]Tλˉg.(25)\nabla_{\theta}L=[\partial_{\theta}\nabla_x L]^{\mathsf T}\lambda_x+[\partial_{\theta}f]^{\mathsf T}\lambda_f+[\partial_{\theta}(g-h)]^{\mathsf T}\bar{\lambda}_g. \tag*{(25)}

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 g(x;θ)≤h(θ)+ξg(x;\theta)\le h(\theta)+\xi and add the penalty ∥ξ∥22/2\|\xi\|_2^2/2, γ>0\gamma>0, to the objective [20]. The slack update (16) remains closed form with Γ=κ(ρg−1+γϵ−1)\Gamma=\kappa(\rho_g^{-1}+\gamma\epsilon^{-1}), ξk+1=κ/(γϵνk+1)\xi^{k+1}=\kappa/(\gamma\epsilon\nu^{k+1}), and zgk+1=hˉ−νk+1+ξk+1z_g^{k+1}=\bar{h}-\nu^{k+1}+\xi^{k+1}. The backward weights (24) become W−1=diag⁡(γygν+γϵyg)W^{-1}=\operatorname{diag}\left(\frac{\gamma y_g}{\nu+\gamma\epsilon y_g}\right).

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]:

min⁡x,u ∑t=0H−1ℓt(xt,ut,xt+1,ut+1;θ)+ℓH(xH;θ)\min_{x,u}\ \sum_{t=0}^{H-1}\ell_t(x_t,u_t,x_{t+1},u_{t+1};\theta)+\ell_H(x_H;\theta)
s.t.x0=xinit,\text{s.t.}\quad x_0=x_{\mathrm{init}},
ft(xt,ut,xt+1,ut+1;θ)=0,t=0,…,H−1,f_t(x_t,u_t,x_{t+1},u_{t+1};\theta)=0,\qquad t=0,\ldots,H-1,
gt≤gt(xt,ut;θ)≤gˉt,t=0,…,H.(26)g_t\le g_t(x_t,u_t;\theta)\le\bar{g}_t,\qquad t=0,\ldots,H. \tag*{(26)}

Here x,ux,u are predicted states and controls, xinitx_{\mathrm{init}} is the initial state, HH is the horizon, and ℓ,f,g\ell,f,g specify costs, dynamics, and constraints. The policy applies the first control u0∗(θ,xinit)u_0^{\ast}(\theta,x_{\mathrm{init}}) and then resolves (26) for the new xinitx_{\mathrm{init}} at the next control step.

Given environment state ss, a neural network with weights ϕ\phi predicts state-dependent MPC parameters θ(s)=πϕθ(s)\theta(s)=\pi_{\phi}^{\theta}(s). For exploration, we use a Gaussian policy [21]:

πϕ(a∣s)=N(a;u0∗(θ(s),xinit),Σ),(27)\pi_{\phi}(a\mid s)=\mathcal{N}(a;u_0^{\ast}(\theta(s),x_{\mathrm{init}}),\Sigma), \tag*{(27)}

where Σ\Sigma is the exploration covariance. RL optimizes ϕ\phi to maximize J(ϕ)=Eπϕ[∑t=0Tγtrt]J(\phi)=\mathbb{E}_{\pi_{\phi}}\left[\sum_{t=0}^{T}\gamma^t r_t\right], with reward rtr_t and discount γ∈[0,1)\gamma\in[0,1). 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:

Cupdate≃nenvCenv+nfwdCfwd+nbwdCbwd,(28)C_{\mathrm{update}}\simeq n_{\mathrm{env}}C_{\mathrm{env}}+n_{\mathrm{fwd}}C_{\mathrm{fwd}}+n_{\mathrm{bwd}}C_{\mathrm{bwd}}, \tag*{(28)}

where CenvC_{\mathrm{env}}, CfwdC_{\mathrm{fwd}}, and CbwdC_{\mathrm{bwd}} are the average costs of an environment step, MPC forward solve, and MPC backward pass. The subscript nn 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 EE epochs, while TD3/SAC re-evaluates MPC for replayed critic targets and actor updates. Profiled PPO and TD3 updates take approximately 10×10\times and 27×27\times 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 Vψ(s)V_\psi(s) learns the expected discounted return from state ss under that policy. The target

AlgorithmForward countForward time (s)Backward countBackward time (s)
MPC + FORL (ours)NN0.63NN0.09
MPC + PPO [22](1+E)N(1+E)N7.39ENEN0.96
MPC + TD3(1+nM+nMd)N(1+nM+\frac{nM}{d})N22.16nMdN\frac{nM}{d}N0.95

Table I. Profiled MPC solver work per learning iteration.

N=BTN=BT transitions; profile uses B=1,024B=1{,}024, T=8T=8, E=10E=10, M=1,024M=1{,}024, n=1/50n=1/50, and d=2d=2. Here, MM is the replay minibatch size, and the actor is updated every dd critic updates. The conservative update-to-data ratio nn understates the off-policy gap.

critic VψˉV_{\bar\psi} is a slowly updated copy of VψV_\psi, 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 TT steps in BB parallel environments. For a rollout without resets, the actor maximizes

J(ϕ)=1BT∑b=1B[∑t=0T−1γtrtb+γTVψˉ(sTb)].(29)J(\phi)=\frac{1}{BT}\sum_{b=1}^{B}\left[\sum_{t=0}^{T-1}\gamma^t r_t^b+\gamma^T V_{\bar\psi}(s_T^b)\right]. \tag*{(29)}

We use reparameterized Gaussian actions and update ϕ\phi 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 VψV_\psi to TD(λ\lambda) targets [27], with V^T=Vψˉ(sT)\hat V_T=V_{\bar\psi}(s_T):

V^t=rt+γ[(1−λ)Vψˉ(st+1)+λV^t+1].(30)\hat V_t=r_t+\gamma\left[(1-\lambda)V_{\bar\psi}(s_{t+1})+\lambda\hat V_{t+1}\right]. \tag*{(30)}

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 (nx,nu)=(8,4)(n_x, n_u) = (8, 4), MPC horizon H=40H = 40, rollout horizon T=50T = 50, control bound umax⁡=10u_{\max} = 10, and solver tolerance 10−310^{-3}. The scaling tests use problem batch size B=64B = 64 unless varied, while training uses B=1024B = 1024.

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 B=1B = 1, acados is 2.0× faster than SmoothedTurboMPC. As the problem batch grows to B=1024B = 1024 (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 BB, horizon HH, and state–control dimension nx+nun_x+n_u, respectively; (d) end-to-end SHAC throughput versus solver batch size MM (B=1024B = 1024).

The horizon sweep in Figure 4(b) shows similar scaling benefits: at H=320H = 320, SmoothedTurboMPC achieves speedups of 9.3× over acados and 57.8× over mpc.pytorch. At the largest state–control dimension, nx+nu=96n_x + n_u = 96 (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 B=1024B = 1024, varying the solver batch size M∈{16,32,64,128,256,512,1024}M \in\{16, 32, 64, 128, 256, 512, 1024\}, the number of OCPs processed together. Our throughput increases with MM, with the highest tested throughput at M=1024M = 1024. The best tested solver batch sizes for acados and mpc.pytorch are M=16M = 16 and M=1024M = 1024, 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 x=(r,v,β,ωr,e,Δϕ,t)x = (r, v, \beta, \omega_r, e, \Delta\phi, t) comprises yaw rate, speed, sideslip, rear-wheel speed, lateral deviation, relative heading, and elapsed time. The control input u=(δ,Tr,Tf)u = (\delta, T_r, T_f) comprises steering angle, signed rear drive/brake torque, and front braking torque. We use a quadratic running cost ℓt(xt,ut,ut+1)=∥xt−xt,ref∥Qθ2+∥ut−ut,ref∥Rθ2+∥ut−ut+1∥W2.\ell_t(x_t, u_t, u_{t+1}) = \lVert x_t-x_{t,\mathrm{ref}}\rVert_{Q_\theta}^2 + \lVert u_t-u_{t,\mathrm{ref}}\rVert_{R_\theta}^2 + \lVert u_t-u_{t+1}\rVert_W^2. where (Qθ,Rθ,W)(Q_\theta, R_\theta, W) are diagonal matrices. The terminal cost is ℓH(xH)=∥xH−xH,ref∥QHθ2+wttH\ell_H(x_H) = \lVert x_H-x_{H,\mathrm{ref}}\rVert_{Q_H^\theta}^2 + w_t t_H. The weights (W,wt)(W, w_t) are fixed and (Qθ,Rθ,QHθ)(Q_\theta, R_\theta, Q_H^\theta) 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 μf=1.02\mu_f = 1.02 (front) and μr=1.08\mu_r = 1.08 (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 (r,v,β,ωr,e,Δϕ)(r, v, \beta, \omega_r, e, \Delta\phi), 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 v<9.5 m/sv < 9.5\,\mathrm{m/s}, ∣Δϕ∣>60∘\lvert\Delta\phi\rvert> 60^\circ, 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 θmin⁡\theta_{\min} and θmax⁡\theta_{\max}, ensuring Qθ,QHθ⪰0Q_\theta, Q_H^\theta\succeq0 and Rθ⪰0R_\theta\succeq0. 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.

Normalized returns and tracking errors for the five methods

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, ∣Δe∣=∣e−eref∣|\Delta e| = |e - e_{\mathrm{ref}}| and ∣Δv∣=∣v−vref∣|\Delta v| = |v - v_{\mathrm{ref}}|. 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 ΔFz\Delta F_z 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 qθq_\theta and qθHq_\theta^H, parameterized as q=−2Q δxrefq=-2Q\,\delta x_{\mathrm{ref}}, 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 v<5v<5 m/s.

Each episode independently samples a puddle center uniformly along the track, μf,dry∼U(0.92,1.12)\mu_{f,\mathrm{dry}}\sim U(0.92,1.12), and μr,dry∼U(0.97,1.19)\mu_{r,\mathrm{dry}}\sim U(0.97,1.19). The Gaussian puddle blends dry friction with 0.6 as μ=(1−wp)μdry+wp⋅0.6\mu=(1-w_p)\mu_{\mathrm{dry}}+w_p\cdot0.6, with wp=exp⁡[−12(ds2σs2+de2σe2)]w_p=\exp\left[-\frac{1}{2}\left(\frac{d_s^2}{\sigma_s^2}+\frac{d_e^2}{\sigma_e^2}\right)\right]. Here ds,ded_s,d_e are longitudinal and lateral offsets from the puddle center, with standard deviations σs∼U(5,10)\sigma_s\sim U(5,10) m and σe=4\sigma_e=4 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 (r,β)(r,\beta) tracking weights are about 100× larger on average than the nominal ones. As a result, the learned MPC operates in a desired stable, low (r,β)(r,\beta) 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]:

min⁡x,ξ,sℓ(x;θ)+γξ2∥ξ∥2−κ∑i=1plog⁡sis.t.f(x;θ)=0,g(x;θ)−ξ+s=h(θ),s>0.(31)\begin{aligned} \min_{x,\xi,s}\quad&\ell(x;\theta)+\frac{\gamma_{\xi}}{2}\lVert\xi\rVert^{2}-\kappa\sum_{i=1}^{p}\log s_i\\ \text{s.t.}\quad&f(x;\theta)=0,\\ &g(x;\theta)-\xi+s=h(\theta),\qquad s>0. \tag*{(31)} \end{aligned}

Here ξ\xi relaxes the inequalities as the parameters vary during learning, preventing inequality infeasibility from stalling training, and γξ>0\gamma_{\xi}>0 is its quadratic penalty. The pure-barrier formulation (11) is recovered as γξ→∞\gamma_{\xi}\to\infty.

Stationarity with respect to ξ\xi and ss gives yg=κ/sy_g=\kappa/s and γξξ=yg\gamma_{\xi}\xi=y_g, respectively. Eliminating ξ=γξ−1yg\xi=\gamma_{\xi}^{-1}y_g yields

Fκ,ξNLP(w;θ):=[∇xℓ+CTyf+GTygfs∘yg−κ1]=0,(32)F_{\kappa,\xi}^{\mathrm{NLP}}(w;\theta):= \begin{bmatrix} \nabla_x\ell+C^{\mathsf T}y_f+G^{\mathsf T}y_g\\ f\\ s\circ y_g-\kappa\mathbf{1} \end{bmatrix} =0, \tag*{(32)}
s:=h(θ)−g(x;θ)+γξ−1yg>0,yg>0.(33)s:=h(\theta)-g(x;\theta)+\gamma_{\xi}^{-1}y_g>0,\qquad y_g>0. \tag*{(33)}

The block DD in (6) then becomes D=diag⁡(s+γξ−1yg)D=\operatorname{diag}(s+\gamma_{\xi}^{-1}y_g). The pure-barrier solution has local O(κ)O(\kappa) primal error as κ→0+\kappa\to0^+, assuming twice continuously differentiable data, LICQ, SOSC, and strict complementarity at the solution of (1) [8 Theorem 3]. The additional relaxation satisfies ∥ξ∥=∥yg∥/γξ\lVert\xi\rVert=\lVert y_g\rVert/\gamma_{\xi} exactly and vanishes as γξ→∞\gamma_{\xi}\to\infty for bounded multipliers.

Slack-relaxed Smooth QP Subproblem

Applying the same relaxation to the local SQP model (12) gives

min⁡x,ξ,s12xTPx+qTx+γξ2∥ξ∥2−κ∑i=1plog⁡sis.t.Cx=c,s=hˉ−Gx+ξ>0.(34)\begin{aligned} \min_{x,\xi,s}\quad&\frac{1}{2}x^{\mathsf T}Px+q^{\mathsf T}x+\frac{\gamma_{\xi}}{2}\lVert\xi\rVert^{2}-\kappa\sum_{i=1}^{p}\log s_i\\ \text{s.t.}\quad&Cx=c,\qquad s=\bar{h}-Gx+\xi>0. \tag*{(34)} \end{aligned}

Its KKT system, after eliminating ξ\xi, is

Fκ,ξQP(w;θ):=[Px+q+CTyf+GTygCx−cs∘yg−κ1]=0,(35)F_{\kappa,\xi}^{\mathrm{QP}}(w;\theta):= \begin{bmatrix} Px+q+C^{\mathsf T}y_f+G^{\mathsf T}y_g\\ Cx-c\\ s\circ y_g-\kappa\mathbf{1} \end{bmatrix} =0, \tag*{(35)}
s:=hˉ−Gx+γξ−1yg>0,yg>0.(36)s:=\bar{h}-Gx+\gamma_{\xi}^{-1}y_g>0,\qquad y_g>0. \tag*{(36)}

Taking γξ→∞\gamma_{\xi}\to\infty 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

min⁡x,z,ξ,s12xTPx+qTx+I{c}(z)+Bκ,ξ(ξ,s)s.t.Ax−z=0,s=hˉ−zg+ξ>0.(37)\begin{aligned} \min_{x,z,\xi,s}\quad&\frac{1}{2}x^{\mathsf T}Px+q^{\mathsf T}x+\mathcal{I}_{\{c\}}(z)+B_{\kappa,\xi}(\xi,s)\\ \text{s.t.}\quad&Ax-z=0,\\ &s=\bar{h}-z_g+\xi>0. \tag*{(37)} \end{aligned}

where Bκ,ξ(ξ,s):=γξ2∥ξ∥2−κ∑i=1plog⁡siB_{\kappa,\xi}(\xi,s):=\frac{\gamma_{\xi}}{2}\lVert\xi\rVert^{2}-\kappa\sum_{i=1}^{p}\log s_i. The inequality-block proximal operator is, componentwise,

(zˉg,ξ)k+1:=arg min⁡zg,ξ  −κlog⁡s+γξ2ξ2+ρg2(z−zgk+1)2,(38)(\bar{z}_g,\xi)^{k+1}:=\underset{z_g,\xi}{\operatorname{arg\,min}}\;-\kappa\log s+\frac{\gamma_{\xi}}{2}\xi^{2}+\frac{\rho_g}{2}\left(z-z_g^{k+1}\right)^{2}, \tag*{(38)}

with s=hˉ−z+ξ>0s=\bar{h}-z+\xi>0. Stationarity gives κ/s=ρg(zˉgk+1−z)\kappa/s=\rho_g(\bar{z}_g^{k+1}-z) and γξξ=κ/s\gamma_{\xi}\xi=\kappa/s. The resulting closed-form update is

zˉgk+1:=zgk+1+ρg−1ygk,rk+1:=hˉ−zˉgk+1,Γ:=κ(ρg−1+γξ−1),sk+1:=bΓ(rk+1),ξk+1:=κγξsk+1,zgk+1:=hˉ−sk+1+ξk+1.(39)\begin{aligned} \bar{z}_g^{k+1}&:=z_g^{k+1}+\rho_g^{-1}y_g^k,\qquad r^{k+1}:=\bar{h}-\bar{z}_g^{k+1},\\ \Gamma&:=\kappa\left(\rho_g^{-1}+\gamma_{\xi}^{-1}\right),\qquad s^{k+1}:=b_{\Gamma}(r^{k+1}),\\ \xi^{k+1}&:=\frac{\kappa}{\gamma_{\xi}s^{k+1}},\qquad z_g^{k+1}:=\bar{h}-s^{k+1}+\xi^{k+1}. \tag*{(39)} \end{aligned}

For κ=0\kappa=0, let Π(v)=min⁡(v,hˉ)\Pi(v)=\min(v,\bar{h}) denote componentwise projection onto the upper-bound set. The corresponding update is

zgk+1:=ρgγξ+ρgzˉgk+1+γξγξ+ρgΠ(zˉgk+1),(40)z_g^{k+1}:=\frac{\rho_g}{\gamma_{\xi}+\rho_g}\bar{z}_g^{k+1}+\frac{\gamma_{\xi}}{\gamma_{\xi}+\rho_g}\Pi(\bar{z}_g^{k+1}), \tag*{(40)}
ξk+1:=ρgγξ+ρg(zˉgk+1−Π(zˉgk+1)).(41)\xi^{k+1}:=\frac{\rho_g}{\gamma_{\xi}+\rho_g}\left(\bar{z}_g^{k+1}-\Pi(\bar{z}_g^{k+1})\right). \tag*{(41)}

Slack-relaxed KKT Consistency

At a converged SQP solution w∗w^*, define s∗:=h(θ)−g(x∗;θ)+γξ−1yg∗s^*:=h(\theta)-g(x^*;\theta)+\gamma_{\xi}^{-1}y_g^*. By (13), the exact-Hessian QP-KKT residual (35) coincides with its NLP-KKT residual:

Fκ,ξQP(w∗;θ)=Fκ,ξNLP(w∗;θ)=[∇xℓ(x∗;θ)+CTyf∗+GTyg∗f(x∗;θ)s∗∘yg∗−κ1]=0.(42)\begin{aligned} F_{\kappa,\xi}^{\mathrm{QP}}(w^*;\theta)=F_{\kappa,\xi}^{\mathrm{NLP}}(w^*;\theta) \\ &= \begin{bmatrix} \nabla_x\ell(x^*;\theta)+C^{\mathsf T}y_f^*+G^{\mathsf T}y_g^*\\ f(x^*;\theta)\\ s^*\circ y_g^*-\kappa\mathbf{1} \end{bmatrix} =0. \tag*{(42)} \end{aligned}

The reduced adjoint system (24) retains the same form, with

W−1:=diag⁡(ygs+γξ−1yg).(43)W^{-1}:=\operatorname{diag}\left(\frac{y_g}{s+\gamma_{\xi}^{-1}y_g}\right). \tag*{(43)}
Relationships among the four inequality treatments

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:

κ>0⟹0⪯W−1⪯γξI.(44)\kappa> 0 \quad\Longrightarrow\quad0 \preceq W^{-1} \preceq\gamma_{\xi} I. \tag*{(44)}

Hence GTW−1G⪯γξGTGG^{\mathsf{T}}W^{-1}G \preceq\gamma_{\xi}G^{\mathsf{T}}G, preventing unbounded inequality scaling in the reduced adjoint system.

The limit κ→0+\kappa\to0^{+} recovers s∘yg=0s \circ y_g = 0. For bounded ygy_g, the relaxation term γξ−1yg\gamma_{\xi}^{-1}y_g vanishes as γξ→∞\gamma_{\xi} \to\infty. Consequently, any finite limit of solutions to (32)–(33) as κ→0+\kappa\to0^{+} and γξ→∞\gamma_{\xi} \to\infty satisfies the original NLP-KKT conditions (3). Likewise, bΓ(v)→max⁡(v,0)b_{\Gamma}(v) \to\max(v,0) 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 γξ=103\gamma_{\xi}=10^{3}. This stiff penalty approximates the hard NLP while retaining its active-set kinks.

Double-integrator parameter learning with inequality relaxation

Figure 8. Double-integrator parameter learning from θ0∈{0.1,10}\theta_0 \in\{0.1,10\} with inequality relaxation enabled in the unsmoothed baseline (γξ=103\gamma_{\xi}=10^{3}). The slack-relaxed NLP still stalls at active-set kinks, whereas sufficient barrier smoothing reaches θ⋆=1.10\theta^\star=1.10 from both initializations.

For comparison, Figure 9 uses the softer penalty γξ=1\gamma_{\xi}=1. The relaxed surrogate deviates from the hard NLP: both initializations converge to a biased parameter whose deployment on the original hard problem remains suboptimal.

Double-integrator parameter learning with soft inequality-relaxation penalty

Figure 9. Double-integrator parameter learning from θ0∈{0.1,10}\theta_0 \in\{0.1,10\} with a soft inequality-relaxation penalty γξ=1\gamma_{\xi}=1. 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 hl(θ)≤g(x;θ)≤hu(θ)h_l(\theta) \le g(x;\theta) \le h_u(\theta).

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

hˉl≤Gx≤hˉu,\bar{h}_l \le Gx \le\bar{h}_u,

with hˉl:=hl(θ)−g(xi;θ)+Gxi\bar{h}_l := h_l(\theta)-g(x^i;\theta)+Gx^i and hˉu\bar{h}_u defined analogously. Each constraint can therefore be arranged as

ϕ(z):=−κlog⁡(z−hˉl)−κlog⁡(hˉu−z).\phi(z) := -\kappa\log(z-\bar{h}_l)-\kappa\log(\bar{h}_u-z).

Two-Sided Proximal Update

The slack update (18) becomes,

zgk+1=arg⁡min⁡ϕ(z)+ρg2(z−zˉgk+1)2,(45)z_g^{k+1}=\arg\min\phi(z)+\frac{\rho_g}{2}(z-\bar{z}_g^{k+1})^2, \tag*{(45)}

with νl:=z−hˉl\nu_l := z-\bar{h}_l and νu:=hˉu−z\nu_u := \bar{h}_u-z. Stationarity requires the root of

r(z):=z−zˉgk+1+Γ(1νu−1νl)=0,(46)r(z):=z-\bar{z}_g^{k+1}+\Gamma\left(\frac{1}{\nu_u}-\frac{1}{\nu_l}\right)=0, \tag*{(46)}

where Γ=κρg−1\Gamma=\kappa\rho_g^{-1} and its derivative is given by

r′(z)=1+Γνl2+Γνu2>0.(47)r'(z)=1+\frac{\Gamma}{\nu_l^2}+\frac{\Gamma}{\nu_u^2}>0. \tag*{(47)}

Since r→−∞r\to-\infty as z→hˉl+z\to\bar{h}_l^{+} and r→∞r\to\infty as z→hˉu−z\to\bar{h}_u^{-}, the root is unique and lies strictly inside the bounds. By the implicit function theorem, the update is smooth in zˉgk+1\bar{z}_g^{k+1} with derivative 1/r′∈(0,1)1/r'\in(0,1). The dual update (17) gives ygk+1=ρg(zgk+1−zˉgk+1)=yu−yly_g^{k+1}=\rho_g(z_g^{k+1}-\bar{z}_g^{k+1})=y_u-y_l, with yl:=κ/νly_l:=\kappa/\nu_l and yu:=κ/νuy_u:=\kappa/\nu_u. Hence νlyl=νuyu=κ\nu_l y_l=\nu_u y_u=\kappa after every ADMM iteration, generalizing Remark 1. As κ→0+\kappa\to0^{+}, the update tends to min⁡(max⁡(zˉgk+1,hˉl),hˉu)\min(\max(\bar{z}_g^{k+1},\bar{h}_l),\bar{h}_u), 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 m:=(hˉl+hˉu)/2m := (\bar{h}_l+\bar{h}_u)/2, νl=νu\nu_l=\nu_u, so the barrier terms cancel and r(m)=m−zˉgk+1r(m)=m-\bar{z}_g^{k+1}. Since rr is strictly increasing, the root lies on the same side of mm as zˉgk+1\bar{z}_g^{k+1}. Hence, the nearer bound dominates the barrier, and we warm-start from its one-sided solution,

z0={min⁡(hˉl+bΓ(zˉgk+1−hˉl),m),zˉgk+1≤m,max⁡(hˉu−bΓ(hˉu−zˉgk+1),m),otherwise.(48)z^0 = \begin{cases} \min(\bar{h}_l+b_{\Gamma}(\bar{z}_g^{k+1}-\bar{h}_l),m), & \bar{z}_g^{k+1}\le m,\\ \max(\bar{h}_u-b_{\Gamma}(\bar{h}_u-\bar{z}_g^{k+1}),m), & \text{otherwise}. \end{cases} \tag*{(48)}

Since rr is singular at the bounds, a full Newton step Δz=−r(z)/r′(z)\Delta z=-r(z)/r'(z) may leave (hˉl,hˉu)(\bar{h}_l,\bar{h}_u). We therefore update z←z+αΔzz\leftarrow z+\alpha\Delta z with

α={min⁡(1,ζνl/∣Δz∣),Δz<0,min⁡(1,ζνu/Δz),otherwise,(49)\alpha= \begin{cases} \min(1,\zeta\nu_l/|\Delta z|), & \Delta z<0,\\ \min(1,\zeta\nu_u/\Delta z), & \text{otherwise}, \end{cases} \tag*{(49)}

where ζ∈(0,1)\zeta\in(0,1) is a fraction-to-boundary constant, so each step covers at most a fraction ζ\zeta of the distance to the bound it approaches.

We use seven Newton steps with ζ=0.99\zeta=0.99. To test this choice, we fix [hˉl,hˉu]=[−1,1][\bar{h}_l,\bar{h}_u]=[-1,1] and run the Newton iteration for a distribution of log-barrier functions sampled in Γ∈[10−20,1010]\Gamma\in[10^{-20},10^{10}], with inputs zˉgk+1\bar{z}_g^{k+1} inside, on, and up to 10810^8 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 10−1510^{-15} 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 Γ\Gamma.

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

(zg,ξ)k+1=arg⁡min⁡z,ξ ϕ(z−ξ)+γξ2ξ2+ρg2(z−zˉgk+1)2.(z_g,\xi)^{k+1}=\arg\min_{z,\xi}\ \phi(z-\xi)+\frac{\gamma_{\xi}}{2}\xi^2+\frac{\rho_g}{2}(z-\bar{z}_g^{k+1})^2.

Substituting w:=z−ξw:=z-\xi and minimizing over ξ\xi in closed form gives ξ=ρgρg+γξ(zˉgk+1−w)\xi=\frac{\rho_g}{\rho_g+\gamma_{\xi}}(\bar{z}_g^{k+1}-w). After eliminating ξ\xi, the update reduces to

wk+1=arg⁡min⁡w ϕ(w)+ρ~g2(w−zˉgk+1)2.w^{k+1}=\arg\min_w\ \phi(w)+\frac{\tilde{\rho}_g}{2}(w-\bar{z}_g^{k+1})^2.

where ρ~g:=ρgγξ/(ρg+γξ)\tilde{\rho}_g:=\rho_g\gamma_{\xi}/(\rho_g+\gamma_{\xi}) is the effective quadratic penalty coefficient. The barrier ϕ\phi and the center zˉgk+1\bar{z}_g^{k+1} of the quadratic term are unchanged from (45); eliminating ξ\xi only replaces ρg\rho_g by ρ~g\tilde{\rho}_g. We therefore compute wk+1w^{k+1} using the same safeguarded Newton iteration, with Γ=κ/ρ~g=κ(ρg−1+γξ−1)\Gamma=\kappa/\tilde{\rho}_g=\kappa(\rho_g^{-1}+\gamma_{\xi}^{-1}), and recover zgk+1=wk+1+ξgk+1z_g^{k+1}=w^{k+1}+\xi_g^{k+1}. With only an upper bound, the root has the closed form wk+1=hˉu−bΓ(hˉu−zˉgk+1)w^{k+1}=\bar{h}_u-b_{\Gamma}(\bar{h}_u-\bar{z}_g^{k+1}), and the update reduces to the one-sided update (39) with slack sk+1=hˉu−wk+1s^{k+1}=\bar{h}_u-w^{k+1}.

The backward pass combines the barrier curvatures of the lower and upper bounds, Hl:=κ/νl2H_l:=\kappa/\nu_l^2 and Hu:=κ/νu2H_u:=\kappa/\nu_u^2, into H:=Hl+HuH:=H_l+H_u. With relaxation, we evaluate these curvatures using νl=w−hˉl\nu_l=w-\bar{h}_l and νu=hˉu−w\nu_u=\bar{h}_u-w. The reduced adjoint system (24) retains its form, with inequality weights

W−1=diag⁡(H)andWˉ−1=diag⁡(γξHγξ+H).(50)W^{-1}=\operatorname{diag}(H)\quad\text{and}\quad\bar{W}^{-1}=\operatorname{diag}\left(\frac{\gamma_{\xi}H}{\gamma_{\xi}+H}\right). \tag*{(50)}

without and with relaxation, respectively. For a single upper bound, H=κ/s2H=\kappa/s^2 and yg=κ/sy_g=\kappa/s. Each diagonal entry of the relaxed weight matrix then reduces to yg/(s+γξ−1yg)y_g/(s+\gamma_{\xi}^{-1}y_g), recovering the one-sided weight (43) in Appendix A.

For parameter gradients, we include derivatives of both bounds. The inequality term in (25) becomes

[∂θg−HlH∂θhl−HuH∂θhu]Tλˉg.(51)\left[\partial_{\theta_g}-\frac{H_l}{H}\partial_{\theta h_l}-\frac{H_u}{H}\partial_{\theta h_u}\right]^{\mathsf{T}}\bar{\lambda}_g. \tag*{(51)}

If only an upper bound hu=hh_u=h is present, then Hl=0H_l=0 and Hu=HH_u=H. Equation (51) therefore reduces to [∂θ(g−h)]Tλˉg[\partial_{\theta}(g-h)]^{\mathsf{T}}\bar{\lambda}_g, 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 κ=10−4\kappa=10^{-4}, the inequality-relaxation penalty is γξ=105\gamma_{\xi}=10^5, 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], B=1024B=1024 parallel environments, discount γ=0.99\gamma=0.99, λ=0.95\lambda=0.95, and critic learning rate 10−310^{-3}. 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.

MPCDirect
SHACPPOSHACPPO
Rollout steps3212832128
Updates100100400100
Actor learning rate5⋅10−45\cdot10^{-4}10−510^{-5}2.5⋅10−62.5\cdot10^{-6}10−410^{-4}
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.

SettingValue
Parallel environmentsB=512B = 512
Control / simulation step0.02 s / 0.01 s
MPC horizon32×332 \times3 m = 96 m
SQP / SAQP iteration limits1 / 500
SHAC rollout horizonT=128T = 128 steps (2.56 s)
Maximum episode1500 steps (30 s)
Training updates250
Discount / TD(λ\lambda)γ=0.995\gamma= 0.995, λ=0.95\lambda= 0.95
Actor learning rate5×10−45 \times10^{-4} to 10−410^{-4}, linearly decayed
Critic learning rate10−310^{-3}
OptimizerAdam, β=(0.9,0.99)\beta= (0.9, 0.99)
Gradient norm cap1.0
Critic fitting per update16 passes, 4 minibatches each
Target critic EMA decay0.995
Exploration standard deviations(σδ,στr,στf)=(0.0025,5,10)(\sigma_\delta, \sigma_{\tau_r}, \sigma_{\tau_f}) = (0.0025, 5, 10)

Table III. Hyperparameters for deployment training (§ 5-C).

Reference. The MPC and RL reward use the same reference lap of length L=258.5L = 258.5 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 (r,v,β,ωr,e,Δϕ)(r, v, \beta, \omega_r, e, \Delta\phi) have symmetric bounds ±(0.05,0.25,0.01,0.25,0.05,0.02)\pm(0.05, 0.25, 0.01, 0.25, 0.05, 0.02), respectively. We sample the front and rear dry-friction coefficients independently and uniformly within ±10%\pm10\% of their nominal values, (1.02,1.08)(1.02, 1.08), and sample the center of a Gaussian puddle uniformly along the lap. The puddle reduces friction toward 0.6, with longitudinal spread σs∼U(5,10)\sigma_s \sim U(5, 10) m and lateral spread σe=4\sigma_e = 4 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 qθq_\theta and qθHq_\theta^H introduced in § 5-C. For both running and terminal costs, we compute these coefficients as q=−2Qδxrefq = -2Q\delta_{\mathrm{xref}}. Here δxref\delta_{\mathrm{xref}} 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 ∣δxref,i∣≤bi|\delta_{\mathrm{xref},i}| \le b_i, where (bv,bωr,be,bΔϕ)=(5,5,1,0.2)(b_v, b_{\omega_r}, b_e, b_{\Delta\phi}) = (5, 5, 1, 0.2). 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 W=diag⁡(104,10−5,10−9)W = \operatorname{diag}(10^4, 10^{-5}, 10^{-9}) and terminal-time weight wt=100w_t = 100.

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,

rt=Δst−206∑j=16(εj,t+1aj)2−500[B(xt+1)+1failure](52)r_t = \Delta s_t - \frac{20}{6}\sum_{j=1}^{6}\left(\frac{\varepsilon_{j,t+1}}{a_j}\right)^2 - 500\left[\mathcal{B}(x_{t+1}) + \mathbf{1}_{\mathrm{failure}}\right] \tag*{(52)}

where Δst\Delta s_t is signed progress along the track in meters. The vector εt+1\varepsilon_{t+1} contains tracking errors in (r,v,β,ωr,e,Δϕ)(r,v,\beta,\omega_r,e,\Delta\phi), and a=(5,25,2,25,5,2)a=(5,25,2,25,5,2) 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 emin⁡e_{\min} and emax⁡e_{\max} denote the lateral track boundaries. The soft penalty B\mathcal{B} is

B(x)=max⁡(0,(5−v30)2)+max⁡(0,(emin⁡+0.15−e5)2)+max⁡(0,(e−emax⁡+0.155)2)+max⁡(0,∣Δϕ∣−π3)2.(53)\mathcal{B}(x) = \max\left(0,\left(\frac{5-v}{30}\right)^2\right) + \max\left(0,\left(\frac{e_{\min}+0.15-e}{5}\right)^2\right) + \max\left(0,\left(\frac{e-e_{\max}+0.15}{5}\right)^2\right) + \max\left(0,\left|\Delta\phi\right|-\frac{\pi}{3}\right)^2. \tag*{(53)}

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: e<emin⁡e < e_{\min} or e>emax⁡e > e_{\max}.

  • The heading error satisfies ∣Δϕ∣>π/3|\Delta\phi| > \pi/3.

  • A transition produces NaN or infinite values.

The indicator 1failure\mathbf{1}_{\mathrm{failure}} equals one for the first three conditions and zero otherwise. Nonfinite transitions receive rt=−500r_t = -500.

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 ±1000\pm1000. Critic targets use normalized rewards, and the actor objective is rescaled to the original reward units.

References

  1. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [16]J. Nocedal and S. J. Wright, Numerical Optimization, 2nd ed. Springer, 2006.
  17. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [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. [29]P. Kidger, “On neural differential equations,” Ph.D. dissertation, University of Oxford, 2021.arxiv.org/abs/2202.02435
  30. [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. [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

Paper details

vlnc:W_pvuszyy6
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 7

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Codex, Claude Code

View statement
Looking for related papers…
Contents