Align-RAG: Alignment Is (Almost) All You Need for TSFM In-Context Learning

Mohammad Asadi, Soheil Hor, Bardiya Akhbari, Jack W O'Sullivan, Tahoura Nedaee, Layne C Price, Raviteja Anantha, Euan Ashley, Ehsan AdeliNeurIPS 2026

TL;DR

When giving historical examples to a frozen Time Series Foundation Model (TSFM) to improve its forecasts, current state-of-the-art methods assume you need to train neural "fusion adapters" on millions of data points so the model can make sense of the retrieved context. Align-RAG shows that you don't need any training at all: simply stretching and shifting the retrieved examples in amplitude and time to match your query unlocks built-in in-context learning, beating trained adapters out of the box.

What Problem Does This Paper Address?

Just like Large Language Models (LLMs) predict the next word, Time Series Foundation Models (TSFMs)—like Chronos, TimesFM, and Moirai—predict future values of signals like energy demand, weather, or hospital vitals without per-domain fine-tuning.

To help these frozen models adapt to unfamiliar domains at test time, researchers borrow Retrieval-Augmented Generation (RAG): find historical (past, future) windows that look like the current query and feed them in as context. Unlike LLMs—where you can simply paste retrieved text into the prompt—the consensus in time series forecasting has been that frozen TSFMs cannot dynamically digest raw retrieved signals on their own. Consequently, recent methods bolt on learned "fusion modules" (like TS-RAG's Adaptive Retrieval Mixer, trained on 26 million examples) to bridge the gap. The authors ask a simple question: Do TSFMs actually lack in-context learning abilities, or are we just feeding them misaligned data?

Methods

The authors introduce Align-RAG, a completely training-free pipeline that prepares retrieved (past, future) pairs before handing them directly to a frozen TSFM's context window.

The core innovation lies in two closed-form signal processing steps applied to every retrieved window:

  1. Amplitude Alignment: A regularized affine transformation (inspired by Wiener filtering) rescales and shifts the retrieved past so its mean and variance match the query's, preventing flat, low-variance signals from blowing up into noise.
  2. Phase Alignment: Using sample cross-correlation, the rescaled past is shifted left or right by an integer time-lag so its peaks and troughs line up with the query.

Crucially, the exact same amplitude scale and time shift are applied to the retrieved future so the historical cause-and-effect relationship remains intact.

Surrounding this core alignment are a few training-free engineering touches: Maximal Marginal Relevance (MMR) filters out near-duplicate retrievals; a tiered token layout packs two long-context examples and eight short-context examples into tight token budgets without ever truncating the futures; and the final output blends the in-context forecast with a distance-weighted average of retrieved futures and a standard zero-shot pass (though pure aligned in-context learning without post-processing still beats the trained baseline).

Datasets

Because Align-RAG requires zero training, datasets are used strictly for inference-time retrieval (from leakage-free training splits) and evaluation. Following the standard TS-RAG benchmark protocol, the authors evaluate across seven univariate forecasting datasets: ETTh1, ETTh2, ETTm1, ETTm2 (electricity transformer temperatures), Weather, Exchange (currency rates), and Electricity (321-channel consumption). No new benchmarks are introduced, ensuring an apples-to-apples comparison with prior trained adapters.

Key Insights and Ideas

  • Alignment matters vastly more than retrieval quality: In a striking $2\times2$ ablation comparing a smart, trained retriever against uniform random sampling from the dataset, turning off alignment tanks forecasting error (MSE) by over 20%. Conversely, keeping alignment on while swapping the smart retriever for random windows costs less than 1% MSE—and still beats the trained TS-RAG adapter on 4 of 7 datasets! Learned fusion modules were largely just compensating for unaligned inputs.
  • Frozen TSFMs secretly do ridge regression: Theoretical ML work shows that transformers can learn to execute implicit linear regression on in-context examples. By comparing how aligned examples shift the TSFM's forecast against a closed-form mathematical ridge regression on those same pairs, the authors find a strong directional match (cosine similarity $\rho_{\text{GD}}$ jumps from $0.30$ unaligned to $0.45$ aligned).
Figure 2: Mechanism evidence on Chronos-Bolt across five demonstration conditions (N=200 windows per cell, averaged over the seven datasets). (a) Implicit-GD signature ρGD: amplitude alignment lifts ρGD from 0.30 (unaligned, cc_only) to ∼0.45 (amp_only, aligned); the future- shuffle condition matches that level. (b) Decoder cross-attention to the demonstration region rises in the same conditions. (c) MSE change versus zero-shot: amp_only and aligned reduce MSE, whereas aligned_fut_shuf reverses the gain even though ρGD stays high in panel (a) – the model continues to track an implicit ridge solution, but on corrupted demonstration pairs.
  • Models read the (past, future) relationship, not just the futures: To prove the model isn't lazily averaging the retrieved futures, the authors run a causal control where they shuffle the futures among the retrieved pairs while keeping the aligned pasts intact. Forecasting error spikes (flipping a 4.2% gain on ETTm1 into a 12.2% loss), yet the model's predictions still track what ridge regression predicts on those corrupted pairs.

Key Results

  • Beating trained state-of-the-art for free: On a frozen Chronos-Bolt backbone, Align-RAG outperforms the trained TS-RAG adapter on 7/7 datasets in MSE (averaging a 3.75% reduction, and up to 8.01% on ETTm1) and 6/7 datasets in MAE, with zero learned parameters.
  • Plug-and-play across architectures: Without changing a single hyperparameter, Align-RAG transfers across five distinct frozen TSFMs (Chronos-Bolt, Chronos-2, TimesFM-2.0, Moirai, and Toto), improving average zero-shot MSE across every backbone—from -2.45% on Toto up to -13.73% on Moirai (including a massive -29.95% MSE drop on ETTm1).

Limitations and Future Work

The authors note that their mechanistic probe is correlational and directional ($\rho_{\text{GD}} = 0.45$) rather than a strict mathematical equivalence ($\rho_{\text{GD}} = 1$), since pretrained TSFMs simultaneously juggle trend extrapolation and seasonality alongside in-context regression. Furthermore, all evaluations focus on standard univariate time series; extending closed-form geometric alignment to multivariate signals, external covariates, and severe distribution shifts remains an open frontier for future work.

Summary updated

Abstract

Retrieval-augmented forecasting promises to adapt frozen Time Series Foundation Models (TSFMs) to new domains without fine-tuning, but recent methods typically rely on learned fusion modules, i.e., trained adapters that merge retrieved examples into the backbone's forecast, based on the assumption that frozen backbones cannot dynamically incorporate retrieved context on their own. We show this assumption is unnecessary. We introduce $\textbf{Align-RAG}$, a training-free method that applies a closed-form per-pair amplitude rescaling and integer-lag phase shift to retrieved past--future windows before they enter a frozen backbone's context. With no learned parameters, Align-RAG outperforms the state-of-the-art trained retrieval adapter on a frozen Chronos-Bolt on all seven datasets of the standard benchmark (avg $-3.75\%$ MSE), showing that the gains previously attributed to learned fusion are recoverable without any training. Align-RAG further improves zero-shot MSE on four additional frozen TSFMs with various architectures by $2.5\%$ to $13.7\%$ per backbone with no per-backbone tuning. To probe why alignment helps, we compare the frozen backbone's prediction shift under aligned demonstrations to the closed-form ridge prediction shift on the same pairs. We find that aligned demonstrations induce prediction shifts that track a closed-form ridge predictor on the same pairs, with a future-shuffle control ruling out a futures-averaging account. Together, these results indicate that frozen TSFMs already support dynamic in-context use of retrievals, and that closed-form alignment should be the default baseline for retrieval-augmented forecasting before any fusion module is trained. Code available at: \url{https://github.com/masadi-99/align-rag}
BibTeX
@inproceedings{asadi2026align,
  author = {Mohammad Asadi and Soheil Hor and Bardiya Akhbari and Jack W O'Sullivan and Tahoura Nedaee and Layne C Price and Raviteja Anantha and Euan Ashley and Ehsan Adeli},
  title = {{Align-RAG: Alignment Is (Almost) All You Need for TSFM In-Context Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=THqFc0nGPv},
}
Figure