In the world of robotics, there’s a long-standing tension between classical control and modern deep learning. Classical control relies on trajectory optimization—solving a mathematical problem to find the best sequence of actions based on a known model. Deep learning, on the other hand, often uses "black box" neural networks to map observations directly to actions.
A new paper introduces DiffTORI (Differentiable Trajectory Optimization for Reinforcement and Imitation learning), a framework that brings these two worlds together. By making the trajectory optimization process itself differentiable, the authors allow robots to learn exactly what they need to optimize to succeed at a task.
TL;DR
DiffTORI embeds differentiable trajectory optimization directly into the policy representation, allowing cost and dynamics functions to be learned end-to-end. This approach solves the "objective mismatch" in reinforcement learning and sets new state-of-the-art benchmarks for imitation learning across 50 diverse robotic tasks using high-dimensional image and point cloud data.
What Problem Does This Paper Address?
Traditional model-based reinforcement learning (MBRL) suffers from a nagging issue called objective mismatch. Usually, we train a dynamics model to predict the next state (minimizing Mean Squared Error). However, a model that is great at predicting the future isn't necessarily great for controlling a robot. A tiny prediction error in a critical part of the state space can lead to total task failure.
In imitation learning (IL), current champions like Diffusion Policies or Energy-Based Models (EBMs) are powerful but can be computationally expensive to sample from or unstable to train. Furthermore, most previous attempts to use differentiable optimization were stuck in "toy" environments with low-dimensional states, failing to scale to the complex visual inputs (images and point clouds) that real-world robots actually see.
Methods
The core "magic" of DiffTORI is treating a trajectory optimizer as a layer in a neural network.
- Differentiable Optimization: Using the Theseus library, the authors implement a non-linear least squares optimizer. Because the solver is differentiable, you can calculate the gradient of the final action with respect to the parameters of the cost function and the dynamics model.
- Reinforcement Learning: DiffTORI builds on the TD-MPC architecture. Unlike standard MBRL, which updates models based on prediction error, DiffTORI uses a policy gradient loss. It back-propagates the task reward through the optimizer to update the encoder, dynamics, and reward models simultaneously.
- Imitation Learning: For IL, DiffTORI learns a cost function such that the "optimal" trajectory produced by the solver matches expert demonstrations. To handle tasks with multiple solutions (multimodality), they wrap the optimizer in a Conditional Variational Auto-Encoder (CVAE).
- Action Refinement: DiffTORI doesn't always start from scratch. It can take an initial guess from a base policy (like a simple Behavior Cloning network) and "refine" it through the optimization layer.
Datasets
The authors put DiffTORI through a massive battery of tests:
- Model-Based RL: 15 visual locomotion and manipulation tasks from the DeepMind Control Suite (e.g., Cheetah-run, Cup-catch).
- Imitation Learning: 35 tasks in total across three major benchmarks:
- Robomimic: 5 tasks using image inputs.
- ManiSkill 1 & 2: 9 tasks using 3D point cloud inputs.
- MetaWorld: 22 tasks using point cloud inputs.
Key Insights and Ideas
- Learning "What" to Optimize: Instead of hand-tuning reward functions, DiffTORI learns a latent "objective function." The robot learns that certain states are "expensive" not because a human said so, but because avoiding them leads to higher task success.
- Solving the Mismatch: By differentiating through the solver, the dynamics model is forced to be accurate in the ways that matter for control, effectively bypassing the objective mismatch problem.
- The Power of Refinement: One of the most practical findings is that DiffTORI acts as a "super-charger" for existing policies. When used to refine a pre-trained Diffusion Policy, it consistently lowered failure rates, suggesting that optimization is a more stable way to "clean up" actions than pure neural inference.
Key Results
DiffTORI demonstrated superior performance across the board:
- RL Performance: In the DeepMind Control Suite, DiffTORI outperformed state-of-the-art baselines like TD-MPC and DrQ-v2 on 14 out of 15 tasks, showing significantly faster convergence and higher average rewards.
- IL Success: On the MetaWorld benchmark, DiffTORI achieved a 7.7% higher average success rate than DP3 (a leading 3D diffusion policy) using only 10 demonstrations per task.
- Robustness: In Robomimic, DiffTORI achieved the lowest failure rates compared to Diffusion and Implicit BC, particularly in complex manipulation tasks like "Transport" and "ToolHang."
Limitations and Future Work
The primary trade-off for this performance is computational overhead. Solving an optimization problem and calculating its gradients is significantly slower than a standard neural network forward pass. For example, inferring an action takes about 0.052 seconds with DiffTORI versus 0.009 seconds with standard MPPI.
The authors also noted that DiffTORI is sensitive to initialization; it performs much better when it has a "base policy" to start from rather than starting from zero or random noise. Future work will likely focus on faster, GPU-accelerated solvers to bring these high-performance policies closer to real-time deployment on physical hardware.
Summary updated