NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Safe Score Matching: Diffusion Policies with Hamilton-Jacobi Reachability for Online Safe Reinforcement Learning

Boyang Li, Matthew Kim, Sylvia Lee HerbertNeurIPS 2026

TL;DR

When teaching robots or aircraft to act via reinforcement learning, enforcing safety "on average" isn’t good enough—crashing once is still a catastrophe, and dodging an obstacle requires decisively going left or right rather than averaging the two. Safe Score Matching (SSM) solves this by pairing expressive diffusion policies with mathematical reachability guarantees in an online learning loop. It switches seamlessly between chasing rewards when safe and actively steering out of danger when things go wrong, achieving top-tier control performance with near-zero safety violations.

What Problem Does This Paper Address?

Teaching an agent to maximize rewards without breaking physical hardware is the central puzzle of Safe Reinforcement Learning (RL). Currently, online safe RL relies on two main paradigms, and both leave a critical gap:

  1. Primal-dual methods treat safety like a financial budget, penalizing the agent only if its average cumulative cost crosses a threshold. That’s convenient for math, but terrible for hardware: an agent can satisfy an average constraint while still occasionally flying straight into a wall.
  2. Hamilton-Jacobi (HJ) reachability methods enforce hard, state-wise constraints—meaning safety must hold at every single time step. They divide the world into a "feasible" safe zone and an "infeasible" danger zone. However, safe action spaces are messy and disconnected (think of swerving left or right around a pillar). Standard RL actors use unimodal Gaussian (bell-curve) or deterministic policies. Faced with two distinct safe paths, a Gaussian policy either averages them—steering straight into the pillar—or prematurely collapses onto a suboptimal route.

Meanwhile, diffusion policies (the generative tech behind image models, adapted to output robot actions) are brilliant at capturing complex, multimodal choices. Yet, existing online diffusion RL methods only know how to maximize rewards; they have no mechanism for hard, step-by-step safety.

Methods

Enter Safe Score Matching (SSM), an online off-policy actor-critic algorithm that marries diffusion policies with Hamilton-Jacobi reachability.

Training a diffusion policy online is notoriously tricky because backpropagating gradients through a multi-step denoising chain is slow and noisy. Standard Q-Score Matching (QSM) sidesteps this by training the diffusion model’s denoiser to directly match the action-gradient of the reward critic ($\nabla_a Q_r$), effectively pointing the denoising process toward higher rewards.

What’s new in SSM is how it alters this denoising target using a learned HJ safety critic ($Q_h$), which predicts the worst-case future safety violation. SSM introduces an HJ-gated two-branch score target:

  • Inside the safe (feasible) set: If the current state and candidate action are deemed viable ($V_h(s) \le 0$ and $Q_h(s, a) \le 0$), the target acts just like QSM, following the reward gradient ($\alpha_r \nabla_a Q_r$) to maximize task performance while restricting support to safe actions.
  • Outside the safe set (recovery branch): If the agent drifts into an infeasible state ($V_h(s) > 0$), chasing rewards is suspended. The gate flips, guiding the denoiser along the negative action gradient of the safety critic ($-\beta \nabla_a Q_h$) to minimize worst-case violations and claw its way back to safety.

To check if a state is feasible without exhaustively searching all possible actions, SSM estimates the state safety value $V_h(s)$ by sampling one action from the diffusion policy and generating $K-1$ local Gaussian perturbations around it.

Figure 1: SSM on a planar-quadrotor stabilize-and-avoid task. Trajectory colors indicate the two route modes learned by the policy rather than safe and unsafe outcomes: green trajectories pass to the left of the obstacles, and orange trajectories pass to the right. (a) Rollouts from randomly sampled initial states. (b) Rollouts from the nominal, symmetric initial state (blue triangle), perturbed within the small neighborhood shown by the light-blue box; from nearly the same initial state, the policy takes either route to the goal. The green star marks the goal center, and the surrounding green disk is the goal region, whose entry counts as a successful episode. Red crosses mark collisions. The background is a two-dimensional slice of the learned HJ value Vh at fixed ˙z = −0.5, and the dashed contour around the gray regions is its zero level set Vh = 0, the estimated boundary of the viable set {s : Vh(s) ≤0}.

Datasets

Because SSM is an online RL algorithm, it does not train on static offline datasets; instead, it collects experience interactively in simulated physics environments:

  • Safety-Critical Control Suite: Three progressively harder continuous-control benchmarks—Quad2D (planar quadrotor tracking a circle inside a tight altitude band), Quad3D (9-state 3D quadrotor regulation), and F16 (16-state fixed-wing jet stabilizing at low altitude within flight-envelope bounds). Plus, a planar quadrotor stabilize-and-avoid obstacle task used to visualize multimodal routing.
  • Safety-Gymnasium: Standard Swimmer and HalfCheetah velocity-constrained locomotion tasks, alongside CarGoal1 navigation for ablation studies.
Figure 2: Benchmark environments. Renderings of the Quad2D, Quad3D, and F16 tasks.

Key Insights and Ideas

  • Safety routing and policy expressiveness can be cleanly decoupled: The entire target score field depends only on standard off-policy reward and safety critics. The diffusion actor simply regresses onto this gated vector field—no fragile backpropagation through the reverse diffusion chain required.
  • Multimodality prevents conservative paralysis: As shown in Figure 1, from virtually the exact same starting point, SSM smoothly maintains both left and right trajectories around obstacles. Unlike unimodal actors that must hedge their bets or commit early, diffusion policies preserve multiple viable options simultaneously.
  • Local perturbations beat policy re-sampling for safety checks: When estimating whether any safe action exists at a state, perturbing a single action with Gaussian noise works much better than drawing multiple fresh samples from the diffusion policy. Why? Because diffusion samples cluster tightly around high-reward modes and miss safer, low-violation actions hiding in between!

Key Results

  • Control Benchmarks: SSM achieves the lowest tracking error on Quad2D, lowest terminal tracking distance on Quad3D, and highest stabilization rate on F16 (nearing 90%), while maintaining the highest safety precision (lowest false-safe rates) on Quad3D and F16.
  • Safety-Gymnasium: While primal-dual baselines train to stay under a cost budget of $25.0$ (and frequently overshoot it), SSM's hard state-wise objective drives violations to near zero: 0.5 average cost on Swimmer (over $10\times$ lower than any baseline) and 0.0 on HalfCheetah, while achieving the highest in-budget reward on HalfCheetah ($2754 \pm 13$).
  • Speed & Efficiency: On Quad3D, SSM reaches peak performance using 4 to 6 times fewer environment steps than reachability baselines (RAC and RESPO), finishing training in ~1 hour vs. 2.5+ hours, and needing just a fast 5-step denoising chain at deployment.

Limitations and Future Work

  • No oracle guarantee with a learned critic: While HJ reachability is mathematically airtight with an exact safety function, SSM learns its safety critic online from nonstationary replay data. If the critic underestimates danger, unsafe actions can slip through. While the authors prove how a known error bound translates into a safety margin, guaranteeing that bound online remains an open problem.
  • Deterministic world assumption: The current formulation assumes deterministic system dynamics. Extending SSM to handle wind gusts, sensor noise, or unmodeled physics via probabilistic or robust (HJ-Isaacs) reachability—and deploying it on physical robots—are the clear next frontiers.

Summary updated

BibTeX
@inproceedings{li2026safe,
  author = {Boyang Li and Matthew Kim and Sylvia Lee Herbert},
  title = {{Safe Score Matching: Diffusion Policies with Hamilton-Jacobi Reachability for Online Safe Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ulU0SYntCo},
}
Figure