Trajectory-Certified Contractive RNN
Implementation & benchmark of arXiv:2607.26277 — Data-Driven Stability and Performance Analysis of Lurye Systems
Source paper: Data-Driven Stability and Performance Analysis of Lurye Systems arXiv:2607.26277 ⓘ · analyzed Aug 31, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Represent a recurrent or residual network as a linear state update driven by a memoryless activation or feedback nonlinearity, then solve a data-driven quadratic Lyapunov SDP using excitation trajectories. Accept an update or parameter checkpoint only when the certificate proves contraction and bounds the disturbance-to-output gain. This should prevent exploding hidden states and give a measurable transition between stable and unstable recurrent dynamics.
Formulas
Mathematical statement
Let the neural state satisfy x_{k+1}=Ax_k+B_1w_k+B_2d_k, with nonlinear signal w_k=Phi(v_k), v_k=C_1x_k+D_{11}w_k+D_{12}d_k, and output e_k=C_2x_k+D_{21}w_k+D_{22}d_k. Assume the activation satisfies a quadratic constraint [v_k;w_k]^T M[v_k;w_k]>=0, where M=M^T is known. For a scalar slope or sector bound w=Phi(v) in [alpha,beta]v, use (w-alpha v)(beta v-w)>=0, represented by M=[[-alpha beta,(alpha+beta)/2],[(alpha+beta)/2,-1]]. Define z_k=[x_k^T,w_k^T,d_k^T]^T, X=[A B_1 B_2], V=[C_1 D_{11} D_{12}], E=[C_2 D_{21} D_{22}], and D_d=[0 0 I]. A sufficient certificate searches for P=P^T>0, multiplier lambda>=0, and gain gamma such that X^T P X-blkdiag(P,0,0)+E^T E-gamma^2D_d^T D_d+lambda[V;W]^T M[V;W]<0, where W=[0 I 0]. The Lyapunov function is V(x)=x^T P x. With d=0, this gives strict decay; with disturbances, it gives ||e||_2<=gamma||d||_2. The data-driven construction replaces unknown state-space matrices with persistently exciting trajectory and Hankel or subspace data; reconstructed states are only defined up to similarity, which is harmless because P transforms congruently.
Implementation notes
1. Integration point: build a gated or plain RNN with hidden state x, but expose its recurrent linear map and activation feedback explicitly. For example, use x_{k+1}=Ax_k+B Phi(Cx_k+Du_k), setting w=Phi(v) and d=u. Apply the certificate during initialization, architecture search, or checkpoint selection; alternatively add a penalty when the certificate margin becomes negative. Use activations with known slope sectors, such as ReLU with [alpha,beta]=[0,1], hard-swish with a verified sector, or tanh with [-1,1]. 2. Pseudocode: collect a trajectory under Gaussian or multisine inputs with input Hankel matrix persistently exciting of order at least 2(n_x+1); record (x,w,d,v,e) if hidden states are available, otherwise reconstruct x with deterministic subspace identification. Form trajectory matrices and solve an SDP over P>0, lambda>=0, and gamma^2 enforcing the lifted dissipation LMI above. Normalize P by trace(P)=n_x. During training, periodically resolve the SDP on a short calibration trajectory and reject updates for which the smallest LMI eigenvalue is nonnegative. 3. Computed from the paper: the quadratic constraint, Lyapunov or dissipativity inequality, PE requirement, and similarity-invariant state reconstruction. Estimated empirically: trajectory matrices, hidden-state realization, activation sector if not analytically known, and the smallest eigenvalue margin. For noisy data, replace strict inequalities by a slack and bootstrap trajectories to estimate certificate confidence. 4. First cheap experiment: compare a vanilla Elman RNN, spectral-normalized RNN, and this certified RNN on sequential MNIST or adding-problem sequences, using identical parameter counts. Sweep a scalar recurrent gain s multiplying A, and independently inject Gaussian input disturbances. The quantitative prediction is a sharp certificate boundary at the largest s for which the SDP is feasible; beyond it, hidden-state perturbations should stop decaying and eventually grow. For certified models, estimate ||delta x_k|| and fit its decay; the LMI predicts geometric decay governed by the largest certified contraction factor rho_P<1, while the measured disturbance-to-output gain should remain below the SDP value gamma up to finite-sample error. Require the data-driven certificate to agree with a model-based SDP within 20 percent on a synthetic known RNN before testing accuracy.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Significant win ✓
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built a scalar Trajectory-Certified Contractive RNN MVP with the lifted sector LMI, trajectory-based identification, and model/data certificate comparison. The mechanism manifested: measured local contraction matched the predicted |a+b| essentially exactly, certification transitioned near the predicted boundary (observed 0.489 vs predicted 0.55, 11% error), and disturbance response grew sharply toward and beyond the boundary. This demonstrates stability checkpoint selection, but not improved task accuracy.
- Agent confidence
- 8/10
- Baseline
- Uncertified recurrence at a=0.60: measured local perturbation ratio 1.045 and finite-horizon impulse response l2=10.035; hidden perturbations grow.
- Idea
- Certified region included a=0.50 with ratio 0.950 and impulse response l2=2.251, while certification failed at a=0.60; model-based and trajectory-derived certificates agreed on sampled points. Certificate gamma values were conservative, e.g. 61.054 at a=0.50.
Limitations: CVXPY was unavailable, so the general SDP was approximated in this scalar MVP by a bounded grid over P, lambda, and gamma^2 with direct LMI eigenvalue checks. No multidimensional RNN, noisy-state reconstruction, training task, accuracy comparison, or large-scale computational benchmark was tested.
How to run: python3 certified_rnn_experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.26277)
Beats the tuned baseline by 78.0% (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0006
- Idea mean
- 0.0001
- Effect (Δ)
- -0.0005 (−78.0%; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±15.7%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
This is a conservative spectral projection proxy for the proposed quadratic Lyapunov certificate, not a general data-driven SDP with trajectory reconstruction. Only the built-in controlled-pendulum dynamics track was tested with 400 training samples, 400 test samples, 20 epochs, one radius, and a three-value learning-rate grid. The mechanism signature used output sensitivity to an input perturbation rather than direct hidden-state free-response decay or disturbance-to-output gain.
How to run: python3 bench_experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Worked ✓
Agent confidence: 7/10
Implemented a matched dynamics-track comparison using the shared rnn_small architecture. The intervention projects the recurrent matrix after each optimizer step to a certified spectral contraction bound and significantly improved test MSE over the tuned vanilla baseline on all 8 paired seeds. The Lipschitz/contraction sanity check passed, and the trained-model perturbation sensitivity stayed below the measured recurrent-norm bound.
- Baseline
- Tuned vanilla rnn_small via bench.train_model, lr=0.006: mean test MSE 0.0006132683593, std 0.0001242455317.
- Delta mean
- -0.0004783262457
- Idea
- Projected contractive rnn_small, lr=0.006, recurrent norm bound 0.88: mean test MSE 0.0001349421136, std 0.0000230953576.
- Idea wins
- 8
- N pairs
- 8
- P value
- 0.0081
- Relative improvement pct
- 77.998
Benchmark result
Beats the tuned baseline by 78.0% (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0006
- Idea mean
- 0.0001
- Effect (Δ)
- -0.0005 (−78.0%; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±15.7%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
This is a conservative spectral projection proxy for the proposed quadratic Lyapunov certificate, not a general data-driven SDP with trajectory reconstruction. Only the built-in controlled-pendulum dynamics track was tested with 400 training samples, 400 test samples, 20 epochs, one radius, and a three-value learning-rate grid. The mechanism signature used output sensitivity to an input perturbation rather than direct hidden-state free-response decay or disturbance-to-output gain.
How to run: python3 bench_experiment.py
Artifacts
- bench_experiment.py 6.3 KB View Raw
- bench_report.json 3.3 KB View Raw
- certified_rnn_experiment.py 5.2 KB View Raw
- report.md 1.6 KB View
- report_bench_2026-08-31T093636.md 4.6 KB View
- results.json 5.6 KB View Raw