# Latent Reference Governor for Safe SSMs

- ID: 786
- Canonical URL: https://synthcore.org/idea/786/latent-reference-governor-for-safe-ssms
- API JSON: https://synthcore.org/api/idea/786.json
- API Markdown: https://synthcore.org/api/idea/786.md
- Verification status: unverified
- Source: [arXiv:2607.12178](https://arxiv.org/abs/2607.12178)
- Category: dynamics
- Solves: stability, accuracy
- ML areas: ssm, rnn, inference-speedup, training-dynamics
- Math tags: control-theory, dynamical-systems, linear-algebra, geometry, optimization
- Ratings: usefulness 6/10; difficulty 6/10; novelty 7/10

## Idea description

Insert a reference governor between a neural model's raw latent command and a linear state-space update, so that hidden states and outputs remain inside a prescribed union of polytopes. At every step, choose the largest interpolation toward the desired command whose predicted trajectory remains in the offline safe set. This can prevent hidden-state explosions and invalid latent trajectories without globally shrinking the model's weights.

## Mathematical statement

Use the discrete-time latent model \(x_{k+1}=Ax_k+Bv_k\) and observable output \(y_k=Cx_k+Dv_k\), where \(x_k\in\mathbb{R}^{n_x}\) is the SSM hidden state, \(v_k\in\mathbb{R}^{n_v}\) is a controllable latent command, and \(y_k\in\mathbb{R}^{n_y}\) is the constrained latent output. Let the non-convex admissible region be \(\mathcal{Y}=\bigcup_{j=1}^M\{y:H_jy\leq h_j\}\). The safe-command set is \(\mathcal{O}_\infty=\{(x,v):y_t\in\mathcal{Y}\ \forall t\geq 0\}\) under constant command \(v\). Given desired command \(r_k\), use \(v_k=v_{k-1}+\alpha_k(r_k-v_{k-1})\), with the largest \(\alpha_k\in[0,1]\) for which \((x_k,v_k)\in\mathcal{O}_\infty\). If \(A\) is Schur stable, \(\rho(A)<1\), and \(r_k\) is strictly admissible, the reference-governor construction guarantees constraint satisfaction and convergence of \(v_k\) to \(r_k\). In a neural implementation, the guarantee is exact only for the identified linear model, so model mismatch must be measured and compensated with constraint margins.

## Key formulas

- $$x_{k+1}=Ax_k+Bv_k,\qquad y_k=Cx_k+Dv_k.$$
- $$\mathcal{Y}=\bigcup_{j=1}^{M}\{y\in\mathbb{R}^{n_y}:H_jy\leq h_j\},\qquad \mathcal{O}_{\infty}=\{(x,v):y_t\in\mathcal{Y}\ \forall t\geq 0\ \text{under }v_t=v\}.$$
- $$v_k=v_{k-1}+\alpha_k(r_k-v_{k-1}),\qquad \alpha_k=\max\{\alpha\in[0,1]:(x_k,v_{k-1}+\alpha(r_k-v_{k-1}))\in\mathcal{O}_{\infty}\}.$$
- $$\rho(A)<1\quad\Longrightarrow\quad A^t\to 0,\qquad y_{k+t}=CA^tx_k+\left(C\sum_{i=0}^{t-1}A^iB+D\right)v_k.$$

## Implementation notes

1. Integration point: use a diagonal or low-dimensional linear SSM block inside an RNN, sequence model, or latent world model. Let its hidden state be \(x_k\) and expose a trainable command \(r_k\) produced by the neural network. Keep the learned state matrices \(A,B,C,D\) fixed during the first experiment, or update their estimates slowly during training. Define axis-aligned or general polytopes for allowable hidden coordinates, output magnitudes, or task-specific latent regions. 2. Pseudocode: precompute an approximate safe set by sampling candidate constant commands \(v\), propagating \(x_{t+1}=Ax_t+Bv\) for \(T\) steps, and retaining candidates satisfying every polytope constraint. Optionally fit a polyhedral union to the retained samples. At inference, compute \(r_k\), search \(\alpha\) on a grid such as \(\{0,0.01,\ldots,1\}\), predict the trajectory for each candidate using the displayed flow equation, reject candidates violating any polytope, and apply the largest surviving \(\alpha\); then update the SSM state. 3. Computed versus estimated: \(A,B,C,D\) and the finite-horizon safe set are computed or fitted offline; the infinite-horizon condition is approximated by checking until \(T\) such that \(\lVert A^T\rVert\) is below a tolerance. Estimate model mismatch by comparing predicted and actual hidden states, and shrink each polytope by a margin proportional to a high quantile of this error. 4. First cheap experiment: use a 2D linear SSM driven by an MLP on a synthetic Adding or Copy task, comparing an unconstrained SSM, a spectral-normalized SSM, and the governor-SSM. Sweep the spectral radius and command jump size. The predicted signature is zero constraint violations for exact-model trajectories initialized in the computed safe set, a sharp failure boundary near \(\rho(A)=1\), and monotone convergence of \(\lVert r_k-v_k\rVert\) toward zero for strictly admissible targets. With finite-horizon approximation, violation probability should decrease as \(T\) increases and \(\lVert A^T\rVert\) decreases.

## Disclaimer

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