Organizations: Department of Industrial Engineering, Tsinghua University, Beijing, China · Lab, Huawei Technologies, ShenZhen, China · Datadog AI Research, Paris, France
Time series anomaly detection (TSAD) is a critical task, but developing models that generalize to unseen data in a zero-shot manner remains challenging. Existing foundation models for TSAD often rely on reconstruction-error scoring at inference time, which can miss subtle anomalies that are well reconstructed and can falsely flag complex but normal patterns in unseen domains. We introduce TimeRCD, a foundation model for TSAD built on Relative Context Discrepancy (RCD), a pre-training paradigm that trains the model to detect anomalies by comparing a query pattern with its surrounding context. This relational formulation, implemented with a standard Transformer architecture, enables the model to infer normality from the input context rather than relying on fixed global normal patterns. We further construct a large-scale synthetic corpus with context-dependent anomaly labels to provide supervised pre-training signals for RCD. Experiments across diverse benchmarks show that TimeRCD outperforms existing general-purpose and anomaly-specific foundation models in most zero-shot TSAD settings, while remaining competitive with dataset-specific full-shot baselines. These results provide empirical evidence that RCD is an effective direction for building robust and generalizable TSAD models.
Figures & tables
Figure 1: Limitations of Reconstruction-based TSAD and Our Proposed TimeRCD. (a) The model accurately reconstructs a smooth anomaly, resulting in a low error score and a missed detection (false negative). (b) The model fails to reconstruct a complex normal pattern unseen in the training dataset, leading to a high error score and a false alarm (false positive). (c) TimeRCD adopts RCD with a large-scale context-dependent corpus and a standard encoder-only Transformer.
Figure 2: Motivation Examples for RCD: Representation conflict in zero-shot TSAD.
Figure 3: TimeRCD Architecture
Figure 4: Synthetic data generation procedure.
Metric
Model
Univariate Datasets
Multivariate Datasets
Total
Total
IOPS
MGAB
NAB
NEK
Power
SED
Stock
TODS
UCR
WSD
YAHOO
MSL
PSM
SMAP
SMD
SWaT
1st
2nd
Zero-Shot Models
Affiliation-F
TimeRCD
86.98
74.54
93.81
83.95
85.02
88.99
41.31
84.86
84.34
91.00
95.94
84.66
82.31
86.01
91.75
69.43
07
04
DADA †
89.37 ∗
67.66 ∗
86.56
95.40
69.79
65.18
98.77
76.89
72.21
93.92
92.20 ∗
76.57
81.27
76.92
83.74
76.18
03
03
MOMENT †
87.54 ∗
66.76 ∗
90.45 ∗
92.26
75.97
59.13
45.26
59.76
75.77
95.39
79.99 ∗
74.55 ∗
65.79
77.42 ∗
74.00 ∗
70.17
01
01
TimesFM
81.88
66.95
79.73
90.49
69.88
67.14
97.53
89.08
70.03
78.97
91.28
20.35
71.24
45.44
62.85
44.37
00
02
Table 1: Performance of TimeRCD against zero-shot and full-shot baselines. TimeRCD operates in a strictly zero-shot capacity in all comparisons. Best results are highlighted in red ; second-best results are shown in blue . Asterisked (*) results are excluded from ranking due to potential data leakage.
Figure 5: Qualitative comparison of anomaly scores for point and contextual anomalies.
Figure 6: Comparison on specialized datasets containing either point or contextual anomalies.
Figure 7: The effect of input window size on datasets (Power, UCR, YAHOO, SMAP, and SMD) with sizes ranging from 1k to 13k.
Figure 8: Empirical scaling trend for average VUS-PR across our benchmarks when increasing the number of training observations (350M, 700M, 2.5B).
Dataset
Aff-F
F1-T
Std-F1
VUS-PR
Our Synthetic Data
0.878
0.569
0.523
0.478
Our Synthetic + DADA Injection
0.878
0.505
0.462
0.487
Real-world Data + DADA Injection
0.716
0.073
0.062
0.102
Table 2: Weighted average performance across all univariate benchmarks.
Exp.
Training Objective
Inference Rule
VUS-PR
Exp1
Reconstruction + Anomaly
Anomaly head
33.57
Exp2
Reconstruction + Anomaly
Reconstruction error
4.08
Exp3
Reconstruction only
Reconstruction error
3.35
Exp4
Anomaly only
Anomaly head
5.90
Exp5
Reconstruction pretraining, frozen encoder, then anomaly-head training
Anomaly head
26.11
Table 3: Controlled UCR ablation with the same backbone, tokenization, and synthetic corpus.
Appendix figures & tables23 assets
Supplementary material from the paper’s appendix.
Appendix
Name
Typical range / rule
Applies to
Intended effect
Number of samples
positive integer
whole dataset
Total number of generated sequences.
Sequence length
uniformly in {100,…,10000}
per sample
Time horizon of each sequence.
Anomalous-sample ratio
real in [0,1]
per sample
Probability a sample contains anomalies.
Multivariate flag
{True, False}
per sample
Whether to generate multi-channel series.
Number of features
fixed or uniformly in {2,…,50}
multivariate only
Channel count when multivariate.
Random seed (optional)
user-provided integer
whole run
Reproducibility of the random draws.
Appendix
Table 4: Dataset-level generation controls and intended effects.
Category
Options
Probability
Seasonality type
no periodic fluctuation
0.3
sine
0.3
square
0.05
triangle
0.05
wavelet
0.3
Trend type
decrease
0.2
Appendix
Table 5: Attribute categories, options, and relative probability.
Name
Typical range / rule
Applies to
Intended role
Number of nodes
Uniformly in 1 to 50
system graph
Dimensionality of the multivariate system.
Number of edges
roughly linear in nodes (acyclic)
system graph
Connectivity while preserving acyclicity.
Parent lags
nonnegative integers up to a small fraction of length
per edge
Causal delays between channels.
ARX autoregression ai
real in [−0.8,0.8]
per node
Decay/stability of latent causal influence.
ARX exogenous gains bij
zero-mean with finite variance
per edge
Strength of parent-to-child coupling.
ARX bias ci
bounded real interval
per node
Baseline offset in causal channel.
Appendix
Table 6: Multivariate and causal-dynamics hyperparameters and intended roles.
Figure 9: Illustration of synthetic anomaly archetypes.
Family
Type
Intent (one sentence)
Formal definition (within [ts,te) )
Local
Upward spike
A single sharp positive glitch
Δ(t)=Amax(1−∣t−t0∣/w,0)
Downward spike
A single sharp negative glitch
Δ(t)=−Amax(1−∣t−t0∣/w,0)
Continuous upward spikes
Rapid consecutive positive spikes
∑m=0M−1Ammax(1−∣t−(t0+md)∣/wm,0)
Continuous downward spikes
Rapid consecutive negative spikes
∑m=0M−1(−Am)max(1−∣t−(t0+md)∣/wm,0)
Wide upward spike
Longer rise/plateau/fall pulse
piecewise linear rise/hold/fall with amplitude A
Wide downward spike
Longer fall/plateau/rise pulse
piecewise linear with amplitude −A
Appendix
Table 7: Summary of anomaly archetypes, intents, and formal definitions.
Name
Domain
#TS
Avg Length
AR (%)
UCR
Misc.
228
67818.7
0.6
NAB
Web
28
5099.7
10.6
YAHOO
Web
259
1560.2
0.6
IOPS
Operations
17
72792.3
1.3
MGAB
Sensor
9
97777.8
0.2
SED
Energy
3
23332.3
4.1
Appendix
Table 8: Univariate Datasets
Name
Domain
#TS
Avg Length
AR (%)
MSL
Space
16
3119.4
5.1
PSM
Sensor
1
217624.0
11.2
SMAP
Space
27
7855.9
2.9
SMD
Server
22
25466.4
3.8
SWaT
ICS
2
207457.5
12.7
Appendix
Table 9: Multivariate Datasets
Figure 10: Distribution of time series lengths within our 2.5B point synthetic pre-training dataset. The histogram follows a long-tailed distribution, demonstrating that the pre-training curriculum is highly diverse. It contains a large volume of shorter series (under 4,000 steps) to teach common patterns, while also including a significant number of longer series (up to 10,000 steps) to ensure the model learns long-range temporal dependencies.
Type
Metric
TimeRCD
Chronos
DADA
MOMENT
TSPulse
Time MOE
TimesFM
Point
Affiliation-F
0.912
0.899
0.823
0.886
0.733
0.793
0.889
F1 T
0.604
0.441
0.387
0.551
0.214
0.303
0.446
Standard-F1
0.521
0.352
0.121
0.472
0.090
0.149
0.397
VUS-PR
0.666
0.293
0.396
0.538
0.063
0.190
0.385
Contextual
Affiliation-F
0.949
0.804
0.721
0.813
0.730
0.756
0.792
F1 T
0.781
0.174
0.227
0.284
0.210
0.269
0.154
Appendix
Table 10: Quantitative comparison on specialized point and contextual anomaly datasets. The table is grouped by anomaly type, with metrics listed vertically for each. TimeRCD is competitive on point anomalies and stronger on contextual anomalies on the reported metrics. Best results in each row are highlighted in bold .
Figure 11: Affiliation-F performance across all 14 datasets as a function of the input window size from 1k to 13k.
Figure 12: F1 T performance across all 14 datasets as a function of the input window size from 1k to 13k.
Figure 13: Standard-F1 performance across all 14 datasets as a function of the input window size from 1k to 13k.
Figure 14: VUS-PR performance across all 14 datasets as a function of the input window size from 1k to 13k.
Metric
Model
Univariate Datasets
Total
Total
IOPS
MGAB
NAB
NEK
Power
SED
TODS
UCR
YAHOO
Stock
WSD
1st
2nd
Affiliation-F
1k
91.34
67.15
89.60
83.95
66.26
81.19
85.03
80.55
94.30
48.81
91.93
03
01
2k
89.18
68.38
90.31
83.95
75.63
90.47
85.72
81.81
95.94
46.25
91.81
03
01
3k
89.87
72.80
92.71
83.95
83.05
95.12
85.43
83.47
95.94
43.45
92.06
03
02
4k
89.92
73.34
93.39
83.95
80.87
90.00
84.91
83.54
95.94
42.96
92.20
03
00
5k
86.98
74.54
93.81
83.95
85.02
88.99
84.86
84.34
95.94
41.31
91.00
03
01
Appendix
Table 11: Impact of Context Window Size: Performance comparison across available datasets. Best values are highlighted in red , second-best in blue .
Metric
Model
Datasets
Total
Total
IOPS
MGAB
NAB
NEK
Power
SED
TODS
UCR
YAHOO
1st
2nd
Affiliation-F
2.5B
84.79
70.69
79.70
79.73
68.30
96.87
85.91
84.63
96.65
06
01
700M
86.46
68.87
86.43
72.74
73.02
92.07
83.95
82.23
93.74
02
05
350M
88.24
68.19
86.21
79.27
63.30
89.21
83.22
82.49
92.35
01
03
F1_T
2.5B
27.70
01.81
42.90
35.87
20.17
69.43
65.89
34.30
85.86
06
00
700M
40.56
01.49
27.82
42.31
05.13
59.02
64.07
28.88
86.88
02
05
Appendix
Table 12: Performance comparison across different models and metrics. Best results for each dataset-metric combination are highlighted in red , and second-best are in blue .
Scenario
Affiliation-F
F1_T
Standard-F1
VUS-PR
Avg Rank
Zero-shot Univariate
2nd (MR=2.73, M=0.844)
1st (MR=2.45, M=0.414)
1st (MR=2.64, M=0.393)
1st (MR=2.27, MD=0.243)
1.8 / 7
Zero-shot Multivariate
1st (MR=1.2, M=0.829)
1st (MR=1.2, M=0.397)
1st (MR=1.2, M=0.322)
1st (MR=1.4, M=0.233)
1.2 / 7
Full-shot Univariate
1st (MR=1.82, M=0.844)
1st (MR=2.27, MD=0.350)
1st (MR=2.64, MD=0.320)
1st (MR=2.55, MD=0.243)
2.3 / 9
Full-shot Multivariate
4th (MR=3.2, MD=0.816)
4th (MR=3.2, M=0.397)
4th (MR=4.4, M=0.322)
4th (MR=3.6, M=0.233)
3.6 / 9
Appendix
Table 13: TimeRCD Performance Summary across All Scenarios. Legend: MR = Mean Rank, M = Mean, MD = Median
Figure 15: Statistical ranking visualization for zero-shot univariate anomaly detection.
Figure 16: Statistical ranking visualization for zero-shot multivariate anomaly detection.
Figure 17: Statistical ranking visualization for full-shot univariate anomaly detection.
Figure 18: Statistical ranking visualization for full-shot multivariate anomaly detection.
Model
Seq=1K
Seq=2K
Seq=5K
Seq=10K
TimeRCD
8.0
9.2
12.2
21.8
TimeMOE
36.5
66.7
130.8
274.2
DADA
207.6
423.1
1042.3
2074.0
Appendix
Table 14: Inference time (ms) as a function of sequence length for TimeRCD and baselines.
Model
Seq=1K
Seq=2K
Seq=5K
Seq=10K
Parameters
TimeRCD
295
434
858
1561
35.5M
TimeMOE
462
462
462
462
113.4M
DADA
17.8
17.8
17.8
17.8
1.8M
Appendix
Table 15: Peak memory usage (MB) and parameter counts for TimeRCD and baselines.
Sequence Length
Inference (ms)
Memory (MB)
Efficiency (ms/1k steps)
1,000
14.37
295
14.37
5,000
28.39
858
5.68
10,000
51.38
1561
5.14
15,000
86.22
2230
5.75
Appendix
Table 16: Scalability of TimeRCD up to 15,000 timesteps.
Time-Series Anomaly Detection identifies unusual patterns or events in sequential data, from sensor readings and network traffic to health and industrial telemetry.
School of Computing and Information Systems, Singapore Management University, Singapore · Chongqing Institute of Green and Intelligent Technology, University of Chinese Academy of Sciences, Chongqing, China · State Information Center, Beijing, China