arXiv:2610.19552cs.LGOct 2026

Manuscript Offprint

arXiv:2610.19552

Test-Time Forecasting: Recurrent Depth Enables In-Context Dynamics Prediction

Jeffrey B. Lai, John Quinn, Anthony Bao, William Gilpin

Jeffrey B. Lai ∗^{*} †^{\dagger}

Oden Institute

University of Texas at Austin

jlai@utexas.edu

Anthony Bao

Department of Electrical

Computer Engineering

University of Texas at Austin

abao@utexas.edu

John Quinn ∗^{*}

Oden Institute

University of Texas at Austin

jq@utexas.edu

William Gilpin

Department of Physics

University of Texas at Austin

wgilpin@utexas.edu

ABSTRACT

Foundation models for dynamical systems can forecast unseen partial differential equations (PDEs), ordinary differential equations (ODEs), and time series during inference. However, it remains an open question whether these foundation models truly learn generalizable in-context forecasting strategies. We show that looped transformers are capable of emulating propagators for dynamical systems in-context by first establishing a link between linear attention and (extended) dynamic mode decomposition. We then generalize this insight into the Test Time Forecasting (TTF) framework in which a one-step forecaster leverages iterations of gradient descent as recurrent depth. We demonstrate that lightweight TTF models trained on ODEs and PDEs generalize to out-of-distribution system dynamics during autoregressive rollout after being trained for one-step prediction. Our results reinforce TTF as a theoretically motivated framework for designing recurrent depth models capable of forecasting unseen dynamical systems at test-time.

1 INTRODUCTION

Data-driven forecasting of dynamics underlies diverse fields such as weather, physiology, and economics. Recently, foundation models trained on large heterogeneous mixtures of dynamical systems have demonstrated the ability to accurately forecast trajectories from unseen dynamical systems (Lang et al., 2024; Ansari et al., 2025; Lai et al., 2026). This phenomenon is typically attributed to in-context learning (ICL), a stronger form of generalization in which models learn to learn from examples contained in the input context during inference (Brown et al., 2020). However, despite extensive mechanistic interpretability results characterizing ICL in the discrete token setting of language modeling (Olsson et al., 2022), there is little understanding of how ICL emerges in the continuous-valued forecast model setting.

Recent studies highlight the surprising effectiveness of ICL in transformer-based foundation models for dynamics (Fear et al., 2025; Zhang & Gilpin, 2026; Bao et al., 2026a; Ansari et al., 2025). These models are typically large ( ∼\sim10M-100M parameters), and recent literature indicates the presence of significant parameter redundancies in transformer-based foundation models across diverse domains such as language, DNA, vision, and time series. In these settings, performance can be often be retained even after pruning half of all parameters (Michel et al., 2019; Bao et al., 2026b; Kendiukhov, 2026; Yang et al., 2023).

Motivated by these observations, we ask: Can in-context learning emerge in forecast foundation models without massive parameter scale? We consider the emerging architectural paradigm of recurrent-depth (looped) transformers, which demonstrate strong ICL capability with comparably much smaller models in synthetic tasks and language modeling due to weight-tied layers (Geiping et al., 2025; Prairie et al., 2026; Giannou et al., 2023).

∗^{*}Equal contribution.

†^{\dagger}Corresponding author.

Figure

Figure 1: TTF as a flexible framework for designing forecasters with recurrent depth and in-context learning capability by embedding regression over a forecasting objective in latent space. (iTTF) Prediction space recurrence. (eTTF) Parameter space recurrence. The choice of iTTF block U, eTTF inner loss L, inner model F, encoder ϕ\phi, and decoder χ\chi are all task-dependent.

We approach the central question by first understanding how to train transformers to forecast linear dynamical systems (LDS) in-context. This toy setting unveils an equivalence between Koopman operator theory for LDS, recurrent-depth transformers, and common architecture design choices in transformer-based forecast models. We then show how key observations from dynamic mode decomposition (DMD), a mathematical framework for data-driven forecasting of dynamical systems (Schmid, 2010), motivate a generalized framework for in-context forecasting we call test-time forecasting (TTF). In particular, we establish three core contributions:

• We empirically validate a theoretical equivalence between looped (linear) transformers and Koopman operator theory for one-step forecasting of LDS, and generalize these results to forecast nonlinear dynamics.

• We develop TTF as a framework to flexibly guide architecture design for forecasting arbitrary dynamical systems in-context, and demonstrate how TTF variants materialize as common transformer design choices.

• We showcase parameter-efficient generalization across dynamical system parameters with TTF models in ODE and PDE forecasting tasks.

References (100)

Couldn't load all references. Reload the page to try again.