Certify Once, Reuse Often: Cached Safety Certificates Behind a Standard Safety-Oracle Interface

Reinforcement learning agents learn by trial and error. When the system is a robot, a car, or a quadrotor, some of those errors are unacceptable even during training. The most reliable way to prevent them is a safety filter: before each action is executed, a formal checker either confirms the action is safe or replaces it with one that is. These checkers are slow. In one neurosymbolic method, verification takes about 87% of all training time. Formal reachability analysis, which computes every state the system could reach, scales roughly with the fifth power of the state dimension. A filter is also usually welded into a single environment's code, so it cannot be reused or compared fairly across methods. The result is that provably safe exploration lives on toy tasks, while fast simulators that run millions of steps per second offer no safety hooks at all.

This note proposes to stop re-checking safety from scratch at every step. A training agent visits nearly the same states over and over. If the checker can certify a whole region of states, together with a set of actions that is safe everywhere in that region, then that certificate can be stored and reused. Later steps whose state and proposed action fall inside a stored certificate skip the expensive checker, and the guarantee is unchanged. We would build this behind a standard "safety oracle" interface: a Gymnasium-style contract that any checker can implement, whether it is reachability-based, a control barrier function, or a symbolic policy check. Batching, caching, and logging of interventions then come for free. A small learned model, trained on the oracle's own intervention records, decides how large a region to try to certify at each call. The claim is that this cuts verification cost by a large factor at zero added safety violations.

Core Claim

During training, most calls to a formal safety checker are redundant: the same state neighbourhoods are re-verified thousands of times. Some checkers can certify sets of states rather than single points. For those, a cache of sound set-valued certificates, sitting behind a standard oracle interface, should remove most verifier calls without weakening the guarantee. A learned proposal of region size, trained on intervention logs, should push the cache-hit rate higher than fixed-size regions do. The new ingredient is neither faster safe RL nor a new filter. It is treating certificates as reusable objects with an interface contract. That contract is what lets checking cost scale with the number of distinct regions the agent visits rather than the number of steps it takes.

What Exists and What Is Missing

The interface work motivates the proposal by showing how much speed is available when safety is ignored. VMAS runs 30,000 parallel simulations in PyTorch in under 10 seconds. PufferLib 2.0 flattens observations and actions to reach millions of steps per second. Neither exposes cost signals or filter hooks. Safety-Gymnasium does unify constrained tasks under one API with GPU support. Its baselines, such as PPO with a Lagrangian penalty, still violate constraints heavily early in training, and it defines no contract for a verifier. We add exactly that missing contract.

The formal-safety work supplies the checkers and documents their cost. REVEL achieves zero violations throughout training on 10 control benchmarks, but shield synthesis takes about 87% of training time. Polynomial-zonotope action projection reaches zero collisions over 2,000 CommonRoad scenarios with a 0.043 s average solve. That solve time is acceptable for deployment but ruinous at millions of training steps. Both checkers certify sets: zonotope reachability starts from set-valued initial states, and REVEL's symbolic policies are verified over regions. This is why caching can be sound for them. The provably safe RL survey constrains our design. It finds that action replacement beats projection in return and learning speed, and that projection is numerically fragile, so the oracle must support replacement as well as projection.

Safe Action Projection asks whether the filter should sit inside the environment or inside the policy. It shows the in-policy version costs 3–12x more wall-clock time because gradients must pass through the projection. We adopt its in-environment placement and attack the remaining per-step cost, which that paper leaves untouched. FDPI motivates logging interventions. It shows that safe agents starve their own replay buffers of boundary data, so violation samples fall below 1% of the buffer. A filter's interventions are exactly that boundary data, and we log them as first-class outputs of the oracle. Finally, EMCC is a metric that counts the longest run of consecutive unsafe steps rather than total cost. It gives us a severity measure for any unsafe step that slips through.

Research Program

The first deliverable is the safety-oracle interface. The environment keeps its normal step function. Alongside it, it exposes a batched call that takes states and proposed actions and returns three things: executed actions, an intervention flag, and the certificate that justified each decision. A certificate is a state region $S$, a set of actions $A(S)$, and a soundness statement: from any state in $S$, any action in $A(S)$ keeps the system inside the safe set over the checker's horizon and ends in a recoverable invariant. Checkers plug in by implementing a "certify region" call. Checkers that only handle single points, such as a barrier-function quadratic program, are supported but are marked as non-cacheable unless the user supplies a Lipschitz margin that can be checked.

The second deliverable is the cache. On each step, a vectorized lookup tests whether $(s, a)$ falls inside a stored $(S, A(S))$; the lookup is a box or zonotope membership test on the GPU. A hit executes the action with no verifier call. A miss calls the verifier on a region around $s$ whose size is chosen by a proposal model. A failure at that size falls back to point verification.

The third deliverable is the learned proposal model. It is a small network that predicts, from the state and recent intervention history, the largest region likely to certify. It is trained on the oracle's logged successes and failures. Because every certificate is checked by the formal verifier before it enters the cache, a bad proposal costs time, never safety. This is the property that keeps the learned component honest.

The analysis then asks when caching pays off. We expect the verifier-call rate to fall as the agent's state visitation concentrates during training. The benefit should shrink in high-dimensional or strongly non-stationary tasks, where regions are small and rarely revisited. We will map that boundary explicitly rather than hide it.

Baselines

The naive reference point is an unshielded constrained learner. We use FOCOPS, the first-order constrained policy optimizer of FOCOPS, and PPO with a Lagrangian penalty, run through Safety-Gymnasium's SafePO implementations. These establish the cheapest wall-clock time and the violation count we are trying to avoid. For scale, FOCOPS reports a Humanoid-Circle reward of 1106.1 against 671.0 for CPO at a cost limit of 50. Safety-Gymnasium reports that PPO-Lag cuts violations by 98% relative to PPO on velocity tasks while losing 45% of reward. Neither method guarantees safety during training.

The strongest existing competitors are the uncached formal filters themselves, because they are the only methods that already achieve zero training violations. One is REVEL's shield, which reports zero violations on all 10 benchmarks with about 87% of time spent in shield synthesis. The other is zonotope projection or replacement, which reports zero collisions on 2,000 CommonRoad scenarios at 0.043 s per solve.

For fairness, each will be run behind the same oracle interface with caching turned off. This gives identical environments, the same verifier code and solver settings, the same learning algorithm, the same seeds, and the same hardware. The only difference is whether certificates are reused. Beating them means at least a 5x reduction in total verification wall-clock time, zero violations, and final return within one standard error of theirs.

We also include a batched-but-uncached baseline. It calls the verifier on all parallel environments at once on the GPU, which separates the gains from simple vectorization from the gains from reuse. Two ablations isolate the key ingredient. Fixed-radius regions with no learned proposal test whether the proposal model matters. Point-only verification with an intervention penalty, following the survey's adaptation reward, tests whether region certificates matter at all.

Why not just…?

Why not just train without a filter in simulation, since simulated crashes are free? If only the final policy matters and a faithful simulator exists, this is the right answer, and FOCOPS-style methods will win on wall-clock time. We do not argue otherwise. Our scope is training where violations count: hardware-in-the-loop, simulators that are themselves the safety-rated artifact, or settings scored by EMCC. In those settings SOOPER shows zero-violation learning on a physical RC car is achievable and valuable. The naive baseline is reported so readers can see exactly what price the guarantee carries.

Why not just use a cheaper filter, such as action replacement or a barrier-function quadratic program? Replacement is cheaper and learns faster according to the survey. It still needs a verifier to judge each proposed action, and that judgment is what we cache, so replacement is one of our supported modes rather than an alternative to them. Point-wise barrier-function filters are fast in low dimensions. They lose their speed advantage, and often their soundness under model error, once the dynamics require reachability. The point-only ablation measures directly whether a cheap filter alone closes the gap.

Why not just batch the verifier on a GPU? This is the real threat. If the speedup comes mostly from parallelism, caching adds complexity for little gain. The batched-uncached baseline settles it. We claim caching beats it because verifier work under batching still grows with total steps, while cached work grows with distinct regions visited. The experiments will report both curves over training. If they fail to diverge, the core claim is false.

Why not just distill the shield into the policy and drop the verifier? This removes the overhead and the guarantee together. Distilled policies are exactly what the safety paradox result warns about: they fail near boundaries they rarely see. We keep the verifier as the sole gatekeeper and use learning only to decide what to verify.

Proposed Experiments

We start where verification cost is documented: REVEL's suite (mountain car, pendulum, adaptive cruise control, obstacle navigation), the 3D quadrotor task, and CommonRoad. Each is run with its native checker behind the oracle. We measure five things: total and per-step verification time, verifier calls per thousand steps, cache-hit rate over training, training violations (count and EMCC), and final return.

The first decisive check is soundness. On a random 1% of cache hits, we independently re-run the point verifier. Any disagreement on safety invalidates the method, and we expect none. The second check is reuse versus batching, comparing the two cost-over-training curves as described above. The third check is a scaling stress test. We port a zonotope checker to Safety-Gymnasium's Point and Car navigation tasks and to a velocity task, raising state dimension to find where regions become too small to be reused, given that reachability cost grows as $\mathcal{O}(n^5)$. We also run one non-stationary task built in NS-Gym, where certificates must expire. This task tests the proposal's main structural assumption, that a certificate stays valid while the dynamics stay fixed.

A secondary check reuses the intervention logs in the policy's penalty critic. It asks whether this removes the late-training cost spikes that FDPI attributes to boundary starvation, without FDPI's second rollout policy. We count it as a bonus result, not a pillar of the claim.