Source-linked AI summary

RATL: Learning from Retrieved Residuals for Robust Multivariate Time-Series Forecasting

Yuchen He, Yueyang Cang, Zhiyuan Ning, Ningyu Wang, Li Shi

arXiv:2609.03937v1cs.LGcs.AI

TL;DR

Long-horizon multivariate forecasters cannot explicitly retrieve relevant patterns beyond their fixed lookback, while reusing retrieved futures can mismatch scale or inject harmful corrections. RATL instead retrieves base-model-specific historical residuals and improves mean MSE by 9.57% in its 156-run main study.

  • Problem

    Fixed-lookback forecasters cannot explicitly inspect relevant historical patterns beyond the lookback, while raw future reuse can mismatch scale or inject inaccurate corrections.

  • Method

    RATL freezes a base forecaster, stores causally admissible historical residuals, and uses a block-variable router to combine retrieved corrections.

  • Results

    9.57% mean MSE improvement was achieved in RATL’s 156-run main study across 13 datasets and 52 settings.

  • Takeaways & Limitations

    Model-specific historical forecast errors can serve as reusable inference-time memory, with compatibility demonstrated across several evaluated forecasting backbones.

  • Takeaways & Limitations

    RATL’s transferable residual-pattern assumption is more likely to fail on Exchange, where regime changes and exogenous shocks can mismatch retrieved residuals.

Abstract

from arXiv · show

Retrieval-augmented generation (RAG) complements parametric models with retrieved external evidence. The same idea is attractive for continuous-output regression, but directly reusing retrieved target values is often not robust when samples differ in output level, numerical scale, or local dynamics. Moreover, conventional forecasting pipelines generally use residuals for model optimization and error diagnosis, but do not retain individual historical residual examples as memory that can be accessed at inference time.For multivariate time-series forecasting, we propose RATL, a plug-in residual-retrieval and feedback-correction method. RATL freezes a base forecaster to construct retrieval keys and turns its historical forecast residuals into a train-only memory specific to that base model. At inference time, RATL retrieves residual trajectories from similar historical contexts subject to causal availability constraints, then uses a set-aware router operating over forecast blocks and variables to select and combine these trajectories. Experiments show that historical residuals matched to the current context contain reusable forecasting information and that RATL improves frozen base forecasters in most experimental settings. Ablations further show that learned routing strengthens raw residual feedback, while validation-based correction-strength selection limits residual over-injection.On real-world benchmarks, we use iTransformer as the primary frozen base forecaster, compare against multiple strong forecasting baselines, and test transferability across backbones. The results show that RATL can further improve base-forecaster performance in most settings.Overall, RATL shifts the retrieved object from historical target values to base-model-specific historical forecast errors, providing a plug-in, residual-memory-based paradigm for learned feedback correction in continuous-output forecasting.

Introduction

RATL addresses limitations of raw future retrieval by storing and retrieving base-model-specific residuals for causal feedback correction. Across broad experiments, it improves frozen forecasters while gains depend on architecture, dataset, and retrieval-key choice.

  • Motivation: Parametric forecasters cannot explicitly inspect relevant historical patterns outside their fixed lookback window at inference time.
  • Motivation: Raw future reuse risks mismatched future levels or scales and negative transfer when the base prediction is already accurate.
  • Method: RATL stores base-model residuals in a train-only memory and retrieves temporally admissible residuals using the frozen forecaster’s per-variable hidden representations.
  • Results: RATL improves overall forecasting performance over the Direct baseline, while transfer gains vary with base-forecaster architecture, dataset, and retrieval-key choice.
  • Method: RATL uses J5, a set-aware block-variable residual router with oracle imitation and a no-correction candidate; similarity-weighted Direct is the non-parametric baseline.
  • Experiments: 156 runs across 13 datasets and 52 settings show that RATL improves mean MSE by 9.57% in the main study.Transfer studies cover frozen DLinear, PatchTST, TimesNet, and TimeMixer checkpoints.

Related Work

Related work spans efficient and structured multivariate forecasting, retrieval-augmented forecasting, and residual-based correction. Existing retrieval methods differ in both their retrieval objects and fusion mechanisms, while residual modeling includes nearest-neighbor and error-based corrections.

  • Multivariate forecasting: Multivariate forecasting advances include efficient attention, decomposition, frequency-aware modeling, two-dimensional temporal variation, multiscale mixing, and channel-independent modeling.Examples include Informer, Autoformer, FEDformer, TimesNet, TimeMixer, DLinear, and PatchTST.
  • Retrieval-augmented forecasting: Retrieval-augmented forecasting methods retrieve future segments, historical patches, or predictions and combine them with local models using learned representations, periods, confidence, or output gates.The cited methods are kNN-MTS, RAFT, and PFRP.
  • Retrieval-augmented forecasting: RATL is compared with representative retrieval-augmented forecasting methods according to their retrieval objects and fusion mechanisms.Table 1 organizes the comparison along these two dimensions.
  • Residual modeling and negative transfer: Residual modeling appears in hybrid statistical–neural models, boosting, nearest-neighbor residual regression, and corrections of ARIMA predictions using errors from related historical periods.Examples include ResMem and similarity-based macroeconomic forecasting.

Method · Problem Setup and Frozen Base · Train-Only Residual Memory

RATL freezes a conventionally trained base forecaster and learns a residual correction using a train-only memory keyed by frozen representations. It retrieves base-specific historical errors rather than target values, preserving the base model’s responsibility for forecastable structure while estimating systematic misses.

  • Problem Setup and Frozen Base: The setup uses a lookback window X_t ∈ R^(L×D), its future Y_t ∈ R^(H×D), and a base forecaster f_θ at forecast origin t.
  • Problem Setup and Frozen Base: RATL first trains f_θ conventionally, freezes it, and learns only to estimate a correction bR_t.
  • Problem Setup and Frozen Base: The separated interface can wrap different forecasters, while each memory value remains interpretable as a historical error of the deployed base.
  • Train-Only Residual Memory: For each training window i, RATL stores a memory entry derived from that window.
  • Train-Only Residual Memory: Keys use frozen base representations, with iTransformer variable-token representations in the main configuration and specified backbone-specific alternatives in transfer protocols.The residual target becomes available at a_i = t_i + H; test results do not select keys, and search uses squared Euclidean similarity independently.
  • Train-Only Residual Memory: RATL retains residuals R_i instead of retrieved futures Y_i, leaving the base responsible for level, trend, and cross-variable structure.Because Y_i = f_θ(X_i) + R_i, residual memory estimates systematic errors that the same model missed in related contexts and is base-specific.

Per-Variable Top-K Search with Retrieval Keys

RATL retrieves residual trajectories independently for each variable using query keys from the frozen mapping, while enforcing temporal availability. It selects the top-K admissible historical entries by key similarity without using the current future, then combines their residuals through score-based or learned weighting.

  • Query-key construction: Queries use the same frozen mapping as memory construction, and retrieval is performed independently for each variable over the full lookback window.For variable d, the query representation is k_t,d = ϕ_θ(X_t) over the complete input window.
  • Causal candidate filtering: Temporal availability excludes candidates whose future information is unavailable, inserting an additional gap of length H after each candidate target.This prevents retrieval entries from being too close to the current forecast origin or from leaking unavailable future information.
  • Top-K search: For each variable, RATL selects the K highest-scoring entries among temporally admissible candidates using per-variable mean squared Euclidean distance between retrieval keys.In the frozen main protocol, keys receive no additional normalization; smaller distances produce larger retrieval scores.
  • Leakage-free retrieval: Retrieval uses only the current query key, historical memory keys, and temporal availability, excluding the current ground-truth future and true residual.After search, the method retrieves the full residual trajectories associated with the selected historical windows.
  • Residual combination: Direct combines retrieved residual trajectories according to retrieval scores, whereas J5 learns candidate weights separately for each forecast block and variable.Both methods operate on the same top-K candidate set.

Direct Similarity-Weighted Baseline

The Direct corrector is a parameter-free, similarity-weighted baseline that averages retrieved residual trajectories to provide a non-parametric control for learned routing.

  • Method: Direct converts retrieval scores s_t,i,d into weights for combining retrieved residual trajectories.The method averages the corresponding residual trajectories after weighting them by context similarity.
  • Purpose: Direct tests whether learned routing improves over simply averaging the same retrieved candidates and residual values by context similarity.It uses the same retrieved candidates and residual values as the learned method, but combines them without learned routing.
  • Configuration: Direct is parameter-free after base training, uses raw correction with γ = 1, and is not separately tuned for correction strength.This design makes Direct a non-parametric control for RATL.

Block-Residual Candidates and the Soft-Oracle Teacher

RATL organizes retrieved residual trajectories into temporal blocks and compares each candidate with the current true residual at every block–variable position. A soft Oracle teacher then preserves multiple similarly effective corrections during training, while remaining unavailable at validation and test time.

  • Block-Residual Candidates: The retrieval module returns K historical residual trajectories, which RATL evaluates over consecutive forecast blocks of length Bh = 8.Whole-trajectory weighting is too coarse, whereas pointwise selection would create H × D fine-grained decisions and be more vulnerable to local noise.
  • Block-Residual Candidates: At each block–variable position, RATL compares every retrieved residual Ri with the frozen forecaster’s current true residual Rt.Candidate quality is assessed according to how closely each historical residual matches the correction needed by the current query.
  • Block-Residual Candidates: Candidate i = 0 is the zero residual, representing no correction alongside the K retrieved residual candidates.This explicitly includes the option to leave the base forecast uncorrected.
  • The Soft-Oracle Teacher: The soft Oracle teacher assigns probability across candidates according to their block–variable residual errors, retaining several similarly effective candidates instead of only the minimum-error one.Its temperature τo controls smoothness and reduces supervision instability from small candidate-error fluctuations.
  • The Soft-Oracle Teacher: The Oracle is used only to construct training supervision because the true future is unavailable at validation and test time.Therefore, q∗ is neither computed nor used after training.

RATL Set-Aware Residual Router

RATL’s set-aware router predicts block–variable residual-candidate weights from inference-time information rather than assuming context similarity directly determines residual utility. It uses candidate tokens, set attention, and an abstention option to form the final correction.

  • Router design: J5 predicts the block–variable Oracle distribution without observing the current true residual, using information available at inference time.For each candidate, temporal block, and variable, the router uses the current query, candidate residual block, Direct residual reference, and positional features.
  • Router design: Candidate tokens combine query, residual, positional, and optional residual-feature channels before block–variable scoring.Supported channels include neighbor-window, window-difference, residual-mean, and Direct-residual-energy features, depending on the feature-ablation mask.
  • Set-aware correction: A zero-residual candidate is appended, and set attention exchanges information among the K + 1 candidates before scoring block–variable weights.The zero candidate enables abstention from residual correction.
  • Set-aware correction: The correction uses a learned global residual scale initialized to one, while candidate-order randomization during training enforces set rather than rank semantics.The weight α_t,0,b,d assigns mass to the zero-correction candidate when the router abstains.

Oracle Imitation and Prediction Loss

J5 combines prediction and Oracle-imitation objectives to improve the residual-corrected forecast while learning which historical residuals are useful for each block and variable. In the frozen main configuration, the effective teacher-loss coefficient is λteach = 0.4.

  • Objectives: J5 jointly minimizes final-prediction MSE and an Oracle-imitation loss over router weights αt,b,d.Prediction MSE constrains whether combined residuals improve the base forecast, while Oracle imitation supervises router selection.
  • Oracle Imitation: The Oracle-imitation objective requires router candidate weights αt,b,d to approximate the block–variable teacher distribution q∗.This provides fine-grained supervision for selecting useful historical residuals by forecast block and variable.
  • Loss Weights: λteach = 2.0 × 0.2 = 0.4 in the frozen main configuration, with prediction-loss weight 1.The global teacher-loss scale is 2.0 and the local block–variable Oracle cross-entropy weight is 0.2.

Correction-Strength Selection and Sealed Evaluation

RATL treats correction strength γ as a forecasting hyperparameter because learned residual corrections can over-inject residuals. It evaluates the test set only at the validation-selected γ∗, while Direct remains fixed at γ = 1 and is not separately tuned.

  • Correction-Strength Selection: RATL treats γ as a scalar forecasting hyperparameter because learned correction can over-inject residuals.The supplied passage indicates that γ is selected by validation, but does not include the full selection procedure.
  • Sealed Evaluation: The test set is evaluated only at the selected γ∗, with ties resolved toward the smaller γ.This enforces sealed evaluation after correction-strength selection.
  • Method Distinction: Direct uses a fixed parameter-free similarity-weighted correction at γ = 1 and is not separately γ-tuned.RATL denotes J5 with validation-selected γ, whereas Direct is not subjected to separate γ tuning.
  • Interpretation: Validation-based γ selection is ordinary hyperparameter selection, not predictive-uncertainty calibration or a safety guarantee.The procedure should therefore not be interpreted as uncertainty calibration or as a safety guarantee.

Experiments

Across 52 dataset–horizon cells, RATL improves the frozen iTransformer base forecaster on average, with learned routing and validation-selected correction strength contributing to robustness. Transfer experiments show positive macro-average gains across evaluated backbones, while performance varies by architecture, dataset, retrieval key, and distributional conditions.

  • Main results: Across all 52 cells, RATL reduces MSE by 9.57% and MAE by 6.21% on average, with 48 wins, 2 ties, and 2 losses.PEMS shows the largest dataset-average gains at 20.56–24.41%, while Exchange-336 and Exchange-720 are the two losses.
  • Ablations: J5 improves the raw aggregate gain over Direct by 1.07 percentage points at fixed correction scale γ = 1, supporting learned candidate interaction.Raw Direct is strong on ECL, Traffic, Solar, and PEMS but degrades results on ETTh2, ETTm2, Exchange, and Weather.
  • Ablations: Validation-selected γ is often below one on ETT and Weather, while high-gain Traffic and PEMS cells frequently retain γ = 1.Because γ ∈[0, 1], validation can reject the correction and revert RATL to the original base forecaster.
  • Transfer across backbones: RATL’s macro-average gain is positive for every evaluated backbone, but transfer varies with base architecture, dataset, and predefined retrieval key, and individual cells can degrade.TimesNet and TimeMixer establish compatibility for evaluated backbone–dataset–key combinations but do not compare retrieval keys or establish hidden-key superiority.
  • Robustness analysis: Positive MSE-gain intervals occur for ETTm1-336, Traffic-336, and PEMS08-24, whereas Exchange-336 and Exchange-720 have strictly negative intervals.The reported intervals are [3.95, 4.31]%, [4.89, 5.11]%, and [15.03, 16.02]%, respectively; increasing K helps ETTm1 but does not repair Exchange-720.
  • Limitations: Exchange is weaker because its relatively small financial series is shaped by exogenous shocks, regime changes, and weak stable periodicity, limiting residual-transfer reliability.RATL addresses such settings with local zero-residual candidates and global γ = 0 fallback mechanisms.

Conclusion and Future Work

RATL uses causally retrieved, base-model-specific residuals with block–variable routing, and the evaluated results indicate compatibility across several forecasting architectures. Its benefits depend on context and retrieval design, motivating safer correction, cheaper memory, and broader validation.

  • Conclusion: RATL causally retrieves historical residuals from a frozen forecaster and combines candidates through a block–variable router.The iTransformer experiment treats model-specific historical errors as reusable inference-time memory.
  • Conclusion: Transfer panels with DLinear, PatchTST, TimesNet, and TimeMixer support compatibility across multiple evaluated architectures.
  • Limitations: RATL’s gains vary with the base forecaster, dataset, and retrieval-key definition, while residual transfer can fail under limited data, weak periodicity, or frequent exogenous changes.The zero-residual candidate and γ = 0 fallback may mitigate negative transfer but provide no non-degradation or safety guarantee.
  • Limitations: Exact retrieval and long multivariate residual memories increase computational and storage costs as training windows, variables, and forecast length grow.Semantic representations of exogenous factors could be incorporated into retrieval-key vectors.
  • Future work: Future work targets uncertainty-aware abstention, sample-adaptive correction strength, validation-safe retrieval-key selection, cheaper memory, and broader cross-regime evaluation.Proposed efficiency methods include approximate nearest-neighbor search, residual quantization, prototype memories, and dynamic memory compression.
Loading 2609.03937v1…