Towards Foundation Models for Zero-Shot Time Series Anomaly Detection: Leveraging Synthetic Data and Relative Context Discrepancy Tian Lan * 1 Hao Duong Le * 1 Jinbo Li * 1 Wenjun He 2 Meng Wang 2 Chenghao Liu 3 Chen Zhang 1 Abstract Time series anomaly detection(TSAD) is a criti- cal task, but developing models that generalize to unseen data in a zero-shot manner remains chal- lenging. Existing foundation models for TSAD often rely on reconstruction-error scoring at in- ference 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 re- lational formulation, implemented with a stan- dard 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 pro- vide supervised pre-training signals for RCD. Ex- periments across diverse benchmarks show that TimeRCD outperforms existing general-purpose and anomaly-specific foundation models in most zero-shot TSAD settings, while remaining com- petitive with dataset-specific full-shot baselines. These results provide empirical evidence that RCD is an effective direction for building robust and generalizable TSAD models. 1. Introduction Time series anomaly detection (TSAD) is a crucial task in domains such as finance (Ahmed et al., 2016), health- *Equal contribution 1Department of Industrial Engineering, Tsinghua University, Beijing, China 22012 Lab, Huawei Technolo- gies, ShenZhen, China 3Datadog AI Research, Paris, France. This work was completed prior to joining Datadog. Correspondence to: Chen Zhang , Chenghao Liu . Proceedings of the 43 rd International Conference on Machine Learning, Seoul, South Korea. PMLR 306, 2026. Copyright 2026 by the author(s). care (Kaji et al., 2019), industrial monitoring (Lan et al., 2025), and cloud operations (Ren et al., 2019). The accurate detection of rare and unexpected events is vital for ensuring system reliability and safety. Despite recent progress driven by deep learning, most existing approaches are trained in a dataset- and model-specific manner, which restricts their scalability and hampers generalization across diverse do- mains in azero-shotway. The success of foundation models in natural language pro- cessing and computer vision has motivated efforts to es- tablish similar paradigms for TSAD. Existing approaches can be broadly categorized into two directions: (i) general- purpose time series foundation models designed for multiple tasks such as classification, forecasting, and anomaly de- tection (Gao et al., 2024; Goswami et al., 2024; Woo et al., 2024; Ekambaram et al., 2025; Xie et al., 2024), and (ii) anomaly-specific foundation models tailored explicitly for TSAD (Shentu et al., 2024). Additional related work is discussed in Appendix A. Despite their differences, both types of models predominantly rely on reconstruction-based objectives trained on real-world data, where anomalies are inferred indirectly fromreconstruction errors. While intuitive, reconstruction-error inference can suffer from a fundamentalobjective mismatch: models are opti- mized to reconstruct normal patterns in a latent space where anomalous structure is assumed to be lost (Wong et al., 2022). This leads to critical limitations, as illustrated in Figure 1(a,b). First, subtle and contextual anomalies are often smoothed out and thus missed, resulting in low recon- struction error and false negatives (Wong et al., 2022; Wu et al.). Second, complex but normal sequences deviate from the “average” patterns learned during training, yielding high reconstruction errors and false alarms (Yahya et al., 2025). While recent works (Yang et al., 2023; Xu et al., 2021) have moved beyond simple reconstruction errors by employing discrepancy-based mechanisms, they fundamentally hinge on aglobal normality assumption. These methods are optimized to learn a fixed distribution of normality predom- inantly from the training set. However, such paradigms are ill-suited forzero-shotsettings due to what we termrepre- sentation conflict. Since the definition of normality often undergoes aconcept shiftacross domains, a morphological 1 arXiv:2509.21190v5 [cs.LG] 29 May 2026 TimeRCD for Zero-Shot Time Series Anomaly Detection 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. pattern considered normal in one domain may be inherently anomalous in another domain (Fig. 2). The model faces opti- mization conflicts and poor generalization when compelled to map identical patterns to contradictory labels within a unified latent space. We emphasize that this paper does not reject reconstruction as a pretext task: our concern is the common inference rule that treats reconstruction error itself as the anomaly score. Thisrepresentation conflictis difficult to resolve with stan- dard supervision strategies. First, labeled anomalies are inherentlyscarce and lack diversity, providing the model with few examples to learn abnormal behavior. Second, existing methods attempt to mitigate limited supervision via data augmentation (Shentu et al., 2024; Darban et al., 2025; Cai et al., 2024). However, a critical limitation re- mains: these techniques primarily focus on expandingmor- phological diversity(e.g., via jittering or masking) butof- ten struggle tobreak the semantic coupling between local patterns and their normality labels. Theyrisk reinforc- ingthe bias that “specific shapes are intrinsically normal,” rather than teaching the model to evaluate patterns rela- tive to their surroundings. Consequently,paradigmsthat rely onmemorizing fixed normal patterns—even with augmented data—face intrinsic limitationsin zero-shot scenarios, highlighting the need to decouple the definition of normality from specific morphological features. To address these limitations, we introduce TimeRCD, a novel foundation model for TSAD built on a new pre- training paradigm, as illustrated in Figure 1(c). Our ap- proach replaces reconstruction-error scores at inference time by explicitly training the model to detect anomalies through theRelative Context Discrepancy(RCD) paradigm in zero- shot settings. Masked reconstruction is retained only as an auxiliary training signal for temporal representation learn- ing, while the final anomaly decision is made by a dedicated anomaly head. Instead of memorizing static normal patterns from the training dataset, we train the model toadaptively identifynormality directly from the unlabeled input se- quence itself. The model identifies intrinsic normal patterns within the immediate context, using them as references to detect anomalies on the fly without relying on pre-defined training distributions. For our pre-training process, we employ a standard Trans- former backbone without any architectural modifications. We tokenize each time series into non-overlapping variate- window patches and project them into Transformer input tokens, which allows the self-attention mechanism to nat- urally compute inter-token relationships, as shown in Fig- ure 1(c). To teach the model this explicit RCD strategy, we provide it with a rich, supervised signal by first leveraging a synthetic engine that breaks the semantic coupling between local patterns and their normality labels. This engine gen- erates a large-scale, diverse, and context-dependent corpus of time series data that is specifically designed to contain a wide variety of context-dependent anomalies, enabling the model to learn the RCD task from the ground up. Our main contributions are threefold: • RCD paradigm for zero-shot TSAD.We introduce a novel pre-training paradigm that moves beyond reconstruction-error inference by explicitly distinguish- ing anomalies through the RCD paradigm. This design enables a standard Transformer to capture normality, achieving strong generalization without architectural complexity. • A large-scale, context-dependent synthetic corpus for breaking semantic coupling.To support the RCD pre-training paradigm, we construct a comprehensive synthetic corpus specifically populated with context- dependent deviations. It provides token-level anno- tations for a diverse spectrum of anomalies, includ- ing point, contextual, and collective types with cross- variate propagation, offering the essential supervision required for the model to learn the RCD mechanism. • Extensive empirical evaluationExperiments on di- verse corpora demonstrate consistent gains over ex- isting reconstruction-based and general-purpose time- 2 TimeRCD for Zero-Shot Time Series Anomaly Detection series foundation models. Ablation studies confirm the contributions of both the synthetic corpus and the RCD framework to zero-shot performance. 2. Methodology: TimeRCD Framework 2.1. Preliminaries Problem DefinitionFor the zero-shot time series anomaly detection problem, we observe a multivariated-channel time series X= (x 1, . . . ,xn) with xt ∈R d for each time step t∈[n] :={1,2, . . . , n}. The objective is to produce a binary annotation sequence ˆy= (ˆy 1, . . . ,ˆyn)∈ {0,1}n such that ˆyt = 1 if and only if time t is anomalous. In the zero-shot setting, the model must detect anomalies on un- seen target sequences without any additional target-domain training, distinguishing normal from anomalous behavior. Figure 2.Motivation Examples for RCD: Representation conflict in zero-shot TSAD. RCD for zero-shot TSADPrevailing paradigms typically define anomalies based on deviations from aglobalnormal- ity learned from training data. However, this assumption falters in zero-shot settings due torepresentation conflict, as illustrated in Fig. 2.Consider the role of the “square wave”:in the top sequence, it establishes the dominant normal rhythm, rendering the spike anomalous. Conversely, in the bottom sequence, the roles are reversed—the spike constitutes the normal baseline, while the square wave be- comes the anomaly. This elementary example demonstrates that in zero-shot settings, “normality” is not an intrinsic property of a pattern’s morphology but arelative concept defined purely by its context. To address this, we aim to shift the objective fromrememberingglobal normality to explicitlyassessingcontext-level normality, enabling the model to define and detect anomalies primarily from contex- tual regularities observed in the target sequence at inference time. To address this representation conflict, RCD is built on two complementary components: large-context compar- ative modeling and context-dependent synthetic supervi- sion. Together, they enable the model to infer normality in a context-relative manner at inference time: (1)Large- context comparative modeling.Establishing a reliable “normality reference” requires sufficient contextual support and the ability to compare local temporal patterns within the context. As illustrated in Fig. 2, whether a square wave constitutes normal behavior is only identifiable when long- range repetitions and contextual temporal structure are ob- servable. A large context window allows the model to cap- ture such long-term regularities and periodic patterns, form- ing an internal baseline against which transient deviations can be evaluated. (2)Context-Dependent Synthetic Su- pervision.To prevent the model from degenerating into memorizing specific morphological features (e.g., falsely learning that “flat lines are always normal”), the training process must explicitly decouple pattern appearance from itscontextual role(i.e., whether a local pattern is considered normal or anomalous under a given context). We achieve this by constructing synthetic training data in which iden- tical patterns are assigned different contextual roles across varying contexts—appearing as normal in some sequences and anomalous in others. This context-dependent supervi- sion encourages the model to move beyond surface-level pattern recognition and instead learn the underlying princi- ple of contextual comparison. 2.2. RCD Strategy and Foundation Model Architecture Standard Transformer for large-context comparative modeling.To implement the first component of the RCD paradigm—capturing long-range contextual depen- dencies—we employ a standard encoder-only Transformer architecture (Vaswani et al., 2017) without structural mod- ifications, as illustrated in Fig. 3. Input time series are tokenized into non-overlapping patches, enabling the model to process long contexts within a feasible computational budget. Crucially, the Transformer’s native self-attention mechanism allows each token to contextualize itself with respect to the entire observation window, thereby enabling implicit comparisons between local temporal patterns and the dominant structure of the sequence. Furthermore, we provide the detailed mathematical formulation of RCD and discuss its theoretical connection to attention mechanisms in Appendix C. Variate-Window TokenizationSince multivariate anomaly detection is a critical task (Zamanzadeh Darban et al., 2024), we build on the design introduced by Moirai (Woo et al., 2024), which flattens multivariate time series so that all variates are represented within a single sequence. This design allows the subsequent Transformer blocks to capture both intra-variate dependencies and inter-variate dependencies. Specifically, given a normalized multivariate time series ˜X∈R n×d, we partition it into ⌈n/W⌉ ×dnon-overlapping windows, where W denotes the window length. The resulting windows are then flattened and linearly projected into input token embeddings Hinp ∈R ⌈n/W⌉d×D v. 3 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 3.TimeRCD Architecture Transformer BlocksWe stack L Transformer blocks, each consisting of layer normalization, feed-forward net- work, and self-attention modules. The architecture im- poses no special requirements on the Transformer block itself. Specifically, we leverage any-variate attention (Woo et al., 2024) and formulate the output token embeddings as Hout ∈R ⌈n/W⌉d×D v. Output Projection and Anomaly/Reconstruction Head To derive anomaly scores at the original temporal resolu- tion, the output token embeddings Hout from the Trans- former blocks are projected back into the observation space. Concretely, we define two heads during train- ing: Xrec = Reshape(H outWsWrec)∈R T×d and Xano = ChannelMean(H outWsWano)∈R T , where Ws ∈R Dv×Dv is the shared embedding projection, Wrec ∈R Dv×W and Wano ∈R Dv×W are the recon- struction and anomaly projections, respectively. The recon- struction head predicts masked portions of the input series. This head should be understood as a representation-learning pretext task rather than as the detector itself: we critique reconstruction error as an inference-time anomaly score, not masked reconstruction as a training signal. To foster robust contextual learning, we employ apatched masking strategy(15% ratio), preventing information leakage from adjacent timestamps. This design encourages the model to infer missing patterns by aggregating context, thereby establishing the “normality reference” required for the RCD mechanism. The rationale of this dual-head design stems from the nature of supervision. The BCE signal for anomaly labels defines the task-specific decision boundary, but it is relatively sparse and can be difficult to optimize from scratch. The masked reconstruction loss provides dense token-level supervision, encouraging the encoder to learn temporal dynamics and dependencies that serve as an optimization scaffold for the anomaly objective. We optimize the model using a joint loss function: L=λ∥M⊙(X rec −X)∥ 2 2 +BCE(σ(X ano),y), whereMis the binary mask. It is vital to note that this reconstruction branch is func- tionally distinct from the detection logic. During infer- ence,the Reconstruction Head is discarded completely, and no masking is applied. The model relies exclusively on the learned latent representations to classify anomalies via the Anomaly Head. This separates our paradigm from reconstruction-error methods: we do not measurehow well the model reconstructs the input at test time; rather, we use reconstruction during training to learn dense tempo- ral representations that make anomaly-head optimization more stable. A controlled objective/inference-rule ablation is provided in Table 3, with an appendix pointer in Ap- pendix E.5. The results show that reconstruction is useful as a training-time scaffold, while the anomaly head and joint representation learning are essential for strong inference- time detection. 2.3. Context-Dependent Data Generation We design a synthetic engine to generate multivariate time series without fixed semantic coupling, mitigating the model’s reliance on memorized global priors. By ensuring that “normality” is context-specific and defined by the se- quence itself, this synthetic-data design encourages models to recognize anomalies primarily relative to the sequence context. The pipeline proceeds in three hierarchical stages designed toestablishand thenviolatecontext: first,con- structing univariate dominant patternsthrough an addi- tive model with trend, seasonality, and noise (Stage 1); next, enforcing multivariate consistencyvia causal dependen- cies to establish cross-variate context (Stage 2); and finally, violating these established contextsby injecting structural and causal anomalies (Stage 3). A summary is shown in Fig. 4, with full details in Appendix B. Stage 1: Establishing Univariate Dominant Patterns. To encourage the model to derive normality from the se- quence context rather than through global memorization, we first generate univariate baselines with highly random- ized structural parameters. For each channel, the normal context is constructed via an additive model: xbase(t) = T(t) +S(t) +ε(t), t= 0,1, . . . , n−1. Here, theTrend T(t) combines deterministic and stochastic drifts to simu- late diverse evolving baselines. Crucially, theSeasonality S(t) = PK k=1 Ak wk(2πfkt+φ k;θ k) serves as the primary “dominant pattern” and provides the reference against which deviations are identified. By randomly sampling the wave- form atoms wk (e.g., sinusoid, square, wavelet), frequencies 4 TimeRCD for Zero-Shot Time Series Anomaly Detection 12 3 Seasonal Noise Trend++ Stage1 Stage2 Stage3 Stage4 AnomalyInjection TimeseriesDataLabelsLabel Generation y! [t] Figure 4.Synthetic data generation procedure. fk, and phases φk for each sample, we prevent any single pe- riodic structure from being universally applicable across all sequences. Finally, theNoise ε(t) introduces local volatility (e.g., bursty variance σ2(t)), requiring the model to distin- guish inherent stochastic volatility from genuine anomalies. Full construction details are provided in Appendix B.2 and Appendix B.3. Stage 2: Enforcing Multivariate ConsistencyTo es- tablish relational context across channels, we integrate the independent univariate patterns into a structurally coupled system. This step is critical for promoting cross-variate at- tention, as “normality” is now defined by the consistency be- tween interacting nodes. We first sample a Directed Acyclic Graph (DAG)G= (V, E)to define the topological structure of dependencies. To impose precise temporal constraints, we employ a latent causal processzi governed by discretized ARX dynamics: zi[t] =a izi[t−1] + P j∈P(i) bijxj[t− ℓij] +c i,|a i| ≤0.8,where the parent set P(i) and spe- cific lags ℓij create lagged dependencies essential for the model to capture. Finally, the observed signal is generated by mixing the univariate baseline with this causal process: xi[t] = (1−α i)x base,i(t) +α i zi[t], α i ∈[0,1]. This mechanism couples the channels, making a channel’s be- havior conditional upon the states of its parents, thereby establishing a structured multivariate ground truth for the RCD task. Stage 3: Violating Established ContextsThe final step involves generating anomalies not through random corrup- tion, but by disrupting the contextual patterns established in previous stages. We introduce two classes of injections designed to necessitate the RCD mechanism: (1) Violating Temporal Context (Structural & Local Anomalies)We apply a broad spectrum of perturbations, ranging fromlocal morphological changes(adding ∆(t) to introduce shape-based outliers) to more challengingstruc- tural violations. Specifically, for the latter, we intervene on the seasonality component S(t), replacing it withS′(t) to in- duce frequency shifts, phase jumps, or pattern replacements. Since these structural anomalies often morphologically re- semblelegitimate normal patternsfound in other gener- ated series, they aredifficult to distinguish based on shape alone. Effective identification relies on contrasting the cur- rent window against its own extended temporal context, thereby driving the model toinfer context-level normality rather than relying on static global priors. We design over 20 anomaly types (detailed in Appendix B.4) to cover these violations. (2) Violating Relational Context (Endogenous Injections) To challenge the model’s capacity for capturing multivariate dependencies, we employ anendogenous injection mecha- nism. Rather than simply overwriting the observed signal (Exogenous), we perturb the latent baseline xbase,i of a vari- able prior to the mixing process. The induced deviation consequently propagates to other correlated variables via the system dynamics defined in Stage 2. This process gener- ates anomalies that preserve structural coherence but violate theinter-variable consistencydictated by the multivari- ate context. Detecting such anomalies hinges on capturing whether the joint behavior of variables remains consistent, facilitating the learning of cross-variate relational discrep- ancies without the need for explicit causal modeling. Stage 4: Label GenerationWe generate token-level bi- nary labels. For exogenous injections, positive labels cor- respond to the intervention window. For endogenous injec- tions, we label the root-cause window and extend it to de- scendant channels based on their causal lags, as implied by the DAG and ARX lags {ℓij}. Sequence lengths, DAG spar- sity, ARX coefficients, and signal regimes (trend, seasonal- ity, noise) are sampled from configurable priors (Appx. B.1), generating rich, interpretable dynamics designed for zero- shot learning. 3. Experiments To validate the effectiveness of TimeRCD, we design a com- prehensive evaluation to answer three research questions: RQ1: How well does TimeRCD perform in strict zero-shot anomaly detection compared with existing time-series foun- dation models and with full-shot, dataset-specific baselines? RQ2: What is the impact of large context windows on con- textual anomaly detection and sensitivity to window size? RQ3: How do our synthetic generator and anomaly de- sign affect performance, and how does accuracy scale with 5 TimeRCD for Zero-Shot Time Series Anomaly Detection pre-training data size? 3.1. Experimental Settings DatasetsOur evaluation is conducted on a comprehensive suite of 16 public time-series anomaly detection datasets, covering a wide range of real-world and synthetic scenar- ios. Details about the benchmark datasets can be found in Appendix D.1. BaselinesWe benchmark TimeRCD against methods from two primary settings: (1)Zero-shot models, which include our approach and other foundation models (DADA† (Shentu et al., 2024), MOMENT† (Goswami et al., 2024), TimesFM (Das et al., 2024), Chronos (Ansari et al., 2024), Time MOE (Shi et al., 2024)). We also include MovingVar., a simple moving-window variance detector, to test whether a lightweight statistical baseline can explain the observed gains. (2)Full-shot models, which are fitted on a per-dataset basis. This category includes deep learn- ing methods (TranAD (Tuli et al., 2022), USAD (Audibert et al., 2020), OmniAnomaly (Su et al., 2019), Sub-PCA (Liu & Paparrizos, 2024), DCdetector (Yang et al., 2023), TF- MAE (Fang et al., 2024)) and classical statistical algorithms (LOF (Breunig et al., 2000), IForest (Liu et al., 2008)). Note that models marked with (†) were excluded where necessary due to potential data leakage under the zero-shot setting (Appendix D.3). Additional details about all baselines can be found in Appendix D.2. Evaluation ProtocolWe evaluate model performance us- ing four standard metrics: Affiliation-F1, F1-T, Standard-F1, and VUS-PR. More details about the metrics are shown in Appendix D.4. TimeRCD uses a single fixed context win- dow of 5000 for every dataset. 3.2. Main Results: TSAD Accuracy (RQ1) Our evaluation includes two comparisons: a directzero-shot test against foundation models, and afull-shottest against baselines trained on target data. We stress thatTimeRCDis strictly zero-shot in all settings, testing true out-of-the-box performance under the fixed 5000 context-window protocol. Results are shown in Table 1. In zero-shot comparisons, TimeRCD ranks first in38and second in14of the 64 evalu- ation cases (16 datasets × 4 metrics). Even against full-shot baselines with access to target data, TimeRCD is highly competitive, ranking first in35and second in3cases. This result highlights the effectiveness and cross-dataset gener- alization of our pre-training framework. The MovingVar. baseline is competitive on several datasets and metrics, es- pecially when variance shifts are directly aligned with the anomaly definition. Nevertheless, TimeRCD is stronger overall and achieves substantially more first-place results, including broad gains on VUS-PR. This comparison sug- gests that the performance cannot be reduced to a simple variance detector, while also confirming that simple statisti- cal baselines remain meaningful competitors in TSAD. 3.3. RCD Strategy Efficiency (RQ2) Qualitative Analysis of Contextual UnderstandingA key architectural feature of TimeRCD is its ability to pro- cess long context windows, allowing it to learn complex temporal dependencies. Many existing zero-shot methods, particularly those based on reconstruction with small look- up windows, are effective at detecting abruptpoint anoma- lies—short-term deviations from an immediate pattern (the left two panels in Fig. 5). However, these models often fail on subtlecontextual anomalies, where the anomalous behavior is a deviation from a long-term pattern (the right two panels in Fig. 5). Their limited context prevents them from distinguishing normal long-term variations from true anomalous segments. In contrast, as our qualitative results in Fig. 5 show, TimeRCD’s ability to view the entire series allows it to learn the complex relationships between distant points. Quantitative Analysis of Contextual Understanding We create specialized, unseen datasets containing either purely point or contextual anomalies, ensuring a fair zero- shot evaluation (details in Appendix E.2). The results are in Fig. 6. While TimeRCD’s performance on point anomalies is highly competitive with other top zero-shot models, it is substantially stronger on contextual anomalies. On this task, our model achieves a Standard-F1 score of 0.827, whereas competing zero-shot models degrade substantially on this split. This performance disparity provides strong evidence that TimeRCD’s ability to leverage long-range context is a key capability, allowing it to detect complex deviations that are challenging for methods with a more limited contextual view. Impact of Context Window SizeTimeRCD’s ability to process variable context lengths is a core architectural fea- ture. To analyze its impact, we evaluate performance with input window sizes from 1k to 13k. As shown in Fig. 7, the results confirm that the optimal context length is task- dependent. For datasets with long-term patterns likeUCR, Power,SMAP, andSMD, performance generally improves with a larger window, as this allows the model to establish a more robust baseline of “normal” behavior. Conversely, on inherently short series likeYAHOO(Fig. 7(c)), perfor- mance remains flat, as the series length itself becomes the effective context limit. Practically, smaller windows are of- ten preferable when anomalies are highly local or the series has weak periodic structure, while larger windows are more helpful when normality depends on long-range context, pe- riodicity, or stronger contextual structure. Thus, the fixed 6 TimeRCD for Zero-Shot Time Series Anomaly Detection Table 1.Performance ofTimeRCDagainst zero-shot and full-shot baselines. TimeRCD operates in a strictly zero-shot capacity in all comparisons. Best results are highlighted inred; second-best results are shown in blue. Asterisked (*) results are excluded from ranking due to potential data leakage. Metric Model Univariate Datasets Multivariate DatasetsTotalTotalIOPS MGAB NAB NEK Power SED Stock TODS UCR WSD YAHOOMSL PSM SMAP SMD SWaT1st 2ndZero-Shot Models Affiliation-F TimeRCD 86.9874.54 93.8183.9585.02 88.9941.31 84.8684.3491.00 95.9484.6682.3186.0191.7569.43 07 04DADA† 89.37∗ 67.66∗ 86.5695.4069.79 65.1898.7776.89 72.21 93.9292.20∗ 76.57 81.2776.92 83.7476.18 03 03MOMENT† 87.54∗ 66.76∗ 90.45∗ 92.26 75.9759.13 45.26 59.76 75.7795.3979.99∗ 74.55∗ 65.79 77.42∗ 74.00∗ 70.17 01 01TimesFM 81.88 66.95 79.73 90.49 69.88 67.14 97.5389.0870.03 78.97 91.2820.35 71.24 45.44 62.85 44.3700 02Chronos 90.1267.89 86.66 93.6369.72 67.8996.8591.9674.35 90.9896.3475.52 70.88 72.22 75.31 70.4303 03Time MOE 76.34 67.23 80.51 80.50 71.19 60.98 63.28 54.68 73.56 80.25 69.7069.85 54.74 74.38 69.97 64.3700 00MovingVar. 83.90 67.56 91.5077.81 74.77 67.14 67.96 71.57 78.4489.13 78.00 89.4373.9188.1481.33 75.5502 03 F1-T TimeRCD 45.399.0550.49 76.91 23.05 60.5918.3868.46 41.1844.1379.14 43.67 43.86 35.82 55.96 35.4711 03DADA† 42.50∗ 0.91∗ 37.24 47.98 19.80 9.5695.4935.18 7.2248.4679.52∗ 34.58 31.8430.4240.8035.13 02 04MOMENT† 33.15∗ 0.80∗ 52.27∗ 63.6619.91 9.54 18.04 17.47 13.0241.98 11.69∗ 25.97∗ 27.77 17.93∗ 28.68∗ 28.76 00 02TimesFM 48.950.93 36.74 36.63 19.80 9.58 88.94 51.13 10.78 41.3883.467.83 25.42 11.64 18.65 21.3902 00Chronos 45.45 1.10 36.10 33.16 19.90 13.18 89.3053.9010.88 39.82 79.0015.59 25.42 11.72 17.32 28.8800 04Time MOE 25.95 0.63 38.70 15.78 19.85 17.7334.13 20.91 8.29 22.60 37.1123.92 26.82 14.22 19.90 30.1100 01MovingVar. 22.53 0.8556.6655.72 19.939.59 17.53 16.43 12.85 22.01 13.8941.0826.13 24.13 32.67 27.1101 02 Standard-F1 TimeRCD 47.28 8.6342.66 68.64 23.12 60.8519.5670.02 33.4741.0489.0534.4828.2525.3653.8234.44 10 04DADA† 32.76∗ 0.80∗ 26.91 48.24 15.99 2.6995.5928.18 3.3645.0679.30∗ 22.13 24.0726.7534.9834.7804 00MOMENT† 30.69∗ 0.67∗ 44.75∗ 63.8516.39 3.36 19.38 14.64 9.00 41.4210.54∗ 14.43∗ 23.83 12.92∗ 29.78∗ 21.30 00 02TimesFM 34.28 0.83 26.46 38.15 16.73 2.96 89.13 40.08 7.86 38.50 84.445.75 22.18 10.46 18.65 22.8400 02Chronos 32.69 0.99 26.22 33.54 17.47 8.74 89.4140.528.21 34.58 78.8911.63 22.27 9.62 17.50 24.0300 03Time MOE 26.52 0.45 26.20 11.47 12.16 17.7334.32 16.38 4.09 20.09 27.5012.85 24.80 9.01 21.62 23.5800 01MovingVar. 22.74 0.7451.3749.19 19.949.60 19.01 16.10 9.5122.57 11.62 35.4326.1023.66 38.4326.86 02 04 VUS-PR TimeRCD 42.98 3.0944.65 71.13 14.63 69.8672.7391.67 27.4829.9587.8823.4121.6919.6846.7018.47 10 03DADA† 24.97∗ 0.57∗ 24.73 46.85 10.61 6.4299.5164.83 2.94 33.4270.74∗ 12.74 17.1720.0225.9821.13 03 03MOMENT† 37.35∗ 0.56∗ 45.38∗ 67.7410.50 4.31 76.97 56.45 6.1755.2630.81∗ 9.32∗ 16.48 8.97∗ 15.96∗ 14.90 01 01TimesFM 19.56 0.58 24.01 35.02 10.44 6.13 98.3972.896.03 21.57 86.7811.84 14.76 16.95 13.02 19.4300 04Chronos 19.00 0.60 23.76 31.80 10.95 8.65 97.49 70.66 6.56 18.81 83.548.25 14.61 5.18 10.22 16.4400 01Time MOE 16.63 0.52 22.62 19.76 9.34 10.8774.78 48.78 2.10 10.93 20.907.82 15.68 4.98 11.12 16.2000 01MovingVar. 22.47 0.4448.7538.81 10.70 5.17 73.99 51.58 6.9022.83 19.85 25.0216.45 12.73 21.43 14.4902 02TimeRCD Grand Total (Zero-Shot) 38 14Full-Shot Models Affiliation-F TimeRCD 86.98 74.54 93.8183.9585.02 88.9941.3184.86 84.34 91.00 95.9484.66 82.3186.01 91.7569.43 11 01TranAD 83.1967.28 90.28 85.02 71.56 61.03 57.94 52.76 73.31 84.3476.08 79.91 73.8387.3992.2075.37 01 03USAD 71.08 67.81 91.54 71.13 76.48 55.60 35.92 47.90 76.00 65.10 53.0581.86 57.86 87.25 85.09 75.0600 00OmniAnomaly80.32 67.35 92.3586.3078.1661.2675.2450.73 73.53 78.02 71.3183.15 58.1791.3885.82 73.3902 03LOF 81.06 68.44 75.75 84.74 66.76 63.85 69.74 60.58 73.53 81.29 75.6384.3561.98 63.32 64.13 56.3400 01IForest 52.81 68.8239.84 71.15 0.00 70.09 0.06 44.17 50.56 41.24 33.3063.36 63.78 59.96 69.71 0.0000 01Sub-PCA 75.39 66.90 89.2997.1071.37 67.14 70.6372.7576.6676.45 75.85 84.25 71.49 90.0885.8076.29 02 04DCdetector 71.83 67.91 72.21 62.31 69.75 72.2055.79 57.81 70.18 72.79 67.7767.74 67.32 67.10 69.55 71.0700 01TFMAE 78.25 67.50 75.99 76.91 70.30 68.17 56.39 62.83 70.60 80.25 76.8775.70 70.07 75.36 70.85 75.7200 02 F1-T TimeRCD 45.39 9.0550.49 76.91 23.0560.5918.3868.46 41.18 44.13 79.1443.6743.8635.8255.9635.4708 01TranAD 22.63 1.65 37.28 69.97 22.36 9.57 16.73 13.51 7.75 20.94 8.4139.42 25.49 29.12 37.98 49.5800 01USAD 20.99 4.07 61.4670.6428.239.54 16.86 20.85 14.63 14.18 9.3548.71 28.96 43.94 50.4150.4103 01OmniAnomaly51.171.61 40.09 82.2023.489.68 36.2214.33 8.47 34.7924.16 49.3630.4246.6351.84 46.6403 05LOF 27.97 1.15 35.76 63.57 19.80 9.6066.1431.638.31 24.38 55.9338.97 25.58 21.81 10.13 30.6201 02IForest 7.64 0.84 21.44 65.56 0.00 9.54 1.10 11.06 6.36 4.28 4.90 20.73 25.39 14.32 16.20 0.0000 00Sub-PCA 32.75 0.98 54.1584.1820.30 9.54 20.10 18.40 18.9024.62 11.57 49.0230.38 44.3151.8746.65 01 05DCdetector 6.61 1.32 32.72 29.21 21.13 10.53 16.07 16.40 6.62 7.32 6.8123.24 25.34 15.73 9.47 28.6400 00TFMAE 19.41 1.07 33.04 31.11 20.18 11.8222.15 16.48 5.90 19.11 23.8525.28 25.36 19.39 10.13 28.4600 01 Standard-F1 TimeRCD 47.28 8.6342.66 68.64 23.1260.8519.5670.02 33.47 41.04 89.0534.48 28.25 25.36 53.82 34.4407 00TranAD 34.85 1.46 27.33 60.36 22.36 2.63 16.23 11.94 4.40 20.23 5.7029.60 25.63 25.11 43.99 61.8600 01USAD 30.66 3.89 56.1562.9128.243.41 17.99 23.87 10.74 13.20 7.2138.7128.41 38.66 53.0662.8203 02OmniAnomaly47.05 1.44 28.81 74.0323.500.43 38.5912.65 5.11 29.5721.40 39.10 30.43 40.5057.0655.93 03 06LOF 30.28 1.05 24.04 56.92 12.18 4.1166.2025.774.70 22.62 48.9530.65 18.80 18.70 8.41 29.0801 02IForest 8.37 0.73 29.41 58.10 19.77 3.81 16.91 13.35 4.09 2.07 3.2014.68 24.15 13.61 16.89 26.7600 00Sub-PCA 33.96 0.83 46.7185.4316.05 9.56 21.77 18.72 15.1224.74 11.06 38.29 30.2638.9057.2255.98 02 04DCdetector 5.19 1.21 24.02 17.37 21.10 10.54 16.97 17.85 3.18 4.64 4.1414.08 25.33 10.67 8.99 27.0200 00TFMAE 9.48 0.97 23.78 19.74 20.14 11.8723.32 14.88 2.83 15.53 20.5015.68 25.39 12.58 9.16 27.0800 01 VUS-PR TimeRCD 42.98 3.0944.65 71.13 14.6369.8672.7391.67 27.48 29.95 87.8823.4121.6919.6846.7018.4709 01TranAD 21.61 0.64 24.82 61.63 13.04 5.75 78.08 47.33 2.25 12.20 25.7814.78 16.49 13.37 28.3447.3701 00USAD 16.58 0.75 55.0358.5318.684.37 74.53 56.368.85 10.00 14.1529.95 17.59 26.37 34.53 44.7302 03OmniAnomaly25.35 0.64 27.17 74.5114.32 6.2091.2945.55 2.40 16.37 29.2631.5718.5828.0737.44 42.9703 03LOF 19.43 0.57 21.18 58.52 9.31 6.81 83.0749.14 2.39 12.85 41.3724.67 13.58 10.59 4.40 14.5000 02IForest 8.59 0.62 23.57 56.50 11.56 7.71 70.99 46.62 2.88 2.06 10.4711.29 15.85 7.55 8.88 15.4900 00Sub-PCA 23.02 0.60 46.0888.9110.49 3.72 80.86 54.16 12.9216.41 21.57 31.4318.52 26.4237.5043.02 01 06DCdetector 5.83 0.59 16.60 14.03 12.32 9.37 74.16 46.66 1.53 3.23 10.177.01 14.49 4.21 4.66 15.04 00 00TFMAE 5.32 0.64 15.68 17.81 11.90 9.5573.54 48.79 2.57 5.36 25.938.25 14.22 5.76 4.77 15.38 00 01TimeRCD Grand Total (Full-Shot) 35 03 5000 window used in Table 1 is a practical zero-shot de- fault, not a claim that context length is irrelevant. A detailed breakdown for all datasets is available in Appendix E.3. 3.4. Synthetic Data Efficiency (RQ3) Ablation Study on Pre-training DataTo validate our data generation framework, we train the same TimeRCD architecture with identical hyperparameters and epochs on three 350M-point datasets: (1) our synthetic data within- contextanomaly injection, (2) the same synthetic series but with DADA-injected anomalies (Shentu et al., 2024), and (3) real-world data (Godahewa et al.) augmented with DADA. Table 2 shows weighted averages over all univariate bench- marks. Models trained on augmented real data performed far worse, confirming the necessity of a high-quality synthetic curriculum. Comparing the two synthetic variants reveals a key trade-off: although DADA injection achieves similar Affiliation-F and slightly higher VUS-PR, it causes sharp 7 TimeRCD for Zero-Shot Time Series Anomaly Detection 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, Y AHOO, SMAP, and SMD) with sizes ranging from 1k to 13k. drops in finer-grained metrics (F1-T decreases by 6.4 per- centage points and Standard-F1 by 6.1 percentage points). This indicates that our in-context injection generates more challenging and robust training signals. Dataset ScalingTo investigate the effect of pre-training data scale on performance, we train TimeRCD on increas- ingly larger subsets of our synthetic dataset: 350M, 700M, and the full 2.5B data points. The results, shown as a weighted average across our benchmark datasets in Fig. 8, demonstrate a clear positive trend in average VUS-PR as Figure 8.Empirical scaling trend for average VUS-PR across our benchmarks when increasing the number of training observations (350M, 700M, 2.5B). Table 2.Weighted average performance across all univariate bench- marks. Dataset Aff-F F1-T Std-F1 VUS-PR Our Synthetic Data 0.878 0.569 0.5230.478 Our Synthetic + DADA Injection 0.8780.505 0.4620.487 Real-world Data + DADA Injection 0.716 0.073 0.062 0.102 the amount of pre-training data increases. Full per-metric results are provided in Appendix E.4. 8 TimeRCD for Zero-Shot Time Series Anomaly Detection 3.5. Controlled Ablation on Objective and Inference Rule To better isolate the roles of synthetic data, reconstruction, and the anomaly head, we perform a controlled comparison on UCR using the same backbone, tokenization, synthetic corpus, and comparable training budget while varying only the training objective and inference rule. The results are shown in Table 3. Table 3.Controlled UCR ablation with the same backbone, tok- enization, and synthetic corpus. Exp.Training Objective Inference RuleVUS-PR Exp1Reconstruction + Anomaly Anomaly head33.57Exp2Reconstruction + Anomaly Reconstruction error4.08Exp3Reconstruction only Reconstruction error3.35Exp4Anomaly only Anomaly head5.90Exp5Reconstruction pretraining, frozen encoder, then anomaly-head trainingAnomaly head26.11 These comparisons clarify the role of each component. Exp1 vs. Exp3 shows that reconstruction-only training on the same synthetic corpus does not recover the full method, so the gains are not explained by data scaling alone. Exp1 vs. Exp2 shows that, even under identical joint training, replacing the anomaly head with reconstruction error at inference causes a large drop, supporting our distinction between useful training-time reconstruction and weak test- time reconstruction-error scoring. Exp4 vs. Exp5 shows that training the anomaly head from scratch is difficult under sparse BCE supervision, whereas a reconstruction- pretrained encoder substantially stabilizes the anomaly ob- jective. Exp3 vs. Exp5 further shows that adding an anomaly head on top of a learned representation is much stronger than using reconstruction error alone. Finally, Exp1 remains better than Exp5, indicating that jointly adapting the repre- sentation to the anomaly objective is also important. 4. Conclusion In conclusion, TimeRCD addresses limitations of reconstruction-error inference by introducing Relative Con- text Discrepancy as a context-relative pre-training paradigm for zero-shot TSAD. Its conceptual simplicity and empirical results suggest several directions for future research. As a current limitation and future direction, our implementation relies on a standard Transformer backbone; exploring archi- tectures designed to capture RCD more efficiently remains an important direction for improving efficiency. Limitations.Several limitations remain important for in- terpreting the current results. First, the context-relative design can fail when a large inference window contains many anomalous points: on datasets such as Stock, frequent outliers inside the same window may be partially absorbed into the local reference pattern, weakening the anomaly signal. Second, the fixed context window of 5000 used in main results is a practical zero-shot default, not evidence that context length is unimportant; some datasets remain sensitive to the window length. Third, reconstruction has a nuanced role in TimeRCD: it is not used as the test-time anomaly score, but masked reconstruction provides a dense representation-learning and optimization scaffold for the sparse anomaly objective. A more rigorous theoretical ac- count of this interaction is an open problem. Acknowledgements This work was supported in part by NSFC Grant 72271138, Tsinghua-NUS Joint Funding 20243080039, and Tsinghua-Huawei Collaboration Project 20252001894. We thank Zixinzhou Yang for helpful contributions to the dataset. The code is available at https://github. com/thu-sail-lab/Time-RCD. Impact Statement This work may reduce the amount of target-domain data required for time series anomaly detection, which could benefit applications such as industrial monitoring, cloud operations, and healthcare. Because anomaly detection sys- tems can affect high-stakes decisions, deployments should include human oversight, domain-specific validation, and careful monitoring of false positives and false negatives. Our use of synthetic pre-training data reduces direct exposure to private downstream data, but downstream deployment must still follow applicable privacy and security requirements. Use of LLMs.Large language models were used only to refine the writing. References Ahmed, M., Mahmood, A. N., and Islam, M. R. A survey of anomaly detection techniques in financial domain.Future Generation Computer Systems, 55:278–288, 2016. Ansari, A. F., Stella, L., Turkmen, C., Zhang, X., Mercado, P., Shen, H., Shchur, O., Rangapuram, S. S., Arango, S. P., Kapoor, S., et al. Chronos: Learning the language of time series.arXiv preprint arXiv:2403.07815, 2024. Audibert, J., Michiardi, P., Guyard, F., Marti, S., and Zu- luaga, M. A. Usad: Unsupervised anomaly detection on multivariate time series. InProceedings of the 26th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 3395–3404, 2020. Bhethanabhotla, S. K., Swelam, O., Siems, J., Salinas, D., and Hutter, F. Mamba4cast: Efficient zero-shot time series forecasting with state space models.arXiv preprint arXiv:2410.09385, 2024. Breunig, M. M., Kriegel, H.-P., Ng, R. T., and Sander, J. Lof: identifying density-based local outliers. InProceedings 9 TimeRCD for Zero-Shot Time Series Anomaly Detection of the 2000 ACM SIGMOD international conference on Management of data, pp. 93–104, 2000. Cai, Y ., Choudhry, A., Goswami, M., and Dubrawski, A. Timeseriesexam: A time series understanding exam. arXiv preprint arXiv:2410.14752, 2024. Darban, Z. Z., Yang, Y ., Webb, G. I., Aggarwal, C. C., Wen, Q., Pan, S., and Salehi, M. Dacad: Domain adaptation contrastive learning for anomaly detection in multivariate time series.IEEE Transactions on Knowledge and Data Engineering, 2025. Das, A., Kong, W., Sen, R., and Zhou, Y . A decoder- only foundation model for time-series forecasting. In Forty-first International Conference on Machine Learn- ing, 2024. Dooley, S., Khurana, G. S., Mohapatra, C., Naidu, S. V ., and White, C. Forecastpfn: Synthetically-trained zero-shot forecasting.Advances in Neural Information Processing Systems, 36:2403–2426, 2023. Ekambaram, V ., Kumar, S., Jati, A., Mukherjee, S., Sakai, T., Dayama, P., Gifford, W. M., and Kalagnanam, J. Tspulse: Dual space tiny pre-trained models for rapid time-series analysis.arXiv preprint arXiv:2505.13033, 2025. Fang, Y ., Xie, J., Zhao, Y ., Chen, L., Gao, Y ., and Zheng, K. Temporal-frequency masked autoencoders for time series anomaly detection. In2024 IEEE 40th International Conference on Data Engineering (ICDE), pp. 1228–1241. IEEE, 2024. Gao, S., Koker, T., Queen, O., Hartvigsen, T., Tsiligkaridis, T., and Zitnik, M. Units: A unified multi-task time se- ries model.Advances in Neural Information Processing Systems, 37:140589–140631, 2024. Godahewa, R., Bergmeir, C., Webb, G. I., Hyndman, R. J., and Montero-Manso, P. Monash time series forecasting archive. Goswami, M., Szafer, K., Choudhry, A., Cai, Y ., Li, S., and Dubrawski, A. Moment: A family of open time-series foundation models.arXiv preprint arXiv:2402.03885, 2024. Hoo, S. B., M ¨uller, S., Salinas, D., and Hutter, F. From tables to time: How tabpfn-v2 outperforms special- ized time series forecasting models.arXiv preprint arXiv:2501.02945, 2025. Huet, A., Navarro, J. M., and Rossi, D. Local evaluation of time series anomaly detection algorithms. InProceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 635–645, 2022. Kaji, D. A., Zech, J. R., Kim, J. S., Cho, S. K., Dangayach, N. S., Costa, A. B., and Oermann, E. K. An attention based deep learning model of clinical events in the inten- sive care unit.PloS one, 14(2):e0211057, 2019. Lan, T., Gao, Y ., Lu, Y ., and Zhang, C. Cicada: Cross- domain interpretable coding for anomaly detection and adaptation in multivariate time series.arXiv preprint arXiv:2505.00415, 2025. Liu, F. T., Ting, K. M., and Zhou, Z.-H. Isolation forest. In 2008 eighth ieee international conference on data mining, pp. 413–422. IEEE, 2008. Liu, Q. and Paparrizos, J. The elephant in the room: Towards a reliable time-series anomaly detection benchmark.Ad- vances in Neural Information Processing Systems, 37: 108231–108261, 2024. Liu, Y ., Qin, G., Shi, Z., Chen, Z., Yang, C., Huang, X., Wang, J., and Long, M. Sundial: A family of highly capable time series foundation models.arXiv preprint arXiv:2502.00816, 2025. Moroshan, V ., Siems, J., Zela, A., Carstensen, T., and Hutter, F. Tempopfn: Synthetic pre-training of linear rnns for zero-shot time series forecasting.arXiv preprint arXiv:2510.25502, 2025. Nam, Y ., Yoon, S., Shin, Y ., Bae, M., Song, H., Lee, J.-G., and Lee, B. S. Breaking the time-frequency granularity discrepancy in time-series anomaly detection. InProceed- ings of the ACM Web Conference 2024, pp. 4204–4215, 2024. Paparrizos, J., Boniol, P., Palpanas, T., Tsay, R. S., Elmore, A., and Franklin, M. J. V olume under the surface: a new accuracy evaluation measure for time-series anomaly detection.Proceedings of the VLDB Endowment, 15(11): 2774–2787, 2022. Ren, H., Xu, B., Wang, Y ., Yi, C., Huang, C., Kou, X., Xing, T., Yang, M., Tong, J., and Zhang, Q. Time-series anomaly detection service at microsoft. InProceedings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 3009–3017, 2019. Sarfraz, M. S., Chen, M.-Y ., Layer, L., Peng, K., and Koulakis, M. Position: Quo vadis, unsupervised time series anomaly detection? InInternational Conference on Machine Learning, pp. 43461–43476. PMLR, 2024. Shen, L., Li, Z., and Kwok, J. Timeseries anomaly de- tection using temporal hierarchical one-class network. Advances in neural information processing systems, 33: 13016–13026, 2020. 10 TimeRCD for Zero-Shot Time Series Anomaly Detection Shentu, Q., Li, B., Zhao, K., Shu, Y ., Rao, Z., Pan, L., Yang, B., and Guo, C. Towards a general time series anomaly detector with adaptive bottlenecks and dual adversarial decoders.arXiv preprint arXiv:2405.15273, 2024. Shi, X., Wang, S., Nie, Y ., Li, D., Ye, Z., Wen, Q., and Jin, M. Time-moe: Billion-scale time series founda- tion models with mixture of experts.arXiv preprint arXiv:2409.16040, 2024. Su, Y ., Zhao, Y ., Niu, C., Liu, R., Sun, W., and Pei, D. Robust anomaly detection for multivariate time series through stochastic recurrent neural network. InProceed- ings of the 25th ACM SIGKDD international conference on knowledge discovery & data mining, pp. 2828–2837, 2019. Taga, E. O., Ildiz, M. E., and Oymak, S. Timepfn: Effec- tive multivariate time series forecasting with synthetic data. InProceedings of the AAAI Conference on Artificial Intelligence, volume 39, pp. 20761–20769, 2025. Tuli, S., Casale, G., and Jennings, N. R. Tranad: deep trans- former networks for anomaly detection in multivariate time series data.Proceedings of the VLDB Endowment, 15(6):1201–1214, 2022. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I. At- tention is all you need.Advances in neural information processing systems, 30, 2017. Wilson, G., Doppa, J. R., and Cook, D. J. Calda: Im- proving multi-source time series domain adaptation with contrastive adversarial learning.IEEE transactions on pattern analysis and machine intelligence, 45(12):14208– 14221, 2023. Wong, L., Liu, D., Berti-Equille, L., Alnegheimish, S., and Veeramachaneni, K. Aer: Auto-encoder with regression for time series anomaly detection. In2022 IEEE Inter- national Conference on Big Data (Big Data), pp. 1152– 1161, 2022. doi: 10.1109/BigData55660.2022.10020857. Woo, G., Liu, C., Kumar, A., Xiong, C., Savarese, S., and Sahoo, D. Unified training of universal time series fore- casting transformers. 2024. Wu, X., Qiu, X., Li, Z., Wang, Y ., Hu, J., Guo, C., Xiong, H., and Yang, B. Catch: Channel-aware multivariate time series anomaly detection via frequency patching. InThe Thirteenth International Conference on Learning Representations. Xie, S., Feofanov, V ., Alonso, M., Odonnat, A., Zhang, J., Palpanas, T., and Redko, I. Cauker: classification time series foundation models can be pretrained on synthetic data only.arXiv preprint arXiv:2508.02879, 2025. Xie, Z., Li, Z., He, X., Xu, L., Wen, X., Zhang, T., Chen, J., Shi, R., and Pei, D. Chatts: Aligning time series with llms via synthetic data for enhanced understanding and reasoning.arXiv preprint arXiv:2412.03104, 2024. Xu, J., Wu, H., Wang, J., and Long, M. Anomaly trans- former: Time series anomaly detection with association discrepancy.arXiv preprint arXiv:2110.02642, 2021. Yahya, M. A., Moya, A. R., and Ventura, S. Deep learn- ing for multivariate time series anomaly detection: an evaluation of reconstruction-based methods.Artificial Intelligence Review, 58(12):400, 2025. Yang, Y ., Zhang, C., Zhou, T., Wen, Q., and Sun, L. Dcde- tector: Dual attention contrastive representation learning for time series anomaly detection. InProceedings of the 29th ACM SIGKDD conference on knowledge discovery and data mining, pp. 3033–3045, 2023. Yoon, S., Kim, J., Ha, J., and Ko, Y . M. Momemto: Patch-based memory gate model in time series foundation model.arXiv preprint arXiv:2509.18751, 2025. Zamanzadeh Darban, Z., Webb, G. I., Pan, S., Aggarwal, C., and Salehi, M. Deep learning for time series anomaly detection: A survey.ACM Computing Surveys, 57(1): 1–42, 2024. Zhang, C., Song, D., Chen, Y ., Feng, X., Lumezanu, C., Cheng, W., Ni, J., Zong, B., Chen, H., and Chawla, N. V . A deep neural network for unsupervised anomaly detec- tion and diagnosis in multivariate time series data. In Proceedings of the AAAI conference on artificial intelli- gence, volume 33, pp. 1409–1416, 2019. 11 TimeRCD for Zero-Shot Time Series Anomaly Detection A. Related Work State-of-the-art TSAD algorithmTraditional unsupervised TSAD operates by training models on domain-specific normal data to identify deviations in unseen test sets. Within this paradigm, two primary approaches have been dominant. Reconstruction-based methods identify anomalies by quantifying the error when attempting to rebuild an input signal, with higher errors indicating anomalous behavior (Audibert et al., 2020; Su et al., 2019; Zhang et al., 2019; Tuli et al., 2022; Nam et al., 2024). In parallel, discrepancy-based methods learn discriminative representations by maximizing the distinction between normal and anomalous patterns or distributions (Xu et al., 2021; Yang et al., 2023; Shen et al., 2020; Darban et al., 2025; Lan et al., 2025; Wilson et al., 2023). However, the reliance of these methods on in-domain normal data presents a fundamental barrier to generalization, leading to significant performance degradation in zero-shot scenarios where the model encounters data from new, unseen domains. While the recent emergence of foundation models aims to overcome this transferability issue, many approaches remain anchored in reconstruction-error inference (Shentu et al., 2024; Gao et al., 2024; Goswami et al., 2024; Liu et al., 2025; Yoon et al., 2025), which can suffer from anobjective mismatch. To our knowledge, this work is among the first foundation-model approaches for zero-shot TSAD built around relative contextual discrimination. Synthetic data for time series analysisThe paradigm of leveraging synthetic data for pre-training time series models has been extensively validated, particularly in the domain of forecasting, where it has led to significant performance gains across various benchmarks (Xie et al., 2025; Cai et al., 2024; Dooley et al., 2023; Hoo et al., 2025; Taga et al., 2025; Bhethanabhotla et al., 2024; Moroshan et al., 2025). Following this trend, several foundation models for general time series analysis have been successfully trained on a hybrid corpus of real-world and synthetic data to enhance their generalization capabilities (Ansari et al., 2024; Das et al., 2024; Shi et al., 2024; Goswami et al., 2024). In contrast, the application of purely synthetic data for TSAD remains substantially less explored. Existing efforts in this area have primarily focused on data augmentation, where artificial anomalies are injected into real-world time series to enrich the training set (Shentu et al., 2024; Darban et al., 2025). While effective, these methods are still fundamentally dependent on the availability and diversity of the underlying real data. Other studies have discussed the generation of entirely synthetic anomalous time series but have not applied this data to the end-to-end training of a dedicated TSAD model (Cai et al., 2024; Xie et al., 2024). To the best of our knowledge, this work is among the first to propose and implement a pre-training framework for a foundation model dedicated to TSAD that relies exclusively on a large-scale, fully synthetic dataset. B. Data Generation Our synthetic data generation framework is designed as a curriculum to encourage broad generalization across diverse temporal patterns and causal couplings. The four-stage process first builds a complex, predictable “normal” context (Stages 1-2) and then introduces meaningful, context-violating anomalies (Stage 3). Finally, we generate causally aware ground-truth labels that teach the model to link an anomaly’s root cause to its downstream effects (Stage 4), preparing it for zero-shot detection on unseen systems. Stage 1: Synthesizing the “Normal” Univariate ContextEvery time series, whether it stands alone or is a component in a multivariate system, begins as a univariate baseline signal, xbase(t). This signal is constructed as an additive composite of trend, seasonal, and noise components: xbase(t) =T(t) +S(t) +ε(t), t= 0,1, . . . , n−1. Sequence length.We samplenfrom 100 to 10000 to match variable-length sequences. Trend T(t) .We mix deterministic and stochastic trends: Tdet(t) and Tstoc(t). Set T(t) = (1−ρ T )T det(t) +ρT Tstoc(t) with ρT ∈[0,1]. The detailed construction of the trend component is given in Appendix B.2. SeasonalityS(t).A mixture ofKperiodic atoms: S(t) = KX k=1 Ak wk(2πfkt+φ k;θ k), where wk is selected from a library (sinusoid, square/triangle wave, wavelet atom), with amplitude Ak >0 , frequency fk, phase φk, and shape parameters θk (e.g., duty cycle for square, mother/scale for wavelets). Frequencies may be harmonic fk =m kf0 or incommensurate. The detailed construction of the seasonal component is given in Appendix B.3. 12 TimeRCD for Zero-Shot Time Series Anomaly Detection Noiseε(t).Zero-mean noise with optional piecewise volatility: ε(t)∼ N 0, σ2(t)  , σ(t) =σ 0 RY r=1 1 +υ r 1[ar,br)(t)  , allowing volatility bursts over windows[a r, br). This captures heteroskedastic segments. Stage 2: Weaving the Multivariate Causal Context via a Discretized ODE SystemThis stage creates a multivariate system with clear causal dependencies. We first conceptualize continuous-time causal dynamics (ODE) and then discretize the dynamics into an autoregressive with exogenous inputs (ARX) model using the Euler scheme. 1. Generate a Causal Structure (DAG):Sample a directed acyclic graph G= (V, E) over N nodes by first drawing an Erd˝os–R´enyi graph and then orienting edges along a random topological order to avoid cycles. Edge presence is controlled byp edge ∈(0,1). An edge(j, i)∈Emeans seriesjcausally influencesi. 2. Define the Continuous-Time Causal Dynamics (ODE Model):We model the evolution of thecausal influenceon each node, zi(t), as a first-order linear ODE. This equation describes how the influence on node i changes over time based on its own internal state and forcing from its parent nodesP(i): dzi(t) dt =−γ izi(t) + X j∈P(i) βijxj(t−τ ij) +C i Here, −γizi(t) represents an internal decay term, the sum represents the forcing from parent nodes xj, and Ci is a constant bias. 3.Discretize to an ARX Model for Implementation:With Euler and∆t= 1, the discrete ARX is zi[t] =a izi[t−1] + X j∈P(i) bijxj[t−ℓ ij] +c i,|a i| ≤0.8, where ai = 1−γ i encodes decay stability, delays ℓij ∈ {0, . . . , ℓmax}, and bij are exogenous gains. We sample ai ∼ U[−0.8,0.8],ℓij ∼ U {0, . . . , ℓmax}, andb ij ∼ N(0, σ2 b )(variance scaled by in-degree). 4.Mix the Signals:The observed node mixes baseline with causal channel: xi[t] = (1−α i)x base,i(t) +α i zi[t], α i ∈[0,1]. In vector form (x[t], z[t]∈R N ), z[t] =A z[t−1] + ℓmaxX δ=0 B(δ)x[t−δ] +c, x[t] = (I−A ′)x base(t) +A ′ z[t], whereA= diag(a i),A ′ = diag(αi), andB (δ) encodes lagged influences. This process, performed sequentially according to the topological sort, creates a system where a change in a parent node will naturally propagate to its child nodes after a specified delay. Stage 3: Principled Anomaly Injection: Simulating Causal and Contextual ComplexityOur primary contribution in data generation lies in a synthetic framework designed to address critical gaps in existing anomaly detection benchmarks, namely the lack of causal realism and contextual complexity. To achieve this, our methodology introduces a novel causal framework for generating anomalies based on two distinct, complementary philosophies: • Endogenous Anomaly (Internal System Failure):This strategy simulates how a single root-cause anomaly propagates through an interconnected system. An anomaly is introduced into the baseline series of a parent nodebeforecausal mixing. Its effects are then passed to descendant nodes based on the ARX model, creating a realistic cascade of causally-linked anomalous events. • Exogenous Anomaly (External Shock):This mirrors more conventional techniques, modeling an external event impacting an otherwise normal system. The normal multivariate system is fully generated first, and then a segment of a single series is overwritten with an anomalous template. 13 TimeRCD for Zero-Shot Time Series Anomaly Detection Stage 4: Label Generation and Causal PropagationWe generate token-level binary labels. For exogenous injections, positive labels correspond to the intervention window. For endogenous injections, we label the root-cause window and extend it to descendant channels based on their causal lags, as implied by the DAG and ARX lags {ℓij}. To capture the duration of these propagated effects, we use a decay time scale derived from the linear dynamics in Stage 2. Specifically, for the AR recurrence, we approximate the decay time scale as t1/2 ≈ln(2)/(1− |ai|). We define the effective anomaly window for descendant nodes by extending the root-cause duration by a factor of this decay time scale (e.g., 3×t 1/2), ensuring the label encompasses the period where the causal shock remains significant before decaying. While our generation process tracks channel-specific anomalies (root-cause vs. propagated effects), for this work, we aggregate these into temporal localization labels (marking when an anomaly occurs across any channel). This aligns with standard zero-shot anomaly detection benchmarks, which typically provide timestep-level but not channel-level ground truth. Sequence lengths, DAG sparsity, ARX coefficients, and signal regimes (trend, seasonality, noise) are sampled from configurable priors (Appendix B.1), generating rich, interpretable dynamics designed for zero-shot learning. In addition to causal dynamics, we move beyond simple point anomalies by creating a rich taxonomy of contextual anomalies designed to violate specific, established patterns within the data. These include: • Local/Change Anomalies:Additive templates, ∆(t), applied over a window, representing events like a sudden sensor glitch (Spike), a component failure shifting its baseline (Level Shift), or mechanical vibrations (Shake). x′ anom(t) =x norm(t) + ∆(t)fort∈[t s, te) • Seasonal Anomalies:The normal seasonal component S(t) is replaced with an altered version S′(t). These anoma- lies simulate systemic issues such as a machine operating at the wrong speed (Frequency Change) or process desynchronization (Phase Shift). x′ anom(t) =T(t) +S ′(t) +ε(t)fort∈[t s, te) In contrast to methods that inject isolated anomalies into independent time series, our dual-pronged approach provides a more challenging and realistic benchmark. By generating complex scenarios with both contextual violations and causal propagation, our dataset enables a more robust evaluation of a model’s ability to understand system-wide dynamics. Details for constructing the anomaly types are provided in Appendix B.4. B.1. Hyperparameters and Sampling Mappings To make the generation process transparent yet non-programmatic, we group hyperparameters into dataset-level controls (Table 4), attribute families and their sampling weights (Table 5), and multivariate graph and causal dynamics (Table 6). Table 4.Dataset-level generation controls and intended effects. 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. B.2. Trend Types and Formal Definitions We instantiate the trend component T(t) using five archetypes aligned with the generator configuration. Let t∈ {0, . . . , n− 1}. Increase / Decrease / Constant.We use an affine model T(t) =k 0 +k 1t, with constraints:increaseusesk 1 >0,decreaseusesk 1 <0, andconstantusesk 1 = 0(constant baseline). 14 TimeRCD for Zero-Shot Time Series Anomaly Detection Table 5.Attribute categories, options, and relative probability. 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 increase 0.2 constant 0.2 multiple 0.3 ARIMA 0.1 Frequency regimehigh frequency 0.5 low frequency 0.5 Noise level almost no noise 0.25 low 0.25 moderate 0.25 high 0.25 Table 6.Multivariate and causal-dynamics hyperparameters and intended roles. 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 autoregressionai real in[−0.8,0.8]per node Decay/stability of latent causal influence. ARX exogenous gainsbij zero-mean with finite variance per edge Strength of parent-to-child coupling. ARX biasci bounded real interval per node Baseline offset in causal channel. Mixing weightαi real in[0,1]per node Balance between baseline and causal channel. Multiple (piecewise trend).To capture mixed regimes, we allow P change-points at integer knots0< τ1 <· · ·< τP < n and define a piecewise-linear trend with slope updates: T(t) =k 0 +k 1t+ PX p=1 δp  t≥τ p  (t−τ p)+, where(u) + = max{u,0}andδ p adjusts slope after eachτ p. This matches the additive hinge construction used in Stage 1. ARIMA (stochastic trend).For stochastic trends we use a differenced ARMA process. Let ∇d be the d-th difference operator. A general ARIMA(p, d, q) satisfies ϕ(B)∇ dT(t) =θ(B)ε T (t), ε T (t)∼ N(0, σ2 T ), with backshift B, AR polynomial ϕ(B) = 1− Pp i=1 ϕiBi, and MA polynomial θ(B) = 1 + Pq j=1 θjBj. In practice we use small orders (e.g.,p, q≤2) and modest variance. B.3. Seasonality Types and Formal Definitions We support five seasonal archetypes. Let the base period be P >0 (in samples), frequency f= 1/P , amplitude A >0, and phaseφ∈[0,2π). No periodic fluctuation.No seasonality is present: S(t) = 0. Sin periodic fluctuation.A sinusoidal component: S(t) =Asin 2πf t+φ  . 15 TimeRCD for Zero-Shot Time Series Anomaly Detection Square periodic fluctuation.A rectangular wave with duty cycled∈(0,1): S(t) =Asgn sin(2πf t+φ)  , or equivalently by its Fourier seriesS(t) = 4A π P modd m−1 sin(2πmf t+φ); duty-cycle variants modulate on/off durations per period. Triangle periodic fluctuation.A symmetric triangle wave of periodP: S(t) = 8A π2 X modd (−1)(m−1)/2 m2 sin(2πmf t+φ), equivalently realizable as a piecewise-linear ramp that rises and falls within each period. Wavelet periodic fluctuation.A sum of localized atoms (e.g.,db,sym,coif,haar,bior,dmeyfamilies): S(t) = LX ℓ=1 Aℓ ψℓ  t−τ ℓ sℓ  , A ℓ ∈R, s ℓ >0, τ ℓ ∈R. B.4. A Taxonomy of Synthetic Anomaly Archetypes Following the high-level description, we now provide complete, self-contained definitions and formulas for each anomaly type supported by our generator. We divide them into two families: Local/Change Anomalies (abrupt, windowed changes) and Seasonal Anomalies (contextual violations of periodic structure). We avoid shorthand; every symbol is explicitly defined. A comprehensive summary of all anomaly archetypes with intents and formal definitions is provided in Table 7. Notation and primitives.We use discrete time index t∈ {0,1, . . . , n−1}. The normal (anomaly-free) series is denoted byx norm(t). An anomaly acts on a closed-open window[t s, te)with integers0≤t s < te ≤n. The indicator function is 1[ts,te)(t) = ( 1, t s ≤t < te, 0,otherwise. The Heaviside step function at integer times isH(t;t 0) =1 [t0,∞)(t). For any scalar u, the logistic sigmoid isσ(u) = 1 1+e−u . For a rectangular window we use h(t;t s, te) =1 [ts,te)(t). All amplitudes A, B,{Am} are real scalars; all durations and lags (e.g.,w, τr, τf , d) are positive integers unless otherwise stated. B.4.1. LOCAL/CHANGEANOMALIES All local anomalies are applied additively within a window using a template∆(t): x′ anom(t) =x norm(t) + ∆(t)1[ts,te)(t), t= 0,1, . . . , n−1. Spikes and bursts • Upward spike(a single sharp positive glitch). Parameters: center time t0 ∈[t s, te), half-width w∈N +, amplitude A >0. Define ∆(t) =Amax  1− |t−t 0| w ,0  , t∈Z. •Downward spike(a single sharp negative glitch). Same parameters as above with negative amplitude: ∆(t) =−Amax  1− |t−t 0| w ,0  . • Continuous upward spikes(a burst of multiple positive spikes). Parameters: spike count M∈N +, centers spaced by strided∈N +, per-spike amplitudesA m >0, per-spike widthsw m ∈N +. Define ∆(t) = M−1X m=0 Am max  1− |t−(t 0 +md)| wm ,0  . 16 TimeRCD for Zero-Shot Time Series Anomaly Detection 250 500 750 1000 1250 1500 1750 2000 1 0 1 2 3 Time Series Value Increase after upward spike 1750 2000 2250 2500 2750 3000 3250 3500 1 0 1 2 3 Time Series Value Triangle pulse width modulation 1500 1750 2000 2250 2500 2750 3000 3250 1.5 1.0 0.5 0.0 0.5 1.0 1.5 2.0 Time Series Value Outlier 0 200 400 600 800 1000 1200 1400 2.5 2.0 1.5 1.0 0.5 0.0 0.5 Time Series Value Decrease after upward spike 2000 2250 2500 2750 3000 3250 3500 3750 1.50 1.25 1.00 0.75 0.50 0.25 0.00 0.25 Time Series Value Slow rise followed by rapid decline 3500 3750 4000 4250 4500 4750 5000 0.5 1.0 1.5 2.0 2.5 3.0 Time Series Value Sin remove harmonic 500 750 1000 1250 1500 1750 2000 2250 3 2 1 0 1 2 Time Series Value Sudden decrease 3250 3500 3750 4000 4250 4500 4750 5000 2 1 0 1 2 Time Series Value Rapid decline followed by slow rise 250 500 750 1000 1250 1500 1750 2000 0.5 0.0 0.5 1.0 1.5 2.0 Time Series Value Continuous upward spike 1500 1750 2000 2250 2500 2750 3000 3250 2 1 0 1 2 3 Time Series Value Downward convex 4200 4400 4600 4800 5000 3 2 1 0 1 Time Series Value Sin modify harmonic mod phase 2000 2250 2500 2750 3000 3250 3500 3750 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Time Series Value Upward convex 2750 3000 3250 3500 3750 4000 4250 4500 0.5 0.0 0.5 1.0 1.5 2.0 2.5 Time Series Value Sin phase shift 750 1000 1250 1500 1750 2000 2250 2500 2.0 1.5 1.0 0.5 0.0 0.5 Time Series Value Sudden increase 750 1000 1250 1500 1750 2000 2250 2500 1.0 0.5 0.0 0.5 1.0 Time Series Value Downward spike 2250 2500 2750 3000 3250 3500 3750 4000 3 2 1 0 1 Time Series Value Decrease after downward spike 1250 1500 1750 2000 2250 2500 2750 3000 1.5 1.0 0.5 0.0 0.5 1.0 Time Series Value Wavelet family 3500 3750 4000 4250 4500 4750 5000 2 1 0 1 2 3 Time Series Value Wavelet add wavelet 3600 3800 4000 4200 4400 4600 4800 5000 1.0 0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Time Series Value Increase after downward spike 750 1000 1250 1500 1750 2000 2250 2500 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0.5 1.0 Time Series Value Wide downward spike 3500 3750 4000 4250 4500 4750 5000 2 1 0 1 2 Time Series Value Wavelet amplitude 1500 1750 2000 2250 2500 2750 3000 3250 2.5 2.0 1.5 1.0 0.5 0.0 0.5 Time Series Value Upward spike 750 1000 1250 1500 1750 2000 2250 2500 2 1 0 1 2 3 Time Series Value Slow decline followed by rapid rise 1000 1250 1500 1750 2000 2250 2500 2750 1.5 1.0 0.5 0.0 0.5 1.0 1.5 Time Series Value Rapid rise followed by slow decline 750 1000 1250 1500 1750 2000 2250 2500 Time Step 2 1 0 1 2 3 Time Series Value Wavelet scale 2750 3000 3250 3500 3750 4000 4250 4500 Time Step 1.0 0.5 0.0 0.5 1.0 Time Series Value Shake 2000 2250 2500 2750 3000 3250 3500 3750 Time Step 1.0 0.5 0.0 0.5 1.0 1.5 2.0 2.5 Time Series Value Square pulse width modulation 3600 3800 4000 4200 4400 4600 4800 5000 Time Step 0.5 1.0 1.5 2.0 2.5 3.0 Time Series Value Wide upward spike 3250 3500 3750 4000 4250 4500 4750 5000 Time Step 3 2 1 0 1 Time Series Value Continuous downward spike 4200 4400 4600 4800 5000 Time Step 3.0 2.5 2.0 1.5 1.0 0.5 Time Series Value Sin waveform Multi-Anomaly Type Visualization from Synthetic Dataset Time Series Values Anomaly Regions Figure 9.Illustration of synthetic anomaly archetypes. 17 TimeRCD for Zero-Shot Time Series Anomaly Detection •Continuous downward spikes(a burst of negative spikes). Use ∆(t) = M−1X m=0 (−Am) max  1− |t−(t 0 +md)| wm ,0  . • Wide upward spike(longer rise, short plateau, and fall). Parameters: rise length τr ∈N +, fall length τf ∈N +, amplitudeA >0. Define ∆(t) =    A t−ts τr , t∈[t s, ts +τ r), A, t∈[t s +τ r, te −τ f ), A 1− t−(te−τf ) τf  , t∈[t e −τ f , te), 0,else. •Wide downward spike(longer fall then recovery). Use the same piecewise definition with amplitude−A. •Outlier(single-point shock). Parameters: positiont 0 ∈[t s, te), amplitudeA∈R. Define the Kronecker impulse ∆(t) = ( A, t=t 0, 0, t̸=t 0. Level shifts and plateaus • Sudden increase(permanent level up-shift). Parameters: slope parameter κ >0, amplitude A >0, change time t0 ∈[t s, te). Define ∆(t) =A σ κ(t−t 0)  , σ(u) = 1 1 +e −u . •Sudden decrease(permanent level down-shift). Use ∆(t) =−A σ κ(t−t 0)  . • Convex/Concave plateau(temporary level change using a raised-cosine window). Parameters: window [ts, te), amplitudeA >0, signs∈ {+1,−1}(convex whens= +1, concave whens=−1). Define ∆(t) =s A 1 2  1−cos π(t−t s) te −t s  1[ts,te)(t). Asymmetric transients • Rapid rise followed by slow decline. Parameters: rise time constant τr ∈N +, fall time constant τf ∈N +, peak time tp ∈[t s, te], amplitudeA >0. Define ∆(t) =A  1−e − t−ts τr  1[ts,tp)(t) +A e − t−tp τf 1[tp,te)(t), τ r ≪τ f . •Slow rise followed by rapid decline. Use the same definition withτ r ≫τ f . • Rapid decline followed by slow rise. Use the above definition with amplitude −A and swap rise/fall roles accordingly. •Slow decline followed by rapid rise. Use the rapid rise–slow decline formula with amplitude−Aandτ r ≫τ f . Spike + level interaction • Decrease after upward spike. Parameters: spike template ∆spk(t) (e.g., the triangular spike above), post-spike shift magnitudeB >0, shift startt 1 ≥t s. Define ∆(t) = ∆spk(t)−B H(t;t 1), H(t;t 1) =1 [t1,∞)(t). 18 TimeRCD for Zero-Shot Time Series Anomaly Detection •Increase after downward spike. Using a negative spike template∆ nspk(t)and a positive shiftB >0: ∆(t) = ∆nspk(t) +B H(t;t1). •Increase after upward spike. Use ∆(t) = ∆spk(t) +B H(t;t1). •Decrease after downward spike. Use ∆(t) = ∆nspk(t)−B H(t;t 1). High-frequency burst • Shake(localized high-frequency vibration). Parameters: carrier frequency fh ∈R >0 in cycles per sample, phase φ∈[0,2π), amplitudeA >0. With a rectangular windowh(t;t s, te), ∆(t) =A h(t;ts, te) sin(2πf ht+φ). B.4.2. SEASONALANOMALIES Seasonal anomalies are implemented by replacing the seasonal component S(t) with a modified component S′(t) strictly within the window[t s, te), while leaving the rest unchanged: x′ anom(t) = ( T(t) +S ′(t) +ε(t), t s ≤t < te, T(t) +S(t) +ε(t),otherwise. Universal transforms (any waveform) •Waveform inversion(polarity flip). Fort∈[t s, te), setS ′(t) =−S(t). •Amplitude scaling. Fort∈[t s, te), setS ′(t) =r S(t)with scaling factorr >0. • Frequency change. Let the original period be P >0 and frequency f= 1/P . Choose a period multiplier ρ >0 and set the new period P ′ =ρP and frequency f ′ = 1/P ′. For a sinusoid S(t) =Asin(2πf t+φ) , define S′(t) =Asin(2πf ′t+φ)fort∈[t s, te). •Noise injection. Fort∈[t s, te), setS ′(t) =S(t) +η(t)with i.i.d. Gaussian noiseη(t)∼ N(0, σ 2 S). • Waveform change from sine to square/triangle. If S(t) is sinusoidal with amplitude A and period P , replace it by a square/triangle waveform wnew(t;A, P, θ)of the same amplitude and period (with shape parameters θ) for t∈[t s, te). Sinusoidal-specific (harmonics and phase)Let a sinusoidal seasonal component be represented by a finite harmonic sum S(t) = NX n=1 An sin 2πnf t+φ n  , and optionally include amplitude modulation for each harmonic via An(t) = An n (1 +d n sin(ωmt+ψ n)), d n ∈[0,1), ω m >0, ψ n ∈[0,2π). •Phase shift. Fort∈[t s, te), update all phases by a fixed shift∆φ∈(0,2π):φ n 7→φ n + ∆φ. • Add harmonic. For t∈[t s, te), add a new harmonic of order m∈N +: S′(t) =S(t) +A h sin(2πmf t+φ h) with amplitudeA h >0and phaseφ h ∈[0,2π). 19 TimeRCD for Zero-Shot Time Series Anomaly Detection • Remove harmonic. For t∈[t s, te), remove one existing harmonic index n∗ ∈ {1, . . . , N}from the sum, keeping the others unchanged. • Modify harmonic phase. For t∈[t s, te), choose one index n∗ and set φn∗ 7→φ ′ n∗ such that |φ′ n∗ −φ n∗ | ≥δfor a given thresholdδ >0. •Modify amplitude-modulation depth. Fort∈[t s, te), choose indexn ∗ and setd n∗ 7→d ′ n∗ within[0,1). •Modify modulation frequency. Fort∈[t s, te), updateω m 7→ω ′ m withω ′ m >0. •Modify modulation phase. Fort∈[t s, te), choose indexn ∗ and setψ n∗ 7→ψ ′ n∗. Square/Triangle-specific (pulse geometry)For a square or triangle waveform with period P >0, define the duty cycle d∈(0,1) as the fraction of each period the waveform is at its high level, and define a cycle start parameter δ∈[0,1) that shifts the waveform phase relative to each period. •Pulse shift. Fort∈[t s, te), apply a phase shift∆∈(−1,1)cycles:δ7→(δ+ ∆) mod 1. •Pulse width modulation. Fort∈[t s, te), scale the duty cycle by a factorλ >0:d7→d ′ = min{1,max{0, λd}}. Wavelet-based (atoms and families)Let a wavelet-based seasonal component be represented as a finite sum of atoms S(t) = LX ℓ=1 Aℓ ψℓ  t−τ ℓ sℓ  , A ℓ ∈R, s ℓ >0, τ ℓ ∈R. • Family change. For t∈[t s, te), replace each mother wavelet ψℓ taken from a family F by a corresponding wavelet ˜ψℓ from a different family ˜Fwhile keepingA ℓ, sℓ, τℓ unchanged. •Scale change. Fort∈[t s, te), update scales by a factorλ >0:s ℓ 7→s ′ ℓ =λs ℓ for selected indices. •Shift change. Fort∈[t s, te), update translations byτ ℓ 7→τ ′ ℓ =τ ℓ + ∆τ,ℓ. •Amplitude change. Fort∈[t s, te), rescale coefficients byA ℓ 7→r ℓ Aℓ withr ℓ >0. •Add wavelet. Fort∈[t s, te), append a new atomA + ψ+ t−τ+ s+  with specified parameters. •Remove wavelet. Fort∈[t s, te), remove one existing atom index from the sum. C. Mathematical Formulation of Relative Context Discrepancy C.1. Definition of RCD Some widely used anomaly-detection pipelines score timesteps largely through local deviations, for example by measuring deviation from expected values or by assessing reconstruction errors.Relative Context Discrepancy (RCD)frames the problem differently. Rather than focusing on the individual value of a token, it evaluates whether therelationshipsa token forms with its surrounding context remain consistent with normal relational patterns. Under this view, an anomaly emerges as a disruption in these relational structures, and RCD therefore emphasizes relational inconsistency rather than absolute deviation. C.2. Mathematical Formulation of RCD Consider a time-series sequence X1, X2, . . . , XT , where each Xt denotes the observation at time t. RCD does not describe Xt by its value alone, but by how it interacts with the other tokens in the sequence. 20 TimeRCD for Zero-Shot Time Series Anomaly Detection Table 7.Summary of anomaly archetypes, intents, and formal definitions. Family Type Intent (one sentence) Formal definition (within[t s, te)) Local Upward spike A single sharp positive glitch∆(t) =Amax(1− |t−t 0|/w,0) Downward spike A single sharp negative glitch∆(t) =−Amax(1− |t−t 0|/w,0) Continuous upward spikes Rapid consecutive positive spikes PM−1 m=0Ammax(1− |t−(t0 +md)|/wm,0) Continuous downward spikes Rapid consecutive negative spikes PM−1 m=0(−Am) max(1− |t−(t0 +md)|/wm,0) Wide upward spike Longer rise/plateau/fall pulse piecewise linear rise/hold/fall with amplitudeA Wide downward spike Longer fall/plateau/rise pulse piecewise linear with amplitude−A Outlier Single-point shock∆(t) =Aift=t 0, else0 Sudden increase Permanent upward level shift∆(t) =A σ(κ(t−t 0)) Sudden decrease Permanent downward level shift∆(t) =−A σ(κ(t−t 0)) Convex/Concave plateau Temporary level changesA 1 2 1−cos(π(t−ts)/(te −ts)) Rapid rise→slow decline Fast excitation then slow decayA(1−e −(t−ts)/τr)1[ts,tp) +Ae−(t−tp)/τf1[tp,te) Slow rise→rapid decline Slow excitation then fast decay same as above withτ r ≫τf Rapid decline→slow rise Fast drop then slow recovery negative-amplitude version of above Slow decline→rapid rise Slow drop then fast recovery negative-amplitude version of above Decrease after upward spike Spike followed by downward shift∆ spk(t)−B H(t;t1) Increase after downward spike Negative spike then upward shift∆ nspk(t) +B H(t;t1) Increase after upward spike Spike followed by upward shift∆ spk(t) +B H(t;t1) Decrease after downward spike Negative spike then downward shift∆nspk(t)−B H(t;t1) Shake Localized high-frequency vibrationAsin(2πf ht+φ)within[ts, te) Seasonal Waveform inversion Polarity flip of seasonal componentS ′(t) =−S(t) Amplitude scaling Change seasonal magnitudeS ′(t) =r S(t) Frequency change Alter base period/frequencyS ′(t)withP′ =ρP(e.g.,f′ = 1/P′) Noise injection Add Gaussian noise to seasonalityS ′(t) =S(t) +η(t), η∼ N(0, σ2S) Waveform change (sin→square/triangle) Replace waveform familyS ′(t) =wnew(t;A, P, θ) Phase shift (sinusoid) Global phase offsetφ n 7→φn + ∆φ Add harmonic (sinusoid) Introduce new harmonicS ′(t) =S(t) +Ahsin(2πmf t+φh) Remove harmonic (sinusoid) Remove one harmonic drop indexn ∗ term inP n Modify harmonic phase Change one harmonic phaseφ n∗ 7→φ′n∗ Modify amp-mod depth Change amplitude modulation depthd n∗ 7→d′n∗ Modify modulation frequency Change modulation frequencyω m 7→ω′m Modify modulation phase Change modulation phaseψ n∗ 7→ψ′n∗ Pulse shift (square/triangle) Shift cycle startδ7→(δ+ ∆) mod 1 Pulse width modulation Change duty cycled7→d ′ = min{1,max{0, λd}} Wavelet family change Swap mother wavelet familyψ ℓ ∈ F →˜ψℓ ∈ ˜F Wavelet scale change Rescale atom widths ℓ 7→s′ℓ =λsℓ Wavelet shift change Shift atom translationτ ℓ 7→τ′ℓ Wavelet amplitude change Rescale atom amplitudeA ℓ 7→rℓAℓ Add wavelet atom Add new atom append(A +, s+, τ+, ψ+) Remove wavelet atom Remove existing atom delete one summand index To formalize this, introduce two functions. The first, f(X j, Xt), is a pairwise interaction function representing how token Xj contributes to the interpretation of token Xt. This function captures therelativeaspect of RCD by explicitly modeling token-to-token relationships: f(X j, Xt). Anomalies, however, typically arise not from a single unusual interaction, but from anunusual patternof interactions. This motivates an aggregation functiongthat synthesizes all pairwise contributions into a contextual embedding for tokent: embeddingXt =g f(X 1, Xt), f(X2, Xt), . . . , f(XT , Xt)  . This embedding summarizes the relational profile that determines how token t fits into its broader temporal context. Under this formulation, an anomaly corresponds to an embedding that deviates from those produced under normal relational patterns. The combination of f and g therefore operationalizes the central RCD principle:the meaning of a token arises from its relationships with the rest of the sequence. 21 TimeRCD for Zero-Shot Time Series Anomaly Detection C.3. Instantiation in TimeRCD via Self-Attention The RCD formulation aligns naturally with the mechanism of self-attention. In a Transformer, each token Xt produces a query vector qt =X tW Q, while each tokenX j generates kj =X jW K, v j =X jW V . The pairwise interaction between tokenstandjis expressed through the scaled dot-product score stj = qt ·k j√dk . The corresponding unnormalized contribution can be written as f(X j, Xt) =v j exp(stj), which directly instantiates the pairwise interaction functionf. Self-attention aggregates these contributions using softmax normalization, which serves as a concrete realization of the aggregation functiong: embeddingXt = P j vj exp  qt·kj√dk  P j exp  qt·kj√dk  . Within the RCD perspective, discrepancy corresponds to deviations in the attention pattern of token Xt relative to the relational patterns learned from pre-training data. When a token is anomalous, its query–key interactions produce an atypical similarity distribution stj, leading to a context embedding that lies outside the manifold of embeddings observed during normal behavior. The anomaly head is then trained to map such deviations in the embedding to a high anomalous probability, thereby converting relational irregularity directly into an anomaly score. C.4. Anomaly Head, Reconstruction Head, and Training Objective TimeRCD employs two heads during training: an anomaly head and a reconstruction head. The anomaly head applies a lightweight MLP to each contextual embedding and outputs logits for the normal and anomalous classes: logitsxt =AnomalyHead(embedding Xt ), and the anomaly score is defined as the softmax probability of the anomalous class: AnomalyScorext =softmax(logits xt )[1]. The reconstruction head is a 3-layer MLP that predicts a scalar reconstruction for each timestep: bxt =ReconstructionHead(embedding Xt ). The total loss combines a cross-entropy loss for anomaly prediction and an MSE loss for reconstruction: Ltotal =λ anomaly ·CrossEntropy(logits xt , yt) +λ recon ·MSE(bxt, xt), where yt and xt are the label and value at timestamp t, respectively. In all experiments, both weighting coefficients are set to λanomaly =λ recon = 1. 22 TimeRCD for Zero-Shot Time Series Anomaly Detection D. Details of experiments D.1. Benchmark Datasets Our evaluation uses a selection of datasets from one primary source, the TSB-AD benchmark by (Liu & Paparrizos, 2024). Our dataset selection prioritizes evaluation quality and avoids redundancy. A substantial fraction of the TSB-AD benchmark’s “univariate” section consists of decomposed multivariate datasets (where dimensions of multivariate series are treated as separate univariate ones), which can introduce bias and inflate performance metrics. To ensure a rigorous and unbiased evaluation, we deliberately filtered out these decomposed series, focusing ongenuinely univariatedatasets for the univariate track and selecting five standard multivariate datasets for the multivariate track (testing them in their original form). This selection covers diverse domains (e.g., medical, industrial, server metrics, finance, weather) while preventing “double counting” and providing a clearer picture of model capabilities. • Univariate Datasets: We utilize a diverse collection of univariate datasets including IOPS, MGAB, NAB, NEK, Power, SED, Stock, TODS, UCR, WSD, and Y AHOO. • Multivariate Datasets: For multivariate anomaly detection, we use the MSL, PSM, SMAP, SMD, and SWaT datasets. These are sourced from industrial control systems and spacecraft telemetry, presenting complex, multi-dimensional dependencies. The specific characteristics of these datasets, including their domain, number of time series (TS), average length, and anomaly ratio, are summarized in Table 8 and Table 9. Table 8.Univariate Datasets Name Domain #TS Avg Length AR (%) UCR Misc. 228 67818.7 0.6 NAB Web 28 5099.7 10.6 Y AHOO 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 Stock Finance 20 15000 9.4 TODS Traffic 15 5000.0 6.3 NEK Weather 9 1073.0 8.0 Power Power Grid 1 35040.0 8.5 WSD Weather 111 17444.5 0.6 Table 9.Multivariate 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 D.2. Baselines Our study compares a range of baseline models, categorized into zero-shot and full-shot detectors, following the methodology from TSB-AD benchmark (Liu & Paparrizos, 2024) and the DADA (Shentu et al., 2024). Zero-shot models.These models are pre-trained on large-scale datasets and can be applied directly to new time series without target-domain training. 23 TimeRCD for Zero-Shot Time Series Anomaly Detection • DADA: This model, from the paper by (Shentu et al., 2024), is a pre-trained general anomaly detector. We set the window size to 100. • MOMENT: A foundation model that utilizes a patch-based pre-training strategy to learn rich representations from diverse time series data (Goswami et al., 2024). We use a window size of 64. • TimesFM: A decoder-only transformer model from Google trained on a large time series corpus using a patching strategy, enabling strong zero-shot generalization (Das et al., 2024). We set the window size to 96. • Chronos: A generative model that frames time series analysis as a language modeling task, using a transformer-based architecture to learn and predict time series values (Ansari et al., 2024). Its window size is 100. • Time MOE: A decoder-only transformer model with a sparse Mixture-of-Experts (MoE) architecture. It is pre-trained on a large time series corpus for forecasting and multi-task learning (Shi et al., 2024). We set the window size to 96. • MovingVar.: A simple statistical detector that scores each timestamp by the variance inside a moving window. We include it as a lightweight, non-neural baseline under the same evaluation protocol to test whether local variance shifts can account for the observed performance. Full-shot models.These models require training on the target dataset. • TranAD: A transformer-based model that uses a reconstructive approach to detect anomalies by comparing original and reconstructed time series (Tuli et al., 2022). It is configured with a window size of 10. • USAD: An autoencoder-based model that employs an adversarial training mechanism to enhance its reconstruction capability and anomaly detection (Audibert et al., 2020). We set the window size to 100. • OmniAnomaly: A deep learning model that uses a Variational Autoencoder (V AE) with a Gated Recurrent Unit (GRU) to learn normal patterns and detect deviations (Su et al., 2019). The model is configured with a window size of 100. • Sub-PCA: A subspace-based method that detects anomalies by identifying deviations in principal component subspaces (Liu & Paparrizos, 2024). The model decomposes multivariate time series into subspaces and flags anomalies based on reconstruction errors in these subspaces. • DCdetector: A deep learning approach that combines dual attention mechanisms and contrastive learning for time series anomaly detection (Yang et al., 2023). The model uses both temporal and channel-wise attention to capture complex dependencies. • TFMAE: A transformer-based masked autoencoder that learns representations by reconstructing masked time series segments (Fang et al., 2024). The model leverages self-supervised pre-training to learn robust temporal patterns for anomaly detection. • LOF: A traditional statistical method that measures the local deviation of a data point from its neighbors, identifying anomalies with lower local density (Breunig et al., 2000). We set the number of neighbors ton= 50 for both univariate and multivariate settings and use the Euclidean metric. • IForest: An ensemble of Isolation Trees that isolates anomalies based on the number of random partitions required to separate them from the rest of the data (Liu et al., 2008). For univariate datasets, we set n estimators to 200, and for multivariate, we set n estimators to 25 and max features to 0.8. D.3. Pre-training Overlap with Evaluation Benchmarks We exclude certain baseline results (specifically from DADA and MOMENT) because their pre-training corpora heavily overlap with our zero-shot test benchmarks, violating the zero-shot evaluation setting. • DADA: Its pre-training data includes IOPS, MGAB, and Y AHOO (Shentu et al., 2024). • MOMENT: Uses the “Time Series Pile,” which contains IOPS, MGAB, NAB, YAHOO, MSL, SMAP, and SMD (Goswami et al., 2024). 24 TimeRCD for Zero-Shot Time Series Anomaly Detection D.4. Evaluation Metric Calculations Our performance evaluation is conducted using four metrics: Affiliation F1 (F1 A), Temporal F1 (F1 T ), Standard F1 (F1 ), and VUS-PR. We adopt a selection of metrics from the TSB-AD benchmark (Liu & Paparrizos, 2024) for Affiliation F1 (F1 A), Standard F1 (F1), and VUS-PR. For Temporal F1, we follow the implementation of (Sarfraz et al., 2024). • Standard-F1The Standard F1-score is a widely used metric that provides a harmonic mean of precision and recall. It is calculated using point-wise True Positives (TP), False Positives (FP), and False Negatives (FN). • F1-TTemporal F1, as described by (Sarfraz et al., 2024), is a range-based metric that evaluates anomaly detection performance by considering the temporal context of anomalies. It is a variant of the F1-score that addresses common issues in time series evaluation, such as overlapping predictions and temporal proximity. • Affiliation-F (F1 A)Affiliation F1 is a distance-based metric that measures the “affiliation” or proximity between the ground truth and predicted anomaly points. It is designed to be less sensitive to minor temporal shifts in the predicted anomalies. The score is calculated by finding the optimal one-to-one mapping between the ground truth and detected anomalies and then computing the F1-score based on these affiliations (Huet et al., 2022). • VUS-PR(V olume Under Surface - Precision/Recall) is a threshold-independent, parameter-free metric for time series anomaly detection. Unlike point-wise metrics, VUS-PR is robust to time lags and measures the area under a 3D surface plot of precision, recall, and a buffer parameter (Paparrizos et al., 2022). It addresses the limitations of standard F1 scores by creating a continuous buffer region around each anomaly, thus providing a more reliable and nuanced evaluation of model performance. D.5. Training Details Pre-training SetupThe pre-training setup for our time series model is built around a transformer architecture. This encoder features 8 transformer layers, each with 8 attention heads. The internal dimension (d model) of the model is 512, which is then projected down to a dimension of 256 (d proj). The input time series is divided into patches of size 16. The model is trained using the AdamW optimizer with a learning rate of 5e-4 and a weight decay of 1e-5. The total loss is a sum of two components: a Mean Squared Error loss for a masked reconstruction task and a Cross-Entropy loss for an anomaly detection task. Training runs for a maximum of 50 epochs with a batch size that starts at 64 but is adjusted dynamically, and it includes an early stopping mechanism that halts training if the validation loss does not improve for 7 epochs. Pre-training Dataset DetailsWe trained our modelonlyon our custom synthetic dataset, which comprises a total of 2.5B data points. This dataset is composed of a vast number of individual time series with widely varying lengths. Figure 10 illustrates the distribution of these lengths. As the histogram shows, our pre-training curriculum follows a long-tailed distribution. It is dominated by a large volume of shorter series, which teaches the model common, localized patterns. Critically, it also includes a significant and diverse tail of longer series, with lengths extending up to 10,000 time steps. For multivariate series, our training data mixes channel counts of 1, 8, 12, 16, and 20 variables to ensure robustness across varying multivariate settings. E. Extended Results and Analysis E.1. Full Results This section provides the complete, unabridged performance results that support the summary claims made in the main text. Experimental Setup and Zero-Shot ProtocolOur evaluation involves two distinct comparisons: (1) a directzero-shot comparison against other foundation models and lightweight statistical baselines, and (2) a comparison againstfull-shot models where specialized baselines are trained on the target data. For the main results in Table 1, TimeRCD uses a single fixed context window of 5000 for every dataset. Under this protocol, TimeRCD ranks first in38and second in14of the 64 zero-shot evaluation cases (16 datasets × 4 metrics). Against full-shot baselines, TimeRCD ranks first in35and second in3 cases. 25 TimeRCD for Zero-Shot Time Series Anomaly Detection 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. Context Window Size Parameters for Main ResultsFor the main results presented in Table 1, a fixed context window of 5kis used for every dataset. Appendix E.3 reports window-size sensitivity only as an analysis of how performance changes with context length, not as the protocol used to select the main-table results. E.2. Contextual Analysis To provide a controlled environment for testing our model’s contextual understanding, we generated a new suite of specialized, unseen test datasets. The objective was to create two distinct sets: one containing onlypoint anomaliesand another containing onlycontextual anomalies. This section details their construction process. General Construction ProcessEach dataset was generated using the framework described in the main paper, with a crucial modification: only one type of anomaly was injected per set. We first synthesized a complex “normal” baseline series, combining trend, seasonal, and noise components. We then injected specific anomalies into these clean series to create our test cases. These datasets were not used in any part of the pre-training process. Point Anomaly DatasetsPoint anomalies are defined as short-term, localized deviations that can be identified by comparing a data point to its immediate neighbors, without requiring long-range context. Contextual Anomaly DatasetsContextual anomalies are defined as deviations from a long-term, established pattern, such as a disruption in a seasonal cycle. Detecting them requires the model to understand the global structure of the time series. Dataset SummaryThe final collection consists of two distinct sets of time series, with their key characteristics summarized in Table 10. 26 TimeRCD for Zero-Shot Time Series Anomaly Detection 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 inbold. Type Metric TimeRCD Chronos DADA MOMENT TSPulse Time MOE TimesFM Point Affiliation-F 0.9120.899 0.823 0.886 0.733 0.793 0.889 F1T 0.6040.441 0.387 0.551 0.214 0.303 0.446 Standard-F1 0.5210.352 0.121 0.472 0.090 0.149 0.397 VUS-PR 0.6660.293 0.396 0.538 0.063 0.190 0.385 Contextual Affiliation-F 0.9490.804 0.721 0.813 0.730 0.756 0.792 F1T 0.7810.174 0.227 0.284 0.210 0.269 0.154 Standard-F1 0.8270.154 0.048 0.172 0.088 0.078 0.140 VUS-PR 0.8790.108 0.132 0.169 0.056 0.063 0.101 E.3. Window Size Sensitivity Analysis In this section, we show the detailed performance of our model across different context window sizes (from 1k to 13k) for each of the four primary evaluation metrics. The following figures provide a per-dataset breakdown, which supports the summarized analysis presented in the main paper. The results in Figures 11 through 14 empirically validate our key finding: the optimal context length is task-dependent, and datasets with long-term or complex structures see a clear benefit from larger window sizes. • Positive Scaling Trend:A positive association between window size and performance is evident for several datasets across most metrics. For example,Power,UCR,MGAB,SMD, andSMAPall demonstrate a general upward trend, especially on the F1-T, Standard-F1, and VUS-PR metrics. This suggests that for these series, a larger context provides a more robust understanding of “normality,” leading to better anomaly detection. • Flat Performance on Short Series:In contrast, datasets with inherently short time series, such asYAHOO,NEK, andTODS, show a flat performance profile. Their scores remain largely unchanged regardless of the window size. This is expected because the length of the time series itself acts as the natural context limit, and the implementation masks padded positions. • Task-Dependent Fluctuation:Other datasets, likeNAB,PSM, andSWaT, exhibit more fluctuating or non-monotonic behavior. For these, the ideal window size varies, with performance sometimes peaking at intermediate lengths. This underscores the value of having a flexible architecture where the context window can be tuned as a hyperparameter to achieve optimal results for a specific task. • Metric Sensitivity:The Affiliation-F metric (Figure 11) generally appears less sensitive to changes in window size compared to the other three metrics. This suggests that while a larger context may be crucial for the precise, point-wise accuracy captured by metrics such as Standard-F1, the broader, proximity-based evaluation of Affiliation-F is less affected. These detailed results reinforce the conclusion that the model’s ability to handle extensive, variable-length contexts is an important feature for a general-purpose time-series anomaly detector. 27 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 11.Affiliation-F performance across all 14 datasets as a function of the input window size from 1k to 13k. 28 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 12.F1 T performance across all 14 datasets as a function of the input window size from 1k to 13k. 29 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 13.Standard-F1 performance across all 14 datasets as a function of the input window size from 1k to 13k. 30 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 14.VUS-PR performance across all 14 datasets as a function of the input window size from 1k to 13k. 31 TimeRCD for Zero-Shot Time Series Anomaly Detection Table 11.Impact of Context Window Size: Performance comparison across available datasets. Best values are highlighted inred, second-best in blue. Metric Model Univariate Datasets Total Total IOPS MGAB NAB NEK Power SED TODS UCR YAHOO Stock WSD 1st 2nd Affiliation-F 1k 91.3467.15 89.6083.9566.26 81.19 85.03 80.55 94.30 48.8191.93 03 01 2k 89.18 68.38 90.3183.9575.63 90.4785.7281.8195.9446.25 91.81 03 01 3k 89.87 72.80 92.7183.9583.0595.1285.43 83.4795.9443.45 92.06 03 02 4k 89.92 73.34 93.3983.9580.87 90.00 84.91 83.5495.9442.9692.20 03 00 5k 86.9874.5493.8183.9585.02 88.99 84.86 84.3495.9441.31 91.00 03 01 6k 89.70 74.07 93.5383.9579.68 92.22 84.8686.43 95.9441.37 89.45 03 02 7k 88.93 71.36 93.8583.9581.67 88.46 84.86 85.6295.9441.62 89.28 02 00 8k 88.26 73.3294.11 83.9582.14 79.72 84.86 85.8895.9441.61 89.90 03 00 9k 89.74 73.68 94.06 83.9575.22 82.28 84.86 85.6795.9441.21 89.39 02 01 10k 89.36 72.03 93.8783.9579.66 80.53 84.86 85.2395.9440.53 89.72 02 00 11k 90.11 73.69 93.9483.9583.70 82.62 84.86 85.5295.9441.19 90.38 02 00 12k 89.48 70.78 93.8283.9582.83 80.52 84.86 86.0395.9441.52 89.16 02 00 13k 89.62 71.37 93.8183.9582.61 82.88 84.86 86.39 95.9442.11 90.19 02 01 14k 90.27 69.92 93.9683.9581.84 82.75 84.86 85.7095.9442.30 90.27 02 01 15k 88.38 72.47 93.9683.95 87.1878.77 84.86 86.1795.9442.70 89.99 03 00 F1 T 1k 44.51 1.82 40.4176.9121.19 42.45 67.87 30.64 76.39 23.2841.35 02 01 2k 40.81 1.74 42.6676.9119.84 56.63 69.22 33.7279.1421.21 43.16 02 02 3k 44.15 4.07 48.4176.9119.8466.26 69.3538.4079.1419.59 45.04 04 01 4k 46.62 7.18 49.2676.9125.18 54.52 66.55 38.6779.1419.0845.07 03 01 5k 45.39 9.0550.49 76.9123.05 60.59 68.46 41.1879.1418.38 44.13 03 01 6k 43.02 10.33 49.2476.9122.09 54.29 68.46 43.0179.1418.72 39.58 02 00 7k 41.58 11.34 50.1876.9124.80 49.63 68.46 42.9779.1418.25 37.37 02 00 8k 46.9212.40 50.0876.9127.30 41.71 68.46 43.3879.1418.53 36.93 03 00 9k 44.80 11.03 50.1176.9122.26 46.14 68.46 44.0779.1418.64 36.41 02 00 10k 42.98 12.06 50.1376.9129.84 45.47 68.46 43.0479.1418.52 36.85 02 00 11k 42.49 15.40 50.29 76.9132.16 49.70 68.46 43.9179.1418.76 37.73 02 01 12k 44.49 12.54 49.8876.9133.95 46.84 68.46 43.8579.1418.67 37.45 02 00 13k 43.4816.7349.6376.9135.90 51.35 68.46 44.35 79.1419.21 38.69 03 02 14k 44.33 15.91 50.0976.9133.86 51.66 68.46 43.9079.1419.37 38.23 02 01 15k 45.40 14.98 50.1276.91 36.5349.60 68.4644.89 79.1419.63 38.15 04 00 Standard-F1 1k 40.31 1.71 30.7868.6420.70 42.68 65.47 24.64 86.19 24.6743.14 02 01 2k 39.33 1.50 33.0468.6417.82 56.88 68.47 27.2989.0522.54 44.14 02 02 3k 42.70 3.72 40.2268.6415.4466.5969.39 31.8789.0520.8345.73 04 01 4k 48.66 6.62 41.7368.6425.23 54.78 66.71 31.7289.0520.24 43.88 02 00 5k 47.28 8.6342.66 68.6423.12 60.85 70.0233.4789.0519.56 41.04 04 01 6k 46.43 9.28 41.4968.6421.32 54.7070.0236.09 89.0519.77 36.57 03 01 7k 45.76 10.27 42.5468.6424.54 49.9870.0235.0289.0519.29 35.79 03 00 8k 47.97 10.36 42.3668.6427.33 42.0270.0235.7189.0519.59 36.09 03 00 9k 49.689.45 42.4868.6421.90 46.5370.0235.9889.0519.64 36.13 04 00 10k 48.24 11.94 42.5068.6429.90 45.7370.0234.9889.0519.47 35.86 03 00 11k 47.20 14.95 42.5768.6432.24 50.0870.0235.5889.0519.75 36.15 03 00 12k 47.95 10.81 42.2768.6434.02 47.1370.0235.8589.0519.65 35.65 03 00 13k 47.7517.0041.9468.6436.03 51.7770.0235.9989.0520.25 36.80 04 01 14k 48.99 14.00 42.5068.6433.73 51.8670.0235.8789.0520.37 36.65 03 01 15k 48.75 16.64 42.60 68.64 36.4549.9070.02 36.91 89.0520.65 36.77 05 02 VUS-PR 1k 35.82 0.70 28.7371.1311.29 37.63 92.61 19.40 83.32 76.6732.64 02 02 2k 32.00 0.91 32.5271.1310.22 63.47 92.19 20.3487.8874.92 35.99 02 01 3k 38.48 1.86 41.2371.1311.0782.47 93.4425.9187.8873.7937.49 05 00 4k 41.43 2.72 42.1571.1314.24 60.52 90.57 24.6187.8873.19 36.72 02 01 5k 42.98 3.0944.65 71.1314.63 69.86 91.67 27.4887.8872.73 29.95 03 01 6k 39.31 3.45 42.3371.1313.67 67.65 91.67 30.0387.8872.81 26.25 02 00 7k 39.85 3.72 44.4371.1316.63 58.93 91.67 29.1587.8872.71 24.99 02 00 8k 41.76 3.90 44.2671.1317.25 45.83 91.67 30.1787.8872.61 25.40 02 00 9k 43.13 3.47 44.44 71.1313.89 52.28 91.67 30.3987.8872.93 25.06 02 01 10k 42.58 3.96 44.3671.1319.51 51.41 91.67 30.0587.8872.58 25.52 02 00 11k 41.96 4.60 44.3771.1321.39 56.05 91.67 30.3287.8872.85 25.84 02 00 12k 42.32 3.62 43.8571.1322.19 50.37 91.67 30.7187.8872.57 25.94 02 00 13k 42.545.4043.7071.1324.29 57.42 91.67 30.80 87.8873.25 26.01 03 02 14k 43.77 4.20 44.1671.1322.47 56.01 91.67 30.7687.8873.18 26.49 02 01 15k 43.934.88 44.2071.13 25.6755.60 91.6731.35 87.8873.07 27.02 05 01 32 TimeRCD for Zero-Shot Time Series Anomaly Detection E.4. Additional Analysis for Data Scaling In this section, we provide the full, per-dataset results for our investigation into the impact of pre-training data scale on model performance. These granular results support the weighted average trends and conclusions presented in the main paper. Experimental SetupTo investigate the effect of pre-training data scale, we trained our model on increasingly larger subsets of our synthetic dataset: 350M, 700M, and the full 2.5B data points. Each model was trained using an identical protocol to isolate the effect of the data volume. Due to the predominantly univariate nature of the large-scale datasets used to construct our synthetic curriculum, this scaling analysis was conducted exclusively on the nine univariate benchmark datasets. Detailed Results and AnalysisThe results, presented in Table 12, show a positive empirical scaling trend. As the volume of pre-training data increases, the model’s overall performance generally improves. This is most evident in the “Total 1st” place rankings, where the full2.5Bmodel outperforms the smaller models across all four metrics, securing the top rank in 24 out of 36 total evaluations. While the general trend is clear, the per-dataset results reveal some nuances. The scaling is not perfectly monotonic for every dataset-metric combination. For instance, the700Mmodel achieves the best F1-T score on the IOPS and Y AHOO datasets, and the350Mmodel shows strong performance on the NEK dataset. These variations likely stem from a combination of dataset-specific characteristics and the inherent stochasticity of the training process. Overall, the aggregate rankings support the value of a large-scale pre-training curriculum. They are also consistent with continued gains from additional pre-training data in this regime, although they do not establish a saturation point. Table 12.Performance comparison across different models and metrics. Best results for each dataset-metric combination are highlighted inred, and second-best are in blue . Metric Model Datasets Total Total IOPS MGAB NAB NEK Power SED TODS UCR YAHOO 1st 2nd Affiliation-F 2.5B 84.7970.6979.7079.7368.30 96.87 85.91 84.63 96.65 06 01 700M 86.46 68.87 86.4372.7473.0292.07 83.95 82.23 93.74 02 05 350M 88.2468.19 86.21 79.27 63.30 89.21 83.22 82.49 92.35 01 03 F1 T 2.5B 27.7001.81 42.9035.8720.17 69.43 65.89 34.3085.86 06 00 700M 40.5601.49 27.82 42.31 05.13 59.02 64.07 28.8886.88 02 05 350M 36.08 01.08 25.6955.0606.23 53.92 58.76 31.59 85.99 01 04 Standard-F1 2.5B 20.5101.62 32.4633.05 15.59 69.88 67.01 28.13 87.02 06 01 350M 30.6301.13 30.1250.89 17.3954.18 61.66 24.38 82.16 03 01 700M 30.08 01.51 32.17 42.68 12.63 59.31 66.45 22.71 83.92 00 07 VUS-PR 2.5B 15.7101.0529.02 27.8809.88 80.75 93.46 23.09 84.41 06 01 700M 26.510.7200 30.1836.27 08.51 67.37 91.62 18.35 78.48 02 05 350M 24.07 0.7000 27.1648.6609.66 61.63 88.62 20.59 74.68 01 03 E.5. Additional Analysis for Ablation Study The controlled ablation on the anomaly head, reconstruction objective, and inference rule is reported in Table 3. This study uses the same backbone, tokenization, synthetic corpus, and comparable training budget, and therefore provides a cleaner comparison across training objectives and inference rules. In particular, it distinguishes reconstruction as a training-time scaffold from reconstruction error as an inference-time anomaly score. F. Statistical Analysis Summary Scenario Affiliation-F F1 T Standard-F1 VUS-PR Avg Rank Zero-shot Univariate2nd (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 Multivariate1st (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 Univariate1st (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 Multivariate4th (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 Table 13.TimeRCD Performance Summary across All Scenarios. Legend: MR = Mean Rank, M = Mean, MD = Median 33 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 15.Statistical ranking visualization for zero-shot univariate anomaly detection. G. Efficiency and Scalability of TimeRCD This appendix provides additional profiling results for TimeRCD in comparison with two baselines, TimeMOE and DADA. The goal is to characterize the computational feasibility, scalability, and memory behavior of TimeRCD across a wide range of sequence lengths, including regimes beyond those reported in the main text. TimeRCD is evaluated on sequences up to 15,000 timesteps. For a sequence of 10,000 timesteps, TimeRCD achieves an inference latency of 21.8 ms, corresponding to a speedup of 12.6× over TimeMOE and 95.2× over DADA under the same hardware and profiling setup. Even at 15,000 timesteps, the inference time remains 86.22 ms, which is compatible with real-time or near real-time monitoring requirements in many practical applications. In our profiling setup, latency grows sublinearly over the measured sequence-length range. In terms of memory, TimeRCD processes the entire input sequence rather than using a fixed-size sliding window. This design provides a longer effective receptive field and richer temporal context at the cost of increased memory usage with sequence length. At 10,000 timesteps, peak memory consumption is approximately 1.5 GB, which remains manageable on widely available GPUs. TimeRCD also uses 3.2× fewer parameters than TimeMOE (35.5M vs. 113.4M), mitigating model storage and deployment overhead while maintaining favorable long-sequence efficiency. G.1. Inference Time (1k–10k Timesteps) All models are profiled on a single GPU using isolated processes and a global warmup phase to reduce variability. Table 14 reports the end-to-end inference latency as a function of sequence length. 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 Table 14.Inference time (ms) as a function of sequence length for TimeRCD and baselines. Across all lengths, TimeRCD exhibits a much slower growth in latency compared to TimeMOE and DADA. This behavior is primarily attributed to its patch-based processing (patch size = 16), which effectively reduces the computational burden for long sequences while preserving temporal coverage. G.2. Peak Memory Usage and Parameter Counts Table 15 summarizes peak memory usage for different sequence lengths together with the parameter counts of each model. TimeMOE and DADA have approximately constant memory usage with respect to sequence length due to their use of fixed-size sliding windows, which limit the effective context. In contrast, TimeRCD processes the full sequence and therefore exhibits increasing memory consumption with longer inputs. Nevertheless, the resulting memory requirements remain well within the capabilities of common consumer-grade GPUs for the sequence lengths considered here. 34 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 16.Statistical ranking visualization for zero-shot multivariate anomaly detection. 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 Table 15.Peak memory usage (MB) and parameter counts for TimeRCD and baselines. G.3. Scalability to Long Contexts (Up to 15k Timesteps) To further characterize long-context behavior, TimeRCD is evaluated on sequences up to 15,000 timesteps. Table 16 reports the end-to-end inference latency, peak memory usage, and a normalized efficiency measure in milliseconds per 1,000 timesteps. 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 Table 16.Scalability of TimeRCD up to 15,000 timesteps. The efficiency metric (milliseconds per 1,000 timesteps) decreases substantially when moving from 1,000 to 5,000 timesteps and then stabilizes around 5–6 ms per 1,000 timesteps for longer sequences. This pattern indicates that fixed overheads are amortized as the sequence length grows, leading to stable per-timestep cost in the long-context regime. Overall, these extended results indicate that TimeRCD provides favorable latency and memory characteristics for long- context time series over the measured range, with a memory footprint suitable for both research and practical deployments. 35 TimeRCD for Zero-Shot Time Series Anomaly Detection Figure 17.Statistical ranking visualization for full-shot univariate anomaly detection. Figure 18.Statistical ranking visualization for full-shot multivariate anomaly detection. 36