Safe Exploration That Notices When Its Own Model Is Wrong

Robots and controllers that learn their own dynamics usually explore in two steps. They fit a model that reports how unsure it is, then send the system toward states where that uncertainty is high. A safety layer meanwhile keeps the system inside bounds that the same uncertainty estimate says are trustworthy. This works when the model's class of possible dynamics contains the real plant. It breaks when the real system differs from what the model can represent, for example a heavier vehicle than assumed or friction the model has no term for. Engineers call this gap model-plant mismatch. Under mismatch, the model's reported uncertainty stops tracking its actual error. Rahmati et al. show that in this regime uncertainty-driven sample selection becomes a "blind guide" that does worse than random sampling.

Our observation is that in safe exploration this failure happens twice, and from the same cause. The exploration rule wastes queries in regions that are not informative. The safety layer also draws its margins from uncertainty bounds that are now too narrow, so it permits violations. We propose to watch a single signal: the gap between the errors the model actually makes on newly collected transitions and the errors it predicted it would make. That signal is used both to widen the safety margin and to redirect exploration toward the states where the mismatch matters for staying safe. The aim is fewer violations and faster recovery of the usable safe region than variance-driven safe explorers, even when the model class is wrong.

Core Claim

In a learned-dynamics safe-exploration loop with a misspecified model, a monitored estimate of model bias can do two jobs at once. It inflates the safety filter's margin, and it focuses exploration on the barrier-relevant directions. Together these yield three things: fewer and shorter constraint violations than variance-only methods such as SAFEMPC and SAMBA, less conservatism than a safety margin hand-tuned to cover the worst mismatch, and better data efficiency than random exploration under the same safety filter. That last comparison is the one Rahmati et al. predict variance-based acquisition loses.

Where This Sits

The closest existing work comes in three groups.

Methods that combine safe exploration with parametric uncertainty all assume the uncertainty estimate is calibrated. SAFEMPC propagates Gaussian-process confidence ellipsoids, a Gaussian process being a regression model that outputs a mean and a variance at every input. It plans toward high variance and keeps a guaranteed safe return path, but its confidence-scaling parameter is tuned by hand. SAMBA uses a leave-one-out acquisition that seeks informative transitions close to confident data, under a tail-risk constraint. It still trusts the Gaussian process's own predictive distribution. SEELS uses confidence ellipsoids from a meta-learned feature basis and explores until the task becomes provably feasible. Its own stated limitation is that calibration fails when the plant leaves the meta-training basis. These three supply our baselines, and SEELS's limitation motivates the work directly.

Methods that combine model mismatch with active learning lack safety. Rahmati et al. diagnose the blind-guide effect through a bias-variance decomposition. They suggest higher-capacity surrogate error models as a remedy, but only for static regression. ALCOI directs identification toward what matters for control cost and proves finite-sample bounds. It needs an unshielded burn-in phase and assumes the parameter structure is known. We reuse Rahmati's surrogate-error idea as a method ingredient, and we borrow ALCOI's principle of identifying what the downstream task needs. In our case the downstream task is the safety constraint rather than control cost.

The barrier-refinement work of Dai et al. shows that learning the time derivative of a control barrier function directly, rather than the full dynamics, tolerates 100% mass error (Dai et al.). A control barrier function is a scalar function $h$ of the state that is nonnegative exactly on the safe set. The same group shows that prioritizing high-loss samples speeds this up (Dai et al.). Both collect data passively. The safety-paradox work constrains our design: a filter that works well starves itself of boundary data, so exploration must deliberately seek safe states near the boundary.

Method

The system keeps a nominal physics model with estimated parameters plus a learned residual model with predictive standard deviation $\sigma(x,u)$. Everything is projected onto the barrier: what matters is the error in the predicted rate of change of the barrier, $\dot h$. At each step the filter observes the realized $\dot h$, the model's prediction of it, and the model's predicted spread. From these it computes a prequential residual $r_t$, meaning the error on a transition the model had not yet been trained on.

A second, deliberately over-parameterized model $\hat b(x,u)$ is fitted to $|r_t|$. Its outputs are scaled with a split-conformal quantile computed over a sliding window of recent residuals. Conformal calibration is a distribution-free way to set an interval width so that it covers a chosen fraction of observed errors. The safety filter is a standard barrier quadratic program with a margin. It enforces

$$\nabla h(x)^\top \big(\hat f(x) + \hat g(x)u\big) \;\ge\; -\alpha\, h(x) \;+\; \beta\,\sigma_h(x,u) \;+\; q_{1-\delta}\,\hat b(x,u),$$

where $\hat f, \hat g$ are the learned drift and input terms, $\alpha$ is the barrier decay rate, $\sigma_h$ is predictive spread projected onto $\nabla h$, $\beta$ is a fixed variance multiplier, and $q_{1-\delta}$ is the conformal quantile at miscoverage level $\delta$. When the model is well specified, $\hat b$ is small and the filter reduces to the usual variance-based margin. When residuals outgrow the predicted variance, the margin widens only where the bias model says it should.

Exploration chooses, among actions the filter certifies, the one maximizing

$$a(x,u) = \big(\beta\,\sigma_h(x,u) + \hat b(x,u)\big)\cdot w(h(x)),$$

where $w$ is a weight that peaks near the safe-set boundary. Exploration therefore targets states where the safety-relevant error, including bias, is largest and close to the boundary, which counters the safety paradox. A calibration statistic, the running mean of $r_t^2/\sigma_h^2$, serves as a diagnostic. Values well above one indicate the blind-guide regime.

The honest weak point is that bias can only be measured where data exist. The over-parameterized $\hat b$ extrapolates, but nothing guarantees it is right in unvisited states. Conformal coverage also holds only for the recently visited state distribution, not for states the explorer is about to enter. We therefore claim empirical violation reduction plus a coverage guarantee for the visited distribution, not forward invariance under arbitrary mismatch. We test explicitly how badly coverage degrades as exploration shifts.

Research Program

We will build the filter-plus-acquisition loop on two model backbones: a sparse Gaussian process and a small ensemble. Using both separates the bias-monitoring idea from any one uncertainty model.

Mismatch will be injected in two forms. The parametric form is mass, inertia or friction outside the prior range. The structural form is a missing drag or friction term that no parameter setting of the nominal model can reproduce.

We will measure three quantities, all under a common safety filter. First, how the calibration statistic evolves. Second, how much each margin term contributes to preventing violations. Third, whether the safety-weighted bias acquisition beats random exploration. That last comparison is the crux, because Rahmati's result says plain variance acquisition should lose to random exploration under mismatch.

Baselines

The naive reference is the same safety filter with variance-only margin $\beta\sigma_h$ and Gaussian action noise for exploration. It shows what happens with no active learning and no bias monitoring.

The strongest existing methods are SAMBA and SAFEMPC, both reimplemented on our backbone with identical dynamics data, planning horizon and compute per step. SAMBA reports convergence in about 1.6k samples on its pendulum task. It also reports over 80% fewer total violations than Constrained Policy Optimization in the Safety Gym Car environment. SAFEMPC reports exploring the pendulum without falling, with horizon 4 as the best trade-off. We found no reported result on Lacuna for either SAMBA or SAFEMPC under injected parametric or structural mismatch. Producing that number is itself a contribution.

The proposal counts as beating these methods if, on mismatched plants, it shows fewer violations and lower EMCC at equal or better sample count to a target safe-set volume, while not losing to them on the well-specified plant. EMCC (expected maximum consecutive cost steps) measures the longest unbroken run of constraint violations; it comes from Eckel et al..

On the Safety-Gymnasium tasks we add SafeDreamer as the strongest learned-world-model safe explorer, run with its released settings and matched environment steps. It reports a 94.3% cost reduction relative to other model-based methods. As a model-free reference we add PPO-Lag, the Lagrangian-penalty version of the PPO policy-gradient algorithm. Safety Gymnasium reports that it cuts velocity-task violations by 98% relative to PPO.

Two baselines are oracle-tuned rather than ablations. Every method receives the same hyperparameter search budget, except that the inflated-variance baseline gets an oracle grid search on the test plant. The first is a variance-only filter whose $\beta$ is chosen on the test plant to give zero violations. The second is random exploration under our full bias-aware filter. It isolates the acquisition rule.

The ablations each remove one ingredient. One keeps the bias margin but uses variance-only acquisition. One keeps bias acquisition but uses a variance-only margin. One drops the boundary weight $w$.

Why not just…?

Why not just turn up the confidence multiplier $\beta$? This is the most serious threat. A large enough $\beta$ covers bias anywhere, at a uniform cost in conservatism, which is exactly the frozen "safe but useless" behavior described for robust MPC in SAFEMPC. The inflated-$\beta$ oracle baseline settles the question. If it matches our safe-set volume at zero violations, the bias model adds nothing and we will say so. We expect a gap only when bias is spatially concentrated, for example friction that matters at high speed, so we vary that concentration explicitly.

Why not just explore randomly under a safe filter? Rahmati et al. find that random sampling beats uncertainty sampling under mismatch, so this is a credible competitor. ALCOI and MAX show that well-directed exploration beats random exploration, but only for well-specified, unconstrained problems. Running random exploration under the identical bias-aware filter isolates acquisition. If random exploration ties us, the contribution reduces to the margin alone.

Why not just use a bigger model so mismatch disappears? High-capacity residual models shrink structural bias but not transient parametric shocks, and they need data near the boundary that a working filter withholds (safety paradox). We test this by giving the variance-only baseline the same over-parameterized network we use for $\hat b$ as its dynamics model.

Why not just use domain randomization or a worst-case robust controller? RRLS reports that domain randomization targets average-case rather than worst-case performance, and neither approach contracts its uncertainty with data. We include a domain-randomized PPO-Lag policy on the RRLS-style perturbed tasks as a reference rather than as a main competitor.

Proposed Experiments

We start with the continuous inverted pendulum used by SAFEMPC and SAMBA. The plant has mass errors of 0–150% and an unmodeled viscous friction term. We then move to the unicycle and two-link arm from Dai et al., whose 100% mass-error setting we reproduce, and we measure the recovered fraction of the safe set. For training-time safety we use the Circle2D levels from Eckel et al., scored by EMCC. Finally we use SafetyPointGoal1 and SafetyCarGoal1 from Safety Gymnasium, with body mass and friction perturbed through an interface modeled on RRLS's parameter modification. Before any closed-loop run, we reproduce Rahmati's polynomial-misspecification result in the static setting to confirm that the bias model recovers the error ordering.

Metrics are total violations, EMCC, samples to reach 90% of the oracle safe-set volume, RMSE of $\dot h$ in a band near the boundary, task return, and per-step filter latency.

Three outcomes decide the proposal. On structurally mismatched plants, the variance-only explorers must show a calibration statistic well above one together with nonzero violations. If they do not, the motivating failure does not occur in closed loop. Our method must beat random exploration under the same filter in samples to safe-set volume. And it must beat the oracle-tuned inflated-$\beta$ baseline in safe-set volume at matched violations. Failing the second check would leave a margin-only result. Failing the third would mean a simple, well-tuned scalar already does the job.