# Proper-Kernel Neural Safety Layer

- ID: 2961
- Canonical URL: https://synthcore.org/idea/2961/proper-kernel-neural-safety-layer
- API JSON: https://synthcore.org/api/idea/2961.json
- API Markdown: https://synthcore.org/api/idea/2961.md
- Verification status: mechanism_failed
- Source: [arXiv:2609.00079](https://arxiv.org/abs/2609.00079)
- Category: dynamics
- Solves: stability, accuracy, sample-efficiency
- ML areas: rl, mlp, rnn, training-dynamics
- Math tags: control-theory, dynamical-systems, linear-algebra, stochastic-processes
- Ratings: usefulness 8/10; difficulty 5/10; novelty 7/10

## Idea description

Attach a dynamic space-time barrier filter to a neural policy instead of directly imposing a noisy, memoryless CBF constraint on its action. The filter state integrates recent barrier residuals with a proper low-pass kernel, while the online safety QP continues to depend affinely on the policy correction, so high-frequency observation noise is attenuated without removing control authority.

## Mathematical statement

Let the learned policy propose $u_{\pi}=\pi_{\theta}(o)$ for plant state $x$, with dynamics $\dot{x}=f(x)+g(x)u$. For a safe set $\mathcal{C}=\{x:h(x)\geq0\}$, define the ordinary relative-degree-one barrier residual $q(x,u)=\nabla h(x)^{\top}[f(x)+g(x)u]+\alpha h(x)$, where $\alpha>0$. Introduce the proper temporal kernel $k_a(t)=ae^{-at}$, bandwidth $a>0$, and filtered residual $z(t)=\int_{0}^{t}k_a(t-s)q(x(s),u(s))\,ds+e^{-at}z(0)$, which obeys $\dot z=-az+aq$. Enforce the filtered barrier condition $\dot z+\kappa z\geq0$, equivalently $q(x,u)\geq(1-\kappa/a)z$, where $\kappa>0$. Since $q$ is affine in $u$, the constraint remains a linear inequality in the QP. With bounded residual-estimation error $|\widehat q-q|\leq\varepsilon$, replace the right side by $(1-\kappa/a)z+\varepsilon$ and retain a direct margin $h\geq\delta$; the robust invariance claim is falsified if the resulting safe set is violated under the assumed error bound. The kernel has frequency response $|K_a(i\omega)|=a/\sqrt{a^2+\omega^2}$, predicting attenuation proportional to $\omega^{-1}$ above the cutoff.

## Key formulas

- $$q(x,u)=\nabla h(x)^{\top}\left[f(x)+g(x)u\right]+\alpha h(x),\qquad \mathcal{C}=\{x:h(x)\geq0\}.$$
- $$z(t)=\int_{0}^{t}ae^{-a(t-s)}q(x(s),u(s))\,ds+e^{-at}z(0),\qquad \dot z=-az+aq.$$
- $$\dot z+\kappa z\geq0\quad\Longleftrightarrow\quad \nabla h(x)^{\top}g(x)u\geq-\nabla h(x)^{\top}f(x)-\alpha h(x)+(1-\kappa/a)z.$$
- $$|K_a(i\omega)|=\frac{a}{\sqrt{a^2+\omega^2}},\qquad \mathrm{TV}(u)\text{ should decrease mainly for }\omega\gg a.$$

## Implementation notes

1. Integration point: use a differentiable MLP or recurrent policy $\pi_\theta(o_t)$ in a simulated robot or low-dimensional continuous-control environment. At every control step, estimate $h(x_t)$ and its gradient, maintain one scalar filter state $z_t$ per safety constraint, and solve a projection QP that finds the smallest correction $\Delta u_t$ to the policy action. 2. Pseudocode: compute $u_\pi=\pi_\theta(o_t)$; estimate $q_\pi=\nabla h(x_t)^T[f(x_t)+g(x_t)u_\pi]+\alpha h(x_t)$; update $z\leftarrow e^{-a\Delta t}z+(1-e^{-a\Delta t})q_\pi$; solve $\min_{u}\|u-u_\pi\|_2^2+\rho\|s\|^2$ subject to $\nabla h^Tg u\geq-\nabla h^Tf-\alpha h+(1-\kappa/a)z+\varepsilon-s$, $h\geq\delta-s$, and $\|u\|_\infty\leq u_{\max}$. Apply $u$ and update the filter with the executed residual. 3. Computed from the paper's mechanism: the exponential proper kernel, dynamic barrier state, affine-QP structure, and robust error margin. Estimated empirically: $f,g$, the observation-noise bound $\varepsilon$, and the useful bandwidth $a$. 4. First experiment: use third-order double-integrator-like dynamics with noisy state observations, comparing equal-network and equal-control-rate baselines: an unconstrained policy, an ordinary memoryless CBF-QP, and the proposed filtered CBF-QP. Sweep $a\in\{0.1,0.3,1,3,10\}$ and noise amplitude while holding training steps and action limits fixed. 5. Preregistered signature: for sinusoidal barrier-residual noise at frequency $\omega$, measured residual amplitude must follow $a/\sqrt{a^2+\omega^2}$ within 20%, and action total variation must fall by at least 50% when $\omega\geq5a$. The safety violation rate must remain below the calibrated error-bound rate of the memoryless robust baseline. Reject the transfer if the frequency response misses 20% or if filtered safety-QP infeasibility increases by more than 5% relative to the ordinary CBF-QP.

## Verification

- Status: mechanism_failed
- Mechanism evidence: yes
- Mechanism confirmed: no
- Verdict: Built a scalar proper-kernel safety-layer MVP with exact exponential filtering, affine projection, robust residual margin, direct state-margin safeguard, and matched noisy-control evaluation. The frequency-response claim was verified: measured attenuation matched a/sqrt(a^2+omega^2) within 0.42% across tested bandwidths and frequencies. However, the proposed controller did not produce a control-smoothing win: total variation was essentially unchanged for a<=1 and increased for a=3 and a=10, while both methods had zero safety violations.

### Mechanism check

- Verdict: Built a scalar proper-kernel safety-layer MVP with exact exponential filtering, affine projection, robust residual margin, direct state-margin safeguard, and matched noisy-control evaluation. The frequency-response claim was verified: measured attenuation matched a/sqrt(a^2+omega^2) within 0.42% across tested bandwidths and frequencies. However, the proposed controller did not produce a control-smoothing win: total variation was essentially unchanged for a<=1 and increased for a=3 and a=10, while both methods had zero safety violations.
- Confidence: 9/10
- Limitations: Only a scalar xdot=u toy plant and hand-designed noisy policy were tested; no learned MLP/RNN, third-order dynamics, true QP solver, multi-constraint setting, parameter/noise sweep, or GPU experiment was run. The direct h>=delta safeguard is represented by a one-step viability clamp rather than a full slack-variable QP.

## Artifacts

- [proper_kernel_experiment.py](https://synthcore.org/code/1134/proper_kernel_experiment.py)
- [report.md](https://synthcore.org/code/1134/report.md)
- [results.json](https://synthcore.org/code/1134/results.json)
- [Download all files as ZIP](https://synthcore.org/download/1134)

## Disclaimer

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