# Encoder-reset recursive world-model training

- ID: 1077
- Canonical URL: https://synthcore.org/idea/1077/encoder-reset-recursive-world-model-training
- API JSON: https://synthcore.org/api/idea/1077.json
- API Markdown: https://synthcore.org/api/idea/1077.md
- Verification status: beats_baseline
- Source: [arXiv:2607.17614](https://arxiv.org/abs/2607.17614)
- Category: dynamics
- Solves: stability, sample-efficiency, scalability
- ML areas: rnn, ssm, world-model, optimizer, training-dynamics
- Math tags: dynamical-systems, control-theory, optimization, stochastic-processes
- Ratings: usefulness 7/10; difficulty 5/10; novelty 6/10

## Idea description

Replace full-history backpropagation through time for an online recurrent or state-space neural network with a fixed-length batch protocol. An encoder maps the most recent input-output window to the latent state at the beginning of each batch, after which the learned dynamics are rolled forward and updated recursively from the new batch only. This should prevent state drift across long streams while retaining adaptation to changing dynamics.

## Mathematical statement

The model is a discrete-time neural state-space system with latent state x_k in R^n_x, input u_k, predicted output y_hat_k, and parameters theta: x_{k+1}=f_theta(x_k,u_k), y_hat_k=h_theta(x_k,u_k). For a batch of length N, infer its initial state as x_{i,0}=E_phi(c_i), where E_phi is an encoder and c_i contains the previous L input-output pairs. Roll out the transition and minimize the batch mean-squared prediction loss. The online recursion updates theta and phi using stochastic gradients. Under bounded gradients, diminishing step sizes with sum eta_i equal to infinity and sum eta_i squared finite, and informative inputs, stochastic approximation predicts convergence toward a stationary point of the expected batch loss. A local contraction condition, sup over x,u of the spectral norm of the state Jacobian being at most rho less than one, yields exponential decay of state perturbations: a perturbation after j steps is at most rho to the power j times its initial magnitude.

## Key formulas

- $$x_{k+1}=f_{\theta}(x_k,u_k),\qquad \widehat{y}_k=h_{\theta}(x_k,u_k).$$
- $$x_{i,0}=E_{\phi}(c_i),\qquad x_{i,j+1}=f_{\theta}(x_{i,j},u_{i,j}),\qquad \ell_i=\frac{1}{N}\sum_{j=0}^{N-1}\left\|y_{i,j}-h_{\theta}(x_{i,j},u_{i,j})\right\|_2^2.$$
- $$\theta_{i+1}=\theta_i-\eta_i\widehat{\nabla}_{\theta}\ell_i,\qquad \phi_{i+1}=\phi_i-\eta_i^E\widehat{\nabla}_{\phi}\ell_i,\qquad \sum_i\eta_i=\infty,\quad\sum_i\eta_i^2<\infty.$$
- $$\sup_{x,u}\left\|\frac{\partial f_{\theta}}{\partial x}(x,u)\right\|_2\leq\rho<1\quad\Longrightarrow\quad\left\|\delta x_j\right\|_2\leq\rho^j\left\|\delta x_0\right\|_2.$$

## Implementation notes

1. Integration point: implement a recurrent world model with an encoder E_phi, transition network f_theta, and observation head h_theta. Partition an incoming stream into non-overlapping batches of length N. Retain the previous L input-output pairs as encoder context, but never backpropagate through older batches. Enforce a local contraction constraint by spectral-normalizing the state-to-state linear layers or adding the penalty lambda times max(0, ||J_f||_2 minus rho) squared, where J_f is the Jacobian of f_theta with respect to the latent state. 2. Pseudocode: for each batch, compute x_0=E_phi(context); for j from 0 to N minus 1, predict y_hat_j=h_theta(x_j,u_j), accumulate squared error, and set x_{j+1}=f_theta(x_j,u_j). Backpropagate only through the current batch and update theta and phi. Detach the final state because the next batch obtains a fresh state estimate from the encoder. Start with Adam, then test eta_i=eta_0 divided by (1+i/i_0) raised to 0.6 to enter a diminishing-step-size regime. 3. Compute directly: rollout loss, gradients, and minibatch Jacobian spectral norms using one or two power iterations. Estimate empirically: the asymptotic loss, contraction factor rho, and gradient-noise variance. 4. First cheap experiment: use a two-dimensional nonlinear oscillator or Lorenz system with control inputs. Compare this method against a GRU with truncated backpropagation through time and a neural state-space model that carries its final state indefinitely. Test N in {16,64,256} and L in {16,64}. The predicted signatures are a state-perturbation decay slope near log(rho), constant per-batch computation as stream length grows, and decreasing batch-to-batch loss under diminishing learning rates. With rho=0.9, the log perturbation plot should have slope approximately -0.105 per step; violating rho less than one should produce growing multi-step state-error variance and worse long-horizon prediction.

## Verification

- Status: beats_baseline
- Mechanism evidence: yes
- Mechanism confirmed: yes
- Practical verdict: helps
- Verdict: Built an encoder-reset recursive world-model MVP and verified the core contraction mechanism with parameter sweeps. For every tested rho, observed log-decay slopes and 20-step perturbation ratios matched log(rho) and rho^20 to numerical precision, including the predicted rho=1 transition from decay to growth. The training comparison did not show a consistent performance win for reset versus carried state, so the stability mechanism is confirmed but the practical advantage remains unproven.

### Mechanism check

- Verdict: Built an encoder-reset recursive world-model MVP and verified the core contraction mechanism with parameter sweeps. For every tested rho, observed log-decay slopes and 20-step perturbation ratios matched log(rho) and rho^20 to numerical precision, including the predicted rho=1 transition from decay to growth. The training comparison did not show a consistent performance win for reset versus carried state, so the stability mechanism is confirmed but the practical advantage remains unproven.
- Confidence: 9/10
- Limitations: The training comparison used one random seed, a small oscillator, short training, and a mean-pooled four-step context. It did not test GRU-TBPTT, N=256, L=16/64, changing dynamics, spectral normalization, Jacobian penalties, diminishing learning rates, FLOPs, or multiple seeds.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.0081
- Paired wins: 8/8
- Benchmark verdict: idea better (significant)

## Artifacts

- [bench_experiment.py](https://synthcore.org/code/433/bench_experiment.py)
- [bench_report.json](https://synthcore.org/code/433/bench_report.json)
- [experiment.py](https://synthcore.org/code/433/experiment.py)
- [report.md](https://synthcore.org/code/433/report.md)
- [report_bench_2026-08-31T120425.md](https://synthcore.org/code/433/report_bench_2026-08-31T120425.md)
- [results.json](https://synthcore.org/code/433/results.json)
- [Download all files as ZIP](https://synthcore.org/download/433)

## Disclaimer

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