{
 "artifacts": [
  {
   "name": "experiment.py",
   "url": "https://synthcore.org/code/1040/experiment.py"
  },
  {
   "name": "report.md",
   "url": "https://synthcore.org/code/1040/report.md"
  },
  {
   "name": "results.json",
   "url": "https://synthcore.org/code/1040/results.json"
  },
  {
   "name": "stage2_bench.py",
   "url": "https://synthcore.org/code/1040/stage2_bench.py"
  }
 ],
 "category": "dynamics",
 "description": "Constrain a recurrent or state-space neural network to keep its hidden state inside an ellipsoid that is robustly invariant under bounded feature inputs, hidden-state perturbations, and model mismatch estimated from offline trajectories. The ellipsoid and a stabilizing recurrent gain are fitted from data through an SDP-inspired certificate, then used either as a training regularizer or as a projection layer at inference time.",
 "download_zip": "https://synthcore.org/download/1040",
 "formulas_latex": [
  "$$h_{k+1}=Ah_k+Bz_k+e_k,\\qquad z_k=Kh_k+\\xi_k,\\qquad F=A+BK.$$",
  "$$\\mathcal{E}(P)=\\{h\\mid h^TP^{-1}h\\leq1\\},\\qquad \\mathcal{E}_e=\\{e\\mid e^TQ_e^{-1}e\\leq1\\},\\qquad \\mathcal{E}_\\xi=\\{\\xi\\mid \\xi^TQ_\\xi^{-1}\\xi\\leq1\\}.$$",
  "$$\\frac{FPF^T}{\\alpha_0}+\\frac{Q_e}{\\alpha_1}+\\frac{BQ_\\xi B^T}{\\alpha_2}\\preceq P,\\qquad \\alpha_i\u003e0,\\quad \\alpha_0+\\alpha_1+\\alpha_2\\leq1.$$",
  "$$q=\\sqrt{\\lambda_{\\max}\\!\\left(P^{-1/2}FPF^TP^{-1/2}\\right)}\u003c1,\\qquad r_\\infty\\lesssim\\frac{\\sigma}{1-q}.$$"
 ],
 "id": 2698,
 "implementation": "1. Integration point: use a GRU-free residual RNN or linear state-space block, for example $h_{t+1}=\\phi(W_hh_t+W_zz_t+b)$, and begin with the linearized or residual version $h_{t+1}=Ah_t+Bz_t+e_t$. Collect hidden trajectories from a normally trained baseline over calibration sequences. Fit $A,B$ by ridge regression and compute residuals $e_t=h_{t+1}-Ah_t-Bz_t$. Estimate $Q_e$ as an inflated covariance ellipsoid or a diagonal ellipsoid containing 99 percent of residuals; estimate $Q_\\xi$ from the feature distribution. 2. Pseudocode: fit $A,B$; initialize $P\\succ0$, $K$, and positive multipliers $\\alpha_i$; solve an SDP or alternating convex program minimizing $\\log\\det P$ subject to $FPF^T/\\alpha_0+Q_e/\\alpha_1+BQ_\\xi B^T/\\alpha_2\\preceq P$, with $F=A+BK$ and a norm bound on $K$; freeze the resulting $P,K$ for the first experiment. During training add $\\lambda\\max(0,h_t^TP^{-1}h_t-1)^2$ to the task loss. At inference optionally project $h_t$ to $\\mathcal{E}(P)$ using $h_t\\leftarrow h_t/\\max(1,\\sqrt{h_t^TP^{-1}h_t})$. 3. Computed from the paper's mechanism: the invariant-set inclusion and SDP certificate. Estimated empirically: $A,B$, residual ellipsoid $Q_e$, feature bound $Q_\\xi$, and nonlinear approximation error. For nonlinear activations, enlarge $Q_e$ using held-out Jacobian and residual errors; the guarantee is empirical unless a global Lipschitz bound is supplied. 4. First cheap experiment: train a small tanh RNN on sequential MNIST, permuted MNIST, or a synthetic long-horizon copy task, comparing the baseline, ellipsoid regularization, and projection. Sweep input-noise scale and recurrent spectral scale. Measure $q$, ellipsoid violation rate, hidden norm, gradient norm, and loss after 1,000 to 10,000 recurrent steps. The predicted signature is a sharp degradation when $q$ crosses one: for $q\u003c1$, violations and hidden energy remain bounded and the disturbance-induced radius follows approximately $1/(1-q)$; for $q\u003e1$, hidden norms grow exponentially at a rate close to $\\log q$. The estimated transition should agree with the observed divergence boundary within approximately 20 percent.",
 "math_summary": "Let the hidden dynamics be approximated on collected trajectories by $h_{k+1}=Ah_k+Bz_k+e_k$, where $h_k\\in\\mathbb{R}^d$ is the hidden state, $z_k$ is the network input or feature, $A$ and $B$ are fitted linear maps, and $e_k$ is the residual. Bound the residual and input by ellipsoids $\\mathcal{E}_e=\\{e:e^TQ_e^{-1}e\\leq1\\}$ and $\\mathcal{E}_z=\\{z:z^TQ_z^{-1}z\\leq1\\}$. For a recurrent feedback parameterization $z_k=Kh_k+\\xi_k$, with bounded exogenous disturbance $\\xi_k$, the closed-loop matrix is $F=A+BK$. An ellipsoid $\\mathcal{E}(P)=\\{h:h^TP^{-1}h\\leq1\\}$ is robust positively invariant if $F\\mathcal{E}(P)\\oplus\\mathcal{E}_e\\oplus B\\mathcal{E}_\\xi\\subseteq\\mathcal{E}(P)$. A sufficient condition uses multipliers $\\alpha_i\u003e0$, $\\sum_i\\alpha_i\\leq1$: $FPF^T/\\alpha_0+Q_e/\\alpha_1+BQ_\\xi B^T/\\alpha_2\\preceq P$. The key quantitative signature is the contraction factor $q=\\sqrt{\\lambda_{\\max}(P^{-1/2}FPF^TP^{-1/2})}\u003c1$ and a disturbance radius proportional to $1/(1-q)$.",
 "math_tags": [
  "control-theory",
  "dynamical-systems",
  "optimization",
  "linear-algebra",
  "spectral-theory"
 ],
 "ml_areas": [
  "rnn",
  "ssm",
  "optimizer",
  "training-dynamics"
 ],
 "paper": {
  "arxiv_id": "2608.23412",
  "arxiv_url": "https://arxiv.org/abs/2608.23412",
  "summary_what_math_gives_to_ml": "The paper provides a constructive mechanism for synthesizing robust positively invariant ellipsoids directly from noisy input-state-output data, jointly with stabilizing feedback or observer gains, without first identifying an explicit plant uncertainty set. The transferable asset is an SDP-checkable certificate that bounded disturbances remain inside a bounded state region under closed-loop dynamics. A neural-network analogue is to treat recurrent hidden states as a controlled dynamical system and learn or constrain a hidden-state ellipsoid that remains invariant under bounded feature inputs, hidden-state perturbations, and model mismatch estimated from offline trajectories. This yields a falsifiable long-horizon stability condition rather than relying only on gradient or benchmark behavior.",
  "title": "Data-Driven Synthesis of Robust Positively Invariant Sets: From State Feedback to Output Feedback",
  "year": "2026"
 },
 "ratings": {
  "difficulty": 6,
  "novelty": 7,
  "usefulness": 7
 },
 "solves": [
  "stability",
  "generalization"
 ],
 "title": "Data-driven invariant hidden-state ellipsoid",
 "url": "https://synthcore.org/idea/2698/data-driven-invariant-hidden-state-ellipsoid",
 "verification": {
  "peer_reviewed": false,
  "stage1_mechanism_check": {
   "worked": true,
   "confidence": 8,
   "verdict": "Built a reproducible data-driven linear hidden-state ellipsoid MVP with ridge dynamics fitting, residual-radius estimation, contraction-factor calculation, projection, and quantitative sweeps. The mechanism manifested: the observed instability boundary was q≈1.01 versus predicted q=1, the disturbance radius matched sigma/(1-q) with 0.062% mean relative error, and unstable growth rates matched log(q) for q=1.01 and 1.10. Projection reduced ellipsoid violations from 96.3% to 0% under a 1e-10 numerical tolerance, although this is a projection safety effect rather than a learned task-performance win.",
   "metrics": {
    "baseline": "Unprojected unstable rollout: q=1.1234, raw ellipsoid violation rate=96.33%, maximum normalized energy=4.11e15",
    "idea": "Projected rollout: same q=1.1234, violation rate=0% with tolerance 1e-10, maximum normalized energy≈1.0; fitted A relative error=2.20%; scalar radius mean relative error=0.062%; observed boundary q=1.01 vs predicted 1.0"
   },
   "how_to_run": "python3 experiment.py",
   "files": [
    "experiment.py",
    "results.json"
   ],
   "limitations": "The experiment is a low-dimensional linear toy, not a trained nonlinear RNN or sequential task. No SDP optimization of P,K, task loss, training regularizer, FLOP/speed comparison, or formal robust-invariance certificate was tested; P was conservatively initialized rather than solved from the full matrix inequality."
  },
  "status": "unverified",
  "status_label": "Unverified",
  "updated_at": "2026-09-01T20:28:58",
  "verdict_source": "deterministic test code (paired-seed permutation statistics)"
 }
}
