Safe Continuous Control with Constrained Model-Based Policy Optimization

Moritz A. Zanger, Karam Daaboul, J. Marius Zöllner

TL;DR

Constrained Model-Based Policy Optimization (CMBPO) is a new framework that brings the sample efficiency of model-based reinforcement learning to the high-stakes world of safe control. By using an ensemble of dynamics models and adaptive techniques to "brake" when the model becomes uncertain, CMBPO achieves the performance of state-of-the-art model-free methods while requiring 10 to 20 times fewer training samples.

What Problem Does This Paper Address?

Reinforcement Learning (RL) has mastered complex games and simulations, but deploying it on physical robots remains a "sample-efficiency nightmare." Standard RL is "trial-and-error," which is fine in a video game but disastrous if a million-dollar robot has to crash a thousand times to learn how to walk.

Safe RL tries to solve this by adding constraints (e.g., "don't hit the wall"). However, current safe RL methods are mostly model-free, meaning they learn entirely from real-world interaction, requiring millions of steps. Model-based RL (MBRL) is much faster because it learns a "simulator" (a model) of the world and "imagines" trajectories. The catch? Models are never perfect. "Model bias" and accumulating errors can lead an agent to believe a path is safe when it is actually dangerous. This paper tackles the challenge of how to trust a learned model enough to learn quickly, but not so much that you violate safety constraints.

Methods

The authors introduce CMBPO, which builds on the model-free Constrained Policy Optimization (CPO) algorithm but augments it with synthetic data. Their key contributions are:

  1. Theoretical Boundaries: They derive a new mathematical bound (Boundary 4.1) that connects the performance of a policy in the "imagined" model to its actual performance in the real world, accounting for model error and policy shifts.
  2. Uncertainty-Aware Ensembles: They use an ensemble of neural networks to predict dynamics. Disagreement between these networks serves as a proxy for epistemic uncertainty (the "I don't know what I don't know" factor).
  3. Adaptive Resampling: If the model's uncertainty exceeds a threshold, the algorithm automatically "dilutes" the synthetic data with more real-world samples to prevent unsafe policy updates.
  4. Adaptive Rollout Horizons: Instead of "imagining" trajectories of a fixed length, CMBPO stops a simulated rollout as soon as the accumulated uncertainty becomes too high. This prevents the agent from learning from "hallucinations" caused by compounding model errors.

Datasets

The algorithm was evaluated on three high-dimensional continuous control tasks in the MuJoCo physics simulator:

  • AntSafe: An 8-degree-of-freedom quadruped robot that must run forward while staying a safe distance from overthrowable walls.
  • HalfCheetahSafe: A 2D running robot that must avoid a moving obstacle.
  • AntCircle: A quadruped tasked with running along a circular path while staying within a narrow corridor.

These tasks are significantly more complex than standard benchmarks because they require balancing high-speed locomotion with strict spatial constraints.

Key Insights and Ideas

  • The "Safety Valve" of Uncertainty: The most elegant idea here is using the average KL divergence between ensemble members as a scale-invariant measure of model error. It allows the agent to know when to stop trusting its "imagination."
  • Reconciling Theory and Practice: The authors show that while theoretical bounds are often too conservative for direct use, they provide the necessary "intuition" for designing practical constraints like the adaptive resampling factor ($\alpha$).
  • Model-Based Advantage: Interestingly, the authors found that CMBPO sometimes exceeds the final performance of model-free methods. They suspect this is because the model provides "cleaner," lower-variance gradients compared to the noisy samples of the real world.

Key Results

  • Sample Efficiency: CMBPO reached peak performance with a 10-20 fold reduction in training samples compared to model-free baselines like CPO and PPO-Lagrangian.
  • Safety Adherence: While CMBPO had slightly more constraint violations during the very early stages of training (due to the initial inaccuracy of the model), it successfully converged to safe policies much faster.
  • Cumulative Cost: Because it learns so much faster, the total incurred cost (the sum of all safety violations during the entire training process) was significantly lower than the baselines—often by an order of magnitude.

Limitations and Future Work

The authors identify a major hurdle: Partial Observability. In preliminary tests on the "Safety-Gym" benchmark, CMBPO struggled because the states weren't fully observable, and there were strong correlations between state dimensions that the current model architecture couldn't capture.

Future Directions: * Sophisticated Architectures: Moving beyond simple feedforward networks to LSTMs or Attention-based models to better handle temporal dependencies. * Latent Space Models: Learning the dynamics in a compressed "latent" space rather than raw state-space. * Real-World Deployment: The authors' ultimate goal is to move these "safe imagination" techniques onto physical robotic hardware.

Summary updated

BibTeX
@inproceedings{zanger2021safe,
  author = {Moritz A. Zanger and Karam Daaboul and J. Marius Zöllner},
  title = {{Safe Continuous Control with Constrained Model-Based Policy Optimization}},
  booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=ZaCU-IxtNMW},
}

Loading related content...

Figure