RobustTSF: Towards Theory and Design of Robust Time Series Forecasting with Anomalies

Hao Cheng, Qingsong Wen, Yang Liu, Liang Sun

In the ideal world of machine learning research, training data is pristine. In the real world—where sensors fail, networks drop, and "fat-finger" errors occur—data is often riddled with anomalies. For time series forecasting, this is a major headache: if you train a model on contaminated data, it learns the noise instead of the signal.

At ICLR 2024, researchers introduced RobustTSF, a framework that bridges the gap between "Learning with Noisy Labels" (a hot topic in image classification) and time series forecasting. It provides both the mathematical theory and a practical algorithm to build forecasting models that don't break when the data gets ugly.

TL;DR

RobustTSF is a theoretically grounded framework that makes time series models resilient to anomalies in both inputs and targets. By combining a robust loss function (Mean Absolute Error) with a smart sample selection strategy that prioritizes data points closest to the forecast target, it consistently outperforms traditional imputation and retraining pipelines.

What Problem Does This Paper Address?

Most time series forecasting (TSF) techniques assume training data is clean. When anomalies exist, the standard industry fix is a detection-imputation-retraining pipeline:

  1. Train a model on messy data.
  2. Use it to detect outliers.
  3. Replace outliers with "imputed" values.
  4. Retrain the model from scratch.

This is slow, computationally expensive, and sensitive to how you define an "outlier." Furthermore, while the field of Learning with Noisy Labels (LNL) has matured for classification tasks (like mislabeled images), those theories don't translate directly to regression tasks like time series, where "noise" can appear in both the historical features ($X$) and the future target ($Y$).

Methods

The authors first categorize anomalies into three statistical types: Constant (a fixed offset), Missing (zeroed out or fixed value), and Gaussian (random noise). They then tackle the problem from two angles:

1. Loss Robustness (Handling anomalies in $Y$)

The paper proves that the Mean Absolute Error (MAE) loss is inherently robust to Constant and Missing anomalies in the target variable, whereas the standard Mean Squared Error (MSE) is not. This mirrors findings in classification where certain losses are "noise-robust."

2. Sample Robustness (Handling anomalies in $X$)

This is the paper's most intuitive "aha" moment. Through simulations, the authors found that anomaly position matters. An outlier at the beginning of an input window has almost no impact on the forecast. However, an anomaly right before the target time step (at the "back" of the window) significantly degrades performance.

Examples of Gaussian anomalies injected at different positions (front, middle, back) of a time series window.
Performance impact based on anomaly position. Anomalies at the 'back' degrade performance significantly more than those at the 'front'.

The RobustTSF Algorithm

Instead of a complex retraining pipeline, RobustTSF uses a streamlined approach:

  • Trend Filtering: It uses an $L_1$ trend filter to estimate the "true" underlying signal of the series without needing a pre-trained neural network.
  • Weighted Anomaly Scoring: It calculates an anomaly score for each training sample. Crucially, it uses a non-decreasing weighting function (like a Dirac or Exponential function) to give more weight to anomalies that occur near the end of the input window.
  • Selective Training: It only trains the model on "informative" samples—those where the weighted anomaly score is below a certain threshold.
  • Robust Objective: It uses MAE as the core loss function to handle any remaining noise in the targets.

Datasets

The authors evaluated RobustTSF across a wide range of benchmarks:

  • Standard Benchmarks: Electricity, Traffic, and the ETT (Electricity Transformer Temperature) datasets (h1, h2, m1).
  • Real-World Anomalies: The NAB (Numenta Anomaly Benchmark) cloud dataset and the M4 forecasting dataset.
  • Synthetic Contamination: They manually injected Constant, Missing, and Gaussian anomalies at various rates (up to 30%) to test the limits of the theory.

Key Insights and Ideas

  • The Proximity Principle: In time series, the most recent data is the most informative for the future. Consequently, an anomaly in recent data is the most damaging. RobustTSF is the first to explicitly bake this "positional sensitivity" into a sample selection algorithm.
  • MAE > MSE for Robustness: While MSE is the "default" for regression, its quadratic penalty makes it hyper-sensitive to outliers. MAE’s linear penalty allows the model to "ignore" large spikes during training.
  • Efficiency is a Feature: Because RobustTSF doesn't require a pre-trained model for detection or an imputation step, it is significantly faster than traditional pipelines—often 2-3x faster than online imputation methods.

Key Results

  • Superior Accuracy: Across almost all anomaly types and datasets, RobustTSF achieved the lowest MAE/MSE on clean test sets.
  • Stability: The authors measured $\Delta$ (the difference between the "best" and "last" epoch performance). RobustTSF showed remarkably low $\Delta$, meaning it doesn't "overfit" to the noise even if trained for many epochs.
  • Generalization: The method worked well not just with LSTMs, but also with modern architectures like Transformers and TCNs (Temporal Convolutional Networks).
  • Real-World Performance: On the NAB dataset (real-world cloud sensor data), RobustTSF achieved an MAE of 0.87, significantly beating Vanilla MAE (1.28) and even specialized imputation methods (1.14).

Limitations and Future Work

  • Point-wise vs. Sequence-wise: The theoretical proofs focus on point-wise anomalies (single spikes). While the algorithm works empirically on subsequence anomalies (e.g., a sensor being stuck for an hour), the statistical theory for "sequence-wise" robustness is still an open challenge.
  • Small Data Gaps: The statistical proofs rely on having a sufficient amount of data. In very low-data regimes, the gap between theoretical robustness and empirical performance might widen.
  • Complex Distributions: While the paper tests heavy-tailed distributions like Student-t, more complex, non-stationary anomaly patterns (like "concept drift" disguised as anomalies) remain a frontier for future research.

Paper Citation: Hao Cheng, Qingsong Wen, Yang Liu, and Liang Sun. "RobustTSF: Towards Theory and Design of Robust Time Series Forecasting with Anomalies." International Conference on Learning Representations (ICLR), 2024. Code available on GitHub.

Summary updated

BibTeX
@inproceedings{cheng2024robusttsf,
  author = {Hao Cheng and Qingsong Wen and Yang Liu and Liang Sun},
  title = {{RobustTSF: Towards Theory and Design of Robust Time Series Forecasting with Anomalies}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=ltZ9ianMth},
}
Figure