TS-Inverse: A Gradient Inversion Attack Tailored for Federated Time Series Forecasting Models

Caspar Meijer, Jiyue Huang, Shreshtha Sharma, Elena Lazovik, Lydia Y. Chen

Abstract

Federated Learning (FL) is increasingly adopted for time series forecasting (TSF) in privacy-sensitive sectors like energy management. While FL is designed to protect raw data by sharing only model updates, it remains vulnerable to Gradient Inversion Attacks (GIAs). Existing GIAs, primarily optimized for image classification, struggle with the unique characteristics of time series data. This paper introduces TS-Inverse, the first framework specifically designed to reconstruct time series data from federated gradients. By utilizing a learned inversion model for quantile bounding and time-series-specific regularizations, TS-Inverse achieves a 2x–10x improvement in reconstruction accuracy over traditional methods.

1. Introduction

In domains such as smart grid management, time series data (e.g., household power consumption) is subject to strict privacy regulations like GDPR. Federated Learning addresses this by allowing models to be trained locally on-device, with only gradient updates sent to a central server. However, an "honest-but-curious" server can potentially exploit these gradients to reconstruct the original training data.

Most research into Gradient Inversion Attacks (GIAs) has focused on the computer vision domain. Applying these techniques to time series forecasting presents three primary hurdles:

  1. Dual Reconstruction Requirements: Unlike classification, where only inputs are recovered, TSF attackers must reconstruct both the input observations and the target values, which often share the same data distribution.
  2. Incompatible Priors: Standard image-based regularizers, such as Total Variation (TV), assume spatial smoothness. Time series data is often volatile and noisy; applying TV-based smoothing actually degrades reconstruction quality.
  3. Architectural Complexity: TSF models frequently employ Temporal Convolutional Networks (TCNs) or Recurrent Neural Networks (GRUs) with many-to-one mappings, complicating the mathematical inversion process.

2. The TS-Inverse Framework

TS-Inverse addresses these challenges through a multi-pillared approach that incorporates statistical constraints and temporal domain knowledge.

2.1 Gradient Inversion Model ($f_{inv}$)

The framework utilizes an auxiliary model, $f_{inv}$, trained on publicly available data similar to the target distribution. Instead of predicting raw values directly, this model maps gradients to quantile bounds (e.g., the 10th and 90th percentiles). These bounds serve as statistical "soft constraints" during the optimization process, ensuring the reconstructed values remain within a realistic range for the specific dataset.

2.2 Time-Series-Specific Regularization

To replace ineffective image priors, TS-Inverse introduces two novel loss terms:

  • Periodicity Regularization: This term penalizes reconstructions that deviate from known seasonal or daily cycles (e.g., the 24-hour cycle of energy usage).
  • Trend Regularization: By incorporating a linear regression component within the optimization loop, the attack ensures the reconstructed sequence follows the correct global direction (upward or downward trend).

2.3 L1-Norm Gradient Matching

While image-based attacks often use Cosine Similarity to match gradient directions, TS-Inverse demonstrates that matching the magnitude of gradients via the L1-norm is critical for regression tasks. In TSF, the scale of the gradient is directly tied to the scale of the underlying data values.

2.4 Analytical One-Shot Inversion

For scenarios where a client trains on a single batch ($B=1$), the authors derived a mathematical shortcut. By analyzing the bias gradients of the final model layer, the target values can be reconstructed with near-perfect accuracy in a single step, bypassing the iterative optimization process for the target sequence.

3. Experimental Evaluation

3.1 Datasets and Setup

The attack was evaluated across four diverse datasets: Electricity 370, London Smartmeter, KDDCup 2018 (air quality), and a Proprietary energy dataset. These were tested against common TSF architectures, including CNNs, TCNs, and GRUs.

3.2 Key Results

  • Superior Accuracy: TS-Inverse outperformed baseline attacks (such as DLG and InvG) by 2x to 10x in terms of Symmetrical Mean Absolute Percentage Error (sMAPE).
  • Architecture Vulnerability: The study revealed that GRUs are significantly more resilient to inversion than CNNs or TCNs. The many-to-one mapping in recurrent gates creates an information bottleneck that makes it harder to map gradients back to specific input timesteps.
  • The Failure of Image Priors: Experiments confirmed that Total Variation (TV) regularization—a staple in image GIAs—consistently increased error in time series reconstruction by smoothing out essential signal volatility.
  • Defense Resilience: TS-Inverse remained effective against common FL defenses like gradient pruning and sign compression. However, the addition of significant Gaussian noise (Differential Privacy) proved to be a partially effective mitigation strategy.

4. Discussion and Limitations

While TS-Inverse represents a significant leap in attacking TSF models, several challenges remain. The attack's efficacy decreases as the local batch size increases (e.g., $B=64$ or $128$), as the gradients become an average of many different data points. Furthermore, the reliance on auxiliary data for the $f_{inv}$ model means the attacker must have some prior knowledge of the data distribution.

5. Conclusion

TS-Inverse demonstrates that federated time series forecasting models are more vulnerable than previously thought. By moving away from image-centric assumptions and embracing time-series-specific priors—such as periodicity, trend, and quantile constraints—attackers can achieve high-fidelity data recovery. This work highlights the urgent need for the development of specialized defense mechanisms tailored for temporal data in federated environments.

Summary updated

Abstract

Federated learning (FL) for time series forecasting (TSF) enables clients with privacy-sensitive time series (TS) data to collaboratively learn accurate forecasting models, for example, in energy load prediction. Unfortunately, privacy risks in FL persist, as servers can potentially reconstruct clients' training data through gradient inversion attacks (GIA). Although GIA is demonstrated for image classification tasks, little is known about time series regression tasks. In this paper, we first conduct an extensive empirical study on inverting TS data across 4 TSF models and 4 datasets, identifying the unique challenges of reconstructing both observations and targets of TS data. We then propose TS-Inverse, a novel GIA that improves the inversion of TS data by (i) learning a gradient inversion model that outputs quantile predictions, (ii) a unique loss function that incorporates periodicity and trend regularization, and (iii) regularization according to the quantile predictions. Our evaluations demonstrate a remarkable performance of TS-Inverse, achieving at least a 2x-10x improvement in terms of the sMAPE metric over existing GIA methods on TS data. Code repository: https://github.com/Capsar/ts-inverse
BibTeX
@inproceedings{meijer2025ts,
  author = {Caspar Meijer and Jiyue Huang and Shreshtha Sharma and Elena Lazovik and Lydia Y. Chen},
  title = {{TS-Inverse: A Gradient Inversion Attack Tailored for Federated Time Series Forecasting Models}},
  booktitle = {SaTML},
  year = {2025},
  url = {https://openreview.net/forum?id=TxvWAuvLwt},
}
Figure