# Forward-Invariant STL Hidden-State Tubes

- ID: 1140
- Canonical URL: https://synthcore.org/idea/1140/forward-invariant-stl-hidden-state-tubes
- API JSON: https://synthcore.org/api/idea/1140.json
- API Markdown: https://synthcore.org/api/idea/1140.md
- Verification status: failed_benchmark
- Source: [arXiv:2607.19196](https://arxiv.org/abs/2607.19196)
- Category: dynamics
- Solves: stability, accuracy, generalization
- ML areas: rnn, ssm, world-model, training-dynamics
- Math tags: dynamical-systems, control-theory, convex-analysis, optimization
- Ratings: usefulness 8/10; difficulty 6/10; novelty 7/10

## Idea description

Augment a neural state-space model or neural ODE with a low-dimensional control residual that keeps its hidden state inside a sequence of time-varying convex sets encoding temporal requirements. At each integration step, solve a small quadratic program that minimally changes the network dynamics while enforcing an inward-pointing condition on every active convex-set face, producing robustly constrained long-horizon rollouts.

## Mathematical statement

Let the learned latent dynamics be $\dot h=f_\theta(h,y,t)+G_\theta(h,y,t)u$, with hidden state $h\in\mathbb{R}^r$, network parameters $\theta$, and correction $u\in\mathbb{R}^m$. Represent the STL requirement at time $t$ by the moving polytope $C(t)=\{h:A(t)h\le b(t)\}$, where row $a_i(t)^\top$ of $A(t)$ and scalar $b_i(t)$ define one convex predicate. For slack $s_i(h,t)=a_i(t)^\top h-b_i(t)$, impose the moving-boundary inward condition $a_i(t)^\top[f_\theta+G_\theta u]+\dot a_i(t)^\top h-\dot b_i(t)\le-\kappa\max(0,s_i)$, where $\kappa>0$ is the desired correction rate. This implies exponential decay of positive violations, $V_i(t)\le V_i(0)e^{-\kappa t}$, when $V_i=\max(0,s_i)$ and the constraints remain feasible. A robustness margin $\delta$ is implemented by shrinking the set boundary to $b_i-\delta\|a_i\|_2$.

## Key formulas

- $$\dot h=f_\theta(h,y,t)+G_\theta(h,y,t)u,$$
- $$C(t)=\{h\in\mathbb{R}^r:A(t)h\le b(t)\},\qquad s_i(h,t)=a_i(t)^\top h-b_i(t),$$
- $$a_i(t)^\top\left[f_\theta(h,y,t)+G_\theta(h,y,t)u\right]+\dot a_i(t)^\top h-\dot b_i(t)\le-\kappa\max(0,s_i(h,t)),$$
- $$u^*=\arg\min_u\frac12u^\top Ru\quad\mathrm{s.t.}\quad A(h,t)G_\theta u\le-A(h,t)f_\theta-\dot A(t)h+\dot b(t)-\kappa[Ah-b]_+.$$

## Implementation notes

1. Integration point: use a GRU, structured state-space model, or neural ODE with latent state $h$. Add a residual input channel $u$ and parameterize $G_\theta$ as a small learned matrix, an identity map on selected latent coordinates, or a bounded linear head. Define STL predicates on decoded outputs $\hat y=D_\theta(h)$; for a linear decoder, pull output half-spaces back into latent half-spaces, while for a nonlinear decoder use its local Jacobian. 2. Pseudocode: at time $t$, compute $f_\theta$, evaluate the active polytope faces, estimate $\dot A$ and $\dot b$ by analytic differentiation or finite differences, construct the displayed inequalities, solve the minimum-norm QP, and integrate $h_{k+1}=h_k+\Delta t(f_\theta+G_\theta u^*)$. Initially stop gradients through the QP; later use an implicit differentiable QP layer. 3. Taken from the paper's mechanism are time-indexed convex STL sets and forward-invariance constraints. Estimated quantities are the learned dynamics, control map, moving-set derivatives, and actual robustness margin. 4. First experiment: train a two-layer GRU on Lorenz-63 or pendulum next-state prediction with the requirement that position remain in a safe interval during $[2,4]$ and enter a target interval during $[6,8]$. Compare unconstrained rollout, penalty-only training, and QP correction. Sweep $\kappa$, input bounds, and integration step. The prediction is a feasibility boundary: when available control authority exceeds the maximum outward boundary velocity, violations should vanish; below it, QP infeasibility or persistent violation should occur. In feasible runs, plot $\log V_i(t)$ and test whether its slope is approximately $-\kappa$ within 20 percent. Also test whether the robust STL violation rate approaches zero and whether long-horizon prediction error is lower than for the unconstrained model.

## Verification

- Status: failed_benchmark
- Mechanism evidence: yes
- Mechanism confirmed: no
- Practical verdict: harms
- Verdict: Built and numerically verified the scalar minimum-norm QP correction for a robust moving-boundary STL tube. All three mechanism predictions were confirmed: the safe-set authority threshold was U*=0.30 versus 0.30 observed, violation log-slopes matched -kappa within 0.21%, and the initial violation feasibility boundary was U*=d+kappa*s0=1.50 versus 1.50 observed. The corrected rollout reduced violation fraction from 0.8666 uncontrolled to 0 with U=0.5, demonstrating the mechanism in the toy setting.

### Mechanism check

- Verdict: Built and numerically verified the scalar minimum-norm QP correction for a robust moving-boundary STL tube. All three mechanism predictions were confirmed: the safe-set authority threshold was U*=0.30 versus 0.30 observed, violation log-slopes matched -kappa within 0.21%, and the initial violation feasibility boundary was U*=d+kappa*s0=1.50 versus 1.50 observed. The corrected rollout reduced violation fraction from 0.8666 uncontrolled to 0 with U=0.5, demonstrating the mechanism in the toy setting.
- Confidence: 9/10
- Limitations: This is an exact 1D toy QP, not a learned GRU/neural ODE or general multidimensional polytope solver. It does not test training effects, prediction accuracy, temporal operators beyond a moving half-space, QP cost, nonlinear decoders, disturbances, or model mismatch.

### 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/219/bench_report.json)
- [bench_stl_tube.py](https://synthcore.org/code/219/bench_stl_tube.py)
- [report.md](https://synthcore.org/code/219/report.md)
- [report_bench_2026-08-30T205841.md](https://synthcore.org/code/219/report_bench_2026-08-30T205841.md)
- [results.json](https://synthcore.org/code/219/results.json)
- [toy_stl_tube.py](https://synthcore.org/code/219/toy_stl_tube.py)
- [Download all files as ZIP](https://synthcore.org/download/219)

## Disclaimer

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