TS-Edit: A model editing framework for adversarial defense of time series foundation modelsTS-Edit: A Model Editing Framework for Adversarial Defense in Time-Series Foundation Models
The authors apply causal tracing and model editing to TimesFM 2.5 adversarial repair; on Electricity, a single ROME after PGD reduces NRMSE from 0.8886 to 0.0231.
The attacker applies masked white-box FGSM, BIM, or PGD attacks to TimesFM 2.5, perturbing an empirically selected context segment in the preprocessed input space with an ℓ∞ budget ε, leaving outside the segment unchanged; the attack loss is computed relative to the true 128-step future, the goal is to corrupt the forecast, and the defense then locally edits the feedforward weights.
- After a time series foundation model is subjected to a local adversarial perturbation, the entire forecast may deviate. The authors focus on whether the feedforward layer carrying this corruption can be localized and only local weights edited to restore the forecast while preserving clean-input behavior.
- TS-Edit first applies masked PGD segment by segment to select the subject segment, then uses causal tracing to localize the MLP layer, and performs ROME, SeqROME, or MEMIT editing with the clean forecast as the target; it also tests reusing the localization layer across attacks.
- Three attacks and editors are compared on Electricity, ETTh1, and Traffic. Under PGD on Electricity, ROME reduces NRMSE from 0.8886 to 0.0231; on ETTh1, MEMIT's restoration is weaker, and the relative merits of the editors vary with dataset and attack.
- The experiments involve only TimesFM 2.5, the focal series of three datasets, and seven channels per dataset; the main results are PGD with ten seeds, while FGSM and BIM are deterministic single values. The paper does not specifically discuss limitations, nor does it report editing time or adaptive attacks.
- Evaluated models
- TimesFM 2.5
- Benchmarks
- UCI ElectricityLoadDiagramsETTh1Traffic
- Metrics
- NRMSEMAEWQLReditspecificitycausal restoration fraction
TS-Edit transfers causal tracing and language model editing methods such as ROME and MEMIT to the time series foundation model TimesFM 2.5, repairing predictions damaged by attacks. On UCI Electricity, after a PGD attack, a single ROME edit reduces the NRMSE of the damaged predictions by 38.5 times, with clean-input drift only on the order of 10^-4. Reusing the layers located by PGD to repair BIM and FGSM achieves 12.2 times and 1.2 times respectively.
Related events and news
1 events · 0 news mentions
- This event's paper
TS-Edit用模型编辑为时序基础模型防御对抗攻击
Paper analysis
What problem does this paper attempt to solve?
The study investigates whether the forecast corruption in TimesFM 2.5 caused by adversarial context perturbations can be localized and locally repaired.
The core question is: after a time series foundation model is subjected to a local adversarial perturbation, can the internal location carrying the forecast corruption be found, and the clean forecast restored through local weight editing.
- Application background: the authors use power grids, traffic, and finance as scenarios, arguing that adversarial or miscalibrated sensor readings may distort the entire forecast horizon and subsequent decisions; the abstract also mentions backdoor injection risk, but the experiments use FGSM, BIM, and PGD.
- Shortcomings of existing defenses: the authors state that adversarial training requires retraining, randomized smoothing transforms every input, and parameter-efficient fine-tuning learns updates via gradients; none of these methods localizes where a given corrupted forecast is mediated, nor answers whether that location can be locally repaired.
- Core observation and hypothesis: drawing on the key-value memory interpretation of feedforward layers, the authors hypothesize that causal tracing and localize-then-edit from language models can transfer to numerical forecasting; this requires redefining the subject, target, and loss for continuous time series.
- Proposed approach: TS-Edit combines empirical subject segment selection, causal localization, and ROME, Sequential ROME, and MEMIT editing on TimesFM 2.5, and evaluates restoration and specificity on UCI Electricity, ETTh1, and Traffic.
- Threat model:
- Goal: make the 128-step forecast deviate from the clean forecast; the attack loss is computed relative to the true future.
- Knowledge: masked white-box attack, computing gradients through the differentiable decoder.
- Capability: perturb only the selected context segment, constrained by an ℓ∞ budget ε within the preprocessed input space, leaving outside the segment unchanged.
- Victim system: the 200M-parameter TimesFM 2.5 univariate forecasting pipeline; the defender subsequently modifies the localized feedforward weights.
What related research exists?
The work spans time-series foundation models, adversarial robustness, and language model editing; the authors position it as local repair of numerical predictions.
Time Series Forecasting and Foundation Models
- Informer, PatchTST, and linear baselines: the paper treats these as the lineage of deep forecasting methods; subsequently TimesFM, Chronos, Moirai, and MOMENT achieve zero-shot forecasting in unseen domains through large-scale pretraining.
- UniTS, Timer-XL, Time-MoE: represent the multi-task, long-context, and mixture-of-experts directions; Liang et al. (2024) survey this field. The authors state that this line mainly optimizes accuracy and transfer, and less often studies how a single forecast is internally produced and how it behaves under attack.
Time Series Adversarial Attacks and Defenses
- FGSM, BIM, PGD, and C&W: gradient attacks originating from image classification, which the paper uses to illustrate their transferability to sequence inputs; Fawaz et al. (2019) and Karim et al. (2021) study time series classification attacks.
- Dang-Nhu et al. (2020) and backdoor research: the former attacks probabilistic autoregressive forecasting models, while BadNets and Jiang et al. (2023) concern backdoors; the authors state that forecasting attacks and backdoor threats are relatively scarce.
- Global defenses: adversarial training and randomized smoothing are the standard defenses discussed in the paper. The authors distinguish their method as localizing and undoing a single local corruption, with the remaining model parameters kept in their pretrained state.
Model Editing and Interpretability
- ROME and MEMIT: the feedforward-layer key-value memory interpretation of Geva et al. (2021) underpins this type of editing; ROME localizes and rewrites factual associations, and MEMIT distributes updates across multiple layers.
- MEND, WISE, and AlphaEdit: represent hypernetwork editing, lifelong stability, and null-space-constrained editing, respectively; Zhang et al. (2024) survey knowledge editing.
- Localization tools: include causal mediation, activation patching, transformer circuits, and sparse-autoencoder features. The authors state that this literature almost entirely targets language models and knowledge editing.
Experimental Controls and Data: the paper does not implement adversarial training or randomized smoothing baselines; the comparison targets are the Attacked unrepaired forecast and the three editors ROME, SeqROME, and MEMIT. The data are UCI ElectricityLoadDiagrams, ETTh1, and Traffic. The authors position this paper as adapting localize-then-edit as an adversarial defense for numerical forecasters, making closed-form updates applicable on continuous context.
How does the paper address this problem?
TS-Edit sequentially selects the damaged context segment, causally localizes the MLP layer, and then performs local weight editing with the clean prediction as the target.
The overall approach is the localize-then-edit pipeline of TS-Edit: first determine the context segment most sensitive to the forecast, then localize the repair layer among the residual, attention, and MLP sites, and finally restore the clean forecast with ROME, SeqROME, or MEMIT.
Model, Input, and Subject Segment Selection
- Uses the 200M-parameter TimesFM 2.5: 20 decoder-only blocks, dmodel=1280, dff about 5120; each feedforward weight has shape (5120,1280). The 1024-step context forms 32 non-overlapping patches, forecasting 128 steps.
- The context is divided evenly into four segments, masked PGD is applied to each, and the segment S⋆ with the largest deviation is selected by MSE relative to the true future. Electricity focal channel MT_253 selects Q2 at ε=0.2 (Table 1).
- The focal series are Electricity's MT_253, ETTh1's OT, and a high-variance Traffic sensor; preprocessing and channel filtering are in Appendix A.3.
Adversarial Corruption and Causal Localization
- FGSM, BIM, and PGD all perturb only within the subject segment, using an ℓ∞ budget in the preprocessed space; the attack loss is the MSE between the forecast and the true 128-step future. The authors note that if the clean forecast were used instead, the gradient at the clean initialization would be zero.
- During tracing, clean residual, attention, and MLP activations are cached and patched layer by layer and site by site into the corrupted forward pass; subject positions are selected by absolute MSE gradient mass.
- The core restoration quantity is Rv(ℓ,q)=(spatched,v(ℓ,q)−sadv,v)/(sclean,v−sadv,v), where 1 indicates restoration of the clean scalar summary, 0 indicates no effect, and less than 0 indicates worsening.
- Only variants whose clean-versus-corrupted summary difference reaches a threshold τ are retained, averaged over six clean-context noise variants, and the layer ℓ⋆ with the highest average MLP restoration is selected; MEMIT additionally takes the top-m layers.
Three Types of Local Editing
- ROME constructs a normalized key from the mean feedforward input at the corrupted subject positions and optimizes the output direction; the objective is LROME(δ)=MSE(ŷ(δ),ŷc)+β|δ|22/|z0|22, i.e., approaching the clean forecast while regularizing the edit direction.
- The above objective is optimized with Adam for 30 steps with learning rate 0.5 and norm clamp, then forms the rank-one update Wℓ⋆←Wℓ⋆+vuᵀ.
- SeqROME performs eight edits at the same ℓ⋆, recomputing u and v each time; MEMIT distributes updates across the top-m MLP restoration layers, using preserve covariance and a regularization term λ, and evaluates one and five iterations.
Attack Configuration and Repair Determination
- FGSM uses T=1, α=ε; BIM uses T=10, α=ε/8; PGD uses T=50, α=ε/20, with five random restarts and retaining the one with the highest final attack loss (Appendix A.1).
- The main experiment uses ε=0.2; Electricity is attacked after the log(1+x) transform, and ε is not rescaled by the context standard deviation.
- Editing is evaluated with Redit=1−NRMSE(edited forecast, clean forecast)/NRMSE(corrupted forecast, clean forecast): 1 is full restoration, 0 is no improvement, and negative values are worsening.
- Also reported are NRMSE and MAE relative to the clean forecast, WQL relative to the true future, and the specificity error of the model on clean inputs before and after editing; causal restoration scores are used only for localization.
What experiments did the paper conduct?
The experiments cover three datasets, three attacks, and three editors; PGD repair is relatively strong, but ETTh1 exposes the difference between restoration and locality.
Experimental Setup
- Model under test: TimesFM 2.5 only; Electricity localizes to L4, with MEMIT band {2,4,17}; the focal series of ETTh1 and Traffic both localize to block 0 (Figures 2, 6, 7).
- Data and channels: UCI Electricity, ETTh1, Traffic; beyond the focal series, single-run ROME results for seven additional channels per dataset are reported (Tables 4–6).
- Attacks and controls: masked white-box PGD, FGSM, BIM; the control is the Attacked unrepaired forecast, and the editors are ROME, eight-run SeqROME, and iterative MEMIT.
- Metrics: NRMSE and MAE relative to the clean forecast, WQL relative to the true future; Redit measures repair, specificity measures clean-input drift.
- Number of repetitions: the main table uses 10 seeds per attack with ε=0.2; PGD reports mean±standard deviation, FGSM and BIM are deterministic single values, and seed differences come from subsequent localization and editing (Appendix A.1, D.1).
- Other scales: the budget sweep is single-seed ROME with ε∈{0.1,0.2,0.3,0.4}; ETTh1 and Traffic additionally have a population sweep with N=15 windows, and MEMIT excludes items marked as failures (Figures 13, 14).
Main Results
According to Table 2, the focal-series results under PGD, ε=0.2, are listed; NRMSE and MAE are relative to the clean forecast, and Spec is clean-input drift.
Swipe horizontally to read the table
Dataset Method NRMSE MAE Redit Spec Electricity Attacked 0.8886 ± 0.0780 0.9096 ± 0.0753 not reported not reported Electricity ROME 0.0231 ± 0.0013 0.0205 ± 0.0011 0.9738 ± 0.0030 (2.57 ± 0.88)×10−4 Electricity SeqROME 0.0168 ± 0.0023 0.0145 ± 0.0022 0.9809 ± 0.0033 (1.74 ± 0.53)×10−4 Electricity MEMIT 0.0145 ± 0.0020 0.0121 ± 0.0018 0.9834 ± 0.0037 (5.25 ± 1.93)×10−5 ETTh1 ROME / SeqROME / MEMIT 0.0300 / 0.0242 / 0.0643 0.1393 / 0.0975 / 0.3041 0.6356 / 0.7069 / 0.2201 0.0326 / 0.0259 / 0.00115 Traffic ROME / SeqROME / MEMIT 0.2254 / 0.1110 / 0.1085 0.0791 / 0.0385 / 0.0388 0.6392 / 0.8525 / 0.8702 0.0000866 / 0.000119 / 0.0000402 - Electricity: the authors state that a single ROME run already restores most of the clean trajectory, and MEMIT achieves the lowest error among the three; a single example in Figure 3 is annotated with MSE dropping from 0.9071 to 0.0006.
- ETTh1 exception: MEMIT's Redit is lower than ROME's and SeqROME's, but its Spec is smaller; on this basis the authors emphasize that the degree of restoration and the locality of editing should be evaluated separately.
- Cross-setting conclusion: the authors state that SeqROME's restoration is the most consistent across attacks, and MEMIT has lower error under PGD on Electricity and Traffic; no editor is superior across all dataset and attack combinations.
Cross-attack Transfer and Attack Strength
- Reusing the localization layer: after localizing once with PGD, it is used for FGSM and BIM without re-tracing, but the edit is recomputed for each attack. On Electricity, ROME's NRMSE drops from 0.889, 0.337, 0.019 to 0.023, 0.028, 0.016 under PGD, BIM, FGSM respectively (Section 3.3).
- Reduction factors: Table 3 gives, for Electricity under PGD/FGSM/BIM, ROME as 38.5×/1.2×/12.2×, SeqROME as 52.9×/1.4×/22.9×, and MEMIT as 61.3×/1.3×/19.4×.
- Budget sweep: in Tables 7–9, for Electricity PGD, as ε goes from 0.10 to 0.40, MSEadv goes from 0.1237 to 6.0584, and MSErome is 0.0003, 0.0006, 0.0009, 0.0004; the authors state that PGD and BIM generally strengthen with budget, while FGSM is weaker.
Cross-channel and Multi-window Checks
- Electricity seven channels: in Table 4, NRMSE, MAE, and WQL for each channel and attack all decrease after ROME; the localization layers are distributed across layers 0, 4, 15, 17, 18, etc.
- ETTh1 and Traffic: the authors state that ROME reduces error on most ETTh1 variables, with smaller gains for MULL; Traffic's sensor_840 has the highest residual error but improves under all three attacks (Tables 5, 6).
- Multiple windows: ETTh1 and Traffic each have N=15 windows; the authors state that SeqROME's restoration is the most stable, ROME is close, and MEMIT has the largest variance after excluding failed items (Figures 13, 14). The specific means in the figures are not given in the text.
Other Ablations and Analyses
- Segment diagnosis: MT_253's NRMSE vs. future at Q0/Q1/Q2/Q3 is 0.0926/0.4577/1.0913/0.5550, so Q2 is selected (Table 1).
- Localization differences: Electricity's MLP restoration peak is at block 4, while ETTh1 and Traffic are at block 0; the authors state that the editing location depends on the dataset (Figures 2, 6, 7).
- Iterative process: on Electricity, MEMIT's error falls below SeqROME's after about iteration 6; a single SeqROME iteration approaches full restoration (Figure 9).
- Quantile repair: Figure 10 reports pinball loss for τ=0.1 to 0.9, and the authors state that it improves after ROME under all three attacks.
- Weak-attack exception: FGSM is close to ineffective in some settings, and its scalar restoration ratio RK⋆ is unstable because the baseline forecast displacement is close to zero (Tables 7, 9).
What are some points that can be further explored?
The paper does not specifically discuss limitations; the experimental scope is concentrated on one model, three datasets, and the established local white-box attacks.
Limitations and Future Directions Noted by the Authors
The paper does not specifically discuss limitations, nor does it have a separate Limitations or Future Work section. The conclusion only emphasizes that restoration performance and specificity should be evaluated separately, and that the choice of editor varies with dataset and attack; these belong to the discussion of results and are not presented as future directions explicitly stated by the authors.
Scope of Experimental Coverage
- Model and task: the only model under test is the 200M-parameter TimesFM 2.5, and the task is univariate forecasting with a 1024-step context and a 128-step forecast (Section 2.1).
- Data scope: the main results are Electricity MT_253, ETTh1 OT, and one high-variance Traffic sensor; the cross-channel experiments cover seven channels per dataset (Tables 4–6).
- Attack scope: the experiments use masked white-box FGSM, BIM, and PGD, perturbing one empirically selected context segment; the main budget is ε=0.2, with a single-seed sweep up to 0.4 (Appendix A.1, D.4).
- Statistics and aggregation: the main PGD results are mean±standard deviation over 10 seeds, while FGSM and BIM are deterministic single values; the population sweep reports only ETTh1 and Traffic with N=15 windows each, and MEMIT excludes items marked as failures.
- Evaluation information not reported: the paper does not report editing time, computational cost, statistical significance tests, or human evaluation; the controls are the unrepaired forecast and three editors, and the adversarial training and randomized smoothing defenses discussed in the main text are not implemented.
Summarize the main content of the paper
TS-Edit turns adversarial prediction repair into causal localization and local editing, and shows that restoration performance and clean-input locality need to be measured separately.
TS-Edit is an adversarial forecast repair framework for TimesFM 2.5 that investigates whether, after a local context is attacked, the clean forecast can be restored by editing a small number of feedforward weights without retraining the entire model.
- Problem and approach: the authors argue that global defenses do not answer where a corrupted forecast is mediated. The method first uses segmented PGD to select the subject segment, then uses causal tracing to localize the MLP layer, and finally performs ROME, SeqROME, or MEMIT with the clean forecast as the target.
- Main results: on Electricity MT_253 under PGD, ε=0.2, NRMSE drops from 0.8886 ± 0.0780 for Attacked to 0.0231 ± 0.0013 for ROME; SeqROME is 0.0168 ± 0.0023 and MEMIT is 0.0145 ± 0.0020 (Table 2).
- Cross-attack: when reusing the PGD localization layer, on Electricity ROME's NRMSE reduction factors for PGD, BIM, and FGSM are 38.5×, 12.2×, and 1.2× respectively; the authors state that FGSM is close to ineffective at this budget (Table 3).
- Cross-dataset: under PGD on Traffic, MEMIT's Redit is 0.8702 ± 0.0154; on ETTh1 it is only 0.2201 ± 0.0065, but its specificity is (1.15 ± 0.08)×10−3, lower than ROME's 0.0326 ± 0.0009 (Table 2).
- Coverage checks: the seven-channel experiments per dataset continue to show error reductions after ROME; ETTh1 and Traffic additionally have N=15 windows checks, and MEMIT excludes items marked as failures.
- Authors' conclusion: the authors state that causal localization and model editing can be used to study how perturbations propagate in time series foundation models; SeqROME's restoration is more consistent across attacks, and MEMIT has lower error under PGD on Electricity and Traffic, but the choice of editor varies with setting, and restoration and specificity should be evaluated separately.
Research lineage
1 foundations · 0 follow-ups in library- Cites2017-08BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply ChainCitation quote
No later in-library follow-ups recorded yet.
“Gradient attacks from image classification, FGSM [12], BIM [19], PGD [23], and C&W [2], transfer to sequential inputs, and time-series robustness has centered on classification [9, 17]; attacks on forecasting [5] and backdoor threats [14, 16] are comparatively rare.”