Adaptive-Gradient Policy Optimization: Enhancing Policy Learning in Non-Smooth Differentiable Simulations

Feng Gao, Liangzhi Shi, Shenao Zhang, Zhaoran Wang, Yi WuICML 2024

Introduction

Adaptive-Gradient Policy Optimization (AGPO) is a novel reinforcement learning algorithm designed to make differentiable simulators work reliably, even when simulated physics gets "messy." By intelligently blending noisy simulation gradients with stable Q-function gradients using inverse-variance weighting, AGPO prevents the policy collapse typically seen in non-smooth environments, such as those involving complex robot contacts.

The Challenge of Non-Smooth Physics

Differentiable simulators are often considered the "holy grail" of robot learning because they provide first-order gradients, known as Simulation Gradients (SG). Instead of guessing which way to move a joint through trial and error, the simulator's underlying math tells the agent exactly how a change in action affects the reward.

However, there is a significant catch: these gradients only work well when the simulation is "smooth." In the real world—and in popular physics engines like MuJoCo—physics is frequently non-smooth. Think of a robot foot hitting the ground; that sudden impact creates a mathematical discontinuity where gradients can either explode or vanish entirely. Existing methods like Short-Horizon Actor-Critic (SHAC) attempt to mitigate this by truncating trajectories, but they still struggle when these "rough" transitions occur within their optimization windows.

The AGPO Approach

To resolve this, the authors introduce the Adaptive Analytic Gradient, a method that treats the Q-function as a resilient surrogate for future returns. The core of the approach is a hybrid gradient estimator that combines two signals:

  1. Simulation Gradient (SG): The "analytic" gradient derived directly from the simulator's chain rule. It is highly precise but extremely volatile in non-smooth regions.
  2. Q-function Gradient (QG): A "zeroth-order" gradient derived from a learned critic. Because it is learned from sampled data, it acts as a smoothed-out approximation of the reward landscape.
Comparison of SHAC and AGPO architectures

The "Secret Sauce": Inverse-Variance Weighting AGPO calculates the empirical variance of both gradients at the action node. It then uses a mixture ratio ($\alpha$) to blend them. When the simulator encounters a "rough" patch (like a hard collision) and the SG becomes erratic, the algorithm automatically shifts its trust toward the more stable QG.

This logic is implemented in the AGPO algorithm, which segments trajectories into short horizons and estimates the Q-value at every step to evaluate the reliability of each transition. This allows the agent to effectively "shortcut" through non-smooth dynamics that would otherwise derail the learning process.

Key Insights

  • QG as a Baseline for Sanity: The most surprising finding is that the Q-function gradient is significantly more stable than Policy Gradients (PG) for detecting simulation outliers. While previous work tried to blend SG with PG, AGPO demonstrates that QG provides a much more consistent "proxy" for future returns.
Variance comparison of QG, SG, and PG over optimization steps
  • Action-Node Efficiency: To keep the algorithm computationally fast, the authors compute gradient variances at the action node rather than the policy parameter node. This provides a reliable "gauge" for the dependability of a transition without the massive computational overhead of full-parameter variance checks.
  • Horizon Scaling: Theoretically and empirically, AGPO benefits from longer horizons ($h$). While standard simulation-gradient methods often explode as the horizon grows, AGPO’s low-variance upper bound allows it to converge faster and more stably as $h$ increases.

Experimental Results

The researchers evaluated AGPO across several challenging continuous control benchmarks, including standard locomotion tasks (Hopper, Half-Cheetah, Walker2D, Ant, and Humanoid) using engines like Brax and DFlex.

  • Outperforming the State-of-the-Art: In the "Ant" task on the Brax generalized backend, AGPO significantly outperformed SHAC and vanilla Backpropagation Through Time (BPTT), which both suffered heavily from the non-smoothness of the contact solver.
  • Sample Efficiency: AGPO proved more sample-efficient than pure RL baselines like PPO, SAC, and TD3. It effectively extracts the useful analytical information from the simulator's math while ignoring the "garbage" noise generated by collisions.
  • Versatility: Unlike previous methods tailored to specific "smooth" simulators (like DFlex), AGPO maintained high performance across both smooth and non-smooth backends, proving it to be highly simulator-agnostic.

Limitations and Future Directions

  • Computational Overhead: Calculating the mixture ratio requires an additional backpropagation step. While the authors show that wall-clock time remains competitive with SAC/TD3 due to JAX's parallelism, there is still room for engineering optimization.
  • Advanced Weighting: The current model uses a scalar mixture ratio. Using tensor-valued weights or incorporating covariance between gradients could further refine the blending process.
  • Exploration: While AGPO elegantly handles the gradient side of the equation, it still relies on standard entropy regularization for exploration. Future iterations might integrate the adaptive gradient more deeply into how the agent chooses to explore "rough" versus "smooth" regions of the state space.

Summary updated

BibTeX
@inproceedings{gao2024adaptive,
  author = {Feng Gao and Liangzhi Shi and Shenao Zhang and Zhaoran Wang and Yi Wu},
  title = {{Adaptive-Gradient Policy Optimization: Enhancing Policy Learning in Non-Smooth Differentiable Simulations}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=S9DV6ZP4eE},
}
Figure