GAPS: Gradient-Aware Adaptation-Gap Scoring for Time-Series Anomaly Detection with Foundation Models

Jongwon Kim, Byunghun Song, Young Myoung KoNeurIPS 2026

TL;DR

When hunting for anomalies in time-series data, AI models usually flag whatever looks hardest to reconstruct—a solid strategy until healthy, normal data happens to be naturally noisy and anomalies are eerily smooth (like a failing heart losing its healthy variability). GAPS solves this "ranking reversal" in Time-Series Foundation Models by comparing how a model performs after fine-tuning on normal data versus before fine-tuning (zero-shot), causing background noise to mathematically cancel out. Using a smart, hyperparameter-free routing switch, it catches subtle anomalies hidden beneath noisy baselines without sacrificing performance on clean data.

What Problem Does This Paper Address?

Unsupervised time-series anomaly detection relies heavily on a simple recipe: train a model on normal data, ask it to reconstruct new inputs, and flag high reconstruction error ($L_{\mathrm{FT}}$) as anomalous. Even modern Time-Series Foundation Models (TSFMs)—like MOMENT, DADA, and UniTS—use this exact playbook.

Here is the catch: reconstruction error conflates true model error with intrinsic input noise. If your normal operating state is jagged and noisy, and an anomaly manifests as a sudden, smooth drop in variance, the model easily reconstructs the smooth anomaly while struggling with the noisy normal data. Every single anomaly gets ranked below normal data—a phenomenon the authors call noise-domination.

When normal training data is high-variance noise (a), standard foundation model reconstruction error ranks low-variance anomalies dead last, yielding an AUC-ROC of 0.00 (b). GAPS flips this back to a perfect 1.00 (c).

This isn't just a quirky math edge case. Healthy human heartbeats exhibit rich, chaotic Heart-Rate Variability (HRV), whereas congestive heart failure produces dangerously smooth, regular rhythms. Standard reconstruction scoring looks at a failing heart and calls it "extra normal."

Methods

Unlike traditional networks initialized from scratch, a pretrained TSFM already produces a sensible zero-shot reconstruction ($L_{\mathrm{ZS}}$) right out of the box, before seeing any task-specific data.

Instead of looking solely at fine-tuned error ($L_{\mathrm{FT}}$), the authors introduce the adaptation gap: $$\mathrm{Diff} = L_{\mathrm{FT}} - L_{\mathrm{ZS}}$$

Because input noise inflates both the zero-shot and fine-tuned losses equally, subtracting them cancels out the shared noise variance on average, leaving behind a clean measure of how much task adaptation helped (or hurt) a specific sample. Since fine-tuning adapts the model to normal data, normal samples see their loss drop ($\mathrm{Diff} < 0$), while anomalies do not benefit and float to the upper tail.

However, pure $\mathrm{Diff}$ isn't invincible—if fine-tuning didn't actually help on a given dataset, or if an anomaly is just a massive noise spike, $\mathrm{Diff}$ can backfire. Enter GAPS (Gradient-Aware Adaptation-Gap Scoring), which blends standardized $L_{\mathrm{FT}}$ and $\mathrm{Diff}$ using a routing weight $r(x) \in [0, 1]$ calibrated strictly on normal training data (zero test-label tuning):

  1. Dataset-Level Hard Gate: Runs a statistical block sign test on normal calibration windows to verify fine-tuning actually beat zero-shot. If not, the gate stays shut ($r(x) = 0$) and GAPS falls back to standard $L_{\mathrm{FT}}$.
  2. Sample-Level Gradient Routing: Measures how well a test sample's loss gradient aligns with the average normal calibration gradient. Normal-aligned samples stay with $L_{\mathrm{FT}}$; misaligned samples route smoothly toward $\mathrm{Diff}$.
  3. Activation Caching: Only the lightweight prediction head is fine-tuned while the heavy TSFM backbone stays frozen, meaning encoder activations are cached once and reused for both training and gradient routing.

Datasets

The authors test GAPS across synthetic and real-world regimes:

  • Synthetic Suite: Single-channel sequences testing four anomaly types (point spike, point jitter, context frequency, context trend) across clean, noisy-normal, and noisy-anomaly conditions.
  • HRV (PhysioNet): Constructed from MIT-BIH Normal Sinus Rhythm (noisy normals) and BIDMC Congestive Heart Failure (smoother anomalies).
  • UCDDB (PhysioNet): Full-night sleep-apnea airflow recordings where normal cyclical breathing is intrinsically noisier than flattened apnea/hypopnea events.
  • TSB-AD-U: A 350-series univariate real-world benchmark evaluated as-released (C-clean) and under a controlled stress test (C-noise, adding Gaussian noise $\sigma=0.10$ to normal windows only).
Figure 2: Synthetic anomaly families. (a) Clean normal, (d) noisy normal (Brownian step std 0.3 in this illustration; 0.5 in the experiments); anomalies: (b) point spike, (e) point jitter, (c) context frequency, (f) context trend. Per-sequence binary labels.

Key Insights and Ideas

  • Zero-shot models are built-in noise references: Pretraining gives TSFMs a superpower that classical autoencoders lack—a coherent baseline prior ($L_{\mathrm{ZS}}$) that lets you subtract away nuisance input noise without training a second network.
  • Gradients predict adaptation gaps: Tracing idealized gradient descent shows that $\mathrm{Diff}$ is essentially an accumulation of per-step gradient alignments. Checking a sample's gradient alignment at the zero-shot head provides a parameter-free mathematical proxy for whether $\mathrm{Diff}$ will separate anomalies from normals.
  • Natural "noisy-normal" data is hiding in plain sight: A wavelet audit found only 8.3% of standard TSB-AD-U series exhibit noisy normals—explaining why benchmarks miss this flaw—yet physiological signals like heart rate and respiration live squarely in this regime.

Key Results

  • Rescuing Physiological Reversals: On HRV (subject-level with DADA), standard reconstruction collapses to an inverted 0.075 AUC-ROC; GAPS Vaults this to 0.967 (+0.892), and boosts UniTS from 0.425 to 0.858. On UCDDB sleep-apnea data, GAPS improves VUS-ROC and VUS-PR across every tested backbone (e.g., MOMENT VUS-ROC jumps from 0.468 to 0.670).
  • Best of Both Worlds on Synthetic Data: Pure $\mathrm{Diff}$ nails noisy-normal data (0.999 AUC-ROC) but scores 0.000 on noisy anomalies. GAPS achieves 0.945 overall mean AUC-ROC across all 12 conditions, beating both standard $L_{\mathrm{FT}}$ (0.738) and pure $\mathrm{Diff}$ (0.479).
  • Stress-Test Resilience Without Clean Penalties: On TSB-AD-U C-clean, GAPS matches standard $L_{\mathrm{FT}}$ within 0.001 aggregate VUS-ROC (0.738 vs. 0.739). Under C-noise, standard $L_{\mathrm{FT}}$ degrades by 20.2% (dropping 35.2% on MOMENT), while GAPS limits the drop to 9.0% (only 7.3% on MOMENT).
  • Near-Zero Overhead: Caching frozen encoder activations yields a 10–114$\times$ speedup over uncached execution; at 1,792 windows, GAPS scoring adds just 0.055 seconds and 8.32 MiB of GPU memory.

Limitations and Future Work

  • Blind Spots: If an anomaly is completely invisible to both zero-shot and fine-tuned reconstruction channels—such as subtle, cross-sensor correlation shifts in multivariate data—GAPS cannot recover it.
  • Theoretical Idealization: The trajectory and mean-separation proofs model fine-tuning as full-batch SGD, whereas practical deployment uses mini-batch AdamW, making the theoretical alignment bound a structural guide rather than an exact identity.
  • Future Directions: Not explicitly discussed in the paper beyond addressing the multivariate and optimizer-analysis boundaries noted above.

Summary updated

Abstract

Reconstruction error is the standard signal for unsupervised time-series anomaly detection and has been widely adopted by time-series foundation models (TSFMs). It is, however, vulnerable to input noise: the resulting score tracks the noise level itself rather than whether a sample is truly anomalous, and this failure is especially pronounced in domains where the noise envelope itself carries information about the underlying process state. We propose the *adaptation gap* $\mathrm{Diff} = L_{\mathrm{FT}} - L_{\mathrm{ZS}}$, the difference between fine-tuned and zero-shot reconstruction losses, as a noise-robust complement. We prove that the noise inflating both losses cancels out of $\mathrm{Diff}$ on average, and establish a calibration-anchored, population-level mean-separation guarantee. Building on these results we introduce **GAPS** (Gradient-Aware Adaptation-Gap Scoring), which selectively augments $L_{\mathrm{FT}}$ with $\mathrm{Diff}$ under a calibration-only routing layer with no label-tuned hyperparameters. Across a synthetic suite, HRV and UCDDB benchmarks whose normal class is intrinsically noisier than the anomaly class, and TSB-AD-U with a predefined noise-stress condition, GAPS preserves performance under standard conditions and yields substantial gains under noise stress.
BibTeX
@inproceedings{kim2026gaps,
  author = {Jongwon Kim and Byunghun Song and Young Myoung Ko},
  title = {{GAPS: Gradient-Aware Adaptation-Gap Scoring for Time-Series Anomaly Detection with Foundation Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=ewNIO4p75i},
}
Figure