# Finite-Plant Minimax RNN

- ID: 1464
- Canonical URL: https://synthcore.org/idea/1464/finite-plant-minimax-rnn
- API JSON: https://synthcore.org/api/idea/1464.json
- API Markdown: https://synthcore.org/api/idea/1464.md
- Verification status: unverified
- Source: [arXiv:2607.26816](https://arxiv.org/abs/2607.26816)
- Category: dynamics
- Solves: stability, accuracy, generalization
- ML areas: ssm, rnn, training-dynamics, regularization
- Math tags: control-theory, dynamical-systems, optimization, linear-algebra
- Ratings: usefulness 6/10; difficulty 6/10; novelty 7/10

## Idea description

Replace a single recurrent transition with a finite bank of candidate positive linear transitions and use a minimax controller to choose the feedback action at every time step. The controller evaluates candidate successors, selects the action whose worst-case predicted cost is smallest, and clips the action to preserve nonnegative hidden states. This should make an SSM or RNN less sensitive to transition-matrix mismatch and long-horizon disturbances.

## Mathematical statement

The paper studies positive dynamics $x_{t+1}=Ax_t+Bu_t+w_t$ with $A\in\mathbb{R}^{n\times n}_+$, state $x_t\in\mathbb{R}^n_+$, control $u_t$, and disturbance $w_t$. The admissible action set is state-dependent and must preserve positivity: $\mathcal{U}(x)\subseteq\{u:Ax+Bu\ge0\}$. For a finite model class, the adversary's worst successor under controller gain $K_k$ is $v^*=\max_{\ell\in\{1,2\}}(a_\ell+b_\ell K_k)x$ in the scalar case, where the maximum is over candidate plants. Relative to true plant $i$, the induced disturbance is $w^*(i,k)=\big(\max_\ell(a_\ell+b_\ell K_k)-(a_i+b_iK_k)\big)x$. The certainty-equivalence policy chooses $u_t=-k_t(a/b)x_t$, with $k_t=\arg\min_{\sigma\in\{+,-\}}z_t^{(\sigma)}$, where $z_t^{(\sigma)}$ is the accumulated predicted cost for candidate mode $\sigma$. Its scalar Bellman certificate requires $p\ge1$, $h\ge1+2ap$, and $h\ge1+2ah-\gamma a$, and yields $J_\mu(x_0)\le(1+2a)x_0$ with $\gamma^{\mathrm{CE}}(a)=\max\{1+2a,4a\}$. The neural adaptation uses $M$ candidate transitions $(A_i,B_i)$, a nonnegative hidden state $h_t$, candidate feedback gains $K_i$, and the vector worst-case successor $v_t^{(k)}=\max_i(A_i h_t+B_i u_t^{(k)})$, with the maximum taken elementwise.

## Key formulas

- $$x_{t+1}=Ax_t+Bu_t+w_t,\qquad x_t\in\mathbb{R}^n_+,\quad A\in\mathbb{R}^{n\times n}_+,$$
- $$\mathcal{U}(x)\subseteq\{u:Ax+Bu\geq0\},$$
- $$v^{\ast}=\max_{\ell\in\{1,2\}}(a_{\ell}+b_{\ell}K_k)x,$$
- $$w^{\ast}(i,k)=\Big(\max_{\ell\in\{1,2\}}(a_{\ell}+b_{\ell}K_k)-(a_i+b_iK_k)\Big)x;\qquad u_t=-k_t\frac{a}{b}x_t,\quad k_t=\arg\min_{\sigma\in\{+,-\}}z_t^{(\sigma)}.$$

## Implementation notes

1. Integration point: implement this as a recurrent or SSM layer replacing the usual transition $h_{t+1}=f(Ah_t+Bx_t)$. Use a nonnegative state, for example $h_t=\operatorname{softplus}(q_t)$, and maintain $M$ candidate matrices $A_i\ge0$ and input matrices $B_i$. Initialize all $A_i$ near the same stable transition, with spectral radius below one, and give each candidate a trainable feedback matrix $K_i$.

2. Pseudocode:
```text
h = softplus(h0)
z[1:M] = 0
for t in 1:T:
    for k in 1:M:
        u[k] = K[k] @ h
        # project action so every candidate successor remains nonnegative
        u[k] = project_to_safe_set(u[k], h, A[1:M], B[1:M])
        for i in 1:M:
            succ[i] = A[i] @ h + B[i] @ u[k] + D @ input[t]
        v[k] = elementwise_max_i(succ[i])
        cost[k] = running_cost(h, u[k], input[t]) + V_proxy(v[k])
    weights = softmax(-temperature * cost)
    u = sum_k(weights[k] * u[k])
    h = softplus(elementwise_max_i(A[i] @ h + B[i] @ u) + D @ input[t])
    z += prediction_loss(head(h))
```
At evaluation, replace the soft selection with $k^*=\arg\min_k cost[k]$. For scalar or diagonal $B_i$, compute the positivity projection by finding the interval of $u$ satisfying every component of $A_i h+B_i u\ge0$; for general $B_i$, use a small quadratic-program projection.

3. Compute directly from the paper's mathematics: candidate successor construction, state-dependent positivity constraints, and worst-case mode aggregation. Estimate empirically: the proxy value $V_{\mathrm{proxy}}$, candidate confidence scores $z_i$, and the number of modes required. Use $V_{\mathrm{proxy}}(h)=\|Wh\|_1$ with $W\ge0$. Add a certificate-inspired penalty enforcing $\rho(A_i+B_iK_i)\le1-\delta$; estimate each spectral radius with 10 to 20 power iterations. In a scalar prototype, set $p=1$, $h_c=1+2a$, and require the disturbance budget $\gamma\ge\max(1+2a,4a)$.

4. First cheap experiment: train a small GRU-like sequence predictor or diagonal SSM on Copy Memory and sequential MNIST. During testing, perturb the transition matrix and inject positive impulse disturbances. Compare a standard single-transition RNN, an ensemble that averages candidate predictions, and this minimax layer with $M=2$ or $4$. Record validation loss, hidden-state norm, fraction of exploding sequences, and loss under an unseen transition. Success means lower long-horizon error and fewer exploding trajectories at equal parameter count; a useful target is at least a twofold reduction in failure rate under transition perturbations with no more than 10 percent extra training FLOPs.

## Disclaimer

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