Safe Beyond the Horizon: Efficient Sampling-based MPC with Neural Control Barrier Functions

Ji Yin, Oswin So, Eric Yang Yu, Chuchu Fan, Panagiotis Tsiotras

TL;DR

This paper introduces Neural Shield-VIMPC (NS-VIMPC), a framework that ensures long-term safety for autonomous systems by combining sampling-based control with learned Neural Control Barrier Functions. By introducing a novel Resampling-Based Rollout (RBR) strategy, the authors achieve a 5x improvement in sample efficiency, enabling safe, real-time planning on a standard CPU even for complex, nonlinear "black-box" dynamics.

What Problem Does This Paper Address?

Model Predictive Control (MPC) is a workhorse in robotics, but it has a fundamental "short-sightedness" problem. It optimizes actions over a finite time window (the prediction horizon). A robot might find a path that is safe for the next 2 seconds, only to realize at the 2.1-second mark that it has entered an inescapable "dead end" where a crash is inevitable. This is known as a lack of recursive feasibility.

While theoretical solutions like "terminal set constraints" exist, they are notoriously difficult to calculate for complex, nonlinear systems. Furthermore, modern sampling-based MPC methods (like MPPI) are great for handling complex dynamics but struggle with hard safety constraints; they often waste massive amounts of computation simulating "suicidal" trajectories that are eventually discarded because they violate safety rules.

Methods

The authors propose a two-stage approach to solve these issues:

  1. Offline: Learning Safety Certificates. They train a Discrete-time Policy Neural Control Barrier Function (DPNCBF). This neural network acts as a safety shield, learning to identify which states are safe not just now, but in the long run. It essentially provides a "safety value" for any given state.
  2. Online: Efficient Safe Sampling. They integrate this shield into a Variational Inference MPC (VIMPC) framework. To make it efficient, they introduce Resampling-Based Rollout (RBR).
Fig. 2: Overview of Neural Shield VIMPC (NS-VIMPC). Offline, using DPNCBFs, we collect a dataset and train a NN approximation Bθ of a DCBF. Bθ is used to impose the DCBF descent condition (16) as a state constraint. Online, we modify the VIMPC architecture to use resampling-based rollouts to improve the sampling distribution of the Monte Carlo estimator in the presence of the DCBF state constraints. In addition, we integrate the DCBF safety condition (14b) into the optimization objective function as in (18).

Standard sampling methods (like Gaussian noise) often produce many unsafe trajectories. RBR borrows an idea from particle filtering: at every simulation step, if a trajectory (a "particle") starts to become unsafe, it is immediately "rewired" to a safe one. This keeps the controller's "attention" focused entirely on safe regions of the state space.

Fig. 1: Standard sampling vs. Resampling-Based Rollout (RBR). In this AutoRally example, the blue dot samples future trajectories and computes an optimal control that avoids the black obstacles. RBR rewires all sampled trajectories to be safe, resulting in a more accurate sampling distribution. In contrast, the standard approach samples from a Gaussian distribution and wastes computation on unsafe trajectories.

Datasets and Benchmarks

The researchers evaluated their method on three distinct platforms:

  • AutoRally: A 1/5 scale autonomous racing car. They tested it both in high-fidelity simulations and on real-world dirt track hardware.
  • Drone: A simulated planar quadrotor navigating a narrow corridor while dealing with complex "ground effect" aerodynamics.
  • Dubins Car: A classic mathematical benchmark for testing safety and reachability.

Key Insights and Ideas

  • Variance is the Enemy: The "aha moment" for RBR is realizing that standard sampling suffers from exponential variance growth over the planning horizon. By resampling at every step, NS-VIMPC keeps the estimator variance bounded, which is why it works so much better with fewer samples.
  • Safety as a Terminal Cost: By using the learned DPNCBF as a terminal constraint, the robot "senses" danger far beyond its actual planning horizon. In the drone experiments, NS-VIMPC began descending to avoid an obstacle long before standard MPC even "saw" it.
  • Robustness to "Bad" Goals: In hardware tests, the authors gave the robot an "adversarial" cost function that actually rewarded crashing. Standard controllers immediately drove into walls, but the Neural Shield successfully overrode these commands to keep the vehicle safe.

Key Results

  • 5x Efficiency Boost: On the AutoRally task, RBR achieved the same safety level as standard methods while using 5 times fewer trajectories.
  • Zero Crash Rate: In the drone corridor task, NS-VIMPC maintained a 0% crash rate even with a very short planning horizon (10 steps), whereas all baseline methods (MPPI, CEM, S-MPPI) crashed frequently.
  • Real-Time CPU Planning: Because of the efficiency gains, the system runs at over 70 Hz on a standard laptop CPU, eliminating the need for expensive, power-hungry GPUs typically required for high-performance sampling-based MPC.
Fig. 6: Varying control horizon on Drone. (a) Only NS- MPPI has a crash rate of zero with a control horizon of 10, demonstrating the benefit of enforcing the DCBF constraint for maintaining safety beyond the prediction horizon.

Limitations and Future Work

The authors acknowledge that their DPNCBF is a neural approximation of a safety certificate. While it works exceptionally well in practice, it doesn't provide the ironclad formal mathematical guarantees that a "true" Control Barrier Function would.

Future work includes exploring how to integrate Control Lyapunov Functions to not just ensure safety, but also optimize performance (like speed or energy efficiency) more effectively within the same resampling framework. They also plan to investigate theoretical guarantees for cases where the safe control set is non-convex, a common occurrence in real-world obstacle avoidance.

Summary updated

BibTeX
@misc{yin2025safe,
  author = {Ji Yin and Oswin So and Eric Yang Yu and Chuchu Fan and Panagiotis Tsiotras},
  title = {{Safe Beyond the Horizon: Efficient Sampling-based MPC with Neural Control Barrier Functions}},
  year = {2025},
  eprint = {2502.15006},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.15006},
}
Figure