Koopman Preview Gate for Adaptive Neural Computation
Implementation & benchmark of arXiv:2608.09413 — Deep Koopman risk-preview supervised LTV-MPC for direct yaw moment control of distributed drive electric vehicles
Source paper: Deep Koopman risk-preview supervised LTV-MPC for direct yaw moment control of distributed drive electric vehicles arXiv:2608.09413 ⓘ · analyzed Sep 1, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Train a small encoder and latent Koopman predictor to forecast whether a neural sequence model will enter a high-error or high-instability region, then execute an expensive refinement block only when the forecasted risk exceeds a threshold. The base model remains active at every step, so the learned preview model controls computation rather than directly replacing the main predictor. Add a bounded-rate interpolation when the gate switches off, preventing abrupt changes in recurrent state or output.
Formulas
Mathematical statement
Let x_t be the input or hidden state, z_t=E_phi(x_t) in R^d its learned latent representation, and K_theta a learned Koopman matrix. The preview dynamics are hat{z}_{t+j}=K_theta^j z_t, optionally with a measured scheduling variable s_t through K_theta(s_t). Define a risky set by a quadratic phase-space score R(z)=z^T Q z with Q positive semidefinite, threshold tau, and preview horizon H. The gate is g_t=1{max_{1<=j<=H} R(hat{z}_{t+j})>tau}, or a differentiable sigmoid during training. The expensive correction network is C_psi, while the cheap base network is B_omega. The output is y_t=B_omega(x_t)+g_t C_psi(x_t); when the gate closes, use u_t=rho u_{t-1}+(1-rho)B_omega(x_t) with 0<=rho<1 to impose a bounded-rate transition. If the spectral radius rho(K_theta)<1, latent preview perturbations decay asymptotically in the linear autonomous case, but the gate remains useful only if the risk score has sufficient lead time before actual error growth.
Implementation notes
First, integrate the mechanism after the hidden state of a GRU, state-space model, or causal Transformer. Train an encoder E_phi from hidden state h_t, a d-dimensional linear Koopman predictor K_theta, a cheap base head B_omega, and an expensive refinement head C_psi. Define risky states using the future base-model loss: fit Q and threshold tau so that R(z_t) predicts whether the base model's loss over the next H tokens or timesteps exceeds a selected quantile. Second, use this pseudocode: compute z=E_phi(h); set risk=0; for j in 1,...,H, replace z by K_theta z and update risk=max(risk,z^T Q z); set g=(risk>tau); compute y_base=B_omega(h); if g is true compute y=y_base+C_psi(h), otherwise set y=rho*y_previous+(1-rho)*y_base. During training, replace the hard gate with sigmoid((risk-tau)/T), anneal temperature T, and add the Koopman loss sum_j ||E_phi(h_{t+j})-K_theta^j E_phi(h_t)||^2. Matrix powers, risk, gating, and interpolation are computed online; E_phi, K_theta, Q, tau, H, and rho are learned or calibrated offline. Estimate Q using inverse covariance or parameterize Q=L L^T. Monitor or project K_theta to satisfy rho(K_theta)<1. The first cheap experiment should use a small GRU on Penn Treebank or a nonlinear dynamical-system forecasting benchmark, comparing base-only, always-on refinement, and Koopman-gated refinement. Sweep tau and H. The predicted signature is a positive warning lead time before future-loss spikes, with compute decreasing approximately with gate activation rate. Accept the method if it removes at least 25% of refinement calls while increasing long-horizon error by less than 5%; additionally test whether latent perturbation norms decay approximately as c alpha^j and whether the measured decay agrees with the spectral-radius estimate.
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 reproducible NumPy Koopman preview gate with quadratic risk, threshold sweeps, bounded-rate interpolation, and baseline/always-refine comparisons. Exact spectral-decay and analytical preview-lead predictions were confirmed, and gating saved 83.5% of refinement calls with 98.8% recall; however, gated MSE was 10.7% above always-refine, exceeding the requested <5% degradation, and the learned autonomous model did not show empirical lead time on the burst-driven system.
- Agent confidence
- 9/10
- Always refine
- MSE 0.00001573; 100% refinement calls
- Analytic preview lead
- For growth factors 1.02, 1.05, 1.10 and horizons 2, 5, 8, observed lead exactly matched predicted H
- Baseline
- MSE 0.0013426; refinement calls 100%
- Idea
- MSE 0.00001742; 16.5% refinement calls; 83.5% calls saved; 98.8% recall; 10.7% increase vs always-refine MSE
- Spectral decay
- For radii 0.50, 0.80, 0.95, observed log slopes matched log(r) to <6e-16 relative error
- Threshold sweep
- At 82nd-percentile threshold: 17.95% gate rate, 99.6% recall, precision 1.0
Limitations: This is a small deterministic NumPy toy experiment, not a trained GRU/encoder or language-model benchmark. The encoder is identity, Q is fixed to the identity, no learned differentiable gate or scheduling variable was tested, and the burst forcing is not included in the autonomous Koopman preview model; CUDA and wall-clock compute savings were not measured.
How to run: python3 koopman_preview_experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Artifacts
- koopman_preview_experiment.py 6.5 KB View Raw
- report.md 1.7 KB View
- results.json 4.0 KB View Raw