✗ Failed on benchmark 2026

Analytic covariance initialization for switched state-space models

Implementation & benchmark of arXiv:2607.09994 — Spectral Characterisation of Covariance Existence in Markov-Switching Affine Recurrences

Usefulness7/10
Difficulty6/10
Novelty7/10

Source paper: Spectral Characterisation of Covariance Existence in Markov-Switching Affine Recurrences arXiv:2607.09994 ⓘ · analyzed Aug 30, 2026

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

Idea description

Use the paper's finite-dimensional second-moment equations to compute the stationary covariance induced by a Markov-switched recurrent layer before training, then whiten or scale each mode's hidden state using that covariance. This can prevent mode-specific saturation and eliminate a long burn-in period in long-context RNNs and state-space models.

Formulas

$$T_{ji}:=p_{ij}(A_j\otimes A_j)$$
$$\operatorname{vec}(M_j)=\sum_{i=1}^{K}p_{ij}(A_j\otimes A_j)\operatorname{vec}(M_i)+\operatorname{vec}(Q_j)$$
$$m=Tm+q,\qquad m=(I-T)^{-1}q\quad\text{when }\rho(T)<1$$
$$\widehat h_t=C_{s_t}^{-1/2}h_t,\qquad C_j=\frac{M_j}{\pi_j}+\delta I$$

Mathematical statement

For the recurrence $Z_{n+1}=A_{\Theta_{n+1}}Z_n+\zeta_{n+1}$, define the regime-weighted second moment $M_j=\mathbb{E}[Z_nZ_n^\top\mathbf{1}_{\{\Theta_n=j\}}]$, where $\mathbf{1}_{\{\Theta_n=j\}}$ selects mode $j$. If $Q_j=\mathbb{E}[\zeta_{n+1}\zeta_{n+1}^\top\mathbf{1}_{\{\Theta_{n+1}=j\}}]$ is the mode-weighted innovation covariance, the second moments satisfy the block linear system $\operatorname{vec}(M_j)=\sum_i p_{ij}(A_j\otimes A_j)\operatorname{vec}(M_i)+\operatorname{vec}(Q_j)$. Stacking all mode vectors gives $m=Tm+q$, hence $m=(I-T)^{-1}q$ whenever $\rho(T)<1$, with $T_{ji}=p_{ij}(A_j\otimes A_j)$. The paper's result guarantees that this solution is finite under the spectral condition. We use the resulting $M_j$ as a mode-conditional normalization target, with $C_j=M_j/\pi_j$ where $\pi_j=\Pr(\Theta=j)$, and apply a damped inverse square root $C_j^{-1/2}$ to hidden states or initialize the mode input/output projections.

Implementation notes

Integrate this at the hidden-state normalization point of a Markov-switching RNN, SSM, or recurrent mixture-of-experts layer. Let $A_j$ be the current mode transition, let $Q_j$ be the covariance of the injected input/noise in mode $j$, and let $p_{ij}$ be the mode transition matrix. Estimate the stationary mode probabilities $\pi$ by solving $\pi^\top=\pi^\top p$ or by averaging router assignments. Construct the implicit block operator $T$ using $T_{ji}=p_{ij}(A_j\otimes A_j)$. Solve $(I-T)m=q$ with conjugate gradients or GMRES; each matrix-vector product is implemented without Kronecker storage by reshaping each $d^2$ vector into $d\times d$ and applying $A_jX A_j^\top$. Reshape the solution blocks into $M_j$, form $C_j=M_j/\pi_j+\delta I$, and compute $C_j^{-1/2}$ using an eigendecomposition for small $d$ or 5--10 Newton-Schulz iterations for larger $d$. During training, recompute this covariance every 100--1000 optimizer steps, detach it from the gradient initially, and use an exponential moving average to avoid noisy mode estimates. Apply $C_{s_t}^{-1/2}$ to the recurrent state before the next transition, or use it only to initialize a learned affine normalization layer. The paper supplies the exact fixed-point equation and the finiteness condition; empirical estimates are $p$, $Q_j$, and $\pi$. Start with a 4-mode diagonal SSM on sequential CIFAR or the copy task, comparing zero-state, LayerNorm, and analytic covariance initialization/normalization. Measure burn-in length, per-mode activation variance, gradient variance, long-sequence loss, and validation accuracy. The expected signal is mode variances close to one from the first hundred steps, less dependence on sequence burn-in, and faster loss descent than LayerNorm at equal FLOPs.

Verification

Failed on benchmark

Stage 1 · Toy mechanism gate: Passed ✓

Stage 2 · Mechanism transferred to benchmark: Not reproduced ✗

Stage 2 · Practical benchmark result: Inconclusive

Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works

Stage 1 — Mechanism check agent confidence 9/10

Built an analytic block second-moment solver and switched linear-state simulator in verify_covariance.py. The mechanism manifested quantitatively: the predicted spectral boundary gamma=1.44196 was bracketed by stable rho=0.97245 and unstable rho=1.02793 cases, empirical covariance growth became dramatic above the boundary, Monte Carlo relative covariance error fell from 0.0419 to 0.00836 with more trials, and observed zero-state burn-in tracked the predicted contraction times. This validates the initialization mechanism, but does not establish a neural-training accuracy or speed win.

Agent confidence
9/10
Baseline
Zero-state initialization: observed 90%-variance burn-in of 1, 2, 2, 3, and 7 steps over gains 0.35, 0.50, 0.65, 0.78, and 0.88.
Idea
Analytic conditional-covariance initialization: final absolute variance error 0.0079, 0.0006, 0.0075, 0.0043, and 0.0142 over the same gains; Monte Carlo fixed-point relative error reached 0.00836 at 2000 trials.

Limitations: Only toy Markov-switched linear systems were tested. No learned RNN/SSM, LayerNorm baseline, sequential benchmark, optimizer training, FLOP accounting, GPU execution, or adaptive covariance recomputation was evaluated.

How to run: python3 verify_covariance.py

Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.09994)

No significant difference vs. the tuned baseline (+2.6%, p=0.7417, wins 3 / 8 paired seeds).

Benchmark
Dynamics forecasting
Model
rnn_small
Paired seeds
8
Baseline mean
0.0343
Idea mean
0.0352
Effect (Δ)
0.0009 (+2.6%; negative = idea better)
Wins
3 / 8 paired seeds
p-value
0.7417 (permutation test, 20 000 shuffles)
Smallest detectable effect
±17.4%
Mechanism
Not confirmed ✗
Practical effect
Inconclusive
Baseline tuning
swept over 3 configs
Limitations:

The neural benchmark uses a diagonal covariance approximation rather than the full dense 64-dimensional covariance because the dense solve exceeded the runtime budget. Only the built-in actuated-pendulum dynamics track was tested; no long-context task, LayerNorm comparison, covariance recomputation during training, FLOP accounting, or larger recurrent models were evaluated.

How to run: python3 bench_covariance.py

Verdict computed by deterministic test code from paired-seed statistics — not by the language model.

Stage 2 — Benchmark latest Failed ✗

Agent confidence: 9/10

Implemented analytic covariance normalization for the matched dynamics/rnn_small benchmark using a diagonal switched second-moment fixed-point solve and CPU/GPU-safe training. Across 8 paired seeds, the idea was slightly worse than the tuned baseline (MSE 0.03524 vs 0.03434; delta +0.000905; permutation p=0.74165), with no significant win. The trained-model mechanism signature was not quantitatively confirmed: relative variance errors were 0.814 and 0.531.

Baseline
dynamics/rnn_small; 8 paired seeds; baseline lr sweep {0.0015, 0.003, 0.006}; best lr=0.006; mean test MSE=0.0343382
Idea
Analytic diagonal mode-conditioned covariance normalization; same rnn_small and lr sweep; best lr=0.006; mean test MSE=0.0352437
Idea wins
3
N pairs
8
Paired delta mean
0.0009054436814039946
Permutation p value
0.74165

Benchmark result

No significant difference vs. the tuned baseline (+2.6%, p=0.7417, wins 3 / 8 paired seeds).

Benchmark
Dynamics forecasting
Model
rnn_small
Paired seeds
8
Baseline mean
0.0343
Idea mean
0.0352
Effect (Δ)
0.0009 (+2.6%; negative = idea better)
Wins
3 / 8 paired seeds
p-value
0.7417 (permutation test, 20 000 shuffles)
Smallest detectable effect
±17.4%
Mechanism
Not confirmed ✗
Practical effect
Inconclusive
Baseline tuning
swept over 3 configs
Limitations:

The neural benchmark uses a diagonal covariance approximation rather than the full dense 64-dimensional covariance because the dense solve exceeded the runtime budget. Only the built-in actuated-pendulum dynamics track was tested; no long-context task, LayerNorm comparison, covariance recomputation during training, FLOP accounting, or larger recurrent models were evaluated.

How to run: python3 bench_covariance.py

Artifacts

Implementation overview ⬇ Download all as ZIP 6 files · code, reports and structured results