TS-Edit: A Model Editing Framework for Adversarial Defense in Time-Series Foundation Models

Vaibhav Achar, Jathin Shettigar Nagabhushan, Abhishek Bhardwaj, Saptarshi SenguptaarXiv 2026

TL;DR

Time-series foundation models are increasingly trusted to forecast critical systems like power grids and traffic, yet a tiny, targeted adversarial perturbation to their input can send their predictions off the rails. TS-Edit borrows a "localize-then-edit" trick from language model interpretability to find the exact feed-forward layer responsible for an attack's damage and surgically repair it with a single rank-one weight update—cutting forecast error by up to 38.5× while leaving clean-input behavior virtually untouched.

What Problem Does This Paper Address?

Time-series foundation models (TSFMs) like TimesFM, Chronos, and Moirai follow the "pretrain once, forecast anywhere" paradigm, delivering strong zero-shot predictions across unseen domains. However, in high-stakes settings—think power grids, traffic networks, or financial markets—adversarial or miscalibrated sensor readings can distort an entire forecast horizon.

Existing defenses against adversarial attacks (like adversarial training or randomized smoothing) act globally: they either retrain the whole model or transform every incoming input. None of them ask where inside the model a corrupted forecast is actually mediated, or whether that specific internal computation can be repaired locally without touching the rest of the pretrained weights.

Methods

TS-Edit adapts mechanistic interpretability tools originally built for large language models—specifically causal tracing, ROME (Rank-One Model Editing), Sequential ROME, and MEMIT—to continuous numeric forecasting on TimesFM 2.5 (a 200M-parameter decoder-only transformer with 20 blocks).

TS-Edit pipeline

Because time-series inputs don't have discrete "subject tokens" like language does, the authors redefine the localize-then-edit pipeline for continuous context windows:

  1. Empirical Subject Selection & Attack: A 1024-step context window is split into four equal segments. The authors apply masked white-box attacks (FGSM, BIM, and PGD) to each segment independently and select the segment whose corruption causes the largest forecast deviation (NRMSE) against the clean forecast.
  2. Causal Localization: Using causal tracing, clean activations (residual, attention, and MLP) are cached and patched into the corrupted pass. By measuring how much each layer restores the clean forecast, TS-Edit identifies the most responsible MLP layer ($\ell^\star$) for ROME, or the top-$m$ MLP layers ($\mathcal{B}$) for MEMIT.
  3. Surgical Repair:
  4. ROME (Standard): Applies a single closed-form rank-one update ($W_{\ell^\star} \leftarrow W_{\ell^\star} + \mathbf{v}\mathbf{u}^\top$) to the localized feed-forward weight, targeting the clean forecast with an NRMSE-based loss.
  5. SeqROME (Newer iterative variant): Applies eight sequential rank-one edits at the same layer $\ell^\star$, recomputing $\mathbf{u}$ and $\mathbf{v}$ after each step.
  6. MEMIT (Standard): Distributes the weight update across the top-3 MLP-restoration layers, evaluated after 1 and 5 iterations.

Datasets

The framework is evaluated on three standard time-series benchmarks (no new benchmarks are introduced), using a 1024-step context window and a 128-step forecast horizon:

  • UCI ElectricityLoadDiagrams: Evaluated on focal channel MT_253.
  • ETTh1: Evaluated on focal channel OT.
  • LSTNet Traffic: Evaluated on a high-variance Traffic sensor.

Key Insights and Ideas

  • Key-value memory extends beyond language: Feed-forward layers in a time-series transformer can be interpreted and edited as localized key-value memories, just like in language models.
  • Temporal position matters: Attacking different quarters of the context window produces wildly different forecast errors (e.g., on Electricity MT_253, attacking segment Q2 yields an NRMSE of 1.0913, while Q0 yields just 0.0926), motivating empirical subject selection.
  • Damage localizes to a narrow band: Causal tracing reveals that adversarial damage isn't smeared uniformly across the network; on Electricity, restoration peaks sharply at MLP layer 4 (with layers $\{2, 4, 17\}$ forming the top-3 band).
Figure 2: Layer-wise causal-trace restoration at ε = 0.2.
  • Cross-attack transfer works: A layer localized using PGD can be reused without re-tracing to repair BIM and FGSM attacks.
  • Restoration vs. specificity trade-off: Iterative editing generally improves forecast restoration, but no single editor dominates every dataset and attack—specificity (how little the edit disturbs clean inputs) varies by setting.

Key Results

On UCI Electricity (MT_253) under PGD ($\varepsilon = 0.2$):

  • ROME at layer 4 slashes corrupted NRMSE from 0.8886 down to 0.0231 (a 38.5× reduction, $R_{\text{edit}} = 0.9738$), with clean-input specificity drift of just $2.57 \times 10^{-4}$.
  • SeqROME pushes NRMSE down further to 0.0168 ($R_{\text{edit}} = 0.9809$).
  • MEMIT achieves the lowest error (0.0145, $R_{\text{edit}} = 0.9834$) and lowest specificity drift ($5.25 \times 10^{-5}$) under PGD.
Forecast comparison after ROME repair

Across attacks and datasets:

  • Cross-attack transfer: Reusing the PGD-localized layer on Electricity repairs BIM by 12.2× (0.3367 $\rightarrow$ 0.0275) and FGSM by 1.2× (0.0189 $\rightarrow$ 0.0158).
  • Consistency: SeqROME delivers the most consistent error reduction across all three attack families and datasets. While MEMIT excels under PGD on Electricity and Traffic (0.1085 NRMSE), it struggles on ETTh1 (0.0643 NRMSE, $R_{\text{edit}} = 0.2201$) compared to ROME (0.0300) and SeqROME (0.0242).

Limitations and Future Work

The authors note that no single editor is universally optimal: while SeqROME is the most consistent, MEMIT's performance and specificity are sensitive to the dataset (as seen on ETTh1). Additionally, the current evaluation focuses on univariate series, white-box attacks on a single localized segment, and a single model architecture (TimesFM 2.5). Evaluating successful restoration alongside non-disruptive, local specificity separately—and extending this localize-then-edit paradigm to broader TSFMs and threat models—remains an open direction.

Summary updated

BibTeX
@misc{achar2026ts,
  author = {Vaibhav Achar and Jathin Shettigar Nagabhushan and Abhishek Bhardwaj and Saptarshi Sengupta},
  title = {{TS-Edit: A Model Editing Framework for Adversarial Defense in Time-Series Foundation Models}},
  year = {2026},
  eprint = {2612.04835},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.04835},
}
Figure