Differentiable Model Predictive Control on the GPU

Emre Adabag, Marcus Greiff, John Subosits, Thomas Jonathan Lew

DiffMPC is a new GPU-accelerated tool that makes differentiable Model Predictive Control (MPC) fast enough for large-scale machine learning. By replacing traditional sequential algorithms with a parallel-friendly optimization routine, researchers achieved massive speedups over existing baselines, enabling complex real-world tasks like training a Toyota Supra to perform robust, high-speed drifting through unpredictable water puddles.

The Computational Bottleneck of Differentiable MPC

Differentiable optimization allows researchers to embed "physics-aware" layers—like an MPC controller—directly into neural networks. This provides a strong inductive bias, meaning the model doesn't have to learn the laws of physics from scratch; it already knows how to plan a trajectory.

However, there is a massive computational bottleneck. Traditional MPC solvers rely on Riccati recursions, which are inherently sequential (you must calculate time step $T$ before $T-1$). This makes them a poor fit for GPUs, which are designed for massive parallelism. Consequently, training differentiable MPC models has historically been agonizingly slow, limiting their use to small problems or simple simulations.

Introducing DiffMPC

To overcome this, the authors introduce DiffMPC, a solver designed from the ground up for the GPU. Key technical innovations include:

  • Parallelism over Time: Instead of sequential Riccati recursions, DiffMPC uses a Preconditioned Conjugate Gradient (PCG) routine. This allows the solver to compute updates for all time steps simultaneously.
  • Tridiagonal Preconditioning: To make the PCG routine converge quickly, the team uses a custom "symmetric stair" preconditioner that exploits the specific sparse structure of optimal control problems.
  • Efficient Backward Pass: Using the Implicit Function Theorem (IFT), the solver calculates gradients (sensitivities) without re-solving the entire problem. Because the math describing the optimal solution is already computed during the forward pass, the backward pass becomes extremely cheap.
  • JAX Integration: The tool is written in JAX, making it "plug-and-play" for modern deep learning pipelines.

Key Insights

  • The "Warm-Start" Advantage: Unlike traditional solvers, PCG is excellent at "warm-starting." If the solver starts with a guess close to the solution (from a previous time step or training iteration), it converges almost instantly. This is a huge win for MPC, where the problem changes only slightly between frames.
  • Learning Robustness: By differentiating through the MPC, the system can learn which cost parameters (e.g., "how much do I care about sliding?") and physics parameters (e.g., "how much grip do these tires actually have?") lead to the most stable behavior.
  • GPU vs. CPU Trade-offs: While Riccati-based solvers are faster on a CPU, they hit a hard scaling ceiling. DiffMPC is specifically tailored for execution on the GPU, where it can scale to much larger batch sizes.

Performance and Real-World Results

DiffMPC was evaluated across several benchmarks, including randomized MPC problems, nonlinear attitude stabilization, and standard imitation learning tasks.

Comparison of forward and backward pass execution times across different solvers on CPU and GPU.

Significant Speedups: On the GPU, DiffMPC is 4–7x faster than trajax (the previous fastest GPU baseline) and orders of magnitude faster than general-purpose solvers like Theseus. In imitation learning tasks, DiffMPC reached convergence 2x faster in wall-clock time compared to the best baselines.

Trajectory comparisons showing the learned controller successfully navigating while the baseline experiences spinouts.

Real-World Success: The system was used to "auto-tune" a controller for a Toyota Supra. Using Domain Randomization (varying friction and puddle locations), they trained a controller robust to real-world uncertainty. The learned policy achieved a 100% success rate in drifting through water puddles in simulation, compared to only 70% for a manually tuned baseline. The learned controller was then successfully deployed on the actual vehicle.

Limitations and Future Work

While highly effective, DiffMPC has a few limitations:

  • Inequality Constraints: Currently, DiffMPC handles constraints (like "don't hit the wall") by adding penalties to the cost function. Incorporating "hard" inequality constraints while maintaining differentiability remains a challenge.
  • Hardware Specificity: The solver is slower than sequential methods when run on a CPU; its benefits are strictly realized on high-end GPU hardware.
  • Hyperparameters: The solver requires manual tuning of its own parameters (like PCG tolerance), which isn't yet automated.

Summary updated

BibTeX
@inproceedings{adabag2026differentiable,
  author = {Emre Adabag and Marcus Greiff and John Subosits and Thomas Jonathan Lew},
  title = {{Differentiable Model Predictive Control on the GPU}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=bFYfV6c9zu},
}
Figure