# K-sample persistence safety filter

- ID: 3049
- Canonical URL: https://synthcore.org/idea/3049/k-sample-persistence-safety-filter
- API JSON: https://synthcore.org/api/idea/3049.json
- API Markdown: https://synthcore.org/api/idea/3049.md
- Verification status: unverified
- Source: [arXiv:2609.02358](https://arxiv.org/abs/2609.02358)
- Category: regularization
- Solves: stability, accuracy
- ML areas: rl, training-dynamics, moe-routing
- Math tags: control-theory, dynamical-systems, probability
- Ratings: usefulness 6/10; difficulty 3/10; novelty 5/10

## Idea description

Replace instantaneous confidence-based routing with a temporal conjunction: enable a learned policy only if its probability and recoverability estimates satisfy their thresholds at every one of the last \(K\) observations. This suppresses brief optimistic critic errors and can wrap RL actions, diffusion trajectories, or MoE expert selection.

## Mathematical statement

The paper's windowed prediction rule addresses noisy instantaneous estimates near the recoverability boundary. For states \(s_{t-K+1},\ldots,s_t\), \(K\) is the persistence-window length, \(\hat P_\phi\) is the stop-success probability, \(\hat V_\psi\) is the reach-avoid value with smaller values safer, and \(\eta_p,\eta_r\) are thresholds. The policy is enabled only if every sample passes both conditions: \(\hat P_\phi(s_k)\geq\eta_p\) and \(\hat V_\psi(s_k)\leq\eta_r\). This is an AND aggregation over recent safety predicates. A single failed sample selects the fallback, creating a conservative temporal filter that reduces false positives from short-lived favorable critic readings, at the cost of delayed activation and lower coverage.

## Key formulas

- $$\pi_{\mathrm{SS}}(s_t)=\pi_{\mathrm{stop}}(s_t)\quad\mathrm{iff}\quad\forall\,k\in\{t-K+1,\ldots,t\}:\hat P_{\phi}(s_k)\geq\eta_p\ \text{and}\ \hat V_{\psi}(s_k)\leq\eta_r$$
- $$g_t=\prod_{k=t-K+1}^{t}\mathbf{1}\!\left[\hat P_{\phi}(s_k)\geq\eta_p\ \land\ \hat V_{\psi}(s_k)\leq\eta_r\right]$$
- $$a_t=g_t\,a_t^{\mathrm{primary}}+(1-g_t)\,a_t^{\mathrm{fallback}}$$

## Implementation notes

(1) Integration point: add a fixed-length ring buffer after critic or router inference and before dispatching the primary action. This wrapper can operate around an RL controller, diffusion action chunk, or MoE expert decision. Cache the scalar pair \((p_t,v_t)=(\hat P_\phi(s_t),\hat V_\psi(s_t))\) at each control step. (2) Pseudocode: initialize a Boolean deque of length \(K\) to false. At every step compute \(p_t,v_t\), append \(b_t=(p_t\geq\eta_p)\land(v_t\leq\eta_r)\), remove the oldest flag, and set \(g_t=\mathrm{all}(b_{t-K+1:t})\). If the deque is not full, force fallback or use a configurable warm-start rule. Execute the primary action only when \(g_t=1\); after a failure, optionally require \(K\) consecutive passing samples before re-enabling the primary. (3) The exact temporal conjunction is taken from the paper. Estimate \(K\), \(\eta_p\), and \(\eta_r\) empirically by plotting failure probability against primary-policy coverage on validation trajectories; sweep \(K\in\{1,2,4,8,16\}\). Calibrate critic probabilities instead of treating raw neural outputs as calibrated. (4) First experiment: use a pretrained PPO policy on Walker2d or a small simulated humanoid, inject observation noise and brief adversarial state perturbations, and compare instantaneous gating with \(K\)-sample gating. Measure catastrophic failures per 10,000 episodes, fallback fraction, false-positive primary activation, and recovery latency. The expected signal is fewer failures caused by one-step critic spikes, with only a modest reduction in primary-policy coverage for small \(K\).

## Disclaimer

AI-generated research hypothesis, automatically tested. Not peer-reviewed.
