Lyapunov-gap regularization for recurrent dynamics
Implementation & benchmark of arXiv:2608.22543 — Quantitative Furstenberg Theory for Large Random Matrices
Source paper: Quantitative Furstenberg Theory for Large Random Matrices arXiv:2608.22543 ⓘ · analyzed Aug 29, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Regularize a recurrent or state-space model using finite-time Lyapunov exponents of its actual hidden-state transition products. Penalize collapsed adjacent exponents while also controlling the largest exponent, encouraging several useful state directions instead of one dominant direction or universal contraction.
Formulas
Mathematical statement
For independent matrices M_t in SL_d(R) with E[log ||M_t||] finite, the Furstenberg-Kesten and Kingman result gives deterministic exponents L_1 >= ... >= L_d satisfying L_i = lim_{n to infinity} n^{-1} log sigma_i(M_1 ... M_n) almost surely, where sigma_i(A) is the i-th singular value. The paper proves for its 2W-dimensional transfer matrices that every adjacent gap satisfies L_i - L_{i+1} >= c/W, where c is a positive model-dependent constant. We estimate exponents numerically from QR factors Q_t R_t = M_t Q_{t-1}, with positive diagonal entries R_{t,ii}, using Lhat_i = T^{-1} sum_t log(R_{t,ii}). The regularizer penalizes gaps below delta/W and penalizes Lhat_1 above a chosen stability ceiling rho.
Implementation notes
(1) Integration point: apply this to the recurrent transition Jacobian, not to the output head. For a linear or diagonal SSM, M_t is the discretized state transition. For a GRU or LSTM, M_t is the Jacobian of h_t with respect to h_{t-1}, evaluated on a minibatch trajectory. Use a smaller number k of leading directions if the hidden dimension is large. (2) Pseudocode: initialize Q with k orthonormal columns; set s=0; for t=1,...,T, compute M_t, form Z=M_t Q, compute reduced QR Z=Q_new R, set Q=Q_new, and accumulate s_i += log(abs(R[i,i])+1e-8); after the loop set Lhat_i=s_i/T and add lambda_gap times the displayed L_gap to the task loss. (3) The QR recursion and exponent estimator come directly from the Lyapunov definition. The target delta/W, ceiling rho, and penalty weights are empirical hyperparameters; estimate c only if desired by measuring gaps in a baseline model. Use stop-gradient through M_t initially for numerical stability, then test differentiable Jacobian products. (4) First experiment: compare a vanilla GRU, orthogonally initialized GRU, spectral-normalized GRU, and this regularizer on sequential MNIST and the adding problem. Record loss versus optimizer steps and FLOPs, gradient norms versus sequence length, hidden-state effective rank, and validation accuracy. Success is fewer exploding or vanishing gradients, larger effective rank, and improved long-context accuracy at equal parameter count and compute.
Verification
Stage 1 · Toy mechanism gate: Failed ✗
Stage 2 · Mechanism transferred to benchmark: Not tested
Stage 2 · Practical benchmark result: Not run
Methodology: Toy-system gate first; the benchmark stage runs only after a pass. How verification works
Stage 1 — Mechanism check agent confidence 9/10
Built a tanh-RNN MVP with analytical hidden-state Jacobians, QR-based finite-time Lyapunov exponents, gap penalties, and a stability-ceiling penalty. The core estimator matched both analytic exponents and singular-value product exponents with maximum error about 5.6e-16. In the matched 60-step adding-task run, baseline validation MSE was 0.10809 versus 0.10812 with regularization, while runtime increased from 7.77s to 52.49s; the promised win was not observed.
- Agent confidence
- 9/10
- Baseline
- Validation MSE 0.1080878; final task MSE 0.1579408; diagnostic gap penalty 0.0010406; runtime 7.77s.
- Idea
- Validation MSE 0.1081237; final task MSE 0.1580989; gap penalty 0.0010479; runtime 52.49s, approximately 6.8x baseline.
Limitations: Only a tiny synthetic adding problem and tanh-RNN were tested; no GRU/LSTM, SSM, sequential MNIST, hyperparameter sweep, multiple seeds, FLOP-normalized comparison, or differentiable-vs-stop-gradient ablation was performed. The current implementation uses full hidden dimension QR and differentiates through the QR penalty, making it substantially more expensive than the baseline.
How to run: OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 /home/maxwelhelp/main/bin/python3 lyapunov_experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Artifacts
- lyapunov_experiment.py 5.1 KB View Raw
- report.md 1.4 KB View
- results.json 1.7 KB View Raw