TL;DR
TS-Memory introduces Parametric Memory Distillation, a novel paradigm that bridges the gap between fine-tuning and retrieval-augmented generation (RAG) for Time Series Foundation Models (TSFMs). By distilling non-parametric $k$NN retrieval distributions into a lightweight parametric adapter offline, it delivers the localized domain-adaptation benefits of RAG with the constant-time inference speed of a frozen backbone.
What Problem Does This Paper Address?
Time Series Foundation Models (TSFMs) have revolutionized forecasting by enabling powerful zero-shot performance across diverse domains. However, when deployed in the real world, TSFMs frequently stumble due to distribution shifts—changes in data scale, seasonality, or sensor variations.
To adapt these models, practitioners generally face a frustrating dilemma between two paradigms:
- Parametric Adaptation (Fine-tuning/LoRA): Modifying the model's weights to fit a new domain. This requires maintaining separate model copies for every single domain (high storage cost) and risks catastrophic forgetting of the model's original pre-trained knowledge.
- Non-Parametric Retrieval (RAG): Keeping the backbone frozen and querying an external database of historical examples at runtime to guide the forecast. While this avoids altering model weights, it places expensive $k$NN database queries directly on the critical inference path, causing latency to scale linearly with database size ($O(|D|)$).
The authors ask: Can we capture the robust adaptability of retrieval-based methods while maintaining the constant-time inference and deployment simplicity of parametric adapters?
Methods
The authors propose TS-Memory, which shifts the heavy computational cost of retrieval from inference time to training time. The framework operates in two distinct stages:
Stage I: Privileged Supervision Construction (Offline)
Instead of querying a database during a live forecast, TS-Memory builds an offline "teacher." For each training instance, it searches a leakage-safe historical database to find its $k$-nearest neighbors in the frozen embedding space. It then applies a shift alignment step to correct for baseline level offsets and aggregates the future trajectories of these neighbors into empirical, confidence-aware quantile targets.
Stage II: Confidence-Gated Memory Distillation
A lightweight encoder-decoder Transformer module called PlugMem is trained to directly predict these teacher quantiles from the raw input context. To ensure robustness against noisy data, the authors use a confidence-gated dual objective. The module is optimized using standard ground-truth regression, but it only distills the retrieval teacher's distribution when the teacher demonstrably outperforms the frozen backbone.
Online Inference
At test time, the external database is completely discarded. Inference requires just two fast forward passes: one through the frozen TSFM backbone and one through the tiny PlugMem module. Their outputs are combined via a simple, quantile-wise linear interpolation.
Datasets
The framework was rigorously evaluated on eight standard long-term multivariate forecasting benchmarks:
- ETT (ETTh1, ETTh2, ETTm1, ETTm2): Electricity Transformer Temperature datasets (hourly and 15-minute resolutions).
- Electricity: Hourly electricity consumption records for 321 customers.
- Exchange-rate: Daily foreign exchange rates of eight currencies.
- Traffic: Hourly road occupancy rates from 862 sensors.
- Weather: Meteorological measurements from 21 weather stations.
Key Insights and Ideas
- Retrieval as Distributional Correction: Retrieval doesn't just provide a single point estimate; the dispersion among retrieved neighbors inherently encodes context-dependent uncertainty. TS-Memory treats this uncertainty as a privileged supervision signal.
- Decoupling Knowledge from Runtime: By compiling retrieval-conditioned predictive distributions into a compact neural module offline, the benefits of RAG are successfully internalized.
- Cross-Model and Cross-Size Portability: Because PlugMem processes raw context windows and maps them directly to a shared quantile forecasting space (rather than relying on internal backbone hidden states), a memory module trained on one foundation model can be plugged directly into a completely different TSFM family or size without retraining.
Key Results
The authors plugged TS-Memory into four prominent TSFM backbones: ChronosBolt, Chronos2, Sundial, and TimesFM.
- Accuracy Boost: Across 32 dataset-backbone pairs, TS-Memory reduced Mean Squared Error (MSE) by an average of 5.8% and Mean Absolute Error (MAE) by 2.1%, outperforming both standard LoRA and online RAG baselines.
- Inference Efficiency: While online RAG methods caused up to a 2x end-to-end slowdown due to database search overhead, TS-Memory maintained a constant-time complexity ($O(1)$) with a negligible forward-pass overhead of less than 6%.
- Parameter Efficiency: Scaling analysis revealed that even a tiny PlugMem module (around 2.5M parameters) recovers the vast majority of the adaptation gains, making it highly viable for edge deployment.
Limitations and Future Work
While highly effective, TS-Memory currently focuses strictly on long-horizon probabilistic forecasting. Extending this paradigm to other time-series tasks like imputation or anomaly detection remains an open area for research.
Additionally, its shift-alignment mechanism primarily addresses simple additive channel-wise offsets; it may struggle with complex temporal warping or abrupt regime changes. Promising future directions include developing input-adaptive fusion mechanisms and enabling streaming, real-time memory updates to handle continuously evolving data environments.
Summary updated