Table of Contents
Fetching ...

TS-RAG: Retrieval-Augmented Generation based Time Series Foundation Models are Stronger Zero-Shot Forecaster

Kanghui Ning, Zijie Pan, Yu Liu, Yushan Jiang, James Yiming Zhang, Kashif Rasul, Anderson Schneider, Lintao Ma, Yuriy Nevmyvaka, Dongjin Song

TL;DR

TS-RAG addresses the challenge of zero-shot forecasting across diverse time series by augmenting a frozen time-series foundation model with retrieved, semantically similar patterns from a knowledge base. A pre-trained time-series encoder retrieves top-$k$ contexts, which are adaptively fused with the backbone via the Adaptive Retrieval Mixer (ARM) to produce context-enriched forecasts; only the ARM and projection heads are trained, keeping the backbone and retriever frozen. The approach achieves state-of-the-art zero-shot performance across seven public benchmarks, with substantial gains in MSE and MAE and markedly lower inference latency than prior retrieval-based methods. The framework affords interpretability by surfacing retrieved analogue sequences and their influence on predictions. This work demonstrates strong generalization across domains and non-stationary dynamics, highlighting the practical potential of retrieval-augmented forecasting for open-world time-series tasks.

Abstract

Large Language Models (LLMs) and Foundation Models (FMs) have recently become prevalent for time series forecasting tasks. While fine-tuning LLMs enables domain adaptation, they often struggle to generalize across diverse and unseen datasets. Moreover, existing Time Series Foundation Models (TSFMs) still face challenges in handling non-stationary dynamics and distribution shifts, largely due to the lack of effective mechanisms for adaptation. To this end, we present TS-RAG, a retrieval-augmented generation framework for time series forecasting that enhances the generalization and interpretability of TSFMs. Specifically, TS-RAG leverages pre-trained time series encoders to retrieve semantically relevant segments from a dedicated knowledge base, enriching the contextual representation of the input query. Furthermore, we propose an Adaptive Retrieval Mixer (ARM) module that dynamically fuses the retrieved patterns with the TSFM's internal representation, improving forecasting accuracy without requiring task-specific fine-tuning. Thorough empirical studies on seven public benchmark datasets demonstrate that TS-RAG achieves state-of-the-art zero-shot forecasting performance, outperforming the existing TSFMs by up to 6.84% across diverse domains while also providing desirable interpretability. Our code and data are available at: https://github.com/UConn-DSIS/TS-RAG

TS-RAG: Retrieval-Augmented Generation based Time Series Foundation Models are Stronger Zero-Shot Forecaster

TL;DR

TS-RAG addresses the challenge of zero-shot forecasting across diverse time series by augmenting a frozen time-series foundation model with retrieved, semantically similar patterns from a knowledge base. A pre-trained time-series encoder retrieves top- contexts, which are adaptively fused with the backbone via the Adaptive Retrieval Mixer (ARM) to produce context-enriched forecasts; only the ARM and projection heads are trained, keeping the backbone and retriever frozen. The approach achieves state-of-the-art zero-shot performance across seven public benchmarks, with substantial gains in MSE and MAE and markedly lower inference latency than prior retrieval-based methods. The framework affords interpretability by surfacing retrieved analogue sequences and their influence on predictions. This work demonstrates strong generalization across domains and non-stationary dynamics, highlighting the practical potential of retrieval-augmented forecasting for open-world time-series tasks.

Abstract

Large Language Models (LLMs) and Foundation Models (FMs) have recently become prevalent for time series forecasting tasks. While fine-tuning LLMs enables domain adaptation, they often struggle to generalize across diverse and unseen datasets. Moreover, existing Time Series Foundation Models (TSFMs) still face challenges in handling non-stationary dynamics and distribution shifts, largely due to the lack of effective mechanisms for adaptation. To this end, we present TS-RAG, a retrieval-augmented generation framework for time series forecasting that enhances the generalization and interpretability of TSFMs. Specifically, TS-RAG leverages pre-trained time series encoders to retrieve semantically relevant segments from a dedicated knowledge base, enriching the contextual representation of the input query. Furthermore, we propose an Adaptive Retrieval Mixer (ARM) module that dynamically fuses the retrieved patterns with the TSFM's internal representation, improving forecasting accuracy without requiring task-specific fine-tuning. Thorough empirical studies on seven public benchmark datasets demonstrate that TS-RAG achieves state-of-the-art zero-shot forecasting performance, outperforming the existing TSFMs by up to 6.84% across diverse domains while also providing desirable interpretability. Our code and data are available at: https://github.com/UConn-DSIS/TS-RAG

Paper Structure

This paper contains 44 sections, 12 equations, 10 figures, 13 tables.

Figures (10)

  • Figure 1: Overview of the proposed TS-RAG framework. Given an input time series as the query, the retriever accesses a knowledge base to obtain semantically related information. The retrieved knowledge is subsequently integrated into a frozen time series foundation model (which can adopt various architectures and design choices) to enhance forecasting performance.
  • Figure 2: The TS-RAG model architecture processes an input time series by retrieving the top-$k$ semantically similar time series segments and their corresponding future horizons from a knowledge base (via Retriever), based on embedding similarity. These retrieved segments are then integrated with the input series embedding using the proposed Adaptive Retrieval Mixer (ARM) augmentation module, enabling the model to generate the final forecast with enriched contextual information.
  • Figure 3: Comparison of average MSE and MAE across augmentation methods (left) and knowledge bases (right). w/o RAG indicates Chronos-Bolt baseline; w/ ARM and w/ Gate refer to TS-RAG with ARM and Gate augmentation modules, respectively. More detailed results are in Appendix \ref{['appendix:ablation']}
  • Figure 4: Case study on TS-RAG retrieval (Weather): Given the query time series, the retriever selects relevant historical sequences based on the embedding of the query. The retrieved sequences exhibit strong similarity to the input query in terms of both trend and periodicity.
  • Figure 5: Case study on TS-RAG retrieval and forecasting (ETTm1): Given the retrieved sequence, the forecasting result with RAG better aligns with the sharp downward trend.
  • ...and 5 more figures