TL;DR
This paper introduces Retrieval Augmented Forecasting (RAF), a novel framework that enhances time series forecasting by leveraging retrieval-augmented generation (RAG) techniques. RAF significantly improves forecasting accuracy across various time series foundation models (TSFMs), especially for larger models, by dynamically retrieving and incorporating relevant historical data patterns.
What Problem Does This Paper Address?
Modern time series forecasting models, particularly foundation models, are powerful but often struggle with dynamic, heterogeneous, and context-dependent data. They can perform poorly on out-of-distribution events or when faced with abrupt regime shifts, as their knowledge is limited to their training data. This paper questions whether the benefits of Retrieval-Augmented Generation (RAG), which has proven effective in LLMs for incorporating external knowledge, can be extended to time series forecasting. The challenge is to adapt RAG's principles to the unique characteristics of time series data, which requires efficient retrieval of relevant historical patterns and their seamless integration into the forecasting process.
Methods
The core contribution is the Retrieval Augmented Forecasting (RAF) framework. RAF works by:
- Retrieval: Given a time series query, RAF identifies and retrieves the most similar historical time series segments (motifs) from a database. This retrieval is based on embedding similarity, with the paper exploring various metrics like L2 norm and Pearson's correlation.
- Augmentation: The retrieved "context" (the historical segment) and its "future" (the segment immediately following it) are combined with the original time series query. This augmented sequence then serves as input to a Time Series Foundation Model (TSFM).
- Forecasting: The TSFM uses this augmented input to produce a more accurate forecast.
The paper also explores two RAF variants:
- Naive RAF: Treats the TSFM as a black box, freezing its weights.
- Advanced RAF: Fine-tunes the TSFM to better leverage the retrieved information.
Efficient strategies for indexing, database formation, and similarity matching are detailed, along with instance normalization to handle distribution shifts.
Datasets
The paper evaluates RAF on two benchmark datasets:
- Benchmark I: Consists of 6 datasets with longer context and prediction lengths, including:
- Weather (Nature)
- Traffic (Transport)
- ETT (Energy)
- FRED-MD (Finance)
- Covid Deaths (Health)
- NN5 (Finance)
- Benchmark II: Consists of 5 datasets with shorter context and prediction lengths, including:
- Tourism (Monthly & Quarterly)
- M1 (Finance)
- Uber TLC (Transport)
- CIF-2016 (Finance)
These datasets cover diverse domains like nature, transport, finance, health, and tourism, with varying frequencies (daily, hourly, monthly, quarterly).
Key Insights and Ideas
- RAG is Crucial for Time Series: The dynamic and event-driven nature of time series data makes RAG a valuable tool, enabling models to adapt to new patterns and external influences without retraining.
- Model Size Matters: Larger TSFMs (like Chronos Base) benefit more from RAF than smaller ones (like Chronos Mini), demonstrating that model capacity is key to effectively utilizing retrieved information. Chronos Mini even fails to solve basic synthetic retrieval tasks without RAF.
- Retrieval Enhances Zero-Shot: RAF significantly improves zero-shot forecasting performance, particularly on out-of-domain datasets where domain-specific structures are not present in the base model's training data.
- Fine-tuning and Retrieval Complement Each Other: Advanced RAF (with fine-tuning) consistently outperforms both baseline fine-tuning and Naive RAF, highlighting that retrieval provides beneficial priors that fine-tuning can further exploit.
- Contextual Alignment is Key: Retrieval from the same domain, or even the same dataset, yields better results than cross-domain retrieval, emphasizing the importance of contextual similarity.
- Noise Can Sometimes Help: Moderate noise levels can surprisingly improve retrieval diversity and lead to better performance, suggesting that slight perturbations can break ties and surface more informative motifs.
Key Results
- Consistent Improvements: RAF consistently outperforms baseline forecasting methods across various TSFMs (Chronos, Moirai, TimesFM, Lag-Llama) and datasets, showing improvements in both probabilistic (WQL) and point (MASE) forecasts.
- Size-Dependent Gains: For Chronos Mini, RAF shows average relative improvements of 0.887 (WQL) and 0.950 (MASE) on Benchmark I, and 0.762 (WQL) and 0.925 (MASE) on Benchmark II. For Chronos Base, these are 0.733 (WQL) and 0.880 (MASE) on Benchmark I, and 0.821 (WQL) and 0.944 (MASE) on Benchmark II.
- Fine-tuning Boost: Advanced RAF (fine-tuned) achieved the lowest WQL/MASE scores on most datasets, e.g., reducing MASE from 0.563 to 0.401 for Chronos Mini on NN5.
- Robustness: RAF demonstrates resilience to moderate noise and sparsity, with performance degrading gracefully rather than failing abruptly.
- Non-Transformer Limitations: Adding RAF to non-attention models like DLinear, GBDT, and ARIMA yielded little to no average benefit and sometimes hurt performance, suggesting that attention mechanisms are crucial for effectively utilizing retrieved information.
Limitations and Future Work
- Univariate Focus: The study primarily focuses on univariate time series. The authors suggest that extending RAF to handle multi-channel predictions is a promising future direction.
- Model Size Dependency: While larger models benefit more, the failure of Chronos Mini on synthetic tasks highlights a limitation in smaller models' ability to perform effective retrieval.
- Domain Alignment: While same-domain retrieval is beneficial, cross-domain retrieval offers only marginal improvements and can sometimes degrade performance, indicating that domain characteristics are important.
- Future Work: The authors propose expanding RAF to multi-channel predictions and exploring its application in more complex scenarios. They also note that the effectiveness of retrieval might be further enhanced with multivariate models.
Summary updated