Gramian-balanced neural SSM compression
Implementation & benchmark of arXiv:2608.22406 — A New Generalized Low-Rank Cholesky Factor ADI Algorithm for Large-Scale Stein Equations
Source paper: A New Generalized Low-Rank Cholesky Factor ADI Algorithm for Large-Scale Stein Equations arXiv:2608.22406 ⓘ · analyzed Aug 29, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Compress the hidden state of a stable neural state-space layer using low-rank controllability and observability Gramians. States that are difficult to excite from the input or weakly visible at the output are removed, producing a smaller recurrent state with a principled input-output preservation criterion.
Formulas
Mathematical statement
For a discrete stable SSM with state update $x_{t+1}=Fx_t+Bu_t$ and output $y_t=Cx_t$, the paper defines controllability and observability Gramians through the Stein equations $FPF^{\top}-P+BB^{\top}=0$ and $F^{\top}QF-Q+C^{\top}C=0$; these are equations (1) and (2) specialized from the paper's generalized form by setting $E=I$ and $F=A$. Stability means every eigenvalue of $F$ lies strictly inside the unit circle, ensuring unique positive-semidefinite solutions. Compute low-rank factors $P\approx Z_pZ_p^{\top}$ and $Q\approx Z_qZ_q^{\top}$. Form $M=Z_q^{\top}Z_p$ and its SVD $M=U\Sigma V^{\top}$. For retained rank $r$, define $V_r=Z_pV_{:,1:r}\Sigma_{1:r,1:r}^{-1/2}$ and $W_r=Z_qU_{:,1:r}\Sigma_{1:r,1:r}^{-1/2}$, giving approximately $W_r^{\top}V_r=I$. The reduced matrices are $F_r=W_r^{\top}FV_r$, $B_r=W_r^{\top}B$, and $C_r=CV_r$. The preserved transfer function is $G(z)=C(zI-F)^{-1}B$, a specialization of the paper's $G(z)=C(zE-A)^{-1}B$. Low-rank factors can be generated without dense Gramians using $P_k=\sum_{i=0}^{k-1}F^iBB^{\top}(F^{\top})^i$ and the block factor iteration $Z_{p,k+1}=\operatorname{compress}_{\tau}([FZ_{p,k}\;B])$; apply the analogous iteration with $F^{\top}$ and $C^{\top}$ for $Q$. Here $\tau$ is a singular-value truncation tolerance and $\operatorname{compress}_{\tau}$ returns a thin factor after truncated or randomized SVD.
Implementation notes
(1) Integrate this as an offline compression pass for a linear or nearly linear SSM layer. Expose its hidden-state transition $F\in\mathbb{R}^{n\times n}$, input matrix $B\in\mathbb{R}^{n\times m}$, and output matrix $C\in\mathbb{R}^{p\times n}$. If the layer has nonlinear gates, freeze the gates on representative calibration sequences or apply the method to the underlying linear transition. Require spectral radius $\rho(F)<1$; estimate it with 10 to 20 power iterations and scale $F$ by $\min(1-\epsilon,0.99/\max(\rho(F),10^{-6}))$ when necessary. (2) Pseudocode: initialize empty $Z_p$; for $k=1,\ldots,K$, set $Y=[FZ_p\;B]$ and $Z_p=\operatorname{compress}_{\tau}(Y)$; independently initialize empty $Z_q$ and repeat with $Y=[F^{\top}Z_q\;C^{\top}]$. Compute $M=Z_q^{\top}Z_p$, run its SVD, retain the first $r$ singular values, construct $V_r,W_r$, and replace $(F,B,C)$ with $(F_r,W_r^{\top}B,CV_r)$. (3) The Stein equations and balancing projection are taken from the paper; the engineer estimates factors matrix-free through products with $F$ and $F^{\top}$, never forming $P$ or $Q$. Monitor approximate residuals using $P=Z_pZ_p^{\top}$ and $Q=Z_qZ_q^{\top}$, and choose $K$ until residual norms stop decreasing. (4) First experiment: compress a 256- or 512-state S4- or Mamba-style layer to ranks 32, 64, and 128 on WikiText-103 or Long Range Arena, comparing against uncompressed fine-tuning and magnitude-based state pruning. Measure validation perplexity or task accuracy, activation memory, recurrent FLOPs, and decoding latency. A useful success criterion is at least 2x lower state-update cost and memory with less than 1% relative perplexity degradation after brief fine-tuning; also evaluate $\|G(e^{j\omega})-G_r(e^{j\omega})\|$ on a held-out frequency grid.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
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 a NumPy/SciPy Gramian-balanced SSM compression MVP with matrix-free factor iteration, balancing projections, Stein residual checks, frequency-response evaluation, and magnitude-pruning comparison. The mechanism manifested: finite-horizon Gramian tails matched the exact predicted formula to numerical precision, scalar Gramian scaling matched 1/(1-rho^2) across rho=0.5–0.995, and every measured balanced-truncation frequency error stayed below the 2-times-discarded-Hankel-singular-values bound. At rank 4, Gramian compression had maximum frequency error 0.0988 versus 13.02 for magnitude pruning, with an ideal transition-cost ratio of 0.111.
- Agent confidence
- 9/10
- Baseline
- Magnitude state pruning, rank 4: maximum frequency-response error 13.0214; full state dimension 12; transition-cost reference 1.0.
- Idea
- Gramian-balanced truncation, rank 4: maximum frequency-response error 0.09882; biorthogonality error 3.44e-15; Stein residuals 6.24e-17; factor-iteration relative errors P=7.12e-7 and Q=1.40e-7; ideal transition-cost ratio 0.1111. The rank-4 balanced-truncation bound was 0.3276 and held.
Limitations: Only small linear NumPy/SciPy toy systems were tested; no S4/Mamba layer, neural gates, WikiText/LRA task, fine-tuning, wall-clock latency, GPU execution, or measured activation-memory benchmark was evaluated. The cost ratio is an idealized state-transition ratio and excludes projection/implementation overhead.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.22406)
No significant difference vs. the tuned baseline (+41.8%, p=0.2034, wins 2 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0015
- Idea mean
- 0.0021
- Effect (Δ)
- 0.0006 (+41.8%; negative = idea better)
- Wins
- 2 / 8 paired seeds
- p-value
- 0.2034 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±79.2%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
The experiment used the small built-in pendulum dynamics track rather than a large S4/Mamba or long-horizon language benchmark. CPU execution was used after shared-GPU native crashes; wall-clock latency and measured activation memory were not benchmarked. The intervention is a Gramian-derived stable recurrent initialization plus reduced hidden width, not an end-to-end compression pass applied to a pretrained neural SSM.
How to run: CUDA_VISIBLE_DEVICES='' /home/maxwelhelp/main/bin/python3 bench_experiment.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
The Gramian-balanced reduced-state GRU was evaluated against the canonical 64-hidden-unit GRU on the structurally matched dynamics track. The best idea setting had higher MSE (0.0021020 vs 0.0014823) and the paired permutation test was not significant (delta_mean=+0.0006197, p=0.20345), so the idea did not win despite achieving the predicted 0.625 state-cost ratio.
- Baseline
- rnn_small, lr=0.01, 64 hidden units: mean test MSE 0.0014822854, std 0.0010530388
- Idea
- Gramian-initialized reduced GRU, rank 40, lr=0.01: mean test MSE 0.0021019701, std 0.0007477002; paired delta +0.0006196846; p=0.20345
Benchmark result
No significant difference vs. the tuned baseline (+41.8%, p=0.2034, wins 2 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0015
- Idea mean
- 0.0021
- Effect (Δ)
- 0.0006 (+41.8%; negative = idea better)
- Wins
- 2 / 8 paired seeds
- p-value
- 0.2034 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±79.2%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 3 configs
The experiment used the small built-in pendulum dynamics track rather than a large S4/Mamba or long-horizon language benchmark. CPU execution was used after shared-GPU native crashes; wall-clock latency and measured activation memory were not benchmarked. The intervention is a Gramian-derived stable recurrent initialization plus reduced hidden width, not an end-to-end compression pass applied to a pretrained neural SSM.
How to run: CUDA_VISIBLE_DEVICES='' /home/maxwelhelp/main/bin/python3 bench_experiment.py
Artifacts
- bench_experiment.py 5.5 KB View Raw
- bench_results/bench_report.json 3.7 KB View Raw
- experiment.py 5.6 KB View Raw
- report.md 1.7 KB View
- report_bench_2026-08-31T222223.md 5.6 KB View
- results.json 4.1 KB View Raw