TLDR: PFRP (Predicting the Future by Retrieving the Past) is a new approach to univariate time series forecasting that improves accuracy by explicitly using global historical data. Unlike traditional models that only consider recent data, PFRP builds a Global Memory Bank of past patterns. During prediction, it retrieves similar historical patterns, generates a “global prediction,” and then intelligently combines it with predictions from any standard local forecasting model. This method has shown significant performance gains on various real-world datasets, particularly those with strong periodic patterns, while maintaining efficiency.
In the world of data science, predicting future trends from historical data, known as time series forecasting, is crucial for many fields like weather prediction, finance, and energy management. While advanced deep learning models have made great strides, they often face a common limitation: they primarily rely on a small, recent “lookback window” of data for their predictions. This means they implicitly learn from historical patterns during training but can’t explicitly access or leverage that vast global knowledge during real-time forecasting, leading to an underutilization of rich historical information.
A new research paper titled “Predicting the Future by Retrieving the Past” introduces an innovative solution called PFRP (Predicting the Future by Retrieving the Past). Authored by Dazhao Du, Tao Han, and Song Guo from the Hong Kong University of Science and Technology, PFRP aims to bridge this gap by dynamically integrating global historical data to significantly improve forecasting accuracy. You can read the full research paper here: Predicting the Future by Retrieving the Past.
The Core Idea: Learning from the Entire Past
The central concept behind PFRP is that time series often contain highly similar patterns across different periods. For instance, electricity consumption patterns from a week in 2019 might closely resemble a week in 2018. Traditional models miss out on explicitly using these recurring patterns. PFRP addresses this by creating a “Global Memory Bank” (GMB).
How PFRP Works: A Two-Stage Process
The PFRP approach involves two main stages:
1. Constructing the Global Memory Bank (GMB):
- Predictive Contrastive Learning (PCL): To effectively store and retrieve patterns, PFRP first trains a special encoder using PCL. This learning method ensures that historical “lookback window” sequences that lead to similar future outcomes are represented closely in a feature space. This is a smart way to make sure the system retrieves truly relevant past events, not just superficially similar ones.
- K-medoids Clustering: To keep the GMB efficient and avoid redundancy, K-medoids clustering is applied to these learned features. This process selects a set of representative historical samples (medoids) that best capture the diverse patterns in the global history. These selected samples, consisting of their unique features and corresponding future sequences, are then stored in the GMB.
2. Predicting the Future by Retrieving the Past:
- Retrieval: During inference, when a new “lookback window” of data comes in, PFRP uses its encoded features to query the GMB. It quickly finds the ‘top-k’ most similar historical patterns stored in the memory bank.
- Confidence Gate: Not all retrieved patterns are equally reliable. A “confidence gate” adaptively adjusts the importance (weights) of these retrieved historical patterns. It assesses how well a retrieved historical future sequence aligns with the current lookback window, giving more weight to more coherent matches.
- Output Gate: The initial prediction from the retrieved patterns might have slight differences in scale or shift compared to the actual future. An “output gate” dynamically refines this “global prediction” by learning to apply appropriate scaling and shifting based on the current data.
- Dynamic Fusion: Finally, PFRP doesn’t just rely on the retrieved past. It intelligently combines this “global prediction” with a “local prediction” generated by any standard deep learning forecasting model (like a Transformer or MLP). A dynamic fusion mechanism weighs these two predictions, giving more importance to the global prediction when highly similar historical patterns are found, and more to the local model when the past offers less clear guidance. This makes PFRP model-agnostic, meaning it can enhance virtually any existing univariate forecasting model.
Impressive Results and Efficiency
Extensive experiments on seven real-world datasets, including Traffic, Electricity, and Weather, demonstrate PFRP’s effectiveness. It significantly boosts the average performance of advanced univariate forecasting models by 8.4%. The improvements are particularly notable in datasets with strong periodic patterns, where similar sequences frequently recur. PFRP also proves to be efficient, outperforming other retrieval-augmented generation (RAG) based forecasting methods in terms of both accuracy and inference speed, with only a minimal increase in model size and training time.
Also Read:
- DeepBooTS: A New Approach to Robust Time-Series Forecasting Against Changing Data Patterns
- Unveiling Forecast Changes: Counterfactual Explanations for Time Series with External Factors
Looking Ahead
While PFRP shows great promise for univariate time series forecasting, the authors acknowledge that extending it efficiently to multivariate time series (where multiple related variables are predicted simultaneously) is a key area for future research. Integrating additional information like timestamps to further refine pattern identification is also a promising direction.


