Calibrating Sim-Trained Safety Filters Online to Make Real-World Exploration Safe

A robot trained in simulation can be protected on real hardware by a safety filter. The filter is a supervisor that checks each proposed action against a learned estimate of "how close to irrecoverable failure this leads." If the action looks dangerous, it swaps in a fallback. The filter's estimate is only as good as the simulator it was learned in, though. Existing practice therefore picks one of two bad options. One option is to deploy a frozen filter with a fixed robustness margin and hope reality falls inside it. The other is to train so pessimistically that the robot never approaches the regions where simulation and reality might disagree. The first option can certify unsafe actions. The second leaves the robot permanently timid, and it never collects the near-boundary real data that would show whether the timidity was needed.

We propose a filter that measures its own error. It is trained once in simulation. Every real transition it executes produces a residual: the gap between the safety value the simulator predicted for the next state and the value actually observed. An online conformal procedure turns the recent stream of residuals into a margin that is distribution-free and tracks shift. Conformal prediction here means a way to choose a margin so that a target fraction of future errors fall inside it. The same safely collected transitions also train a grounding model that corrects the simulator, so the residuals shrink over time. The intended result is a robot that starts as cautious as the worst pessimistic methods and stays nearly as safe while it earns back the performance that pessimism gives away.

Core Claim

Real-world safe exploration after sim-to-real transfer should be governed by a safety margin that is estimated, not assumed. That margin should be calibrated online on the exact quantity the filter relies on: the one-step error in the predicted safety value. Each new real transition both checks and narrows that margin. The claim has two parts. First, a rolling-conformal margin on value residuals keeps the violation rate near zero under continuous, unknown dynamics shift. Second, coupling that margin to simulator grounding lets the margin tighten fast enough to recover task reward that fixed-margin and pessimistic-training methods leave unclaimed.

This is a continuous, high-dimensional analogue of the mismatch-region idea in Provably Safe Sim-to-Real Transfer. That work collects real data safely to certify where a tabular simulator is accurate. It is restricted to finite state spaces and to a separability assumption on simulator errors, and both break under smooth friction or latency drift. We give up its exact sample-complexity bound in exchange for a calibration guarantee that holds without those assumptions.

How It Differs From the Closest Work

The papers that combine filtering with transfer each freeze one piece that we make adaptive. Sim-to-Lab-to-Real supplies our filter backbone. It learns a dense reachability-style safety value with a discounted safety Bellman equation and shields a performance policy with a backup policy. Its critic is fixed after the Lab stage, and its certificates need hundreds of rollouts in a photorealistic intermediate environment. We drop that intermediate stage and calibrate directly on hardware data.

Gameplay Filters obtains zero-shot robustness by imagining rollouts against a learned adversary. Its margin is implicitly fixed by how strong the adversary turned out to be. The authors note that a suboptimal adversary certifies unsafe actions, and the filter never improves during deployment.

SPiDR adds ensemble disagreement to the cost during simulation training. It has no runtime interception, and its pessimism weight is hand-tuned.

Several other papers supply the method rather than the motivation. Multi-Agent Reachability Calibration with Conformal Prediction shows that rolling risk control can keep reachability tubes calibrated under shift, but only for trajectory forecasters around a fixed planner. Safe Flow Q-Learning calibrates a reachability buffer conformally, but on a static offline set whose exchangeability assumption breaks under deployment shift. RGAT gives us the grounding model: an action transformer trained with reinforcement learning to make simulated transitions match real ones. It collects real data with no safety mechanism at all.

Generalizing Safety Beyond Collision Avoidance motivates the work. Its latent reachability filter degraded when Skittles were swapped for M&Ms, which is exactly the uncorrected value error we propose to measure. Breaking Safety Paradox constrains the design. Safer policies generate fewer boundary samples, so critics degrade near the boundary. That is why we calibrate on value residuals from every transition rather than on rare violation events.

Research Program

We first train three components in a domain-randomized simulator. The first is a safety value $V(s)$, where $V(s) < 0$ means the state lies inside the set from which failure is unavoidable. The second is a backup policy that maximizes $V$. The third is a task policy. Each component follows the Sim-to-Lab-to-Real recipe. We also train a fast learned surrogate $\hat f$ of the simulator's dynamics, so that a candidate action's predicted next state is available in one forward pass. This avoids the online ensemble MPC whose latency CARL acknowledges.

On hardware, every executed transition $(s_t, a_t, s_{t+1})$ yields a residual $e_t = V(\hat f(s_t,a_t)) - V(s_{t+1})$, which is how much safer the model thought the next state would be than it actually was. We maintain a margin $q_t$ by adaptive conformal updating:

$$q_{t+1} = q_t + \eta\,(\mathbf{1}[e_t > q_t] - \alpha),$$

where $\alpha$ is the target miscoverage rate and $\eta$ a step size. This update guarantees that the long-run fraction of residuals exceeding the margin approaches $\alpha$ whatever the shift sequence, which is the property exploited by rolling risk control. The filter accepts the task policy's action $a$ only if

$$V(\hat f(s_t,a)) - H\,q_t \ge 0,$$

where $H$ is the number of steps the backup policy needs to recover. Scaling by $H$ is a conservative way to account for errors compounding over the recovery. Otherwise the filter executes the backup action.

Residuals are also conditioned on a small set of features: speed, contact state, and the grounding model's own disagreement. This way a large error in one regime does not inflate the margin everywhere. We will test whether this conditioning helps or merely adds variance.

The accepted real transitions are used to train an RGAT action transformer. Every $K$ episodes we refit $V$ and the backup policy inside the grounded simulator. Residuals then fall, $q_t$ shrinks, and the filter permits trajectories closer to the true boundary.

The analysis will be honest about what is proved. Adaptive conformal control bounds the long-run frequency of under-predicted value drops, not the per-episode violation probability. Turning the margin into recursive feasibility assumes the residual bound holds along the backup's recovery horizon. We will measure how often that assumption fails empirically.

Baselines

The naive reference point is standard domain randomization with a Lagrangian constrained learner, here PPO-Lagrangian with PID damping from Safety-Gymnasium, deployed with no filter and fine-tuned online. It shows the violations that unfiltered exploration incurs.

The strongest zero-shot competitor is SPiDR, run with the same randomization ranges, simulator steps, and a tuning sweep over its pessimism weight of the same size as our sweep over $\alpha$ and $\eta$. The file reports that SPiDR satisfied constraints 100% of the time on a Unitree Go1, and that standard domain randomization produced 26.1x more violations on Go1 and 6.2x more on a 1/10th-scale RaceCar (SPiDR). No reported result found on Lacuna for SPiDR's task reward on PointGoal2 in MJX, so we will reproduce it. Beating SPiDR means matching its violation count within statistical noise while reaching higher task reward within a fixed real-interaction budget.

The strongest runtime-filter competitor is a frozen Sim-to-Lab-to-Real-style shield with a constant margin. The constant is tuned post hoc on target dynamics to give the same violation rate as our method, which is deliberately generous to the baseline. We also run a gameplay filter on the locomotion task. The file reports that the gameplay filter achieved 10/10 safe runs on irregular terrain and withstood tugs up to 150 N (Gameplay Filters).

For adaptive model-based exploration we run CARL and FOSP with the same real budget. FOSP is given access to the same safely collected data rather than a separate offline log. No reported result found on Lacuna for numeric CARL cost tables. FOSP is reported only qualitatively as near-zero violations in simulation, plus a success rate rising from roughly 20–40% to 50–65% in 40 real Franka trials.

Three ablations isolate our ingredients. In static conformal, the margin is calibrated once on the first $N$ real transitions and then frozen, in the style of Safe Flow Q-Learning. In calibration without grounding, $q_t$ adapts but the simulator is never corrected. In grounding with a fixed margin, RGAT runs under a fixed-margin shield.

Why not just…?

Why not just use SPiDR's pessimistic training and skip runtime filtering? SPiDR's reported zero-shot safety is strong, which makes it the real threat. If its reward under mismatch is already close to that of a policy trained on the true dynamics, there is little left to recover. Its own limitations section notes freezing at high pessimism weights and invalidity outside the randomization range. We will measure the reward gap between SPiDR and a dynamics-oracle policy across mismatch severities, including shifts outside the randomization range. If that gap is small within the range, our claim narrows to out-of-range shifts, and we will say so.

Why not just use a fixed, well-tuned robustness margin? A constant margin tuned on the target dynamics is exactly the frozen-shield baseline. It cannot be tuned before deployment without knowing the shift, and it cannot loosen as grounding improves the model. The experiment that settles this is a drift test in which friction or latency changes mid-run. A margin tuned for the first regime should either violate constraints or over-intervene in the second.

Why not just ground the simulator with RGAT under any conservative shield, without conformal calibration? This is the grounding-with-fixed-margin ablation. It may reach similar final reward. Our prediction is that it either needs a margin large enough to slow early exploration or suffers violations before grounding converges. Both effects are measurable as cumulative violations and as reward per real sample.

Why not just use uncertainty-penalized ensemble MPC like CARL? It adapts online but relies on sampled percentiles without a coverage guarantee, and per-step ensemble rollouts strain control frequency. We will report decision latency alongside safety and reward, and show where CARL misses low-probability failures.

Proposed Experiments

The main testbed is surrogate sim-to-real in Safety-Gymnasium, using PointGoal2 ported to MJX as in SPiDR and the velocity-constrained Hopper and HalfCheetah tasks. "Reality" is created by modified physics, in the style of RGAT, with three kinds of shift. The first is within-range friction and mass. The second is out-of-range actuator latency. The third is mid-episode drift. CartPole length shifts and Duckietown width shifts from the CARL suite serve as structural-shift checks.

The metrics are cumulative real-world violations during learning, the fraction of residuals exceeding $q_t$ against the target $\alpha$, task reward as a function of real samples, intervention rate, and control-loop latency. A hardware confirmation follows on a 1/10th-scale RaceCar, reusing SPiDR's tire-slip obstacle task.

Three outcomes would decide the project. First, residual coverage must stay within a small tolerance of $1-\alpha$ under drift while the static-conformal ablation's coverage falls. This is the analogue of the 95% coverage maintained against baselines dropping to 81% in the trajectory-forecasting setting. Second, we must match SPiDR's violation count while closing a measurable fraction of its reward gap to the dynamics oracle. Third, $q_t$ must shrink as grounding residuals fall. Without that shrinkage the calibration-grounding coupling contributes nothing, and the method reduces to an adaptive shield.