Differentiable Mpc

Differentiable Model Predictive Control (Differentiable MPC) is a framework that embeds a Model Predictive Control optimization solver as a differentiable layer within a neural network, enabling end-to-end gradient-based learning of the dynamics model and cost function that drive the controller — combining MPC's constraint satisfaction and safe planning guarantees with deep learning's ability to learn complex system models from data — making it possible to learn interpretable, physically-grounded control policies for robotics, autonomous vehicles, and industrial systems where constraint satisfaction is non-negotiable.

What Is Differentiable MPC?

  • MPC Background: Model Predictive Control solves a finite-horizon optimization problem at each timestep — finding the sequence of K actions that minimizes a cost function subject to dynamics constraints, then executes only the first action and re-plans (receding horizon).
  • Differentiable Extension: By differentiating through the MPC optimization (using implicit differentiation or differentiable QP solvers), gradients of the task loss can flow backward through the entire control pipeline — updating the learned dynamics model and cost function jointly.
  • Learning the Model: Rather than manually engineering a physics model, the agent learns a neural dynamics model f(s, a) → s' that is used inside the MPC optimizer.
  • Learning the Cost: Rather than manually specifying the cost function, it can be learned from demonstrations or task reward — the optimizer finds the action sequence minimizing this learned cost.

Why Differentiability Matters

  • End-to-End Training: The controller, dynamics model, and cost function can all be updated together with a single backward pass — standard autoML optimization replaces manual system identification.
  • Safety by Design: Unlike black-box neural policies, MPC enforces explicit state/action constraints at every step — critical for physical systems where constraint violation causes hardware damage or safety incidents.
  • Interpretability: The learned dynamics model is explicit and inspectable — engineers can examine what the system predicts and diagnose failure modes.
  • Data Efficiency: Physics priors encoded in the MPC structure reduce the amount of data needed to learn a competent controller compared to pure model-free methods.

Key Technical Approaches

OptNet (Amos & Kolter, 2017):
- Embeds quadratic programming (QP) solvers as differentiable layers via implicit differentiation through KKT conditions.
- First general framework for differentiable constrained optimization in neural networks.
- Foundation for differentiable MPC implementations.

DMPC (Amos et al., 2018):
- Applies OptNet's QP differentiation to the MPC setting — linear dynamics with quadratic cost.
- Demonstrated learning dynamics and cost from demonstrations with analytical gradients.

Neural MPC / CausalMPC:
- Replaces linear dynamics assumption with learned neural dynamics model.
- Combines uncertainty-aware ensemble models with MPC for robust control under model error.

Applications

DomainConstraint TypeAdvantage of Differentiable MPC
Robotic manipulationJoint limits, torque limitsSafe torque profiles from learned dynamics
Autonomous drivingRoad boundaries, collision avoidanceMulti-step safe trajectory planning
Chemical processesSafety bounds on temperature/pressureConstraint satisfaction during learning
Legged locomotionStability constraintsDynamically consistent gait synthesis

Differentiable MPC is the union of physics-aware planning and data-driven learning — enabling AI systems that respect hard real-world constraints while continuously improving their understanding of complex dynamics from experience, bridging the gap between classical control theory and modern deep learning.

Take differentiable mpc further

Ask the copilot about this term, or have our engineers assess it against your process.