Back to Feed
Benchmarks & Evals / Efficiency & Inference

Retrieval Augmented Generation for Time Series

Original: TS-RAG: Retrieval Augmented Generation for Time Series Forecasting

Listen to the summary

Uses a voice available on your device

Audio options
On this page

Key Takeaways

  • TS-RAG achieves significant performance gains over simple sequence concatenation by using cross-attention to align retrieved historical data with input sequences.
  • The TS-RAG-CM variant recorded the best performance with an average MSE of 0.310 and MAE of 0.348 across six benchmark datasets.
  • At a 720-step prediction horizon, TS-RAG and TS-RAG-CM reduce MSE by 16.2% and 18.2% respectively compared to standard concatenation methods.
  • The method uses learnable reference tokens to inject historical context directly into the model architecture.

Summary & Methodology Analysis

The TS-RAG architecture addresses the failure of traditional time series models to leverage external data by introducing a retrieval-based pipeline. The process begins by identifying relevant historical segments from a database using a similarity-based function. Input sequences and these retrieved segments are then converted into non-overlapping patches. A key contribution is the use of learnable reference tokens, which are prepended to the input sequence to represent broader historical patterns before computing embeddings and positional encodings. This structure allows the model to treat external historical context as a first-class feature rather than just appending raw data to the input stream. For the model layers, TS-RAG employs self-attention to capture internal temporal dependencies, while cross-attention is specifically utilized to integrate the retrieved sequences into the current input. The final hidden representations are processed through a standard feed-forward network to generate the forecast. The CM variant further improves results by explicitly modeling inter-channel dependencies, leading to an average MSE of 0.310 and MAE of 0.348. The performance impact is most pronounced at longer horizons, where it achieves up to an 18.2% reduction in MSE for 720-step predictions compared to simple concatenation. However, the model has limitations. Performance can degrade if excessive sequences are retrieved due to noise and redundancy, suggesting an optimal limit on reference data. Additionally, the standard TS-RAG variant lacks the explicit inter-channel modeling found in the CM version.

Interactive System Flowchart

Click diagram to expand and zoom

Cross-Examination & FAQs

A deeper dive clarifying mechanics, constraints, and baseline evaluations.

Q1. What is the main problem addressed by this paper?

Traditional time series models lack the ability to effectively incorporate external information, and simple data concatenation fails to deliver optimal forecasting results.

Q2. How does TS-RAG differ from basic concatenation?

Instead of just appending data, TS-RAG uses learnable reference tokens and cross-attention to align and integrate retrieved historical patterns with the input sequence.

Q3. Does this method improve long-term forecasting?

Yes, at a 720-step prediction horizon, TS-RAG-CM reduces MSE by 18.2% compared to direct sequence concatenation.

Q4. What happens if you retrieve too many sequences?

Retrieving too many similar sequences introduces noise and redundancy, which can degrade performance compared to using a single reference sequence.

Q5. Which specific datasets were used for benchmarking?

The authors used the ECL, ETTh1, ETTh2, ETTm1, ETTm2, and Weather datasets.

Q6. What is the difference between TS-RAG and TS-RAG-CM?

The TS-RAG-CM variant is designed to model inter-channel dependencies, whereas the standard TS-RAG model does not explicitly model these.

Q7. How does the model handle the input data?

Input and retrieved sequences are divided into non-overlapping patches, a standard technique, before prepending learnable reference tokens.

Q8. What baseline models were considered in this study?

The paper benchmarks against Informer, Autoformer, FedFormer, PatchTST, TimeXer, iTransformer, RLinear, DLinear, Crossformer, TiDE, TimesNet, TimeGPT-1, ForecastPFN, TimesFM, MOIRAI, LOTSA, Tiny Time Mixers, ReTime, and RAFT.

Q9. Does the paper provide specific inference latency figures?

The paper does not specify this.