# Finite-Candidate Neural Reference Shield

- ID: 2906
- Canonical URL: https://synthcore.org/idea/2906/finite-candidate-neural-reference-shield
- API JSON: https://synthcore.org/api/idea/2906.json
- API Markdown: https://synthcore.org/api/idea/2906.md
- Verification status: mech_ok_no_baseline
- Source: [arXiv:2608.30825](https://arxiv.org/abs/2608.30825)
- Category: dynamics
- Solves: stability, accuracy, speedup
- ML areas: rl, optimizer, world-model
- Math tags: optimization, control-theory, linear-algebra, dynamical-systems
- Ratings: usefulness 8/10; difficulty 6/10; novelty 6/10

## Idea description

Place a deterministic reference-shaping layer after a neural policy or trajectory predictor. It minimizes deviation from the network command subject to nonlinear, state-dependent actuator and kinematic constraints, using KKT active-set candidates rather than iterative gradient projection. The layer should preserve the network command exactly in the interior of the feasible region and return the nearest feasible candidate when the command crosses a constraint boundary.

## Mathematical statement

Let $z\in\mathbb{R}^{m}$ be the unconstrained neural command, $r\in\mathbb{R}^{m}$ the shaped command, and $x$ the measured system state. Define the shaping problem as $\min_r \frac{1}{2}(r-z)^\top W(r-z)$ subject to inequality constraints $g_j(r,x)\leq0$, where $W\succ0$ is a weighting matrix and $j=1,\ldots,q$. For an active set $A\subseteq\{1,\ldots,q\}$, KKT candidates satisfy stationarity $W(r-z)+\sum_{j\in A}\lambda_j\nabla_r g_j(r,x)=0$, active equalities $g_j(r,x)=0$, inactive feasibility $g_j(r,x)\leq0$, and multipliers $\lambda_j\geq0$. The transferable construction is that the solution belongs to a finite set generated by these active-set/KKT candidates and can be recovered deterministically, with the remaining candidate calculation reducible to closed forms and a small eigenvalue problem. Select the feasible candidate with minimum objective value. The key property is exact feasibility, not merely a penalty-based approximation.

## Key formulas

- $$r^*(x,z)=\arg\min_{r}\;\frac{1}{2}(r-z)^\top W(r-z)\quad\mathrm{s.t.}\quad g_j(r,x)\leq0,\;j=1,\ldots,q,$$
- $$W(r-z)+\sum_{j\in A}\lambda_j\nabla_r g_j(r,x)=0,\qquad g_j(r,x)=0\;(j\in A),\qquad g_j(r,x)\leq0\;(j\notin A),\qquad \lambda_j\geq0,$$
- $$r^*=\mathop{\arg\min}_{(r_A,\lambda_A)\in\mathcal{C}(x,z)}\frac{1}{2}(r_A-z)^\top W(r_A-z),$$

## Implementation notes

1. Integration point: attach the layer between an NN policy or trajectory head and the low-level controller. The network emits $z_t$, while measured state $x_t$ supplies speed, position, current, voltage, and other quantities needed to evaluate state-dependent constraints. Encode current and voltage limits such as $i_d^2+i_q^2\leq I_{\max}^2$ and $u_d^2+u_q^2\leq V_{\mathrm{dq,max}}^2$, together with the paper's kinematic limits, as $g_j(r,x)\leq0$. 2. Pseudocode: evaluate every constraint; enumerate active sets permitted by command dimension; for each active set solve the stationarity and active-boundary equations using the paper's closed-form expressions or small eigenvalue construction; discard candidates with violated inactive constraints or negative multipliers; return the feasible candidate with minimum weighted distance to $z_t$. If none passes tolerances, use a conservative interior fallback. Initially stop gradients through the shield, then test implicit differentiation. 3. Computed versus estimated: constraint values, candidates, feasibility, and objective are computed analytically; model mismatch, noise margins, and tolerances are estimated empirically. 4. First cheap experiment: use a 2D MLP policy controlling a simulated PMSM or constrained point-mass servo. Compare raw output, penalty training, iterative projected-gradient projection, and this shield. Sweep command magnitude and measure violations, latency, and tracking error. The prediction is a sharp feasibility transition: interior commands satisfy $r^*=z$ up to tolerance, while exterior commands have zero violations and increasing residual beginning at the boundary. The solver should agree with a high-accuracy nonlinear optimizer within $10^{-5}$ and have nearly constant runtime; measured transition locations should match the analytically computed feasible boundary within 5%.

## Verification

- Status: mech_ok_no_baseline
- Mechanism evidence: yes
- Mechanism confirmed: yes
- Practical verdict: harms
- Verdict: Built a deterministic finite-candidate KKT shield for a 2D actuator set defined by disk and box constraints, with projected repair and SLSQP references. The mechanism manifested: interior commands were preserved exactly, the measured transition was 1.01 versus the predicted 1.00, radius-transition slope was 1.00 versus predicted 1.00, maximum violation was 6.7e-16, and maximum error versus SLSQP was 2.7e-8. The shield was faster than iterative repair in this toy test, at 0.72 ms versus 6.57 ms per command, with slightly smaller command deviation.

### Mechanism check

- Verdict: Built a deterministic finite-candidate KKT shield for a 2D actuator set defined by disk and box constraints, with projected repair and SLSQP references. The mechanism manifested: interior commands were preserved exactly, the measured transition was 1.01 versus the predicted 1.00, radius-transition slope was 1.00 versus predicted 1.00, maximum violation was 6.7e-16, and maximum error versus SLSQP was 2.7e-8. The shield was faster than iterative repair in this toy test, at 0.72 ms versus 6.57 ms per command, with slightly smaller command deviation.
- Confidence: 9/10
- Limitations: Only a convex 2D disk-and-box actuator region was tested. General nonconvex nonlinear constraints, higher-dimensional active-set enumeration, neural-policy training, state noise, model mismatch, and GPU execution were not tested.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.0081
- Paired wins: 0/8
- Benchmark verdict: idea worse (significant)

## Artifacts

- [bench_report.json](https://synthcore.org/code/1076/bench_report.json)
- [report.md](https://synthcore.org/code/1076/report.md)
- [report_bench_2026-09-01T235711.md](https://synthcore.org/code/1076/report_bench_2026-09-01T235711.md)
- [results.json](https://synthcore.org/code/1076/results.json)
- [shield_experiment.py](https://synthcore.org/code/1076/shield_experiment.py)
- [stage2_bench.py](https://synthcore.org/code/1076/stage2_bench.py)
- [Download all files as ZIP](https://synthcore.org/download/1076)

## Disclaimer

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