Introduction
Time series foundation models (TSFMs) have recently delivered substantial gains in the landscape of time series analysis. Pre-trained on massive and diverse corpora, TSFMs such as Aurora [54 ] , ROSE [49 ] , Chronos [4 ] , and MOMENT [18 ] encode rich universal representations of temporal dynamics and demonstrate strong zero-shot and few-shot generalization across various downstream tasks. Time series anomaly detection (TSAD) is one of the key downstream tasks of TSFMs. It aims to identify deviations from expected patterns, playing a critical role in many real-world applications such as industrial control [50 ] , disease identification [40 ] , and fraud detection [3 ] .
Although TSFMs have strong expressive power, their design is fundamentally reconstruction- or forecasting-centric, where internal features are shaped for broad pattern modeling. Since such general-purpose representation capability can often efficiently model both normal and abnormal patterns, the existing common practice of directly repurposing the reconstruction/forecasting errors of TSFMs for anomaly detection is questionable. As illustrated in Figure 1 , both reconstruction-based and forecasting-based TSFMs can effectively reconstruct or forecast most of the abnormal observations, resulting in small reconstruction/forecasting errors for not only normal data but also anomalies. This phenomenon fundamentally undermines the widely-used TSAD intuition that anomalies are harder to reconstruct or forecast than normal data [35 , 59 , 30 , 65 ] . We also provide a theoretical analysis of this issue in Appendix § 10 .
Figure 1. (a) Anomaly scores for reconstruction-based TSFMs. (b) Anomaly scores for forecasting-based TSFMs.
Figure 1: (a) and (b) respectively show the anomaly score distributions of normal and abnormal observations for reconstruction-based and forecasting-based TSFMs and their NCL-augmented counterparts on the PSM dataset [1 ] . NCL enables both types of TSFMs to produce substantially more discriminative anomaly scores.
To address this challenge, a natural idea is to adapt TSFMs for anomaly detection through fine-tuning strategies [24 , 42 ] (Park & Yoon 2026). However, fine-tuning pre-trained foundation models risks catastrophic forgetting of the rich temporal knowledge, on which the anomaly scoring mechanisms in the fine-tuned TSFMs still heavily rely when computing the reconstruction or forecasting errors. This raises a critical question: How can we effectively leverage the powerful representational capacity of frozen TSFMs while steering their outputs toward a normality regime so that abnormal deviations stand out more clearly?
In this paper, we propose Normality Constraint Learning (NCL) , a lightweight plug-and-play framework that can augment diverse TSFMs for accurate anomaly detection without modifying their pre-trained parameters. Our key insight is that, while TSFMs can capture a broad spectrum of temporal patterns, reconstruction/forecasting-error-based anomaly detection requires identifying and emphasizing the relevant normal patterns only; we therefore first construct a normality subspace from this broad pattern space and then adaptively steer each patch feature toward normality within the subspace, guided by compact and discriminative manifolds learned from a few normal patch features.
To this end, NCL is instantiated with three main components, namely normal subspace construction (NormSpace ), patch-adaptive normality transformation (PatchNT ), and contrastive normality constraint (ConNC ). NormSpace constructs a compact normality subspace via singular value decomposition (SVD) of patch features from a few training subsequences encoded by a frozen TSFM. Within this subspace, PatchNT adaptively calibrates patch features toward a learnable normality manifold along each principal direction, while ConNC guides this adaptive transformation by encouraging the formation of compact and discriminative normality manifolds. The calibrated features across all normality directions are then aggregated into consensus features that reinforce normal components. Finally, these features are decoded and fused with the original TSFM output to enhance the normal patterns, thereby amplifying the discrepancy between normal and abnormal data. As shown in Figure 1 , augmenting TSFMs with NCL yields more discriminative anomaly score distributions than vanilla TSFMs (see Appendix K for additional results). In summary, our contributions are as follows:
We propose NCL, a novel plug-and-play framework that augments frozen TSFMs with normality constraints to learn calibrated normality features, thereby substantially sharpening the reconstruction/forecasting error-based anomaly scores of the TSFMs.
We further instantiate NCL with three components: NormSpace, PatchNT, and ConNC. NormSpace constructs a normality subspace, while PatchNT adaptively transforms patch features toward the normality regime. This transformation is guided by ConNC to encourage the formation of compact yet discriminative normality manifolds within the regime.
Extensive experiments on popular TSAD datasets demonstrate that NCL consistently and significantly improves the anomaly detection performance of diverse families of TSFMs.
Related Work
Time Series Anomaly Detection
Conventional TSAD approaches rely on statistical techniques and machine learning methods, which detect anomalies based on deviation from statistical properties or density estimates (Breunig et al., 2000; Yairi et al., [56 ] ; Liu et al., [29 ] ; Hariri et al., [19 ] . Recently, the advent of deep learning has significantly advanced TSAD capabilities. Reconstruction-based methods [27 , 53 , 61 , 25 ] learn to reconstruct normal patterns and identify anomalies through large reconstruction errors, while forecasting-based approaches [31 , 9 , 63 ] detect anomalies by measuring discrepancies between predicted and actual future observations. Meanwhile, contrastive learning [32 , 34 ] (Park & Kang 2026) has emerged as a powerful paradigm for learning discriminative representations.
Despite these advances, existing methods typically require training a separate model for each new dataset or application, i.e. , they are trained from scratch on large-scale domain-specific normal data and evaluated on the testing dataset from the same domain. This strong dependence on abundant in-domain data severely limits their applicability to scenarios where such data are scarce or costly to obtain [44 , 26 , 21 ] .
Time Series Foundation Models for Anomaly Detection
The recent emergence of TSFMs provides a generalization path, modeling universal temporal representations through large-scale time series pre-training. Most existing TSFMs [17 , 45 , 54 ] are task-general, which are pre-trained on massive data with general objectives (e.g. , reconstruction or forecasting), and are applied to various downstream tasks such as forecasting and anomaly detection. However, directly applying TSFMs to anomaly detection presents fundamental challenges. As noted by recent studies [30 , 65 ] , task-general TSFMs effectively model both normal and anomalous patterns. This undermines the widely-used TSAD intuition that anomalies are harder to reconstruct or forecast than normal data.
More recently, TSAD-specific foundation models have also been explored [44 , 26 , 21 ] . For instance, DADA [44 ] utilizes injected anomalies to explicitly distinguish between normal and abnormal patterns, while TimeRCD [26 ] conducts relative context discrepancy pre-training on synthetic anomalies. TimeRadar [21 ] is focused on leveraging these synthetic anomalies to enforce contextual deviations. These methods require mass synthetic anomalies to enrich the pre-training corpus. However, Low-quality anomalies may cause the foundation models to specialize in artificial deviations that do not transfer to real-world distributions [55 , 64 ] , thereby leading to high detection errors.
Preliminaries
Time Series Anomaly Detection (TSAD). Given a time series X = ( x 1 , x 2 , … , x T ) ∈ R D × T \mathbf{X} = (\mathbf{x}_1, \mathbf{x}_2, \ldots, \mathbf{x}_T) \in\mathbb{R}^{D \times T} X = ( x 1 , x 2 , … , x T ) ∈ R D × T with D D D channels and T T T ordered observations, the task of TSAD is to calculate an anomaly score s t ∈ R s_t \in\mathbb{R} s t ∈ R for each x t ∈ R D \mathbf{x}_t \in\mathbb{R}^{D} x t ∈ R D at timestamp t t t . The optimal goal is to assign each anomalous observation a larger anomaly score than all the normal observations.
Time Series Foundation Models for Anomaly Detection. Most TSFMs rely on data reconstruction and/or forecasting objectives in their training, and furthermore, reconstruction and forecasting errors are widely-used effective anomaly measures in TSAD. Thus, these models are the backend TSFMs in this work. Formally, a TSFM F \mathcal{F} F typically regards a time series subsequence X t − L : t = ( x t − L , x t − L + 1 , … , x t − 1 ) ∈ R D × L \mathbf{X}_{t-L:t} = (\mathbf{x}_{t-L}, \mathbf{x}_{t-L+1}, \ldots, \mathbf{x}_{t-1}) \in\mathbb{R}^{D \times L} X t − L : t = ( x t − L , x t − L + 1 , … , x t − 1 ) ∈ R D × L as a sample input, and produces either a reconstruction of the input X ^ t − L : t \hat{\mathbf{X}}_{t-L:t} X ^ t − L : t or a forecast of future observations X ^ t : t + F \hat{\mathbf{X}}_{t:t+F} X ^ t : t + F over a horizon F F F . For notational brevity, we unify both paradigms by letting Y t \mathbf{Y}_t Y t denote the prediction target, i.e., Y t = X t − L : t \mathbf{Y}_t = \mathbf{X}_{t-L:t} Y t = X t − L : t under reconstruction and Y t = X t : t + F \mathbf{Y}_t = \mathbf{X}_{t:t+F} Y t = X t : t + F under forecasting. The corresponding model output is formulated as Y ^ t = F ( X t − L : t ) \hat{\mathbf{Y}}_t = \mathcal{F}(\mathbf{X}_{t-L:t}) Y ^ t = F ( X t − L : t ) . The pointwise anomaly score is then derived from the discrepancy between Y t \mathbf{Y}_t Y t and Y ^ t \hat{\mathbf{Y}}_t Y ^ t , commonly measured by the squared error s t = ∥ y t − y ^ t ∥ 2 s_t = \lVert\mathbf{y}_t - \hat{\mathbf{y}}_t \rVert^2 s t = ∥ y t − y ^ t ∥ 2 , where y t ∈ Y t \mathbf{y}_t \in\mathbf{Y}_t y t ∈ Y t and y ^ t ∈ Y ^ t \hat{\mathbf{y}}_t \in\hat{\mathbf{Y}}_t y ^ t ∈ Y ^ t .
Methodology
Overview of NCL: Toward Normality-Constrained TSFMs
TSFMs are pre-trained on large corpora to learn a variety of universal temporal patterns. However, this generality allows them to reconstruct or forecast normal and anomalous data similarly well, so anomalies may not yield larger errors. To mitigate this issue, we introduce the plug-and-play normality constraint learning (NCL) module G \mathcal{G} G to achieve normality-constrained TSFMs by steering the representational capacity of a TSFM F \mathcal{F} F toward the normal regime out of its broad pattern space.
As illustrated in Figure 2 , NCL consists of three main components. Given a few normal training subsequences, its first component, ① Normal Subspace Construction (NormSpace) , identifies k k k principal normal directions via SVD on their patch features Z \mathbf{Z} Z extracted from the frozen TSFM F \mathcal{F} F . The ② Patch-Adaptive Normality Transformation (PatchNT) component is then devised to enforce a lightweight yet patch-adaptive alignment of each feature with a learnable normality manifold along each principal direction. The ③ Contrastive Normality Constraint (ConNC) component is further proposed to constrain the transformed features tightly cluster around their respective normality modes. In doing so, NCL amplifies the discrepancy signal between normal and abnormal observations that the superior fitting capacity of TSFMs would otherwise diminish. All these three components are done without changing any of the pre-trained parameters of F \mathcal{F} F itself. Let F ′ \mathcal{F}' F ′ denote the frozen TSFM augmented with the proposed NCL module, the predictions can then be defined as Y ~ t = F ′ ( X t − L : t ) \widetilde{\mathbf{Y}}_t = \mathcal{F}'(\mathbf{X}_{t-L:t}) Y t = F ′ ( X t − L : t ) .
Figure 2. Overview of NCL. ① Given few-shot normal training subsequences, a frozen TSFM is used to extract their patch features Z \mathbf{Z} Z , upon which NormSpace constructs a normal subspace of k k k principal directions via SVD. ② PatchNT is then trained to perform patch-adaptive transformation of each feature onto a learnable normality manifold along each principal direction. ③ ConNC is further leveraged to calibrate the transformed features via constraining their distributions tightly cluster around the normal prototypes { c i } i = 1 k \{\mathbf{c}_i\}_{i=1}^{k} { c i } i = 1 k . Finally, these calibrated features are synthesized with the original TSFM output to amplify the error discrepancy between normal and abnormal data.
NormSpace: Normal Subspace Construction via Few-Shot SVD
Let Z = [ z 1 , z 2 , … , z N ] ⊤ ∈ R N × d \mathbf{Z} = [\mathbf{z}_1,\mathbf{z}_2,\ldots,\mathbf{z}_N]^\top\in\mathbb{R}^{N \times d} Z = [ z 1 , z 2 , … , z N ] ⊤ ∈ R N × d be the matrix of normal patch features extracted from F \mathcal{F} F , where N N N is the total number of patches and d d d is the feature dimension. To identify the most informative directions of variation within the normal feature space, we perform SVD on Z \mathbf{Z} Z :
Z = U r Σ r V r ⊤ = ∑ i = 1 r σ i u i v i ⊤ , (1) \mathbf{Z} = \mathbf{U}_r \mathbf{\Sigma}_r \mathbf{V}_r^\top= \sum_{i=1}^{r} \sigma_i \mathbf{u}_i \mathbf{v}_i^\top, \tag*{(1)} Z = U r Σ r V r ⊤ = i = 1 ∑ r σ i u i v i ⊤ , (1)
where U r ∈ R N × r \mathbf{U}_r \in\mathbb{R}^{N \times r} U r ∈ R N × r , Σ r = diag ( σ 1 , σ 2 , … , σ r ) \mathbf{\Sigma}_r = \operatorname{diag}(\sigma_1,\sigma_2,\ldots,\sigma_r) Σ r = diag ( σ 1 , σ 2 , … , σ r ) with σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r ≥ 0 \sigma_1 \ge\sigma_2 \ge\cdots\ge\sigma_r \ge0 σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r ≥ 0 , and V r ∈ R d × r \mathbf{V}_r \in\mathbb{R}^{d \times r} V r ∈ R d × r , with r = rank ( Z ) r = \operatorname{rank}(\mathbf{Z}) r = rank ( Z ) . The columns of V r \mathbf{V}_r V r , denoted { v 1 , v 2 , … , v r } \{\mathbf{v}_1,\mathbf{v}_2,\ldots,\mathbf{v}_r\} { v 1 , v 2 , … , v r } , are the right singular vectors and correspond to the principal directions of Z \mathbf{Z} Z .
The singular vectors with the largest singular values capture the dominant and stable patterns shared across all N N N normal patch features, i.e., the directions along which normal temporal structure is most concentrated. Therefore, we construct a normal-pattern-focused space by retaining the top-k k k right singular vectors:
{ v i } i = 1 k , k < d , (2) \{\mathbf{v}_i\}_{i=1}^{k}, \quad k < d, \tag*{(2)} { v i } i = 1 k , k < d , (2)
which collectively span a k k k -dimensional normal subspace . These vectors are stored as tunning buffers during inference, ensuring that the normal subspace is estimated from the training distribution.
We theoretically show in Appendix § 11 that (i) performing SVD on the patch features from few-shot normal samples is sufficient to construct an informative normality space and (ii) choosing the top-k k k vectors to span a k k k -dimensional normal subspace is most effective.
PatchNT: Lightweight Patch-Adaptive Normality Transformation
The normal subspace spanned by { v i } i = 1 k \{\mathbf{v}_i\}_{i=1}^{k} { v i } i = 1 k captures the principal directions of normal temporal patterns, but SVD projection alone only preserves feature components along these directions without explicitly aligning them with normality. Moreover, different patches may deviate from normality in different ways and to different degrees, requiring patch-specific calibration. We therefore introduce patch-adaptive normality transformation (PatchNT), which uses only a few learnable parameters to selectively add or delete information from each patch feature, steering its component along v i \mathbf{v}_i v i via these learnable “add” and “delete” operations toward a normality-consistent representation. Applying PatchNT separately along the k k k directions then yields k k k complementary views, each calibrating the patch feature toward the normal temporal structure captured along one direction.
Formally, for each patch feature z n ∈ R d \mathbf{z}_n \in\mathbb{R}^d z n ∈ R d , the i i i -th normality transformation proceeds as follows. First, the scalar projection of z n \mathbf{z}_n z n onto v i \mathbf{v}_i v i is computed:
p n ( i ) = v i T z n . (3) p_n^{(i)} = \mathbf{v}_i^{\mathsf{T}}\mathbf{z}_n. \tag*{(3)} p n ( i ) = v i T z n . (3)
Next, inspired by deep delta learning (Zhang et al. [62 ] ) in residual update, two patch-adaptive vector parameters are defined to specify the learnable “add” and “delete” operations for steering patch feature along each direction v i \mathbf{v}_i v i . Specifically, the target value α \boldsymbol{\alpha} α and the calibration strength β \boldsymbol{\beta} β are produced by lightweight linear heads applied to z n \mathbf{z}_n z n for the feature steering in all k k k directions:
α = σ ( W α z n + b α ) ∈ ( 0 , 1 ) k , β = 2 ⋅ σ ( W β z n + b β ) ∈ ( 0 , 2 ) k , (4) \boldsymbol{\alpha} = \sigma(\mathbf{W}_{\alpha}\mathbf{z}_n + \mathbf{b}_{\alpha}) \in(0,1)^k,\qquad\boldsymbol{\beta} = 2 \cdot\sigma(\mathbf{W}_{\beta}\mathbf{z}_n + \mathbf{b}_{\beta}) \in(0,2)^k, \tag*{(4)} α = σ ( W α z n + b α ) ∈ ( 0 , 1 ) k , β = 2 ⋅ σ ( W β z n + b β ) ∈ ( 0 , 2 ) k , (4)
where σ ( ⋅ ) \sigma(\cdot) σ ( ⋅ ) is the sigmoid function, and W α , W β ∈ R k × d \mathbf{W}_{\alpha}, \mathbf{W}_{\beta} \in\mathbb{R}^{k \times d} W α , W β ∈ R k × d are the learnable weights. Each target value α i ∈ α \alpha_i \in\boldsymbol{\alpha} α i ∈ α specifies where the calibrated feature should lie along v i \mathbf{v}_i v i , while β i ∈ β \beta_i \in\boldsymbol{\beta} β i ∈ β controls the degree of calibration. Then we can obtain the calibrated feature as follows:
z ~ n ( i ) = z n + β i v i ( α i − p n ( i ) ) = z n + β i v i ( α i − v i T z n ) = z n + v i ( α i β i ) ⏟ add − ( β i v i T z n ) ⏟ delete , (5) \widetilde{\mathbf{z}}_n^{(i)} = \mathbf{z}_n + \beta_i\mathbf{v}_i(\alpha_i - p_n^{(i)}) = \mathbf{z}_n + \beta_i\mathbf{v}_i(\alpha_i - \mathbf{v}_i^{\mathsf{T}}\mathbf{z}_n) = \mathbf{z}_n + \mathbf{v}_i\underbrace{(\alpha_i\beta_i)}_{\text{add}} - \underbrace{(\beta_i\mathbf{v}_i^{\mathsf{T}}\mathbf{z}_n)}_{\text{delete}}, \tag*{(5)} z n ( i ) = z n + β i v i ( α i − p n ( i ) ) = z n + β i v i ( α i − v i T z n ) = z n + v i add ( α i β i ) − delete ( β i v i T z n ) , (5)
indicating that the introduced patch-adaptive parameters can achieve both information addition and deletion along the direction v i \mathbf{v}_i v i . However, it is still unclear to what extent the β i \beta_i β i will modify the relative distances of the feature from α i \alpha_i α i in the direction v i \mathbf{v}_i v i . We further treat the calibration in Equation (5) as a rank-1 affine update:
z ~ n ( i ) = z n + v i ( α i β i − β i v i T z n ) = ( I − β i v i v i T ) z n + α i β i v i = W i z n + b i , (6) \widetilde{\mathbf{z}}_n^{(i)} = \mathbf{z}_n + \mathbf{v}_i(\alpha_i\beta_i - \beta_i\mathbf{v}_i^{\mathsf{T}}\mathbf{z}_n) = (\mathbf{I} - \beta_i\mathbf{v}_i\mathbf{v}_i^{\mathsf{T}})\mathbf{z}_n + \alpha_i\beta_i\mathbf{v}_i = \mathbf{W}_i\mathbf{z}_n + \mathbf{b}_i, \tag*{(6)} z n ( i ) = z n + v i ( α i β i − β i v i T z n ) = ( I − β i v i v i T ) z n + α i β i v i = W i z n + b i , (6)
where W i = I − β i v i v i T \mathbf{W}_i = \mathbf{I} - \beta_i\mathbf{v}_i\mathbf{v}_i^{\mathsf{T}} W i = I − β i v i v i T and b i = α i β i v i \mathbf{b}_i = \alpha_i\beta_i\mathbf{v}_i b i = α i β i v i . Based on Equation (6) , we can then characterize how β i \beta_i β i governs the general behavior of the transformation by analyzing the spectral structure of W i \mathbf{W}_i W i . We further propose Proposition 1 (see Appendix C for its proof).
Proposition 1 (Spectral and Geometric Property). The spectrum of W i = I − β i v i v i T \mathbf{W}_i = \mathbf{I} - \beta_i\mathbf{v}_i\mathbf{v}_i^{\mathsf{T}} W i = I − β i v i v i T is Λ ( W i ) = { 1 − β i , 1 , … , 1 } \Lambda(\mathbf{W}_i) = \{1-\beta_i,1,\ldots,1\} Λ ( W i ) = { 1 − β i , 1 , … , 1 } with one eigenvalue ( 1 − β i ) (1-\beta_i) ( 1 − β i ) for eigenvector v i \mathbf{v}_i v i and ( d − 1 ) (d-1) ( d − 1 ) eigenvalues of I \mathbf{I} I in v i ⊥ = { k ∈ R d ∣ v i T k = 0 } \mathbf{v}_i^\perp= \{\mathbf{k} \in\mathbb{R}^d \mid\mathbf{v}_i^{\mathsf{T}}\mathbf{k} = 0\} v i ⊥ = { k ∈ R d ∣ v i T k = 0 } . At β i = 1 \beta_i = 1 β i = 1 , the affine update z ~ n ( i ) = W i z n + b i \widetilde{\mathbf{z}}_n^{(i)} = \mathbf{W}_i\mathbf{z}_n + \mathbf{b}_i z n ( i ) = W i z n + b i exactly deletes the v i \mathbf{v}_i v i -component of z n \mathbf{z}_n z n and adds α i \alpha_i α i . At β i < 1 \beta_i < 1 β i < 1 , the update is partial and at β i > 1 \beta_i > 1 β i > 1 it slightly overshoots, allowing the model to learn under- or over-corrective behaviors where beneficial.
The proposition shows that PatchNT offers a brand-new affine transformation that requires only selective modification of the v i \mathbf{v}_i v i -component of z \mathbf{z} z , leaving the orthogonality of all components intact. Applying such transformation to all N N N patch features across all k k k directions, we obtain k k k normal views, each consisting of N N N transformed features:
Z ~ ( i ) = [ z ~ 1 ( i ) , z ~ 2 ( i ) , … , z ~ N ( i ) ] T ∈ R N × d , i ∈ { 1 , 2 , … , k } , (7) \widetilde{\mathbf{Z}}^{(i)} = [\widetilde{\mathbf{z}}_1^{(i)}, \widetilde{\mathbf{z}}_2^{(i)}, \ldots, \widetilde{\mathbf{z}}_N^{(i)}]^{\mathsf{T}} \in\mathbb{R}^{N \times d},\qquad i \in\{1,2,\ldots,k\}, \tag*{(7)} Z ( i ) = [ z 1 ( i ) , z 2 ( i ) , … , z N ( i ) ] T ∈ R N × d , i ∈ { 1 , 2 , … , k } , (7)
where each z ~ n ( i ) \widetilde{\mathbf{z}}_n^{(i)} z n ( i ) is adaptively calibrated toward normality captured along the v i \mathbf{v}_i v i direction. Thus, Z ~ ( i ) \widetilde{\mathbf{Z}}^{(i)} Z ( i ) is effectively aligned with a direction-specific view of normality.
ConNC: Contrastive Normality Constraint
In the transformed feature space, we aim to promote coherence among patch features calibrated along the same direction while preserving distinctions between features calibrated along different directions. This helps each view to accurately align with the direction-specific normality and reduces redundancy across views. Contrastive learning naturally supports this objective by encouraging within-view compactness and between-view separation. Inspired by self-supervised transformation classification ([22 , 6 ] ), we therefore introduce a contrastive normality constraint that uses the k k k transformation views as self-supervised labels, encouraging the transformed features to form k k k compact and discriminative normality manifolds.
Formally, let z ~ n ( i ) ∈ R d \widetilde{z}_{n}^{(i)} \in\mathbb{R}^{d} z n ( i ) ∈ R d denote the i i i -th transformation view of patch feature z n z_n z n , the center c i c_i c i be the average feature over all N N N normal patch features for the i i i -th transformation, i.e., c i = 1 N ∑ n = 1 N z ~ n ( i ) c_i = \frac{1}{N}\sum_{n=1}^{N}\widetilde{z}_{n}^{(i)} c i = N 1 ∑ n = 1 N z n ( i ) , and the contrastive normality constraint can then be formulated as follows:
L C o n N C = 1 N ∑ n = 1 N 1 k ∑ i = 1 k max ( 0 , ∥ z ~ n ( i ) − c i ∥ 2 + γ − min j ≠ i ∥ z ~ n ( i ) − c j ∥ 2 ) , (8) \mathcal{L}_{\mathrm{ConNC}} = \frac{1}{N}\sum_{n=1}^{N}\frac{1}{k}\sum_{i=1}^{k}\max\left(0,\left\lVert\widetilde{z}_{n}^{(i)}-c_i\right\rVert_2+\gamma-\min_{j\ne i}\left\lVert\widetilde{z}_{n}^{(i)}-c_j\right\rVert_2\right), \tag*{(8)} L ConNC = N 1 n = 1 ∑ N k 1 i = 1 ∑ k max ( 0 , z n ( i ) − c i 2 + γ − j = i min z n ( i ) − c j 2 ) , (8)
where γ > 0 \gamma> 0 γ > 0 is a margin hyperparameter. The above loss encourages each transformation view z ~ n ( i ) \widetilde{z}_{n}^{(i)} z n ( i ) to be closer to its own cluster center c i c_i c i than to any other cluster center c j c_j c j (j ≠ i j \ne i j = i ) by a margin of at least γ \gamma γ . This ensures that the k k k normality-calibrated views are not only compact within each cluster but also mutually discriminative, forming a structured partition of the normal feature space that is difficult for anomalous features to satisfy.
Training and Inference
Training. Given a normal patch feature z n z_n z n , following the SVD projection and normality transformation stated above, we obtain its k k k calibrated features, which are then aggregated into a single normal feature by taking their element-wise mean, i.e., z ~ n = 1 k ∑ i = 1 k z ~ n ( i ) \widetilde{z}_n = \frac{1}{k}\sum_{i=1}^{k}\widetilde{z}_{n}^{(i)} z n = k 1 ∑ i = 1 k z n ( i ) . Fusing over these k k k principal directions yields a consensus feature that reinforces the normality components. These fused patch features are then concatenated and passed through a linear head to produce the module prediction Y ~ t n c l \widetilde{Y}^{\mathrm{ncl}}_t Y t ncl . To retain the strong modeling capacity of the original TSFM while amplifying the normality properties, we fuse the module prediction with the frozen TSFM prediction Y ^ t \widehat{Y}_t Y t as follows:
Y ~ t = λ ⊙ Y ~ t n c l + ( 1 − λ ) ⊙ Y ^ t , (9) \widetilde{Y}_t = \lambda\odot\widetilde{Y}^{\mathrm{ncl}}_t + (1-\lambda)\odot\widehat{Y}_t, \tag*{(9)} Y t = λ ⊙ Y t ncl + ( 1 − λ ) ⊙ Y t , (9)
where ⊙ \odot ⊙ denotes channel-wise broadcasting multiplication, and λ ∈ ( 0 , 1 ) D \lambda\in(0,1)^D λ ∈ ( 0 , 1 ) D is a learnable gated weight that captures the channel-specific reliance on the normality constraint versus the original TSFM output. This fusion mechanism is to increase reconstruction/forecasting error for abnormal observations through the normality-constrained component Y ~ t n c l \widetilde{Y}^{\mathrm{ncl}}_t Y t ncl . The key insight is that for abnormal input, the normality constraint pushes them away from the pre-training support S j \mathcal{S}_j S j , causing NCL-enhanced TSFMs to produce larger errors. This error amplification effect is theoretically justified via Theorem 1, with the proof provided in Appendix § 10 .§ 2.1 .
Theorem 1 (Error Amplification). Let F ∗ \mathcal{F}^{*} F ∗ be a frozen TSFM pre-trained on S j \mathcal{S}_j S j with Lipschitz constant L F L_{\mathcal{F}} L F , and let ( X a , Y a ) ∈ Supp ( P a ) ⊆ N ρ ( S j ) (X_a,Y_a) \in\operatorname{Supp}(\mathcal{P}_a) \subseteq\mathcal{N}_{\rho}(\mathcal{S}_j) ( X a , Y a ) ∈ Supp ( P a ) ⊆ N ρ ( S j ) be an anomalous pair. Under assumption with linear expansion rate ω ( r ) = κ r \omega(r)=\kappa r ω ( r ) = κ r where κ ∈ ( 0 , L F ) \kappa\in(0,L_{\mathcal{F}}) κ ∈ ( 0 , L F ) , for the fused prediction Y ~ a \widetilde{Y}_a Y a , we have:
∥ Y a − Y ~ a ∥ 2 2 ≫ ∥ Y a − Y ^ a ∥ 2 2 , (10) \left\lVert Y_a-\widetilde{Y}_a\right\rVert_2^2 \gg\left\lVert Y_a-\widehat{Y}_a\right\rVert_2^2, \tag*{(10)} Y a − Y a 2 2 ≫ Y a − Y a 2 2 , (10) demonstrating that output fusion amplifies the reconstruction or forecasting errors on anomalies.
Accordingly, the normality transformation is optimized by minimizing the following training loss that combines the squared error (for either reconstruction or forecasting) loss with the contrastive normality constraint:
L = L P r e d + L C o n N C , (11) \mathcal{L} = \mathcal{L}_{\mathrm{Pred}}+\mathcal{L}_{\mathrm{ConNC}}, \tag*{(11)} L = L Pred + L ConNC , (11)
where L P r e d \mathcal{L}_{\mathrm{Pred}} L Pred is the squared error between the fused prediction Y ~ t \widetilde{Y}_t Y t and the ground-truth target Y t Y_t Y t . During the training process, only the parameters of the NCL module are updated, while all parameters of the TSFM F \mathcal{F} F remain frozen. We also conduct detailed theoretical analysis in Appendix § 10 .§ 2.2 to demonstrate that, in case there is abnormal information in the training normal patch features, L C o n N C \mathcal{L}_{\mathrm{ConNC}} L ConNC can serve as a regularization term that prevents the NCL module from overfitting to it.
Inference. During inference, the anomaly score consists of two components. One is the amplified reconstruction/forecasting squared error between Y ~ t \widetilde{Y}_t Y t and Y t Y_t Y t . Another anomaly scoring component is to leverage the misalignment between each test sample’s normality-calibrated views and the centers. For patch features Z t e s t = { z 1 , z 2 , … , z M } Z_{\mathrm{test}} = \{z_1, z_2, \ldots, z_M\} Z test = { z 1 , z 2 , … , z M } from a test sample, this misalignment-based score for the sample is defined as the maximum over all M M M patches of the average negative log-probability of each view being assigned to its own center:
s = max m ≤ M − 1 k ∑ i = 1 k log e − ∥ z ~ m ( i ) − c ( i ) ∥ 2 ∑ j = 1 k e − ∥ z ~ m ( i ) − c ( j ) ∥ 2 (12) s = \max_{m \le M} -\frac{1}{k}\sum_{i=1}^{k}\log\frac{e^{-\lVert\widetilde{z}_m^{(i)}-c^{(i)}\rVert_2}}{\sum_{j=1}^{k}e^{-\lVert\widetilde{z}_m^{(i)}-c^{(j)}\rVert_2}} \tag*{(12)} s = m ≤ M max − k 1 i = 1 ∑ k log ∑ j = 1 k e − ∥ z m ( i ) − c ( j ) ∥ 2 e − ∥ z m ( i ) − c ( i ) ∥ 2 (12)
For a normal sample, each calibrated view z ~ m ( i ) \widetilde{z}_m^{(i)} z m ( i ) lies close to its corresponding center c ( i ) c^{(i)} c ( i ) . For an abnormal one, the normality transformation cannot align the anomalous feature to center equally well. The maximum over all M M M patches is used as the sample score, as the top anomalous patch conveys the most information about abnormality.
Experiments
Experimental Setup
Datasets. To evaluate the effectiveness of NCL, we conduct comprehensive experiments on ten TSAD datasets, including five univariate datasets—IOPS ([43 ] ), UCR ([52 ] ), NAB ([2 ] ), MSL ([5 ] ), and SMAP ([5 ] )—and five multivariate datasets—PSM ([1 ] ), SMD ((Su et al., 2019)), SWAT ([33 ] ), PUMP ([16 ] ), and NYC ([10 ] ). Details about the datasets are included in Appendix § 13 .§ 1 .
Baselines. We choose both forecasting-based and reconstruction-based TSFMs for anomaly detection as backbones. Forecasting-based TSFMs include Aurora ([54 ] ), ROSE ([49 ] ), Chronos ([4 ] ), and TTM ([14 ] ). For reconstruction-based TSFMs, MOMENT ([18 ] ) and UniTS ([17 ] ) are selected. Additionally, we also include TSPulse ([15 ] ) and SEMPO ([20 ] ), which employ both forecasting and reconstruction. Other popular TSFMs, such as Time-MoE ([45 ] ) and TimesFM ([11 ] ), are also compared in § 5.4 and Appendix § 18 . NCL-augmented TSFMs are also compared with deep TSAD methods, simple one-liner baselines, and TSAD-specific foundation models to further demonstrate the advances made by our NCL, with the results presented in Appendix § 17 and Appendix § 18 . The detailed descriptions of these baselines can be found in Appendix § 13 .§ 2 .
Implementation Details. NCL is trained for five epochs with only five normal samples randomly selected from the training set (see Appendix § 24 for other few-shot sizes). All reported results are averaged over three independent runs. More implementation details are given in Appendix § 13 .§ 3 .
Evaluation Metrics. Recent works have highlighted that point-adjusted metrics may exhibit severe overestimation issues ([30 , 41 ] ), whereas VUS-PR ([36 ] ) emerges as a more robust and fair evaluation measure. Therefore, we adopt VUS-PR as our primary metric. Several other PR and ROC metrics are reported in Appendix § 26 .
Main Results
Enabling Anomaly Detection of Diverse TSFMs. Table 1 presents the results of eight different TSFMs with/without using our proposed NCL across ten TSAD datasets. The full results (including several PR and ROC metric results with the standard deviations) are provided in Appendix § 26 . It is clear that NCL consistently and significantly improves the anomaly detection performance of diverse TSFMs, with an average improvement ratio of 41.49% across all backbone models. This dramatic enhancement demonstrates NCL’s ability to address the fundamental limitation of TSFMs in distinguishing normal and abnormal patterns.
Table 1. VUS-PR results of vanilla and NCL-augmented TSFMs that use forecasting/reconstruction errors to detect anomalies on ten TSAD datasets. △ i m p \triangle_{\mathrm{imp}} △ imp indicates improvement ratios gained by NCL.
Comparison with Other TSFM Adaptation Methods. To demonstrate the superiority of NCL over alternative adaptation strategies, we compare it against two popular TSFM adaptation methods, including LoRA ([24 ] ) and CoRA ([8 ] ). As shown in Figure 3 , NCL consistently outperforms these methods across three representative TSFMs. LoRA can further utilize the limited normal samples to fine-tune TSFMs, while CoRA can enhance the modeling ability across channels; however, neither of them has an explicit normality constraint design for anomaly detection. In contrast, NCL constructs a sample-efficient normality space and constrains the features to align with its normality manifolds, thereby making abnormal deviations stand out more clearly.
Figure 3. Performance changes relative to vanilla TSFMs for three different TSFMs.
Ablation Studies
To validate the contribution of each component in NCL, we conduct comprehensive ablation studies by systematically removing or replacing its individual components. Table 2 presents the results on IOPS and PSM datasets with three representative TSFMs (ROSE, TMM, UniTS).
Table 2. Ablation study results of NCL and its variants.
Normality Grounded by NormSpace. As a NCL variant that uses only NormSpace, relying on the top-k k k singular vectors to perform reconstruction-based anomaly detection directly, N C L N \mathrm{NCL}_{\mathrm{N}} NCL N gains consistent improvement compared to all three vanilla TSFMs. This indicates that, although only a few patch features are used, NormSpace can achieve a strong sample-efficient normality grounding that effectively narrows down the broad pattern space of TSFMs onto the normality space. This also confirms Theorems 2 and 3 in Appendix § 11 . Its significance can also be observed when (i) comparing N C L P \mathrm{NCL}_{\mathrm{P}} NCL P to N C L N P \mathrm{NCL}_{\mathrm{NP}} NCL NP or (ii) comparing N C L P C \mathrm{NCL}_{\mathrm{PC}} NCL PC to the full NCL method N C L N P C \mathrm{NCL}_{\mathrm{NPC}} NCL NPC .
Learnable Transformation to Calibrate Features via PatchNT. Adding the learnable transformation in PatchNT on top of NCLN _N N , NCLN P _{NP} N P further effectively calibrates the features in the normality space across all three TSFMs on both datasets. Even without using NormSpace, the adaptive transformation in PatchNT works well for the calibration as highlighted by the difference between NCLC _C C (which uses random affine transformation to replace PatchNT) and NCLP C _{PC} P C . Besides, the features transformed solely by NCLP _P P are also better than the vanilla TSFM features. Collectively, these results systematically justify the effectiveness of our learnable transformation design.
Sharpening the Feature Normality Further via ConNC. Adding ConNC on top of NCLN P _{NP} N P , our full method NCLN P C _{NPC} N P C gains consistently large improvements across all cases, showcasing the importance of the contrastive constraint for enhancing the discriminability of the calibrated features. This constraint can also work well solely (i.e., NCLC _C C ) compared to the vanilla TSFMs. Overall, these well justify the role of ConNC in guiding PatchNT to further sharpen the normality within the subspace.
Efficiency Analysis
NCL enjoys not only substantial detection improvements but also parameter and training efficiency. Figure 4 compares its training costs with LoRA, CoRA, and full fine-tuning TSFMs, with the results averaged over the five multivariate datasets. Our key observations are as follows.
Figure 4. Effectiveness vs. efficiency trade-off.
Parameter Efficiency. NCL requires an average of only 14.2K trainable parameters across different TSFMs, which is significantly fewer than both the parameter-efficient fine-tuning methods like LoRA (1.15M) and CoRA (8.05M) and the full fine-tuning (from 371.4K to 205.29M).
Training Speed. NCL exhibits remarkably fast training time, completing its full training within around 2 seconds . The efficiency stems from two main factors: (i) NormSpace requires only few-shot samples to construct an informative normality space and (ii) only lightweight projection heads and fusion weights are learned while the TSFM remains frozen.
Overall, represented by a small bubble in the upper-left of the plot (denoting a lower number of training parameters), NCL achieves substantially better detection effectiveness (higher on the y-axis) while also having a fast training time (further left on the x-axis). In contrast, most competitors concentrate in the lower-right region, requiring longer training times yet inferior VUS-PR. More detailed efficiency comparisons are in Appendix § 16 .
Conclusion
We propose NCL, a lightweight plug-and-play framework that empowers frozen TSFMs to achieve accurate anomaly detection. NCL is implemented with NormSpace, PatchNT, and ConNC. NormSpace constructs a normality subspace, while PatchNT adaptively steers patch features toward normality within this subspace, guided by ConNC to encourage the formation of compact yet discriminative normality manifolds. We justify the effectiveness of NCL in constraining TSFMs into the normality space through both theoretical and empirical evidence. These results imply that further specialization/adaptation of pre-trained TSFMs is required for the downstream anomaly detection task, and NCL provides a generalizable framework and a new perspective on tackling this issue.
AI USE STATEMENT
In this work, we used generative AI tools for language polishing of the paper. We have not used generative AI tools for formulating mathematical claims, assisting in the writing of proofs, proposing or refining hypotheses, or implementing methods; and the remaining required-disclosure tasks are not applicable to this work. We have reviewed all AI-assisted work. Specifically, all AI-assisted text was checked and revised by the authors to ensure fidelity to the intended meaning; the AI tools were used solely to improve grammar, clarity, and fluency, and did not generate new scientific content. No AI-generated text was incorporated without author verification. We take responsibility for the final content of this work, including text, claims or artifacts produced with the aid of generative AI.
ETHICS STATEMENT
This work provides a methodological contribution and relies exclusively on publicly available, non-proprietary datasets used under their original licenses. It involves neither human subjects nor sensitive data. We believe our results advance the understanding of specialized foundation models and time series anomaly detection while raising no additional ethical concerns.
REPRODUCIBILITY STATEMENT
We provide the hyperparameter configurations and implementation details for our experiments in Appendix D. The core algorithmic component of our method is described in Appendix E. The theoretical results presented in this paper, including their proofs and assumptions, are detailed in Appendix A, B, and C. The source code has been submitted as supplemental material and will be made publicly available upon acceptance of this paper.
Theoretical Analysis of Applying TSFMs to Anomaly Detection
In § 1 , we emphasize that both reconstruction-based and forecasting-based TSFMs can effectively reconstruct or forecast most of the abnormal observations, meaning that anomalies do not necessarily incur larger reconstruction or forecasting errors. We attribute this issue to two aspects: (i) TSFMs are typically pre-trained on large-scale time-series datasets encompassing diverse patterns and domains. Consequently, observations that constitute anomalies in a specific application domain may represent normal patterns in other domains within the pre-training corpus, enabling the model to reconstruct or forecast them with high fidelity; and (ii) the large parameter capacity of TSFMs allows them to further capture and internalize a wide range of general temporal patterns.
These two factors jointly lead to the extremely broad pattern modeling ability of TSFMs, making anomalies not inherently difficult to reconstruct or forecast. This undermines the fundamental assumption that anomalies should yield higher reconstruction or forecasting errors, thereby limiting the effectiveness of applying TSFMs to anomaly detection. In order to further understand the influence of these two aspects on the broad pattern modeling ability of TSFMs during the pre-training process, we conducted a detailed theoretical analysis in Appendix § 10 .§ 1 .
Pre-Training and Anomaly Detection on the TSFMs
Let { P i } i = 1 s \{\mathcal{P}_i\}_{i=1}^{s} { P i } i = 1 s represent the collection of various time series distributions in a large-scale corpus. Then we know the empirical distribution of the entire pre-training data is P p r e = ∑ i = 1 s η i P i \mathcal{P}_{pre} = \sum_{i=1}^{s}\eta_i\mathcal{P}_i P p r e = ∑ i = 1 s η i P i , where ∑ i = 1 s η i = 1 \sum_{i=1}^{s}\eta_i = 1 ∑ i = 1 s η i = 1 . Pre-training a reconstruction-based or forecasting-based TSFM F \mathcal{F} F aims to minimize the following objective:
L P r e d ( F ( ⋅ ) ) = ∑ i = 1 s η i E ( X , Y ) ∼ P i [ ∥ Y − F ( X ) ∥ 2 2 ] . (13) \mathcal{L}_{\mathrm{Pred}}(\mathcal{F}(\cdot)) = \sum_{i=1}^{s}\eta_i\mathbb{E}_{(\mathbf{X},\mathbf{Y})\sim\mathcal{P}_i}\left[\lVert\mathbf{Y}-\mathcal{F}(\mathbf{X})\rVert_2^2\right]. \tag*{(13)} L Pred ( F ( ⋅ )) = i = 1 ∑ s η i E ( X , Y ) ∼ P i [ ∥ Y − F ( X ) ∥ 2 2 ] . (13)
By the universal approximation theorem (Hornik, [23 ] ), for any continuous function f f f and any ϵ > 0 \epsilon> 0 ϵ > 0 , there exists a neural network F \mathcal{F} F with sufficient capacity such that
sup X ∈ K ∥ F ( X ) − f ( X ) ∥ 2 2 ≤ ϵ , (14) \sup_{\mathbf{X}\in\mathcal{K}}\lVert\mathcal{F}(\mathbf{X})-f(\mathbf{X})\rVert_2^2\leq\epsilon, \tag*{(14)} X ∈ K sup ∥ F ( X ) − f ( X ) ∥ 2 2 ≤ ϵ , (14)
where K \mathcal{K} K is a compact subset. For each distribution P i \mathcal{P}_i P i in the pre-training corpus, let f i ∗ ( ⋅ ) f_i^*(\cdot) f i ∗ ( ⋅ ) denote the optimal predictor that minimizes the expected squared error:
f i ∗ ( X ) = E Y ∣ X ∼ P i [ Y ∣ X ] . (15) f_i^*(\mathbf{X})=\mathbb{E}_{\mathbf{Y}\mid\mathbf{X}\sim\mathcal{P}_i}[\mathbf{Y}\mid\mathbf{X}]. \tag*{(15)} f i ∗ ( X ) = E Y ∣ X ∼ P i [ Y ∣ X ] . (15)
Given sufficient model capacity and training data, the pre-trained TSFM F \mathcal{F} F approximates a weighted combination of these optimal predictors. Specifically, minimizing (13) yields:
F ∗ ( X ) ≈ ∑ i = 1 s η i f i ∗ ( X ) = E Y ∣ X ∼ P p r e [ Y ∣ X ] , (16) \mathcal{F}^*(\mathbf{X})\approx\sum_{i=1}^{s}\eta_i f_i^*(\mathbf{X})=\mathbb{E}_{\mathbf{Y}\mid\mathbf{X}\sim\mathcal{P}_{pre}}[\mathbf{Y}\mid\mathbf{X}], \tag*{(16)} F ∗ ( X ) ≈ i = 1 ∑ s η i f i ∗ ( X ) = E Y ∣ X ∼ P p r e [ Y ∣ X ] , (16)
where the approximation becomes exact as model capacity increases.
Then we consider a downstream anomaly detection task on a target distribution P t \mathcal{P}_t P t , where anomalies correspond to observations drawn from an anomalous distribution P a \mathcal{P}_a P a . The fundamental challenge arises when the support of P a \mathcal{P}_a P a overlaps with or lies close to the support of pre-training distributions. Let S j = Supp ( P j ) \mathcal{S}_j=\operatorname{Supp}(\mathcal{P}_j) S j = Supp ( P j ) denote the support of the j j j -th pre-training distribution in the input-output space. For ρ ≥ 0 \rho\geq0 ρ ≥ 0 , we define its ρ \rho ρ -neighborhood as:
N ρ ( S j ) = { ( X , Y ) : inf ( X ~ , Y ~ ) ∈ S j ∥ ( X , Y ) − ( X ~ , Y ~ ) ∥ 2 ≤ ρ } . (17) \mathcal{N}_{\rho}(\mathcal{S}_j)=\left\{(\mathbf{X},\mathbf{Y}):\inf_{(\widetilde{\mathbf{X}},\widetilde{\mathbf{Y}})\in\mathcal{S}_j}\lVert(\mathbf{X},\mathbf{Y})-(\widetilde{\mathbf{X}},\widetilde{\mathbf{Y}})\rVert_2\leq\rho\right\}. \tag*{(17)} N ρ ( S j ) = { ( X , Y ) : ( X , Y ) ∈ S j inf ∥( X , Y ) − ( X , Y ) ∥ 2 ≤ ρ } . (17)
Suppose the support of the anomalous distribution is contained within this neighborhood, i.e., Supp ( P a ) ⊆ N ρ ( S j ) \operatorname{Supp}(\mathcal{P}_a)\subseteq\mathcal{N}_{\rho}(\mathcal{S}_j) Supp ( P a ) ⊆ N ρ ( S j ) , for some j ∈ { 1 , … , s } j\in\{1,\ldots,s\} j ∈ { 1 , … , s } and sufficiently small ρ > 0 \rho>0 ρ > 0 . This condition means that, although these observations are abnormal in the downstream domain, their temporal patterns are close to patterns that appeared in the pre-training corpus. Assume the pre-trained model achieves uniformly small prediction error on S j \mathcal{S}_j S j :
sup ( X , Y ) ∈ S j ∥ Y − F ∗ ( X ) ∥ 2 ≤ sup ( X , Y ) ∈ S j ∥ Y − f j ∗ ( X ) ∥ 2 + ∥ f j ∗ ( X ) − F ∗ ( X ) ∥ 2 ≤ δ + ϵ j . (18) \sup_{(\mathbf{X},\mathbf{Y})\in\mathcal{S}_j}\lVert\mathbf{Y}-\mathcal{F}^*(\mathbf{X})\rVert_2\leq\sup_{(\mathbf{X},\mathbf{Y})\in\mathcal{S}_j}\lVert\mathbf{Y}-f_j^*(\mathbf{X})\rVert_2+\lVert f_j^*(\mathbf{X})-\mathcal{F}^*(\mathbf{X})\rVert_2\leq\delta+\epsilon_j. \tag*{(18)} ( X , Y ) ∈ S j sup ∥ Y − F ∗ ( X ) ∥ 2 ≤ ( X , Y ) ∈ S j sup ∥ Y − f j ∗ ( X ) ∥ 2 + ∥ f j ∗ ( X ) − F ∗ ( X ) ∥ 2 ≤ δ + ϵ j . (18)
where δ \delta δ is the irreducible uncertainty error, and ϵ j \epsilon_j ϵ j is the approximation error. Furthermore, assume F ∗ \mathcal{F}^* F ∗ is L F L_F L F -Lipschitz continuous on N ρ ( S j ) \mathcal{N}_{\rho}(S_j) N ρ ( S j ) :
∥ F ∗ ( X 1 ) − F ∗ ( X 2 ) ∥ 2 ≤ L F ∥ X 1 − X 2 ∥ 2 . (19) \lVert\mathcal{F}^*(\mathbf{X}_1) - \mathcal{F}^*(\mathbf{X}_2) \rVert_2 \le L_F \lVert\mathbf{X}_1 - \mathbf{X}_2 \rVert_2. \tag*{(19)} ∥ F ∗ ( X 1 ) − F ∗ ( X 2 ) ∥ 2 ≤ L F ∥ X 1 − X 2 ∥ 2 . (19)
For any anomalous pair ( X a , Y a ) ∈ Supp ( P a ) (\mathbf{X}_a, \mathbf{Y}_a) \in\operatorname{Supp}(\mathcal{P}_a) ( X a , Y a ) ∈ Supp ( P a ) , since Supp ( P a ) ⊆ N ρ ( S j ) \operatorname{Supp}(\mathcal{P}_a) \subseteq\mathcal{N}_{\rho}(S_j) Supp ( P a ) ⊆ N ρ ( S j ) , there exists ( X ~ , Y ~ ) ∈ S j (\widetilde{\mathbf{X}}, \widetilde{\mathbf{Y}}) \in S_j ( X , Y ) ∈ S j such that
∥ X a − X ~ ∥ 2 ≤ ρ , ∥ Y a − Y ~ ∥ 2 ≤ ρ . (20) \lVert\mathbf{X}_a - \widetilde{\mathbf{X}} \rVert_2 \le\rho, \qquad\lVert\mathbf{Y}_a - \widetilde{\mathbf{Y}} \rVert_2 \le\rho. \tag*{(20)} ∥ X a − X ∥ 2 ≤ ρ , ∥ Y a − Y ∥ 2 ≤ ρ . (20)
By the triangle inequality:
∥ Y a − F ∗ ( X a ) ∥ 2 ≤ ∥ Y a − Y ~ ∥ 2 + ∥ Y ~ − F ∗ ( X ~ ) ∥ 2 + ∥ F ∗ ( X ~ ) − F ∗ ( X a ) ∥ 2 ≤ ρ + δ + ϵ j + L F ρ = ϵ j + δ + ( 1 + L F ) ρ , (21) \begin{aligned}
\lVert\mathbf{Y}_a - \mathcal{F}^*(\mathbf{X}_a) \rVert_2
&\le\lVert\mathbf{Y}_a - \widetilde{\mathbf{Y}} \rVert_2 + \lVert\widetilde{\mathbf{Y}} - \mathcal{F}^*(\widetilde{\mathbf{X}}) \rVert_2 + \lVert\mathcal{F}^*(\widetilde{\mathbf{X}}) - \mathcal{F}^*(\mathbf{X}_a) \rVert_2 \\
&\le\rho+ \delta+ \epsilon_j + L_F \rho\\
&= \epsilon_j + \delta+ (1 + L_F)\rho, \tag*{(21)}
\end{aligned} ∥ Y a − F ∗ ( X a ) ∥ 2 ≤ ∥ Y a − Y ∥ 2 + ∥ Y − F ∗ ( X ) ∥ 2 + ∥ F ∗ ( X ) − F ∗ ( X a ) ∥ 2 ≤ ρ + δ + ϵ j + L F ρ = ϵ j + δ + ( 1 + L F ) ρ , (21)
where the second inequality follows from: (i) ∥ Y a − Y ~ ∥ 2 ≤ ρ \lVert\mathbf{Y}_a - \widetilde{\mathbf{Y}} \rVert_2 \le\rho ∥ Y a − Y ∥ 2 ≤ ρ by Inequation (20); (ii) ∥ Y ~ − F ∗ ( X ~ ) ∥ 2 ≤ δ + ϵ j \lVert\widetilde{\mathbf{Y}} - \mathcal{F}^*(\widetilde{\mathbf{X}}) \rVert_2 \le\delta+ \epsilon_j ∥ Y − F ∗ ( X ) ∥ 2 ≤ δ + ϵ j since ( X ~ , Y ~ ) ∈ S j (\widetilde{\mathbf{X}}, \widetilde{\mathbf{Y}}) \in S_j ( X , Y ) ∈ S j and the uniform error bound in Inequation (18) holds for all points in S j S_j S j ; and (iii) ∥ F ∗ ( X ~ ) − F ∗ ( X a ) ∥ 2 ≤ L F ∥ X ~ − X a ∥ 2 ≤ L F ρ \lVert\mathcal{F}^*(\widetilde{\mathbf{X}}) - \mathcal{F}^*(\mathbf{X}_a) \rVert_2 \le L_F \lVert\widetilde{\mathbf{X}} - \mathbf{X}_a \rVert_2 \le L_F \rho ∥ F ∗ ( X ) − F ∗ ( X a ) ∥ 2 ≤ L F ∥ X − X a ∥ 2 ≤ L F ρ by the Lipschitz continuity in Inequation (19).
Consequently, the squared error satisfies:
∥ Y a − F ∗ ( X a ) ∥ 2 2 ≤ [ ϵ j + δ + ( 1 + L F ) ρ ] 2 . (22) \lVert\mathbf{Y}_a - \mathcal{F}^*(\mathbf{X}_a) \rVert_2^2 \le[\epsilon_j + \delta+ (1 + L_F)\rho]^2. \tag*{(22)} ∥ Y a − F ∗ ( X a ) ∥ 2 2 ≤ [ ϵ j + δ + ( 1 + L F ) ρ ] 2 . (22)
Taking expectations over P a \mathcal{P}_a P a :
E ( X , Y ) ∼ P a [ ∥ Y − F ∗ ( X ) ∥ 2 2 ] ≤ [ ϵ j + δ + ( 1 + L F ) ρ ] 2 . (23) \mathbb{E}_{(\mathbf{X},\mathbf{Y}) \sim\mathcal{P}_a} \left[\lVert\mathbf{Y} - \mathcal{F}^*(\mathbf{X}) \rVert_2^2\right] \le[\epsilon_j + \delta+ (1 + L_F)\rho]^2. \tag*{(23)} E ( X , Y ) ∼ P a [ ∥ Y − F ∗ ( X ) ∥ 2 2 ] ≤ [ ϵ j + δ + ( 1 + L F ) ρ ] 2 . (23)
This reveals the over-generalization phenomenon. In non-extremely unstable scenarios, δ \delta δ is usually very small. When both ϵ j \epsilon_j ϵ j and ρ \rho ρ are small, anomalies that fall near the support of pre-training data can also be reconstructed or forecasted with high accuracy, making reconstruction or forecasting error an unreliable anomaly score.
Theoretical Justification of Normality Constraint Learning
Having established that TSFMs suffer from over-generalization in Appendix A.1, we now demonstrate how the proposed normality constraint learning mitigates this issue through two complementary mechanisms: (i) error amplification on anomalies via output fusion, and (ii) regularization against anomaly overfitting via contrastive normality constraint.
Error Amplification via Output Fusion (Proof of erroramplification)
Proof. Recall from (9) that the final prediction is formed by:
Y ~ t = λ ⊙ Y ~ t n c l + ( 1 − λ ) ⊙ Y ^ t , (24) \widetilde{\mathbf{Y}}_t = \lambda\odot\widetilde{\mathbf{Y}}^{\mathrm{ncl}}_t + (1 - \lambda) \odot\widehat{\mathbf{Y}}_t, \tag*{(24)} Y t = λ ⊙ Y t ncl + ( 1 − λ ) ⊙ Y t , (24)
where Y ~ t n c l \widetilde{\mathbf{Y}}^{\mathrm{ncl}}_t Y t ncl is the normality-constrained prediction and Y ^ t = F ∗ ( X t ) \widehat{\mathbf{Y}}_t = \mathcal{F}^*(\mathbf{X}_t) Y t = F ∗ ( X t ) is the frozen TSFM prediction. For notational simplicity, we denote the channel-wise fusion weight as λ ∈ ( 0 , 1 ) \lambda\in(0,1) λ ∈ ( 0 , 1 ) for a single-channel analysis.
For a normal pair ( X n , Y n ) ∈ Supp ( P t ) (\mathbf{X}_n, \mathbf{Y}_n) \in\operatorname{Supp}(\mathcal{P}_t) ( X n , Y n ) ∈ Supp ( P t ) , the normality constraint learning module is trained to minimize L P r e d \mathcal{L}_{\mathrm{Pred}} L Pred in (11) . Since the transformation z ~ n ( i ) = W i z n + b i \widetilde{\mathbf{z}}_n^{(i)} = \mathbf{W}_i\mathbf{z}_n + \mathbf{b}_i z n ( i ) = W i z n + b i projects patch features onto the normal manifold spanned by { v i } i = 1 k \{\mathbf{v}_i\}_{i=1}^{k} { v i } i = 1 k , the module prediction Y ~ n n c l \widetilde{\mathbf{Y}}_n^{\mathrm{ncl}} Y n ncl approximates the normal conditional expectation:
Y ~ n n c l ≈ E Y ∣ X n ∼ P t [ Y ∣ X n ] = f t ∗ ( X n ) . (25) \widetilde{\mathbf{Y}}_n^{\mathrm{ncl}} \approx\mathbb{E}_{\mathbf{Y} \mid\mathbf{X}_n \sim\mathcal{P}_t}[\mathbf{Y} \mid\mathbf{X}_n] = f_t^*(\mathbf{X}_n). \tag*{(25)} Y n ncl ≈ E Y ∣ X n ∼ P t [ Y ∣ X n ] = f t ∗ ( X n ) . (25)
Assuming both Y ^ n \widehat{\mathbf{Y}}_n Y n and Y ~ n n c l \widetilde{\mathbf{Y}}_n^{\mathrm{ncl}} Y n ncl achieve small errors on normal data:
∥ Y n − Y ^ n ∥ 2 ≤ ϵ F , ∥ Y n − Y ~ n n c l ∥ 2 ≤ ϵ n c l , (26) \lVert\mathbf{Y}_n - \widehat{\mathbf{Y}}_n \rVert_2 \le\epsilon_F, \qquad\lVert\mathbf{Y}_n - \widetilde{\mathbf{Y}}_n^{\mathrm{ncl}} \rVert_2 \le\epsilon_{\mathrm{ncl}}, \tag*{(26)} ∥ Y n − Y n ∥ 2 ≤ ϵ F , ∥ Y n − Y n ncl ∥ 2 ≤ ϵ ncl , (26)
the fused prediction error satisfies:
∥ Y n − Y ~ n ∥ 2 = ∥ Y n − λ Y ~ n n c l − ( 1 − λ ) Y ^ n ∥ 2 ≤ λ ∥ Y n − Y ~ n n c l ∥ 2 + ( 1 − λ ) ∥ Y n − Y ^ n ∥ 2 ≤ λ ϵ n c l + ( 1 − λ ) ϵ F . (27) \begin{aligned}
\lVert\mathbf{Y}_n-\widetilde{\mathbf{Y}}_n\rVert_2=\lVert\mathbf{Y}_n-\lambda\widetilde{\mathbf{Y}}_n^{\mathrm{ncl}}-(1-\lambda)\widehat{\mathbf{Y}}_n\rVert_2 \\
&\leq\lambda\lVert\mathbf{Y}_n-\widetilde{\mathbf{Y}}_n^{\mathrm{ncl}}\rVert_2+(1-\lambda)\lVert\mathbf{Y}_n-\widehat{\mathbf{Y}}_n\rVert_2 \\
&\leq\lambda\epsilon_{\mathrm{ncl}}+(1-\lambda)\epsilon_F. \tag*{(27)}
\end{aligned} ∥ Y n − Y n ∥ 2 = ∥ Y n − λ Y n ncl − ( 1 − λ ) Y n ∥ 2 ≤ λ ∥ Y n − Y n ncl ∥ 2 + ( 1 − λ ) ∥ Y n − Y n ∥ 2 ≤ λ ϵ ncl + ( 1 − λ ) ϵ F . (27)
Thus, the fused prediction maintains low error on normal data.
For an anomalous pair ( X a , Y a ) ∈ Supp ( P a ) (\mathbf{X}_a,\mathbf{Y}_a)\in\operatorname{Supp}(\mathcal{P}_a) ( X a , Y a ) ∈ Supp ( P a ) , the frozen TSFM prediction Y ^ a \widehat{\mathbf{Y}}_a Y a achieves a small error due to over-generalization (Inequation (21)):
∥ Y a − Y ^ a ∥ 2 ≤ ϵ j + δ + ( 1 + L F ) ρ . (28) \lVert\mathbf{Y}_a-\widehat{\mathbf{Y}}_a\rVert_2\leq\epsilon_j+\delta+(1+L_F)\rho. \tag*{(28)} ∥ Y a − Y a ∥ 2 ≤ ϵ j + δ + ( 1 + L F ) ρ . (28)
Recall that Supp ( P a ) ⊆ N ρ ( S j ) \operatorname{Supp}(\mathcal{P}_a)\subseteq\mathcal{N}_{\rho}(\mathcal{S}_j) Supp ( P a ) ⊆ N ρ ( S j ) , meaning abnormal features lie within a ρ \rho ρ -neighborhood of the j j j -th pre-training distribution support. The normality constraint learning module transforms abnormal patch features z a \mathbf{z}_a z a via:
z ~ a ( i ) = ( I − β i v i v i T ) z a + α i β i v i , (29) \widetilde{\mathbf{z}}_a^{(i)}=(\mathbf{I}-\beta_i\mathbf{v}_i\mathbf{v}_i^{\mathsf{T}})\mathbf{z}_a+\alpha_i\beta_i\mathbf{v}_i, \tag*{(29)} z a ( i ) = ( I − β i v i v i T ) z a + α i β i v i , (29)
where { v i } i = 1 k \{\mathbf{v}_i\}_{i=1}^{k} { v i } i = 1 k are the principal directions of the normal distribution from P t \mathcal{P}_t P t . Since P t ≠ P j \mathcal{P}_t\neq\mathcal{P}_j P t = P j (the target normal distribution differs from the pre-training distribution), these transformations calibrate z a \mathbf{z}_a z a toward the target normality manifolds rather than the pre-training support S j \mathcal{S}_j S j . Let X ~ a \widetilde{\mathbf{X}}_a X a denote the λ \lambda λ -fusion of the original input and the input reconstructed from the transformed patch features { z ~ a ( i ) } i = 1 k \{\widetilde{\mathbf{z}}_a^{(i)}\}_{i=1}^{k} { z a ( i ) } i = 1 k , the transformation then shifts the abnormal input away from N ρ ( S j ) \mathcal{N}_{\rho}(\mathcal{S}_j) N ρ ( S j ) toward the support of P t \mathcal{P}_t P t . Specifically, for any ( X ~ , Y ~ ) ∈ S j (\widetilde{\mathbf{X}},\widetilde{\mathbf{Y}})\in\mathcal{S}_j ( X , Y ) ∈ S j that was within ρ \rho ρ distance of ( X a , Y a ) (\mathbf{X}_a,\mathbf{Y}_a) ( X a , Y a ) , the transformed input satisfies:
∥ X ~ a − X ~ ∥ 2 ≥ ∥ X a − X ~ ∥ 2 + τ , (30) \lVert\widetilde{\mathbf{X}}_a-\widetilde{\mathbf{X}}\rVert_2\geq\lVert\mathbf{X}_a-\widetilde{\mathbf{X}}\rVert_2+\tau, \tag*{(30)} ∥ X a − X ∥ 2 ≥ ∥ X a − X ∥ 2 + τ , (30)
where τ ≫ ρ \tau\gg\rho τ ≫ ρ quantifies the displacement induced by the normality transformation. Consequently, the transformed abnormal input X ~ a \widetilde{\mathbf{X}}_a X a now lies in a larger neighborhood N ρ + τ ( S j ) \mathcal{N}_{\rho+\tau}(\mathcal{S}_j) N ρ + τ ( S j ) relative to its original position. Since the pre-trained model F ∗ \mathcal{F}^{*} F ∗ was trained on S j \mathcal{S}_j S j and achieves small error only within N ρ ( S j ) \mathcal{N}_{\rho}(\mathcal{S}_j) N ρ ( S j ) , the prediction error on the transformed input increases. Thus, we have Assumption 1.
Assumption 1. There exists a strictly increasing ω : [ 0 , ∞ ) → [ 0 , ∞ ) \omega:[0,\infty)\to[0,\infty) ω : [ 0 , ∞ ) → [ 0 , ∞ ) with ω ( 0 ) = 0 \omega(0)=0 ω ( 0 ) = 0 such that for all X 1 , X 2 ∈ N ρ + τ ( S j ) ∖ N ρ ( S j ) \mathbf{X}_1,\mathbf{X}_2\in\mathcal{N}_{\rho+\tau}(\mathcal{S}_j)\setminus\mathcal{N}_{\rho}(\mathcal{S}_j) X 1 , X 2 ∈ N ρ + τ ( S j ) ∖ N ρ ( S j ) ,
ω ( ∥ X 1 − X 2 ∥ 2 ) ≤ ∥ F ∗ ( X 1 ) − F ∗ ( X 2 ) ∥ 2 ≤ L F ∥ X 1 − X 2 ∥ 2 . (31) \omega(\lVert\mathbf{X}_1-\mathbf{X}_2\rVert_2)\leq\lVert\mathcal{F}^{*}(\mathbf{X}_1)-\mathcal{F}^{*}(\mathbf{X}_2)\rVert_2\leq L_F\lVert\mathbf{X}_1-\mathbf{X}_2\rVert_2. \tag*{(31)} ω (∥ X 1 − X 2 ∥ 2 ) ≤ ∥ F ∗ ( X 1 ) − F ∗ ( X 2 ) ∥ 2 ≤ L F ∥ X 1 − X 2 ∥ 2 . (31)
Under Assumption 1, applying the reverse triangle inequality with F ∗ ( X ~ ) \mathcal{F}^{*}(\widetilde{\mathbf{X}}) F ∗ ( X ) where X ~ \widetilde{\mathbf{X}} X has ρ \rho ρ distance from X a \mathbf{X}_a X a , we have:
∥ Y a − Y ~ a ∥ 2 = ∥ Y a − F ∗ ( X ~ a ) ∥ 2 ≥ ∥ ( Y a − F ∗ ( X ~ ) ) + ( F ∗ ( X ~ ) − F ∗ ( X ~ a ) ) ∥ 2 ≥ ∥ F ∗ ( X ~ a ) − F ∗ ( X ~ ) ∥ 2 − ∥ Y a − F ∗ ( X ~ ) ∥ 2 . (32) \begin{aligned}
\lVert\mathbf{Y}_a-\widetilde{\mathbf{Y}}_a\rVert_2=\lVert\mathbf{Y}_a-\mathcal{F}^{*}(\widetilde{\mathbf{X}}_a)\rVert_2 \\
&\geq\lVert(\mathbf{Y}_a-\mathcal{F}^{*}(\widetilde{\mathbf{X}}))+(\mathcal{F}^{*}(\widetilde{\mathbf{X}})-\mathcal{F}^{*}(\widetilde{\mathbf{X}}_a))\rVert_2 \\
&\geq\lVert\mathcal{F}^{*}(\widetilde{\mathbf{X}}_a)-\mathcal{F}^{*}(\widetilde{\mathbf{X}})\rVert_2-\lVert\mathbf{Y}_a-\mathcal{F}^{*}(\widetilde{\mathbf{X}})\rVert_2. \tag*{(32)}
\end{aligned} ∥ Y a − Y a ∥ 2 = ∥ Y a − F ∗ ( X a ) ∥ 2 ≥ ∥( Y a − F ∗ ( X )) + ( F ∗ ( X ) − F ∗ ( X a )) ∥ 2 ≥ ∥ F ∗ ( X a ) − F ∗ ( X ) ∥ 2 − ∥ Y a − F ∗ ( X ) ∥ 2 . (32)
Since X ~ ∈ S j \widetilde{\mathbf{X}}\in\mathcal{S}_j X ∈ S j and F ∗ \mathcal{F}^{*} F ∗ perform well in N ρ ( S j ) \mathcal{N}_{\rho}(\mathcal{S}_j) N ρ ( S j ) , we can simplify the above as:
∥ Y a − Y ~ a n c l ∥ 2 ≥ ∥ F ∗ ( X ~ a ) − F ∗ ( X ~ ) ∥ 2 − ∥ Y a − F ∗ ( X a ) ∥ 2 ≥ ω ( ∥ X ~ a − X ~ ∥ 2 ) − B j ≥ ω ( ρ + τ ) − B j , (33) \begin{aligned}
\lVert\mathbf{Y}_a-\widetilde{\mathbf{Y}}_a^{\mathrm{ncl}}\rVert_2\geq\lVert\mathcal{F}^{*}(\widetilde{\mathbf{X}}_a)-\mathcal{F}^{*}(\widetilde{\mathbf{X}})\rVert_2-\lVert\mathbf{Y}_a-\mathcal{F}^{*}(\mathbf{X}_a)\rVert_2 \\
&\geq\omega(\lVert\widetilde{\mathbf{X}}_a-\widetilde{\mathbf{X}}\rVert_2)-B_j \\
&\geq\omega(\rho+\tau)-B_j, \tag*{(33)}
\end{aligned} ∥ Y a − Y a ncl ∥ 2 ≥ ∥ F ∗ ( X a ) − F ∗ ( X ) ∥ 2 − ∥ Y a − F ∗ ( X a ) ∥ 2 ≥ ω (∥ X a − X ∥ 2 ) − B j ≥ ω ( ρ + τ ) − B j , (33)
where B j : = ϵ j + δ + ( 1 + L F ) ρ B_j:=\epsilon_j+\delta+(1+L_F)\rho B j := ϵ j + δ + ( 1 + L F ) ρ according to Inequation (28). By simultaneously discarding the uncertainty and approximation parts in both ω ( ρ + τ ) \omega(\rho+\tau) ω ( ρ + τ ) and B j B_j B j , i.e., ϵ j \epsilon_j ϵ j and δ \delta δ , we can approximately regard ω ( ρ + τ ) \omega(\rho+\tau) ω ( ρ + τ ) as a linear function of ρ + τ \rho+\tau ρ + τ , i.e., ω ( ρ + τ ) = κ ⋅ ( ρ + τ ) \omega(\rho+\tau)=\kappa\cdot(\rho+\tau) ω ( ρ + τ ) = κ ⋅ ( ρ + τ ) , where 0 < κ < L F 0<\kappa<L_F 0 < κ < L F . Then we have:
∥ Y a − Y ~ a n c l ∥ 2 − ∥ Y a − Y ~ a ∥ 2 ≥ ∥ F ∗ ( X ~ a ) − F ∗ ( X ~ ) ∥ 2 − 2 ∥ Y a − F ∗ ( X a ) ∥ 2 ≥ ω ( ρ + τ ) − 2 B j ≈ κ ⋅ ( ρ + τ ) − ( 2 + 2 L F ) ρ . (34) \begin{aligned}
\lVert\mathbf{Y}_a-\widetilde{\mathbf{Y}}_a^{\mathrm{ncl}}\rVert_2-\lVert\mathbf{Y}_a-\widetilde{\mathbf{Y}}_a\rVert_2\geq\lVert\mathcal{F}^{*}(\widetilde{\mathbf{X}}_a)-\mathcal{F}^{*}(\widetilde{\mathbf{X}})\rVert_2-2\lVert\mathbf{Y}_a-\mathcal{F}^{*}(\mathbf{X}_a)\rVert_2 \\
&\geq\omega(\rho+\tau)-2B_j \\
&\approx\kappa\cdot(\rho+\tau)-(2+2L_F)\rho. \tag*{(34)}
\end{aligned} ∥ Y a − Y a ncl ∥ 2 − ∥ Y a − Y a ∥ 2 ≥ ∥ F ∗ ( X a ) − F ∗ ( X ) ∥ 2 − 2 ∥ Y a − F ∗ ( X a ) ∥ 2 ≥ ω ( ρ + τ ) − 2 B j ≈ κ ⋅ ( ρ + τ ) − ( 2 + 2 L F ) ρ . (34)
Since ρ \rho ρ denotes a very small neighborhood radius and τ ≫ ρ \tau\gg\rho τ ≫ ρ , κ ∈ ( 0 , L F ) \kappa\in(0,L_F) κ ∈ ( 0 , L F ) can easily satisfy κ > 2 + 2 L F 1 + τ ρ → 0 \kappa> \frac{2+2L_F}{1+\frac{\tau}{\rho}} \to0 κ > 1 + ρ τ 2 + 2 L F → 0 , so that:
∥ Y a − Y ~ a ∥ 2 2 ≥ ∥ Y a − Y ^ a ∥ 2 2 . (35) \lVert\mathbf{Y}_a-\widetilde{\mathbf{Y}}_a\rVert_2^2 \ge\lVert\mathbf{Y}_a-\widehat{\mathbf{Y}}_a\rVert_2^2. \tag*{(35)} ∥ Y a − Y a ∥ 2 2 ≥ ∥ Y a − Y a ∥ 2 2 . (35)
This demonstrates that the output fusion mechanism directly amplifies the reconstruction or forecasting errors on anomalies while preserving low errors on normal data.
Regularization Against Anomaly Overfitting
The contrastive normality constraint L C o n N C \mathcal{L}_{\mathrm{ConNC}} L ConNC in Equation (8) also acts as a regularization term that prevents the NCL module from overfitting to abnormal patterns. Firstly, the contrastive loss enforces that the k k k transformation views { z ~ n ( i ) } i = 1 k \{\widetilde{\mathbf{z}}_n^{(i)}\}_{i=1}^k { z n ( i ) } i = 1 k form k k k well-separated clusters in the normality subspace, with each cluster centered at c i \mathbf{c}_i c i . Formally, for any patch feature z n \mathbf{z}_n z n from normal data:
∥ z ~ n ( i ) − c i ∥ 2 + γ ≤ min j ≠ i ∥ z ~ n ( i ) − c j ∥ 2 . (36) \lVert\widetilde{\mathbf{z}}_n^{(i)}-\mathbf{c}_i\rVert_2+\gamma\le\min_{j\ne i}\lVert\widetilde{\mathbf{z}}_n^{(i)}-\mathbf{c}_j\rVert_2. \tag*{(36)} ∥ z n ( i ) − c i ∥ 2 + γ ≤ j = i min ∥ z n ( i ) − c j ∥ 2 . (36)
This margin-based separation ensures that normal features are tightly clustered around their respective centers, with inter-cluster distances exceeding intra-cluster distances by at least γ \gamma γ .
Then for anomalous patch features z a \mathbf{z}_a z a derived from ( X a , Y a ) ∼ P a (\mathbf{X}_a,\mathbf{Y}_a)\sim\mathcal{P}_a ( X a , Y a ) ∼ P a , the transformation z ~ a ( i ) = W i z a + b i \widetilde{\mathbf{z}}_a^{(i)}=\mathbf{W}_i\mathbf{z}_a+\mathbf{b}_i z a ( i ) = W i z a + b i attempts to project z a \mathbf{z}_a z a onto the normality manifold. However, if z a \mathbf{z}_a z a contains abnormal components orthogonal to all { v i } i = 1 k \{\mathbf{v}_i\}_{i=1}^k { v i } i = 1 k , the projection cannot fully eliminate these components. Let z a = z a ∥ + z a ⊥ \mathbf{z}_a=\mathbf{z}_a^{\parallel}+\mathbf{z}_a^{\perp} z a = z a ∥ + z a ⊥ , where z a ∥ ∈ span ( { v i } i = 1 k ) \mathbf{z}_a^{\parallel}\in\operatorname{span}(\{\mathbf{v}_i\}_{i=1}^k) z a ∥ ∈ span ({ v i } i = 1 k ) and z a ⊥ ∈ span ( { v i } i = 1 k ) ⊥ \mathbf{z}_a^{\perp}\in\operatorname{span}(\{\mathbf{v}_i\}_{i=1}^k)^\perp z a ⊥ ∈ span ({ v i } i = 1 k ) ⊥ . The transformation only modifies z a ∥ \mathbf{z}_a^{\parallel} z a ∥ :
z ~ a ( i ) = W i ( z a ∥ + z a ⊥ ) + b i = W i z a ∥ + b i + z a ⊥ . (37) \widetilde{\mathbf{z}}_a^{(i)}=\mathbf{W}_i(\mathbf{z}_a^{\parallel}+\mathbf{z}_a^{\perp})+\mathbf{b}_i=\mathbf{W}_i\mathbf{z}_a^{\parallel}+\mathbf{b}_i+\mathbf{z}_a^{\perp}. \tag*{(37)} z a ( i ) = W i ( z a ∥ + z a ⊥ ) + b i = W i z a ∥ + b i + z a ⊥ . (37)
The residual component z a ⊥ \mathbf{z}_a^{\perp} z a ⊥ causes z ~ a ( i ) \widetilde{\mathbf{z}}_a^{(i)} z a ( i ) to deviate from the cluster centers:
∥ z ~ a ( i ) − c i ∥ 2 ≥ ∥ z a ⊥ ∥ 2 − ∥ W i z a ∥ + b i − c i ∥ 2 . (38) \lVert\widetilde{\mathbf{z}}_a^{(i)}-\mathbf{c}_i\rVert_2 \ge\lVert\mathbf{z}_a^{\perp}\rVert_2-\lVert\mathbf{W}_i\mathbf{z}_a^{\parallel}+\mathbf{b}_i-\mathbf{c}_i\rVert_2. \tag*{(38)} ∥ z a ( i ) − c i ∥ 2 ≥ ∥ z a ⊥ ∥ 2 − ∥ W i z a ∥ + b i − c i ∥ 2 . (38)
If ∥ z a ⊥ ∥ 2 \lVert\mathbf{z}_a^{\perp}\rVert_2 ∥ z a ⊥ ∥ 2 is sufficiently large, z ~ a ( i ) \widetilde{\mathbf{z}}_a^{(i)} z a ( i ) will not satisfy the margin constraint, leading to zero loss, which does not result in parameter updates and prevents the NCL from adapting to abnormal patterns.
Theoretical Analysis for Normal Subspace Construction
To illustrate the effectiveness of normal subspace construction, we conduct theoretical analysis from two aspects: (i) few-shot normal samples are sufficient to construct an informative normality space (Appendix B.1); and (ii) top-k k k truncation effectively captures the essential normal information while suppressing noise (Appendix B.2).
Few-Shot SVD for Effective Estimation of the Normality Space
In this section, we demonstrate that the construction of an effective normal subspace does not require a large number of normal samples. Generally, normal patch features naturally lie in a low-dimensional subspace with a nontrivial spectral gap [58 ] . Then we utilize standard matrix concentration and the Davis–Kahan theorem [12 ] to prove that the leading singular subspace estimated from a finite set of normal patches converges to the population normal subspace, with estimation error decreasing as O ( N − 1 / 2 ) O(N^{-1/2}) O ( N − 1/2 ) . Hence, patch features from a small number of normal samples can already provide a reliable estimate of the normality space.
Theorem 2 (Few-Shot Normal Subspace Construction). Let z 1 , … , z N ∈ R d \mathbf{z}_1,\ldots,\mathbf{z}_N\in\mathbb{R}^d z 1 , … , z N ∈ R d be i.i.d. normal patch features with E [ z i z i T ] = M ^ \mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]=\widehat{\mathbf{M}} E [ z i z i T ] = M , where M ^ \widehat{\mathbf{M}} M has eigenvalues λ 1 ≥ λ 2 ≥ ⋯ ≥ λ d ≥ 0 \lambda_1\ge\lambda_2\ge\cdots\ge\lambda_d\ge0 λ 1 ≥ λ 2 ≥ ⋯ ≥ λ d ≥ 0 , and nontrivial eigengap Δ k = λ k − λ k + 1 > 0 \Delta_k=\lambda_k-\lambda_{k+1}>0 Δ k = λ k − λ k + 1 > 0 . For sample estimation subspace V k \mathbf{V}_k V k and population normal subspace V ^ k \widehat{\mathbf{V}}_k V k , with probability at least 1 − δ 1-\delta 1 − δ ,
∥ sin Θ ( V k , V ^ k ) ∥ 2 = O ( 1 N ) , (39) \left\lVert\sin\Theta(\mathbf{V}_k,\widehat{\mathbf{V}}_k)\right\rVert_2=O\left(\frac{1}{\sqrt{N}}\right), \tag*{(39)} sin Θ ( V k , V k ) 2 = O ( N 1 ) , (39) demonstrating that estimation error decreases as O ( 1 / N ) O(1/\sqrt{N}) O ( 1/ N ) . Therefore, only a relatively small number of normal samples are sufficient to construct an informative normality space.
Proof. According to Equation (2) , the sample estimation subspace is spanned by top-k k k right singular vectors of normal patch features Z Z Z , formalized as:
V k = span { v 1 , v 2 , … , v k } . (40) V_k = \operatorname{span}\{\mathbf{v}_1,\mathbf{v}_2,\ldots,\mathbf{v}_k\}. \tag*{(40)} V k = span { v 1 , v 2 , … , v k } . (40)
Similarly, we can define the population top-k k k normal subspace as:
V ^ k = span { v ^ 1 , v ^ 2 , … , v ^ k } . (41) \widehat{V}_k = \operatorname{span}\{\widehat{\mathbf{v}}_1,\widehat{\mathbf{v}}_2,\ldots,\widehat{\mathbf{v}}_k\}. \tag*{(41)} V k = span { v 1 , v 2 , … , v k } . (41)
Let normal patch features z 1 , z 2 , … , z N ∈ R d \mathbf{z}_1,\mathbf{z}_2,\ldots,\mathbf{z}_N \in\mathbb{R}^d z 1 , z 2 , … , z N ∈ R d be i.i.d. drawn from the normal-feature distribution Z \mathcal{Z} Z , satisfying ∥ z i ∥ 2 2 ≤ l \|\mathbf{z}_i\|_2^2 \le l ∥ z i ∥ 2 2 ≤ l almost surely. Then we can define the population and empirical second-moment matrices as:
M ^ = E [ z z T ] , M = 1 N Z T Z = 1 N ∑ i = 1 N z i z i T . (42) \widehat{M} = \mathbb{E}[\mathbf{z}\mathbf{z}^{\mathsf{T}}], \qquad M = \frac{1}{N}Z^{\mathsf{T}}Z = \frac{1}{N}\sum_{i=1}^{N}\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}. \tag*{(42)} M = E [ z z T ] , M = N 1 Z T Z = N 1 i = 1 ∑ N z i z i T . (42)
Since Z = U r Σ r V r T Z = U_r\Sigma_rV_r^{\mathsf{T}} Z = U r Σ r V r T , where Σ r = diag ( σ 1 , σ 2 , … , σ r ) \Sigma_r = \operatorname{diag}(\sigma_1,\sigma_2,\ldots,\sigma_r) Σ r = diag ( σ 1 , σ 2 , … , σ r ) with σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r ≥ 0 \sigma_1 \ge\sigma_2 \ge\cdots\ge\sigma_r \ge0 σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r ≥ 0 , we have:
M = V r Σ r 2 N V r T . (43) M = V_r\frac{\Sigma_r^2}{N}V_r^{\mathsf{T}}. \tag*{(43)} M = V r N Σ r 2 V r T . (43)
The r r r eigenvectors of M M M are exactly the r r r right singular vectors from Z Z Z , and the corresponding eigenvalues are λ j = σ j 2 N \lambda_j = \frac{\sigma_j^2}{N} λ j = N σ j 2 , where j ∈ { 1 , 2 , … , r } j \in\{1,2,\ldots,r\} j ∈ { 1 , 2 , … , r } . Then according to Davis–Kahan theorem [12 ] , we have:
∥ sin Θ ( V k , V ^ k ) ∥ 2 ≤ 2 ∥ M − M ^ ∥ 2 Δ k , (44) \left\|\sin\Theta(V_k,\widehat{V}_k)\right\|_2 \le\frac{2\|M-\widehat{M}\|_2}{\Delta_k}, \tag*{(44)} sin Θ ( V k , V k ) 2 ≤ Δ k 2∥ M − M ∥ 2 , (44)
where Θ ( V k , V ^ k ) = diag ( arccos ⟨ v 1 , v ^ 1 ⟩ , … , arccos ⟨ v k , v ^ k ⟩ ) \Theta(V_k,\widehat{V}_k) = \operatorname{diag}(\arccos\langle\mathbf{v}_1,\widehat{\mathbf{v}}_1\rangle,\ldots,\arccos\langle\mathbf{v}_k,\widehat{\mathbf{v}}_k\rangle) Θ ( V k , V k ) = diag ( arccos ⟨ v 1 , v 1 ⟩ , … , arccos ⟨ v k , v k ⟩) , and Δ k = λ k − λ k + 1 > 0 \Delta_k = \lambda_k-\lambda_{k+1}>0 Δ k = λ k − λ k + 1 > 0 is the eigengap. Then for each i ∈ { 1 , 2 , … , N } i \in\{1,2,\ldots,N\} i ∈ { 1 , 2 , … , N } , we can define the random matrix as:
H i = z i z i T − M ^ . (45) H_i = \mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}-\widehat{M}. \tag*{(45)} H i = z i z i T − M . (45)
By construction, E [ H i ] = 0 \mathbb{E}[H_i]=0 E [ H i ] = 0 . The matrices { H i } i = 1 N \{H_i\}_{i=1}^{N} { H i } i = 1 N are independent and zero-mean.
Since z i z i T \mathbf{z}_i\mathbf{z}_i^{\mathsf{T}} z i z i T is a rank-one positive semidefinite matrix with ∥ z i z i T ∥ 2 = ∥ z i ∥ 2 2 ≤ l \|\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\|_2=\|\mathbf{z}_i\|_2^2\le l ∥ z i z i T ∥ 2 = ∥ z i ∥ 2 2 ≤ l , and M ^ ⪯ l ⋅ I \widehat{M}\preceq l\cdot I M ⪯ l ⋅ I (because M ^ = E [ z z T ] \widehat{M}=\mathbb{E}[\mathbf{z}\mathbf{z}^{\mathsf{T}}] M = E [ z z T ] and ∥ z ∥ 2 2 ≤ l \|\mathbf{z}\|_2^2\le l ∥ z ∥ 2 2 ≤ l ), we have:
∥ H i ∥ 2 = ∥ z i z i T − M ^ ∥ 2 ≤ max { ∥ z i z i T ∥ 2 , ∥ M ^ ∥ 2 } ≤ l . (46) \|H_i\|_2=\left\|\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}-\widehat{M}\right\|_2\le\max\{\|\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\|_2,\|\widehat{M}\|_2\}\le l. \tag*{(46)} ∥ H i ∥ 2 = z i z i T − M 2 ≤ max { ∥ z i z i T ∥ 2 , ∥ M ∥ 2 } ≤ l . (46)
Then we compute:
E [ H i 2 ] = E [ ( z i z i T − M ^ ) 2 ] = E [ ( z i z i T ) 2 ] − M ^ 2 ⪯ E [ ( z i z i T ) 2 ] . (47) \mathbb{E}[H_i^2]=\mathbb{E}[(\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}-\widehat{M})^2]=\mathbb{E}[(\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}})^2]-\widehat{M}^2\preceq\mathbb{E}[(\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}})^2]. \tag*{(47)} E [ H i 2 ] = E [( z i z i T − M ) 2 ] = E [( z i z i T ) 2 ] − M 2 ⪯ E [( z i z i T ) 2 ] . (47)
Since
( z i z i T ) 2 = z i z i T z i z i T = ∥ z i ∥ 2 2 z i z i T ⪯ l ⋅ z i z i T , (48) (\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}})^2=\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}=\|\mathbf{z}_i\|_2^2\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}\preceq l\cdot\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}, \tag*{(48)} ( z i z i T ) 2 = z i z i T z i z i T = ∥ z i ∥ 2 2 z i z i T ⪯ l ⋅ z i z i T , (48)
taking expectations, we have:
E [ H i 2 ] ⪯ E [ ( z i z i T ) 2 ] ⪯ l ⋅ E [ z i z i T ] = l ⋅ M ^ . (49) \mathbb{E}[H_i^2]\preceq\mathbb{E}[(\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}})^2]\preceq l\cdot\mathbb{E}[\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}]=l\cdot\widehat{M}. \tag*{(49)} E [ H i 2 ] ⪯ E [( z i z i T ) 2 ] ⪯ l ⋅ E [ z i z i T ] = l ⋅ M . (49)
Therefore, we can obtain:
∥ ∑ i = 1 N E [ H i 2 ] ∥ 2 ≤ N ⋅ l ⋅ ∥ M ^ ∥ 2 = N ⋅ l ⋅ λ ^ 1 , (50) \left\|\sum_{i=1}^{N}\mathbb{E}[H_i^2]\right\|_2\le N\cdot l\cdot\|\widehat{M}\|_2=N\cdot l\cdot\widehat{\lambda}_1, \tag*{(50)} i = 1 ∑ N E [ H i 2 ] 2 ≤ N ⋅ l ⋅ ∥ M ∥ 2 = N ⋅ l ⋅ λ 1 , (50)
Where λ ^ 1 = ∥ M ^ ∥ 2 \widehat{\lambda}_1=\|\widehat{M}\|_2 λ 1 = ∥ M ∥ 2 is the largest eigenvalue of the population second-moment matrix. Then by the matrix Bernstein inequality [48 ] , for any t ≥ 0 t\ge0 t ≥ 0 , we have:
P ( ∥ ∑ i = 1 N H i ∥ 2 ≥ t ) ≤ 2 d ⋅ exp ( − t 2 / 2 N l λ ^ 1 + l t / 3 ) , (51) \mathbb{P}\left(\left\|\sum_{i=1}^{N}H_i\right\|_2\ge t\right)\le2d\cdot\exp\left(\frac{-t^2/2}{N l\widehat{\lambda}_1+l t/3}\right), \tag*{(51)} P ( i = 1 ∑ N H i 2 ≥ t ) ≤ 2 d ⋅ exp ( N l λ 1 + l t /3 − t 2 /2 ) , (51)
where d d d is the feature dimension. Therefore, for any δ ∈ ( 0 , 1 ) \delta\in(0,1) δ ∈ ( 0 , 1 ) , with probability at least 1 − δ 1-\delta 1 − δ , we have:
∥ ∑ i = 1 N H i ∥ 2 ≤ 2 N l λ ^ 1 ln 2 d δ + 2 l 3 ln 2 d δ . (52) \left\|\sum_{i=1}^{N}H_i\right\|_2\le\sqrt{2N l\widehat{\lambda}_1\ln\frac{2d}{\delta}+\frac{2l}{3}\ln\frac{2d}{\delta}}. \tag*{(52)} i = 1 ∑ N H i 2 ≤ 2 N l λ 1 ln δ 2 d + 3 2 l ln δ 2 d . (52)
Dividing both sides by N N N , we obtain:
∥ 1 N ∑ i = 1 N H i ∥ 2 ≤ 2 l λ ^ 1 N log 2 d δ + 2 l 3 N log 2 d δ . (53) \left\lVert\frac{1}{N}\sum_{i=1}^{N}\mathbf{H}_i \right\rVert_2 \leq\sqrt{\frac{2l\hat{\lambda}_1}{N}\log\frac{2d}{\delta}}+\frac{2l}{3N}\log\frac{2d}{\delta}. \tag*{(53)} N 1 i = 1 ∑ N H i 2 ≤ N 2 l λ ^ 1 log δ 2 d + 3 N 2 l log δ 2 d . (53)
According to (45) , since
1 N ∑ i = 1 N H i = 1 N ∑ i = 1 N ( z i z i T − M ^ ) = 1 N Z T Z − M ^ = M − M ^ , (54) \frac{1}{N}\sum_{i=1}^{N}\mathbf{H}_i=\frac{1}{N}\sum_{i=1}^{N}(\mathbf{z}_i\mathbf{z}_i^{\mathsf{T}}-\widehat{\mathbf{M}})=\frac{1}{N}\mathbf{Z}^{\mathsf{T}}\mathbf{Z}-\widehat{\mathbf{M}}=\mathbf{M}-\widehat{\mathbf{M}}, \tag*{(54)} N 1 i = 1 ∑ N H i = N 1 i = 1 ∑ N ( z i z i T − M ) = N 1 Z T Z − M = M − M , (54)
we can establish the concentration inequality:
∥ M − M ^ ∥ 2 ≤ 2 l λ ^ 1 N log 2 d δ + 2 l 3 N log 2 d δ . (55) \left\lVert\mathbf{M}-\widehat{\mathbf{M}}\right\rVert_2\leq\sqrt{\frac{2l\hat{\lambda}_1}{N}\log\frac{2d}{\delta}}+\frac{2l}{3N}\log\frac{2d}{\delta}. \tag*{(55)} M − M 2 ≤ N 2 l λ ^ 1 log δ 2 d + 3 N 2 l log δ 2 d . (55)
Combining this concentration bound with Inequality (44), with probability at least 1 − δ 1-\delta 1 − δ , we have:
∥ sin Θ ( V k , V ^ k ) ∥ 2 ≤ 2 Δ k [ 2 l λ ^ 1 N log 2 d δ + 2 l 3 N log 2 d δ ] . (56) \left\lVert\sin\Theta(\mathbf{V}_k,\widehat{\mathbf{V}}_k)\right\rVert_2\leq\frac{2}{\Delta_k}\left[\sqrt{\frac{2l\hat{\lambda}_1}{N}\log\frac{2d}{\delta}}+\frac{2l}{3N}\log\frac{2d}{\delta}\right]. \tag*{(56)} sin Θ ( V k , V k ) 2 ≤ Δ k 2 N 2 l λ ^ 1 log δ 2 d + 3 N 2 l log δ 2 d . (56)
Thus, regarding d d d , l l l , δ \delta δ , λ ^ 1 \hat{\lambda}_1 λ ^ 1 , Δ k \Delta_k Δ k as constants, asymptotically, we have:
∥ sin Θ ( V k , V ^ k ) ∥ 2 = O ( 1 N ) . (57) \left\lVert\sin\Theta(\mathbf{V}_k,\widehat{\mathbf{V}}_k)\right\rVert_2=O\left(\frac{1}{\sqrt{N}}\right). \tag*{(57)} sin Θ ( V k , V k ) 2 = O ( N 1 ) . (57)
The above analyses show that the error diminishes at a rate of O ( 1 / N ) O(1/\sqrt{N}) O ( 1/ N ) with a certain probability. For instance, when N N N is 5 × p 5\times p 5 × p with only five normal samples, where p p p is the number of patches in a single sample, the error can be reduced to 0.1118 0.1118 0.1118 when p = 16 p=16 p = 16 ; and it would be 0.0791 0.0791 0.0791 when p = 32 p=32 p = 32 .
Therefore, only a relatively small number of normal samples are sufficient to construct an informative normality space. The proof is completed.
Effectiveness of the Top-k k k Truncation
Retaining only the top-k k k singular vectors from SVD to preserve dominant directions is a common practice in many tasks [57 , 46 , 28 ] . This approach is intuitive and reasonable, since it removes many small singular value components that are not helpful for the current task, further highlighting the main patterns and eliminating potential interference.
However, there is still a lack of in-depth theoretical analysis to explore why the top-k k k truncation is effective. Focusing on our k k k -dimensional normal subspace construction, we conduct a detailed theoretical analysis from the following three aspects: (i) top-k k k truncated approximation is more effective than arbitrary k k k approximation; (ii) top-k k k approximation effectively retains the main information; (iii) top-k k k approximation effectively reduces noise interference. Then we derive Theorems 3, 4, and 5 (detailed proofs in Appendix B.2.1, B.2.2, and B.2.3) to explore the above three aspects.
Theorem 3. Consider a well-trained decoder with weights w \mathbf{w} w that can effectively recover patch feature matrix Z \mathbf{Z} Z to the original series. Compared to the approximation of arbitrary k k k singular vectors Z ‾ = ∑ j = i 1 k σ j u j v j T \overline{\mathbf{Z}}=\sum_{j=i_1}^{k}\sigma_j\mathbf{u}_j\mathbf{v}_j^{\mathsf{T}} Z = ∑ j = i 1 k σ j u j v j T , the top-k k k truncated approximation Z ^ = ∑ i = 1 k σ i u i v i T \widehat{\mathbf{Z}}=\sum_{i=1}^{k}\sigma_i\mathbf{u}_i\mathbf{v}_i^{\mathsf{T}} Z = ∑ i = 1 k σ i u i v i T can achieve lower output error:
E Z ∼ Z [ ∥ Z w − Z ^ w ∥ 2 2 ] ≤ E Z ∼ Z [ ∥ Z w − Z ‾ w ∥ 2 2 ] . (58) \mathbb{E}_{\mathbf{Z}\sim\mathcal{Z}}\left[\left\lVert\mathbf{Z}\mathbf{w}-\widehat{\mathbf{Z}}\mathbf{w}\right\rVert_2^2\right]\leq\mathbb{E}_{\mathbf{Z}\sim\mathcal{Z}}\left[\left\lVert\mathbf{Z}\mathbf{w}-\overline{\mathbf{Z}}\mathbf{w}\right\rVert_2^2\right]. \tag*{(58)} E Z ∼ Z [ Zw − Z w 2 2 ] ≤ E Z ∼ Z [ Zw − Z w 2 2 ] . (58)
Theorem 3 indicates that the top-k k k truncated approximation can retain more effective information than arbitrary k k k approximation, thus achieving lower output error. However, it remains unclear to what extent this information is being retained. Then we derive Theorem 4 to illustrate that for each patch feature, there is an upper bound to the difference between the top-k k k approximation information and the original information, thus effectively retaining the dominant patterns.
Theorem 4. ∀ z n ∈ Z , ∃ z n ′ \forall\mathbf{z}_n\in\mathbf{Z},\ \exists\mathbf{z}'_n ∀ z n ∈ Z , ∃ z n ′ from the k k k -dimensional normal subspace, such that ∥ z n − z n ′ ∥ 2 ≤ σ k + 1 \left\lVert\mathbf{z}_n-\mathbf{z}'_n\right\rVert_2\leq\sigma_{k+1} ∥ z n − z n ′ ∥ 2 ≤ σ k + 1 .
Theorems 3 and 4 mainly prove the validity of the k k k -dimensional normal subspace spanned by the top-k k k right singular vectors from different perspectives of dominant information retention. Then we would like to investigate whether our top-k k k approximation can effectively eliminate the noise interference if there are noise disturbances in the original patch feature matrix Z \mathbf{Z} Z . For instance, the noise interference could cause once there is inherent noise in the original input or irrelevant information introduced during the encoding process. Finally, we derive Theorem 5 to demonstrate the effectiveness of using top-k k k approximation to reduce noise.
Theorem 5. Suppose that Z \mathbf{Z} Z is composed of a clean data matrix E \mathbf{E} E and a white noise matrix D \mathbf{D} D , i.e., Z = E + D \mathbf{Z}=\mathbf{E}+\mathbf{D} Z = E + D , and the clean data is uncorrelated with the noise. To estimate E \mathbf{E} E , the best rank k k k matrix in the least-squares sense is E ^ L S = ∑ i = 1 k σ i u i v i T \hat{\mathbf{E}}_{\mathrm{LS}}=\sum_{i=1}^{k}\sigma_i\mathbf{u}_i\mathbf{v}_i^{\mathsf{T}} E ^ LS = ∑ i = 1 k σ i u i v i T , which minimizes the following squared error:
min E ^ ∥ E ^ − E ∥ F 2 . (59) \min_{\hat{\mathbf{E}}}\left\|\hat{\mathbf{E}}-\mathbf{E}\right\|_{F}^{2}. \tag*{(59)} E ^ min E ^ − E F 2 . (59)
Proof of theorem1
Proof. The singular value decomposition of Z ∈ R N × d \mathbf{Z}\in\mathbb{R}^{N\times d} Z ∈ R N × d is Z = U r Σ r V r T = ∑ i = 1 r σ i u i v i T \mathbf{Z}=\mathbf{U}_r\boldsymbol{\Sigma}_r\mathbf{V}_r^{\mathsf{T}}=\sum_{i=1}^{r}\sigma_i\mathbf{u}_i\mathbf{v}_i^{\mathsf{T}} Z = U r Σ r V r T = ∑ i = 1 r σ i u i v i T , where r = rank ( Z ) r=\operatorname{rank}(\mathbf{Z}) r = rank ( Z ) . We denote the sorted index subset obtained by random selection as I ˉ = { i 1 , i 2 , … , i k } \bar{I}=\{i_1,i_2,\ldots,i_k\} I ˉ = { i 1 , i 2 , … , i k } , where i 1 < i 2 < ⋯ < i k i_1<i_2<\cdots<i_k i 1 < i 2 < ⋯ < i k , and the remaining sorted index subset is I ˉ = { i k + 1 , i k + 2 , … , i r } \bar{I}=\{i_{k+1},i_{k+2},\ldots,i_r\} I ˉ = { i k + 1 , i k + 2 , … , i r } . Then we can calculate the error matrix resulting from the arbitrary approximation:
Z − Z ˉ = ∑ j = i k + 1 i r σ j u j v j T . (60) \mathbf{Z}-\bar{\mathbf{Z}}=\sum_{j=i_{k+1}}^{i_r}\sigma_j\mathbf{u}_j\mathbf{v}_j^{\mathsf{T}}. \tag*{(60)} Z − Z ˉ = j = i k + 1 ∑ i r σ j u j v j T . (60)
Similarly, the error matrix resulting from the top-k k k truncated approximation is:
Z − Z ^ = ∑ i = k + 1 r σ i u i v i T . (61) \mathbf{Z}-\hat{\mathbf{Z}}=\sum_{i=k+1}^{r}\sigma_i\mathbf{u}_i\mathbf{v}_i^{\mathsf{T}}. \tag*{(61)} Z − Z ^ = i = k + 1 ∑ r σ i u i v i T . (61)
Consider the well-trained decoder with weights w = { w 1 , w 2 , … , w s } ∈ R d × s \mathbf{w}=\{w_1,w_2,\ldots,w_s\}\in\mathbb{R}^{d\times s} w = { w 1 , w 2 , … , w s } ∈ R d × s , where s s s is the patch size. It is worth noting that Z w \mathbf{Z}\mathbf{w} Zw denotes the best restoration of the original series, thus, a lower error compared to Z w \mathbf{Z}\mathbf{w} Zw implies that more effective information of the matrix Z \mathbf{Z} Z has been approximately retained. For w l ∈ w w_l\in\mathbf{w} w l ∈ w , the corresponding point errors for arbitrary approximation and top-k k k truncated approximation are as follows:
( Z − Z ˉ ) w l = ( ∑ j = i k + 1 i r σ j u j v j T ) w l = ∑ j = i k + 1 i r σ j u j ( v j T w l ) , (\mathbf{Z}-\bar{\mathbf{Z}})w_l=\left(\sum_{j=i_{k+1}}^{i_r}\sigma_j\mathbf{u}_j\mathbf{v}_j^{\mathsf{T}}\right)w_l=\sum_{j=i_{k+1}}^{i_r}\sigma_j\mathbf{u}_j(\mathbf{v}_j^{\mathsf{T}}w_l), ( Z − Z ˉ ) w l = j = i k + 1 ∑ i r σ j u j v j T w l = j = i k + 1 ∑ i r σ j u j ( v j T w l ) ,
( Z − Z ^ ) w l = ( ∑ i = k + 1 r σ i u i v i T ) w l = ∑ i = k + 1 r σ i u i ( v i T w l ) . (62) (\mathbf{Z}-\hat{\mathbf{Z}})w_l=\left(\sum_{i=k+1}^{r}\sigma_i\mathbf{u}_i\mathbf{v}_i^{\mathsf{T}}\right)w_l=\sum_{i=k+1}^{r}\sigma_i\mathbf{u}_i(\mathbf{v}_i^{\mathsf{T}}w_l). \tag*{(62)} ( Z − Z ^ ) w l = ( i = k + 1 ∑ r σ i u i v i T ) w l = i = k + 1 ∑ r σ i u i ( v i T w l ) . (62)
Considering the above point-by-point error calculation where v j T w l \mathbf{v}_j^{\mathsf{T}}w_l v j T w l is a scalar, we can sum up the above to form the linear combination of orthogonal normalized vectors u i \mathbf{u}_i u i . Then we have:
∥ ( Z − Z ˉ ) w ∥ 2 2 = ∥ ∑ l = 1 s ∑ j = i k + 1 i r ( σ j v j T w l ) u j ∥ 2 2 = ∑ l = 1 s ∑ j = i k + 1 i r ( σ j v j T w l ) 2 , \left\|(\mathbf{Z}-\bar{\mathbf{Z}})\mathbf{w}\right\|_2^2=\left\|\sum_{l=1}^{s}\sum_{j=i_{k+1}}^{i_r}(\sigma_j\mathbf{v}_j^{\mathsf{T}}w_l)\mathbf{u}_j\right\|_2^2=\sum_{l=1}^{s}\sum_{j=i_{k+1}}^{i_r}(\sigma_j\mathbf{v}_j^{\mathsf{T}}w_l)^2, ( Z − Z ˉ ) w 2 2 = l = 1 ∑ s j = i k + 1 ∑ i r ( σ j v j T w l ) u j 2 2 = l = 1 ∑ s j = i k + 1 ∑ i r ( σ j v j T w l ) 2 ,
∥ ( Z − Z ^ ) w ∥ 2 2 = ∥ ∑ l = 1 s ∑ i = k + 1 r ( σ i v i T w l ) u i ∥ 2 2 = ∑ l = 1 s ∑ i = k + 1 r ( σ i v i T w l ) 2 . (63) \left\|(\mathbf{Z}-\hat{\mathbf{Z}})\mathbf{w}\right\|_2^2=\left\|\sum_{l=1}^{s}\sum_{i=k+1}^{r}(\sigma_i\mathbf{v}_i^{\mathsf{T}}w_l)\mathbf{u}_i\right\|_2^2=\sum_{l=1}^{s}\sum_{i=k+1}^{r}(\sigma_i\mathbf{v}_i^{\mathsf{T}}w_l)^2. \tag*{(63)} ( Z − Z ^ ) w 2 2 = l = 1 ∑ s i = k + 1 ∑ r ( σ i v i T w l ) u i 2 2 = l = 1 ∑ s i = k + 1 ∑ r ( σ i v i T w l ) 2 . (63)
Since w \mathbf{w} w is assumed to be well-trained, the contribution strength of the right singular vector v i \mathbf{v}_i v i to the decoding output monotonically increases with the corresponding singular value σ i \sigma_i σ i . Thus we have: c i ≜ ∑ l = 1 s ( v i T w l ) 2 c_i\triangleq\sum_{l=1}^{s}(\mathbf{v}_i^{\mathsf{T}}w_l)^2 c i ≜ ∑ l = 1 s ( v i T w l ) 2 , where c 1 ≥ c 2 ≥ ⋯ ≥ c r ≥ 0 c_1\ge c_2\ge\cdots\ge c_r\ge0 c 1 ≥ c 2 ≥ ⋯ ≥ c r ≥ 0 . Then we can rewrite (63) as follows:
∥ ( Z − Z ˉ ) w ∥ 2 2 = ∑ j = i k + 1 i r σ j 2 c j , ∥ ( Z − Z ^ ) w ∥ 2 2 = ∑ i = k + 1 r σ i 2 c i . (64) \left\|(\mathbf{Z}-\bar{\mathbf{Z}})\mathbf{w}\right\|_2^2=\sum_{j=i_{k+1}}^{i_r}\sigma_j^2c_j,\quad\left\|(\mathbf{Z}-\hat{\mathbf{Z}})\mathbf{w}\right\|_2^2=\sum_{i=k+1}^{r}\sigma_i^2c_i. \tag*{(64)} ( Z − Z ˉ ) w 2 2 = j = i k + 1 ∑ i r σ j 2 c j , ( Z − Z ^ ) w 2 2 = i = k + 1 ∑ r σ i 2 c i . (64)
Noting σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r \sigma_1 \ge\sigma_2 \ge\cdots\ge\sigma_r σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r , and I ^ = { i k + 1 , … , i r } \hat{I} = \{i_{k+1}, \ldots, i_r\} I ^ = { i k + 1 , … , i r } represents indices from the arbitrary selection while { σ k + 1 , … , σ r } \{\sigma_{k+1}, \ldots, \sigma_r\} { σ k + 1 , … , σ r } represents the smallest singular values, thus, we have: σ i r ≥ σ r , … , σ i k + 1 ≥ σ k + 1 \sigma_{i_r} \ge\sigma_r, \ldots, \sigma_{i_{k+1}} \ge\sigma_{k+1} σ i r ≥ σ r , … , σ i k + 1 ≥ σ k + 1 and c i r ≥ c r , … , c i k + 1 ≥ c k + 1 c_{i_r} \ge c_r, \ldots, c_{i_{k+1}} \ge c_{k+1} c i r ≥ c r , … , c i k + 1 ≥ c k + 1 , with the fact i r ≤ r , … , i k + 1 ≤ k + 1 i_r \le r, \ldots, i_{k+1} \le k+1 i r ≤ r , … , i k + 1 ≤ k + 1 . Then for each item in (64) , we know σ i m 2 c i m ≥ σ m 2 c m \sigma_{i_m}^2 c_{i_m} \ge\sigma_m^2 c_m σ i m 2 c i m ≥ σ m 2 c m since i m ≤ m i_m \le m i m ≤ m , and obtain:
∑ j = i k + 1 i r σ j 2 c j ≥ ∑ i = k + 1 r σ i 2 c i . (65) \sum_{j=i_{k+1}}^{i_r} \sigma_j^2 c_j \ge\sum_{i=k+1}^{r} \sigma_i^2 c_i . \tag*{(65)} j = i k + 1 ∑ i r σ j 2 c j ≥ i = k + 1 ∑ r σ i 2 c i . (65)
By taking the expectation over the feature distribution Z \mathcal{Z} Z , we can obtain the following inequality:
E Z ∼ Z [ ∥ Z w − Z ^ w ^ ∥ 2 2 ] ≤ E Z ∼ Z [ ∥ Z w − Z ˉ w ˉ ∥ 2 2 ] . (66) \mathbb{E}_{\mathcal{Z}\sim\mathcal{Z}}\left[\left\|Z w-\hat{Z}\hat{w}\right\|_2^2\right]\leq\mathbb{E}_{\mathcal{Z}\sim\mathcal{Z}}\left[\left\|Z w-\bar{Z}\bar{w}\right\|_2^2\right]. \tag*{(66)} E Z ∼ Z [ Z w − Z ^ w ^ 2 2 ] ≤ E Z ∼ Z [ Z w − Z ˉ w ˉ 2 2 ] . (66)
Proof of theorem2
Proof. Since Z Z Z is a N × d N \times d N × d matrix, i.e., Z = [ z 1 , z 2 , … , z N ] ⊤ Z=[z_1,z_2,\ldots,z_N]^\top Z = [ z 1 , z 2 , … , z N ] ⊤ , where z n ∈ R d z_n\in\mathbb{R}^d z n ∈ R d is the patch feature. After performing SVD on Z Z Z , i.e., Z = U r Σ r V r ⊤ Z=U_r\Sigma_rV_r^\top Z = U r Σ r V r ⊤ , we have:
\begin{bmatrix}
z_1^\top\\
z_2^\top\\
\vdots\\
\vdots\\
z_N^\top
\end{bmatrix}
=
\begin{bmatrix}
u_1^\top\\
u_2^\top\\
\vdots\\
\vdots\\
u_N^\top
\end{bmatrix}
\cdot
\begin{bmatrix}
\sigma_1 & 0 & \cdots& 0\\
0 & \sigma_2 & \cdots& 0\\
\vdots& \vdots& \ddots& \vdots\\
0 & 0 & \cdots& \sigma_r
\end{bmatrix}
\cdot
\begin{bmatrix}
v_1^\top\\
v_2^\top\\
\vdots\\
v_r^\top
\end{bmatrix}, \tag*{(67)}\end{bmatrix}
where U r = [ u ⃗ 1 , u ⃗ 2 , … , u ⃗ N ] ⊤ ∈ R N × r U_r=[\vec{u}_1,\vec{u}_2,\ldots,\vec{u}_N]^\top\in\mathbb{R}^{N\times r} U r = [ u 1 , u 2 , … , u N ] ⊤ ∈ R N × r , V r = [ v 1 , v 2 , … , v r ] ∈ R d × r V_r=[v_1,v_2,\ldots,v_r]\in\mathbb{R}^{d\times r} V r = [ v 1 , v 2 , … , v r ] ∈ R d × r . Then we expand each item u i j u_{ij} u ij in U r U_r U r , and obtain:
\begin{bmatrix}
z_1^\top\\
z_2^\top\\
\vdots\\
z_N^\top
\end{bmatrix}
=
\begin{bmatrix}
\sigma_1\cdot u_{11} & \sigma_2\cdot u_{12} & \cdots& \sigma_r\cdot u_{1r}\\
\sigma_1\cdot u_{21} & \sigma_2\cdot u_{22} & \cdots& \sigma_r\cdot u_{2r}\\
\vdots& \vdots& \ddots& \vdots\\
\sigma_1\cdot u_{N1} & \sigma_2\cdot u_{N2} & \cdots& \sigma_r\cdot u_{Nr}
\end{bmatrix}
\cdot
\begin{bmatrix}
v_1^\top\\
v_2^\top\\
\vdots\\
v_r^\top
\end{bmatrix}. \tag*{(68)}\end{bmatrix}
For each patch feature z n ∈ Z z_n\in\mathcal{Z} z n ∈ Z , we have:
z n ⊤ = [ σ 1 ⋅ u n 1 σ 2 ⋅ u n 2 ⋯ σ r ⋅ u n r ] ⋅ [ v 1 ⊤ v 2 ⊤ ⋮ v r ⊤ ] . (69) z_n^\top=
\begin{bmatrix}
\sigma_1\cdot u_{n1} & \sigma_2\cdot u_{n2} & \cdots& \sigma_r\cdot u_{nr}
\end{bmatrix}
\cdot
\begin{bmatrix}
v_1^\top\\
v_2^\top\\
\vdots\\
v_r^\top
\end{bmatrix}. \tag*{(69)} z n ⊤ = [ σ 1 ⋅ u n 1 σ 2 ⋅ u n 2 ⋯ σ r ⋅ u n r ] ⋅ v 1 ⊤ v 2 ⊤ ⋮ v r ⊤ . (69)
Then we can get the summation form:
z n ⊤ = ∑ i = 1 r σ i ⋅ u n i v i ⊤ = ∑ i = 1 k σ i ⋅ u n i v i ⊤ + ∑ i = k + 1 r σ i ⋅ u n i v i ⊤ . (70) z_n^\top=\sum_{i=1}^{r}\sigma_i\cdot u_{ni}v_i^\top=\sum_{i=1}^{k}\sigma_i\cdot u_{ni}v_i^\top+\sum_{i=k+1}^{r}\sigma_i\cdot u_{ni}v_i^\top. \tag*{(70)} z n ⊤ = i = 1 ∑ r σ i ⋅ u ni v i ⊤ = i = 1 ∑ k σ i ⋅ u ni v i ⊤ + i = k + 1 ∑ r σ i ⋅ u ni v i ⊤ . (70)
Note that we can construct feature z n ′ z'_n z n ′ from the k k k -dimensional normal subspace, i.e., z n ′ ⊤ = ∑ i = 1 k σ i ⋅ u n i v i ⊤ z_n'^\top=\sum_{i=1}^{k}\sigma_i\cdot u_{ni}v_i^\top z n ′⊤ = ∑ i = 1 k σ i ⋅ u ni v i ⊤ . Then we have:
∥ z n ⊤ − z n ′ ⊤ ∥ 2 = ∥ ∑ i = k + 1 r σ i ⋅ u n i v i ⊤ ∥ 2 = ∑ i = k + 1 r ( σ i ⋅ u n i ) 2 . (71) \left\|z_n^\top-z_n'^\top\right\|_2=\left\|\sum_{i=k+1}^{r}\sigma_i\cdot u_{ni}v_i^\top\right\|_2=\sqrt{\sum_{i=k+1}^{r}\left(\sigma_i\cdot u_{ni}\right)^2}. \tag*{(71)} z n ⊤ − z n ′⊤ 2 = i = k + 1 ∑ r σ i ⋅ u ni v i ⊤ 2 = i = k + 1 ∑ r ( σ i ⋅ u ni ) 2 . (71)
Since all the vectors in U r U_r U r are mutually orthogonal and normalized, we know ∥ u ⃗ n ∥ = 1 \|\vec{u}_n\|=1 ∥ u n ∥ = 1 , and ∥ u ⃗ n [ k + 1 , r ] ∥ ≤ 1 \left\|\vec{u}_n^{[k+1,r]}\right\|\leq1 u n [ k + 1 , r ] ≤ 1 , where u ⃗ n [ k + 1 , r ] \vec{u}_n^{[k+1,r]} u n [ k + 1 , r ] is the sub-vectors of u ⃗ n \vec{u}_n u n from k + 1 k+1 k + 1 -th to r r r -th dimensions. Noting that the singular values are decreasing, i.e., σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r \sigma_1\geq\sigma_2\geq\cdots\geq\sigma_r σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r , then we have the following upper bound:
∥ z n ⊤ − z n ′ ⊤ ∥ 2 ≤ σ k + 1 ∑ i = k + 1 r u n i 2 ≤ σ k + 1 . (72) \left\|z_n^\top-z_n'^\top\right\|_2\leq\sigma_{k+1}\sqrt{\sum_{i=k+1}^{r}u_{ni}^2}\leq\sigma_{k+1}. \tag*{(72)} z n ⊤ − z n ′⊤ 2 ≤ σ k + 1 i = k + 1 ∑ r u ni 2 ≤ σ k + 1 . (72)
Proof of theorem3
Proof. Since clean data is assumed to be uncorrelated with the white noise, we know that the clean data matrix E \mathbf{E} E is orthogonal to the noise matrix D \mathbf{D} D , i.e., E ⊤ D = 0 \mathbf{E}^{\top}\mathbf{D}=0 E ⊤ D = 0 . We also have D ⊤ D = δ 2 I \mathbf{D}^{\top}\mathbf{D}=\delta^{2}\mathbf{I} D ⊤ D = δ 2 I since noise is white and uncorrelated, where δ 2 \delta^{2} δ 2 is the noise variance. Our goal is to minimize ∥ E ^ − E ∥ F 2 \lVert\widehat{\mathbf{E}}-\mathbf{E}\rVert_{F}^{2} ∥ E − E ∥ F 2 . Because of Z = E + D \mathbf{Z}=\mathbf{E}+\mathbf{D} Z = E + D , we have:
∥ Z − E ^ ∥ F 2 = ∥ E − E ^ + D ∥ F 2 = ∥ E − E ^ ∥ F 2 + ∥ D ∥ F 2 + 2 tr [ ( E − E ^ ) ⊤ D ] . (73) \lVert\mathbf{Z}-\widehat{\mathbf{E}}\rVert_{F}^{2}=\lVert\mathbf{E}-\widehat{\mathbf{E}}+\mathbf{D}\rVert_{F}^{2}=\lVert\mathbf{E}-\widehat{\mathbf{E}}\rVert_{F}^{2}+\lVert\mathbf{D}\rVert_{F}^{2}+2\operatorname{tr}\left[(\mathbf{E}-\widehat{\mathbf{E}})^{\top}\mathbf{D}\right]. \tag*{(73)} ∥ Z − E ∥ F 2 = ∥ E − E + D ∥ F 2 = ∥ E − E ∥ F 2 + ∥ D ∥ F 2 + 2 tr [ ( E − E ) ⊤ D ] . (73)
Since E ⊤ D = 0 \mathbf{E}^{\top}\mathbf{D}=0 E ⊤ D = 0 and the estimated signal is uncorrelated with noise in the expectation sense, thus tr [ ( E − E ^ ) ⊤ D ] = 0 \operatorname{tr}\left[(\mathbf{E}-\widehat{\mathbf{E}})^{\top}\mathbf{D}\right]=0 tr [ ( E − E ) ⊤ D ] = 0 , and we have ∥ D ∥ F 2 = tr ( D ⊤ D ) = tr ( δ 2 I ) = δ 2 ⋅ d \lVert\mathbf{D}\rVert_{F}^{2}=\operatorname{tr}(\mathbf{D}^{\top}\mathbf{D})=\operatorname{tr}(\delta^{2}\mathbf{I})=\delta^{2}\cdot d ∥ D ∥ F 2 = tr ( D ⊤ D ) = tr ( δ 2 I ) = δ 2 ⋅ d , then we can obtain:
∥ Z − E ^ ∥ F 2 = ∥ E − E ^ ∥ F 2 + δ 2 ⋅ d , (74) \lVert\mathbf{Z}-\widehat{\mathbf{E}}\rVert_{F}^{2}=\lVert\mathbf{E}-\widehat{\mathbf{E}}\rVert_{F}^{2}+\delta^{2}\cdot d, \tag*{(74)} ∥ Z − E ∥ F 2 = ∥ E − E ∥ F 2 + δ 2 ⋅ d , (74)
where δ 2 ⋅ d \delta^{2}\cdot d δ 2 ⋅ d is a constant term. Therefore, the minimization of ∥ E ^ − E ∥ F 2 \lVert\widehat{\mathbf{E}}-\mathbf{E}\rVert_{F}^{2} ∥ E − E ∥ F 2 is equivalent to the minimization of ∥ Z − E ^ ∥ F 2 \lVert\mathbf{Z}-\widehat{\mathbf{E}}\rVert_{F}^{2} ∥ Z − E ∥ F 2 . Suppose that clean data matrix E \mathbf{E} E is rank deficient, i.e., rank ( E ) = k \operatorname{rank}(\mathbf{E})=k rank ( E ) = k , then we also restrict E ^ \widehat{\mathbf{E}} E to the matrix with a rank not exceeding k k k . Therefore, minimizing ∥ E ^ − E ∥ F 2 \lVert\widehat{\mathbf{E}}-\mathbf{E}\rVert_{F}^{2} ∥ E − E ∥ F 2 becomes:
min rank ( E ^ ) ≤ k ∥ Z − E ^ ∥ F 2 . (75) \min_{\operatorname{rank}(\widehat{\mathbf{E}})\leq k}\lVert\mathbf{Z}-\widehat{\mathbf{E}}\rVert_{F}^{2}. \tag*{(75)} rank ( E ) ≤ k min ∥ Z − E ∥ F 2 . (75)
According to the Eckart–Young–Mirsky theorem [13 ] , for any matrix Z \mathbf{Z} Z , the optimal approximation with a rank no greater than k k k is the truncation of top-k k k singular values of Z \mathbf{Z} Z . Therefore, the best least-squares estimate of the clean data matrix E \mathbf{E} E is the top-k k k truncated approximation of Z \mathbf{Z} Z :
E ^ L S = Z ^ = ∑ i = 1 k σ i u i v i ⊤ , (76) \widehat{\mathbf{E}}_{\mathrm{LS}}=\widehat{\mathbf{Z}}=\sum_{i=1}^{k}\sigma_i\mathbf{u}_i\mathbf{v}_i^{\top}, \tag*{(76)} E LS = Z = i = 1 ∑ k σ i u i v i ⊤ , (76)
where σ i \sigma_i σ i , u i \mathbf{u}_i u i , and v i \mathbf{v}_i v i denote the singular values, left singular vectors, and right singular vectors of Z \mathbf{Z} Z respectively. We complete the proof.
Proof of prop1 (Spectral and Geometric Property)
Proof. For any k ∈ v i ⊥ \mathbf{k}\in\mathbf{v}_i^{\perp} k ∈ v i ⊥ (i.e., v i ⊤ k = 0 \mathbf{v}_i^{\top}\mathbf{k}=0 v i ⊤ k = 0 ), we have:
W i k = ( I − β i v i v i ⊤ ) k = k − β i v i ( v i ⊤ k ) = k . (77) \mathbf{W}_i\mathbf{k}=(\mathbf{I}-\beta_i\mathbf{v}_i\mathbf{v}_i^{\top})\mathbf{k}=\mathbf{k}-\beta_i\mathbf{v}_i(\mathbf{v}_i^{\top}\mathbf{k})=\mathbf{k}. \tag*{(77)} W i k = ( I − β i v i v i ⊤ ) k = k − β i v i ( v i ⊤ k ) = k . (77)
Thus each vector in v i ⊥ \mathbf{v}_i^{\perp} v i ⊥ is an eigenvector with eigenvalue 1. Since v i ∈ R d \mathbf{v}_i\in\mathbb{R}^{d} v i ∈ R d , we can select the remaining d − 1 d-1 d − 1 directions that are orthogonal to v i \mathbf{v}_i v i and combine them to form v i ⊥ \mathbf{v}_i^{\perp} v i ⊥ . Then we can know that W i \mathbf{W}_i W i has ( d − 1 ) (d-1) ( d − 1 ) eigenvalues of 1 since dim ( v i ⊥ ) = d − 1 \dim(\mathbf{v}_i^{\perp})=d-1 dim ( v i ⊥ ) = d − 1 .
Similarly, for the vector v i \mathbf{v}_i v i itself, we have:
W i v i = ( I − β i v i v i ⊤ ) v i = v i − β i v i ( v i ⊤ v i ) = ( 1 − β i ) v i . (78) \mathbf{W}_i\mathbf{v}_i=(\mathbf{I}-\beta_i\mathbf{v}_i\mathbf{v}_i^{\top})\mathbf{v}_i=\mathbf{v}_i-\beta_i\mathbf{v}_i(\mathbf{v}_i^{\top}\mathbf{v}_i)=(1-\beta_i)\mathbf{v}_i. \tag*{(78)} W i v i = ( I − β i v i v i ⊤ ) v i = v i − β i v i ( v i ⊤ v i ) = ( 1 − β i ) v i . (78)
Therefore, W i \mathbf{W}_i W i has an eigenvector v i \mathbf{v}_i v i with eigenvalue 1 − β i 1-\beta_i 1 − β i . Overall, The spectrum of W i \mathbf{W}_i W i is Λ ( W i ) = { 1 − β i , 1 , … , 1 } \Lambda(\mathbf{W}_i)=\{1-\beta_i,1,\ldots,1\} Λ ( W i ) = { 1 − β i , 1 , … , 1 } . This indicates that since W i \mathbf{W}_i W i is a rank-1 perturbation of the identity, it leaves all components orthogonal to v i \mathbf{v}_i v i unchanged and only rescales the projection along v i \mathbf{v}_i v i by a factor of ( 1 − β i ) (1-\beta_i) ( 1 − β i ) .
To more intuitively present how β i \beta_i β i governs the geometric behavior of the transformation z ~ n ( i ) = W i z n + b i \widetilde{\mathbf{z}}_n^{(i)}=\mathbf{W}_i\mathbf{z}_n+\mathbf{b}_i z n ( i ) = W i z n + b i , we compute the corresponding projection of z ~ n ( i ) \widetilde{\mathbf{z}}_n^{(i)} z n ( i ) onto v i \mathbf{v}_i v i :
v i ⊤ z ~ n ( i ) = v i ⊤ ( I − β i v i v i ⊤ ) z n + v i ⊤ α i β i v i = ( 1 − β i ) v i ⊤ z n + α i β i = α i + ( 1 − β i ) ( v i ⊤ z n − α i ) . (79) \begin{aligned}
\mathbf{v}_i^{\top}\widetilde{\mathbf{z}}_n^{(i)}
&=\mathbf{v}_i^{\top}(\mathbf{I}-\beta_i\mathbf{v}_i\mathbf{v}_i^{\top})\mathbf{z}_n+\mathbf{v}_i^{\top}\alpha_i\beta_i\mathbf{v}_i\\
&=(1-\beta_i)\mathbf{v}_i^{\top}\mathbf{z}_n+\alpha_i\beta_i\\
&=\alpha_i+(1-\beta_i)(\mathbf{v}_i^{\top}\mathbf{z}_n-\alpha_i). \tag*{(79)}
\end{aligned} v i ⊤ z n ( i ) = v i ⊤ ( I − β i v i v i ⊤ ) z n + v i ⊤ α i β i v i = ( 1 − β i ) v i ⊤ z n + α i β i = α i + ( 1 − β i ) ( v i ⊤ z n − α i ) . (79)
Equation (79) reflects explicit geometric regimes: (i) identity mapping (β i < 1 \beta_i<1 β i < 1 , β i → 0 \beta_i\to0 β i → 0 ): the update tends to retain partial old information, and remains unchanged when β i = 0 \beta_i=0 β i = 0 . (ii) complete replacement (β i = 1 \beta_i=1 β i = 1 ): the updated projection is exactly replaced by α i \alpha_i α i to reflect normality. (iii) over-calibration (β i > 1 \beta_i>1 β i > 1 ): the update tends to further reversely calibrate the old information.
Since each patch feature involves varying degrees of normality, our learnable parameters α i \alpha_i α i and β i \beta_i β i can adaptively adjust each feature to the normality manifold. This allows the model to learn under-, moderate, and over-corrective behaviors where beneficial.
Experimental Details
Datasets
We conduct comprehensive experiments on ten TSAD datasets, including five univariate and five multivariate datasets. Table 3 summarizes the detailed statistics of these datasets. The characteristics of each dataset are introduced below:
Table 3. Statistics of ten datasets (Dim: dimensionality).
IOPS ([43 ] ): A large-scale dataset containing Key Performance Indicators (KPIs) from Internet companies, with time series collected from real-world IT operations. The dataset includes various anomaly patterns such as spikes, level shifts, and gradual changes.
UCR ([52 ] ): A collection of univariate time series from diverse domains including medicine, power demand, air temperature, and so on. The anomalies are typically point anomalies or short subsequence anomalies.
NAB ([2 ] ): The Numenta Anomaly Benchmark consists of labeled real-world and artificial time series with point and contextual anomalies. It includes data from various sources such as online advertisement clicks, machine temperature sensors, and traffic data.
MSL ([5 ] ): Mars Science Laboratory dataset containing telemetry data from spacecraft monitoring systems. It consists of time series with anomalies caused by various spacecraft operational issues. Since only one feature represents a sensor measurement and the remaining features are binary-encoded commands, we transform the original multivariate time series into univariate ones, which is consistent with TSB-UAD ([37 ] ) and TAB ([41 ] ).
SMAP ([5 ] ): Soil Moisture Active Passive satellite dataset containing spacecraft telemetry data. Anomalies represent spacecraft component failures and unusual sensor behaviors. Like the processing of MSL, the multivariate time series are transformed into univariate ones.
PSM ([1 ] ): Pooled Server Metrics dataset is collected internally from multiple application server nodes as eBay, containing monitoring server performance metrics such as CPU usage, memory consumption, and network traffic. The dataset includes complex multivariate anomaly patterns.
SMD ((Su et al., 2019)): Server Machine Dataset is collected from a large Internet company’s server monitoring system. It contains various types of server anomalies, including hardware failures and software bugs. Anomalies are annotated by domain experts.
SWAT ([33 ] ): Secure Water Treatment dataset is collected from a real-world water treatment testbed. Anomalies are caused by attack scenarios targeting critical infrastructure, making it particularly challenging.
PUMP ([16 ] ): A dataset collected from a water pumping system with multiple sensors monitoring pressure, flow rate, and motor status. The anomalies are caused by mechanical failures and sensor malfunctions.
NYC ([10 ] ): New York City taxi demand dataset containing traffic volume measurements. Anomalies correspond to unusual traffic patterns caused by special events or incidents.
For all univariate time series, we follow the data filtering strategy proposed by TAB benchmark ([41 ] ) to ensure data quality. Finally, we include a total of 361 univariate and multivariate time series. For all datasets, we follow the standard train-test split provided by the original sources ([41 ] ). Only five normal samples from the training set are utilized to learn the normality constraint, while the test set includes both normal and anomalous observations for evaluation.
Baselines
We evaluate NCL on ten state-of-the-art foundation models, including six forecasting-based, two reconstruction-based, and two forecasting-reconstruction-combined TSFMs:
TSPulse [15 ] : An ultra-lightweight foundation model with disentangled representation learning. It pre-trains with masked reconstruction augmented by explicit disentanglement across temporal, spectral, and semantic spaces, and employs lightweight post-hoc fusers to selectively combine these views for task-specific adaptation.
SEMPO [20 ] : A lightweight foundation model featuring energy-aware spectral decomposition and mixture-of-prompts enabled Transformer. It models both high-energy and low-energy informative frequency signals for efficient pre-training, and employs dataset-specific prompts with adaptive routing for parameter-efficient cross-domain adaptation.
For anomaly detection, all TSFMs are applied in a zero-shot manner without fine-tuning their pre-trained parameters. We use the forecasting error (for forecasting-based TSFMs), reconstruction error (for reconstruction-based TSFMs), or combined error of forecasting and reconstruction (for forecasting-reconstruction-combined TSFMs) as the baseline anomaly score. NCL is then applied as a plug-and-play framework to enhance their anomaly detection capabilities.
Additionally, we compare NCL-augmented TSFMs with several deep TSAD methods, simple one-liner baselines, and TSAD-specific foundation models in Appendix § 17 , Appendix § 18 , and Appendix § 19 , respectively.
Conventional deep TSAD methods (i.e. , methods trained from scratch on each dataset) include CroAD [27 ] , ConAD [66 ] , TsNet [51 ] , and Dlinear [60 ] .
One-liner baselines (i.e. , simple baseline methods requiring no training) include LOF (Local Outlier Factor), Last-1 (last value as prediction), Last-3 (average of last 3 values), Var-100 (100-window moving variance), and Centered-5 (average of the 2 neighboring values before and after).
TSAD-specific foundation models include DADA [44 ] , TimeRCD [26 ] , and TimeRadar [21 ] . These approaches aim to learn discriminative representations by pre-training on large-scale datasets augmented with synthetic anomalies. DADA employs dual adversarial decoders to explicitly distinguish normal from abnormal patterns using injected anomalies, while TimeRCD conducts relative context discrepancy pre-training on synthetic anomalies. Pre-training on the anomaly-injected time series corpus released by DADA, TimeRadar identifies diverse anomalies in a domain-rotatable time–frequency space.
Implementation Details
We utilize the TAB [41 ] code repository for unified evaluation and follow its default parameter configuration. For all ten TSFMs, we rely on code from:
Aurora: https://github.com/decisionintelligence/Aurora
ROSE: https://github.com/decisionintelligence/ROSE
Time-MoE: https://github.com/Time-MoE/Time-MoE
Chronos: https://github.com/amazon-science/chronos-forecasting
TimesFM: https://github.com/google-research/timesfm
TTM: https://github.com/ibm-granite/granite-tsfm/tree/main/tsfm_public/models/tinytimemixer
MOMENT: https://github.com/moment-timeseries-foundation-model/moment
UniTS: https://github.com/mims-harvard/UniTS
TSPulse: https://github.com/ibm-granite/granite-tsfm
SEMPO: https://github.com/mala-lab/SEMPO
Several deep TSAD methods (CroAD, ConAD, TsNet, and Dlinear) are adopted from https://github.com/decisionintelligence/TAB. LOF is adapted from the pyod package https://github.com/yzhao062/pyod. Last-1, Last-3, Var-100, and Centered-5 are adopted from https://gitlab.kuleuven.be/m-group-campus-brugge/dtai_public/publications/iclr2026_timeseriesfoundationmodelsad/. DADA is from the official code repository https://github.com/iambowen/DADA. TimeRCD is from https://github.com/thu-sail-lab/Time-RCD. TimeRadar is from https://github.com/mala-lab/TimeRadar.
For NCL hyperparameters, the number of principal directions (top-k k k singular vectors) is set to k = 16 k = 16 k = 16 for all experiments, and we also conduct a comprehensive sensitivity analysis in Appendix § 25 . The margin γ \gamma γ in the contrastive normality constraint (Equation (8) ) is set to 1.0. The learning rate is 1e-4 with the Adam optimizer. We train NCL for 5 epochs with only 500 normal samples randomly selected from the training set. During training, we freeze all parameters of the pre-trained TSFM and only optimize the parameters in NCL. All experiments are conducted on a workstation with an Intel(R) Xeon(R) Gold 6426Y CPU and a single NVIDIA A100 GPU (80GB memory).
Algorithms Details
Algorithm 1 details the complete training procedure of NCL, including normal subspace construction, patch-adaptive normality transformation, contrastive normality constraint, and output fusion. Only the NCL module parameters are updated while the TSFM F \mathcal{F} F remains frozen. The training procedure emphasizes five key aspects: (i) The TSFM F \mathcal{F} F is kept frozen throughout training, preserving its pre-trained knowledge; (ii) The SVD identifies the principal directions of normal variation in the feature space; (iii) Transforming each feature onto the normality manifold along each direction; (iv) The contrastive normality constraint encourages that transformed features form well-separated clusters corresponding to distinct normal directions; and (v) The gated fusion mechanism adaptively combines NCL predictions with original TSFM outputs to amplify normal properties.
Algorithm 1 Training Procedure of NCL
Input: Frozen TSFM F \mathcal{F} F , normal training samples { X t , Y t } t = 1 N t r a i n \{X_t,Y_t\}_{t=1}^{N^{\mathrm{train}}} { X t , Y t } t = 1 N train , learning rate η \eta η , margin γ \gamma γ , number of epochs E E E , number of principal directions k k k , trainable parameters W α , W β , b α , b β W_{\alpha},W_{\beta},b_{\alpha},b_{\beta} W α , W β , b α , b β , decoder weights, fusion weights λ \lambda λ
Output: Trained NCL parameters, top-k k k right singular vectors { v i } i = 1 k \{v_i\}_{i=1}^{k} { v i } i = 1 k , cluster centers { c i } i = 1 k \{c_i\}_{i=1}^{k} { c i } i = 1 k
Initialize learnable parameters: W α , W β ∈ R k × d W_{\alpha},W_{\beta}\in\mathbb{R}^{k\times d} W α , W β ∈ R k × d , b α , b β ∈ R k b_{\alpha},b_{\beta}\in\mathbb{R}^{k} b α , b β ∈ R k
Initialize decoder head and fusion weights λ ∈ ( 0 , 1 ) D \lambda\in(0,1)^D λ ∈ ( 0 , 1 ) D
for epoch e = 1 e=1 e = 1 to E E E do
Select all the samples from { X t , Y t } t = 1 N t r a i n \{X_t,Y_t\}_{t=1}^{N^{\mathrm{train}}} { X t , Y t } t = 1 N train to form batch { ( X t , Y t ) } t ∈ B \{(X_t,Y_t)\}_{t\in\mathcal{B}} {( X t , Y t ) } t ∈ B
Z = { z n } n = 1 N = F ( X B ) Z=\{z_n\}_{n=1}^{N}=\mathcal{F}(X_{\mathcal{B}}) Z = { z n } n = 1 N = F ( X B ) {Extract patch features from frozen TSFM}
Y ^ B = Decoder F ( Z ) \widehat{Y}_{\mathcal{B}}=\operatorname{Decoder}_{\mathcal{F}}(Z) Y B = Decoder F ( Z ) {Obtain TSFM predictions}
Z = U r Σ r V r ⊤ Z=U_r\Sigma_rV_r^{\top} Z = U r Σ r V r ⊤ with σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r \sigma_1\geq\sigma_2\geq\cdots\geq\sigma_r σ 1 ≥ σ 2 ≥ ⋯ ≥ σ r {Perform SVD on feature matrix}
{ v i } i = 1 k ← \{v_i\}_{i=1}^{k}\leftarrow { v i } i = 1 k ← columns 1 to k k k of V r V_r V r {Retain top-k k k right singular vectors}
for each patch feature z n z_n z n in Z Z Z do
α n = σ ( W α z n + b α ) ∈ ( 0 , 1 ) k \alpha_n=\sigma(W_{\alpha}z_n+b_{\alpha})\in(0,1)^k α n = σ ( W α z n + b α ) ∈ ( 0 , 1 ) k
β n = 2 ⋅ σ ( W β z n + b β ) ∈ ( 0 , 2 ) k \beta_n=2\cdot\sigma(W_{\beta}z_n+b_{\beta})\in(0,2)^k β n = 2 ⋅ σ ( W β z n + b β ) ∈ ( 0 , 2 ) k
for each principal direction i = 1 i=1 i = 1 to k k k do
z ~ n ( i ) = ( I − β i v i v i ⊤ ) z n + α i β i v i \widetilde{z}_n^{(i)}=(I-\beta_i v_i v_i^{\top})z_n+\alpha_i\beta_i v_i z n ( i ) = ( I − β i v i v i ⊤ ) z n + α i β i v i {Normality Transformation, Equation (6) }
end for
z ~ n = 1 k ∑ i = 1 k z ~ n ( i ) \widetilde{z}_n=\frac{1}{k}\sum_{i=1}^{k}\widetilde{z}_n^{(i)} z n = k 1 ∑ i = 1 k z n ( i ) {Aggregate views}
end for
for each direction i = 1 i=1 i = 1 to k k k do
c i = 1 N ∑ n = 1 N z ~ n ( i ) c_i=\frac{1}{N}\sum_{n=1}^{N}\widetilde{z}_n^{(i)} c i = N 1 ∑ n = 1 N z n ( i )
end for
Initialize L C o n N C = 0 \mathcal{L}_{\mathrm{ConNC}}=0 L ConNC = 0
for each patch n = 1 n=1 n = 1 to N N N do
for each direction i = 1 i=1 i = 1 to k k k do
d p o s = ∥ z ~ n ( i ) − c i ∥ 2 d_{\mathrm{pos}}=\lVert\widetilde{z}_n^{(i)}-c_i\rVert_2 d pos = ∥ z n ( i ) − c i ∥ 2 {Compute positive pair distance}
d n e g = min j ≠ i ∥ z ~ n ( i ) − c j ∥ 2 d_{\mathrm{neg}}=\min_{j\ne i}\lVert\widetilde{z}_n^{(i)}-c_j\rVert_2 d neg = min j = i ∥ z n ( i ) − c j ∥ 2 {Compute negative pair distances}
L C o n N C ← L C o n N C + max ( 0 , d p o s + γ − d n e g ) \mathcal{L}_{\mathrm{ConNC}}\leftarrow\mathcal{L}_{\mathrm{ConNC}}+\max(0,d_{\mathrm{pos}}+\gamma-d_{\mathrm{neg}}) L ConNC ← L ConNC + max ( 0 , d pos + γ − d neg ) {Accumulate triplet loss}
end for
end for
L C o n N C = L C o n N C / ( N ⋅ k ) \mathcal{L}_{\mathrm{ConNC}}=\mathcal{L}_{\mathrm{ConNC}}/(N\cdot k) L ConNC = L ConNC / ( N ⋅ k ) Equation (8)
Y ~ B n c l = Decoder n c l ( [ z ~ 1 , … , z ~ N ] ) \widetilde{Y}_{\mathcal{B}}^{\mathrm{ncl}}=\operatorname{Decoder}_{\mathrm{ncl}}([\widetilde{z}_1,\ldots,\widetilde{z}_N]) Y B ncl = Decoder ncl ([ z 1 , … , z N ]) {Decode calibrated features}
Y ~ B = λ ⊙ Y ^ B + ( 1 − λ ) ⊙ Y ~ B n c l \widetilde{Y}_{\mathcal{B}}=\lambda\odot\widehat{Y}_{\mathcal{B}}+(1-\lambda)\odot\widetilde{Y}_{\mathcal{B}}^{\mathrm{ncl}} Y B = λ ⊙ Y B + ( 1 − λ ) ⊙ Y B ncl {Fuse with TSFM output, Equation (9) }
L P r e d = 1 ∣ B ∣ ∑ t ∈ B ∥ Y ~ t − Y t ∥ 2 2 \mathcal{L}_{\mathrm{Pred}}=\frac{1}{|\mathcal{B}|}\sum_{t\in\mathcal{B}}\lVert\widetilde{Y}_t-Y_t\rVert_2^2 L Pred = ∣ B ∣ 1 ∑ t ∈ B ∥ Y t − Y t ∥ 2 2 {Compute prediction loss}
L = L P r e d + L C o n N C \mathcal{L}=\mathcal{L}_{\mathrm{Pred}}+\mathcal{L}_{\mathrm{ConNC}} L = L Pred + L ConNC {Total loss, Equation (11) }
θ N C L ← θ N C L − η ∇ θ N C L L \theta_{\mathrm{NCL}}\leftarrow\theta_{\mathrm{NCL}}-\eta\nabla_{\theta_{\mathrm{NCL}}}\mathcal{L} θ NCL ← θ NCL − η ∇ θ NCL L {Update NCL parameters via gradient descent}
end for
return Trained NCL parameters, { v i } i = 1 k \{v_i\}_{i=1}^{k} { v i } i = 1 k , { c i } i = 1 k \{c_i\}_{i=1}^{k} { c i } i = 1 k
Computational Complexity Analysis
We further analyze the computational complexity of NCL. Given N N N patches from few-shot normal training samples, feature dimension d d d , and k k k principal directions, the normal subspace construction via SVD requires O ( N 2 ⋅ d ) O(N^{2} \cdot d) O ( N 2 ⋅ d ) one-time cost. Then for per-iteration complexity, TSFM feature extraction requires O ( N ⋅ d ⋅ C F ) O(N \cdot d \cdot C_{F}) O ( N ⋅ d ⋅ C F ) where C F C_{F} C F is TSFM complexity (frozen, no gradients); normality transformation is O ( N ⋅ k ⋅ d ) O(N \cdot k \cdot d) O ( N ⋅ k ⋅ d ) for all k k k views; O ( N ⋅ k 2 ⋅ d ) O(N \cdot k^{2} \cdot d) O ( N ⋅ k 2 ⋅ d ) is needed for distance computations; and lightweight projection requires O ( k ⋅ d ) O(k \cdot d) O ( k ⋅ d ) . Since k ≪ d k \ll d k ≪ d and the TSFM is frozen, we can effectively conduct NCL training in approximate O ( N ⋅ k 2 ⋅ d ) O(N \cdot k^{2} \cdot d) O ( N ⋅ k 2 ⋅ d ) time, which is linear with dimensionality d d d . The comparisons in § 5.4 and Appendix § 16 empirically validate the computational efficiency of NCL.
Detailed Efficiency Comparison with Other TSFM Adaptation Methods
Figure 5 provides a detailed efficiency comparison of NCL against other TSFM adaptation methods across different TSFMs on multivariate time series. The results consistently demonstrate NCL’s superior efficiency. By freezing the TSFM backbone and only optimizing lightweight projection heads, NCL requires minimal parameter update overhead during training. In contrast, LoRA must store gradients for updating key TSFM parameters, and CoRA needs more parameters to model the cross-channel association. It is worth noting that NCL has slightly more trainable parameters compared to LoRA on reconstruction-based TSFMs (MOMENT and UniTS). This is because the reconstruction is performed on the entire series, and the final linear head of NCL thus introduces more parameters. Beyond parameter overhead, NCL also exhibits the fastest training times across nearly all TSFMs. For MOMENT, NCL completes training in approximately 2.59 seconds, while LoRA requires 2.71 seconds and CoRA needs 3.32 seconds. Similar patterns are observed for other TSFMs including Chronos, ROSE, and SEMPO. The efficiency advantage makes NCL particularly attractive for practical deployment scenarios where frequent model updates are required.
Figure 5. Efficiency comparison of NCL and other TSFM adaptation methods w.r.t. different TSFMs.
Comparison with Deep TSAD and One-Liner Methods
To further demonstrate the effectiveness of NCL, we compare it against advanced deep TSAD methods (trained from scratch on each dataset) and simple one-liner baselines (requiring no training). Table 4 presents comprehensive precision-recall-based metrics including the Area Under the Precision-Recall Curve (A-P), the Range Area Under the Precision-Recall Curve (R-A-P), and the Volume Under the Surface of Precision-Recall (VUS-PR, abbreviated as V-PR) across all ten datasets. Table 5 reports comprehensive receiver-operating-characteristic-based metrics including the Area under the Receiver Operating Characteristics Curve (A-R), the Range Area under the Receiver Operating Characteristics Curve (R-A-R), and the Volume Under the Surface of Receiver Operating Characteristic (VUS-ROC, abbreviated as V-ROC) across all ten datasets.
Table 4. PR comparison with deep TSAD methods and one-liner baselines. The best ones are boldfaced and the second best are underlined.
Table 5. ROC comparison with deep TSAD methods and one-liner baselines. The best ones are boldfaced and the second best are <u>underlined</u>.
Comparison with Deep TSAD Methods. NCL consistently outperforms sophisticated deep TSAD methods such as CroAD, ConAD, TsNet, and DLinear. Specifically, UniTS+NCL achieves the best average rank of 2.13 across all PR metrics and datasets, significantly better than CroAD (5.13) and TsNet (6.27). The key advantage of NCL over deep TSAD methods is its generalization capability. Conventional deep TSAD methods must be trained from scratch for each new dataset, while NCL requires only a few normal samples to adapt pre-trained TSFMs. This makes NCL significantly more practical for real-world scenarios where training data is scarce or expensive to obtain.
Comparison with One-Liner Baselines. Interestingly, simple moving-window variance baselines (Var-100) achieve competitive performance with an average rank of 4.00, even outperforming sophisticated deep learning methods. For instance, on UCR and MSL datasets, Var-100 achieves the best A-P scores. This phenomenon has been noted in recent studies [65 ] (Deldari et al. 2024), suggesting that many existing methods fail to substantially improve over simple statistical baselines. However, NCL-enhanced TSFMs (TMM+NCL and UniTS+NCL with average ranks of 3.77 and 2.13 in PR metrics, and average ranks of 3.47 and 2.73 in ROC metrics) consistently surpass these baselines, demonstrating that normality constraint learning successfully addresses the fundamental limitation of TSFMs in anomaly detection.
Significant improvement for TSFMs. As analyzed above, NCL-enhanced TSFMs achieve better performance compared to deep TSAD and one-liner methods. More intuitively, in terms of the PR metrics, the average rank of the original TMM was only 7.47, significantly lower than 5.13 for CroAD and 4.00 for Var-100. After adding NCL, the rank improves to 3.77. It is the gains brought by NCL that enable TSFMs to achieve the best ranks compared to the baselines. e.g. , 4.40 → 2.13 (UniTS on PR metrics), 7.23 → 3.47 (TMM on ROC metrics), 4.93 → 2.73 (UniTS on ROC metrics). The consistent improvement of NCL across diverse metrics and datasets validates that the proposed normality constraint effectively steers frozen TSFMs toward enhanced anomaly discrimination.
Comparison with TSAD-Specific Foundation Models
We further compare NCL against state-of-the-art TSAD-specific foundation models DADA [44 ] , TimeRCD [26 ] , and TimeRadar [21 ] in both zero-shot and few-shot settings. We apply NCL to four representative general-purpose TSFMs: Time-MoE, TimesFM, TMM, and UniTS, and the results are presented in Table 6 . NCL demonstrates substantial improvements when integrated with general-purpose TSFMs, enabling them to achieve competitive or superior performance compared to TSAD-specific foundation models. Specifically, UniTS+NCL
Table 6. VUS-PR comparison with TSAD-specific foundation models. The best ones are boldfaced and the second best are <u>underlined</u>.
achieves the best performance on 4 out of 10 datasets, while TMM+NCL excels on 2 datasets. Both Time-MoE+NCL and TimesFM+NCL are competitive on datasets such as PSM and SMD. This indicates that NCL effectively transforms them into powerful anomaly detectors.
While DADA, TimeRCD, and TimeRadar are specifically engineered for anomaly detection, they show inconsistent performance across datasets. DADAf i v e _{\mathrm{five}} five performs well on PUMP (0.2541) and NYC (0.3744), but struggles on other datasets like IOPS (0.1453) and SWAT (0.4262). TimeRCDz e r o _{\mathrm{zero}} zero achieves notable performance on SWAT (0.5721) but falls short on most other benchmarks. TimeRadarz e r o _{\mathrm{zero}} zero achieves competitive performance on certain datasets such as SWAT (0.5802), yet underperforms on other datasets. In contrast, NCL-augmented TSFMs demonstrate more robust performance across diverse domains, achieving the higher average performance across all datasets. This suggests that general-purpose TSFMs, when properly adapted through NCL, can leverage their broad pre-trained knowledge more effectively than models trained specifically for anomaly detection from scratch.
One-to-One Comparison with One-Liner Baselines
To provide a more granular comparison against simple one-liner baselines, we conduct one-to-one comparisons across all 361 time series from the ten datasets. Figure 6 and Figure 7 visualize the win-loss records of Chronos and MOMENT against three representative baselines, respectively.
Figure 6. (a) Comparison between Chronos and the squared-difference baselines. (b) Comparison between Chronos+NCL and the squared-difference baselines. One-to-one comparison between Chronos (without and with NCL) and three squared-difference baselines across 361 time series from ten TSAD datasets.
Figure 7. One-to-one comparison between MOMENT (without and with NCL) and three moving-window variances across 361 time series from ten TSAD datasets.
Chronos vs. Squared-Difference Baselines. Figure 6 shows that the vanilla Chronos struggles against simple squared-difference baselines (Last-1, Last-3, Centered-5), winning only 26% against Last-1, 24% against Last-3, and 26% against Centered-5. More importantly, the p p p -value between Chronos and Centered-5 is 0.246, indicating that the statistics are not significant. This confirms the observation in recent studies ([65 ] ) that foundation models without proper normality con-
straints often fail to outperform trivial baselines. By contrast, as shown in Figure 6 b, Chronos+NCL dramatically improves the win rate, achieving 31% against Last-1, 33% against Last-3, and 35% against Centered-5. In the meantime, the p p p -value between Chronos+NCL and Centered-5 is 0.0002, indicating a significant difference. This substantial improvement demonstrates NCL’s effectiveness in steering the foundation model toward normality-biased predictions that amplify anomalies.
MOMENT vs. Moving-Window Variances. Figure 7 a reveals a similar pattern for reconstruction-based TSFMs. Vanilla MOMENT wins only 34% against Var-96, 38% against Var-128, and 39% against Var-512, and the p p p -value between MOMENT and Var-96 is 0.4306. After applying NCL, as shown in Figure 7 b, MOMENT+NCL significantly improves to 40% against Var-96, 40% against Var-256, and 43% against Var-512; and reduces the p p p -value between MOMENT and Var-96 to 0.0303. The improvements are particularly pronounced against the stronger Var-96 baseline, indicating that NCL effectively captures fine-grained normal patterns that simple variance measures cannot.
The consistent improvements across hundreds of individual time series provide strong statistical evidence for NCL’s effectiveness. While NCL substantially improves overall performance, there are time series where simple baselines outperform NCL-enhanced TSFMs. These cases stem from two main aspects: (i) time series with extremely simple periodic patterns where one-liner methods naturally excel; and (ii) time series with non-stationary training samples where the normal subspace construction becomes unstable. Future work could explore stationary processing strategies to address the latter limitation.
Distinguishable Distributions of Anomaly Scores
Figure 8 provides additional evidence for NCL’s effectiveness by visualizing the anomaly score distributions on different TSFMs and datasets. The results consistently show that NCL successfully widens the gap between normal and abnormal score distributions. As shown in Figure 8 a, vanilla Aurora produces highly overlapping distributions between normal and abnormal observations, with substantial overlap in the 0-0.2 score range. This overlap makes it extremely difficult to set an appropriate threshold for anomaly detection. After applying NCL, the distributions become well-separated: normal observations concentrate around 0-0.1, while anomalous observations shift toward 0.1-0.4 with a longer tail extending to higher scores, creating a clear separation margin. The reduced overlap translates directly to improved detection performance with fewer false positives and false negatives. Figure 8 b reveals a similar pattern for reconstruction-based TSFMs. Vanilla UniTS exhibits significant distribution overlap with both normal and abnormal scores concentrated in the 0-0.2 range, making discrimination challenging. With NCL, the normal distribution becomes more compact and concentrated near zero, while the abnormal distribution shifts rightward.
Figure 8. (a) Anomaly scores for Aurora on the SMD dataset. (b) Anomaly scores for UniTS on the PUMP dataset. Anomaly score distributions for different TSFMs and datasets.
The consistent distributional improvements across different TSFMs (forecasting-based Aurora and reconstruction-based UniTS) and datasets (multivariate SMD and PUMP) demonstrate that NCL’s normality constraint is universally effective. Regardless of the TSFM architecture or data characteristics, NCL successfully steers the model toward normality-biased predictions that amplify the normal-abnormal gap.
Visualization of Feature Space
To understand how NCL sharpens the feature normality within the feature space, we utilize t-SNE dimensionality reduction to visualize patch features from vanilla and NCL-augmented TSFMs.
Figure 9 presents the feature space visualization on two representative TSFM-dataset combinations. As shown in Figure 9 a, vanilla TMM produces a feature space where normal and abnormal patches are heavily intermingled with no clear boundary. The normal features are scattered across a large region, and many abnormal features fall within the normal region, making discrimination extremely difficult. After applying NCL (as shown in Figure 9 b), the feature space undergoes a dramatic transformation. The abnormal features are clearly separated from the normal clusters. Figure 9 c and Figure 9 d show a similar pattern for reconstruction-based TSFMs. The feature visualizations provide intuitive geometric understanding of how NCL improves anomaly detection. By explicitly constructing an informative normality subspace and constraining features to align with the normality manifolds, NCL transforms the originally broad pattern space into one where normal and abnormal patterns occupy geometrically distinct regions. This spatial separation makes subsequent reconstruction/forecasting error-based anomaly scoring much more discriminative.
Figure 9. The t-SNE visualization of internal features from vanilla and NCL-augmented TSFMs.
Horizon and Window Size Analysis for TSFMs
To investigate the impact of forecasting horizons and reconstruction window sizes on anomaly detection performance, we conduct comprehensive experiments on both forecasting-based and reconstruction-based TSFMs. Figure 10 presents the VUS-PR scores across different horizon/window configurations on four representative datasets.
Figure 10. VUS-PR scores with various forecasting horizons and reconstruction window sizes, evaluated on four datasets for different TSFMs without and with using NCL.
Forecasting Horizon Analysis. For forecasting-based TMM, we vary the forecasting horizon F ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 } F \in\{1, 2, 4, 8, 16, 32, 64, 128, 256\} F ∈ { 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 } while fixing the input window length. As shown in Figure 10 a and Figure 10 b, compared to vanilla TMM, NCL-enhanced TMM exhibits relatively stable performance across different horizons, and achieves excellent detection results even with small horizons. This robustness stems from NCL’s explicit construction of a normal subspace. Even when the forecasting task becomes harder, the contrastive normality constraint ensures that features are consistently aligned with normality manifolds, preventing the model from fitting anomalous patterns equally well.
Reconstruction Window Size Analysis. For reconstruction-based UniTS, we evaluate different window sizes L ∈ { 32 , 48 , 64 , 80 , 96 , 128 , 192 , 256 , 512 } L \in\{32, 48, 64, 80, 96, 128, 192, 256, 512\} L ∈ { 32 , 48 , 64 , 80 , 96 , 128 , 192 , 256 , 512 } . Figure 10 c and 10d reveal that NCL can stably enhance the detection performance of vanilla UniTS under different window sizes. For instance, on PSM, NCL continuously increases the VUS-PR from around 40 to nearly 50. This validates that NCL’s normality transformation operates effectively across different temporal scales. By constructing the normal subspace from patch features rather than raw observations, NCL captures scale-invariant normal patterns that remain discriminative across various window configurations.
The robustness to hyperparameter choices is crucial for practical deployment. Performing extensive grid search to identify optimal horizons or window sizes for each dataset is computationally expensive and may not generalize to new domains. NCL alleviates this burden by providing stable performance across a wide range of configurations, making it easier to deploy TSFMs for anomaly detection in real-world scenarios.
Visualization of Anomaly Scores
We visualize the anomaly scores and ground truth labels on representative time series segments from both univariate and multivariate datasets. Figure 11 presents original time series, ground truth anomaly intervals, and anomaly scores for different TSFMs. Figure 11 a and 11b show the detection results on the UCR time series. Notably, after applying NCL, the anomaly scores exhibit significantly improved alignment with the ground truth. The scores for normal regions are consistently suppressed close to zero, while true anomalies produce sharp, prominent peaks that clearly stand out. For instance, in Figure 11 a, the anomalous segment around timesteps 1250-1750 that was previously missed now generates distinctly elevated scores. This improvement validates that NCL’s normality constraint effectively amplifies the normal-abnormal discrimination gap by steering features toward the normal subspace and penalizing deviations through contrastive misalignment. NCL-enhanced
Figure 11. Visualization of anomaly scores in comparison with vanilla and NCL-augmented TSFMs on the univariate and multivariate datasets. Red regions highlight the ground truth anomaly intervals.
TSFMs also produce distinct, well-separated peaks responding to true anomalies in multivariate time series (as shown in Figure 11 c and 11d). The reduced false positive rate and improved peak sharpness on actual anomalies demonstrate NCL’s effectiveness in multivariate scenarios where cross-channel dependencies add complexity. These visual improvements further confirm that NCL successfully amplifies the normal-abnormal discrimination signal that vanilla TSFMs lack.
Utility of Few-Shot Normal Samples
A key practical question for NCL is how many normal samples are required to construct an informative normality subspace and learn accurate normality transformations. To investigate this, we evaluate NCL’s performance with varying numbers of few-shot normal samples on three representative TSFMs: ROSE (forecasting-based), TMM (forecasting-based), and UniTS (reconstruction-based). Figure 12 presents the VUS-PR performance across ten datasets with sample sizes ranging from 1 to 20.
(a) (a) ROSE with NCL on ten TSAD datasets.
(b) (b) TMM with NCL on ten TSAD datasets.
(c) (c) UniTS with NCL on ten TSAD datasets.
Figure 12. VUS-PR performance of three NCL-augmented TSFMs w.r.t. different number of normal samples.
Remarkably, NCL achieves competitive performance even with extremely limited normal samples. As shown in Figure 12a , ROSE+NCL with only one normal sample already achieves substantial improvements across all datasets. This demonstrates that even one representative normality sample can provide sufficient information to construct a meaningful normal subspace via SVD, which also confirms Theorem 2 in Appendix § 11 .§ 1 . This extreme sample efficiency is crucial for scenarios where normal data is scarce or expensive to obtain, such as in industrial anomaly detection where collecting extensive normal operation data may require prolonged monitoring periods.
While performance generally improves with more normal samples, the gains exhibit diminishing returns beyond 5-10 samples. This pattern appears consistently across all three TSFMs, suggesting that the top singular vectors capturing the principal normal directions stabilize relatively quickly. Once the dominant axes of normal variation are identified, additional samples provide only marginal refinement. It is worth noting that different datasets exhibit varying sensitivity to sample size. On relatively simple univariate datasets like IOPS and NAB where normal patterns are more homogeneous, 1-3 samples often suffice to capture the essential normal structure. On more complex multivariate datasets like SMD and SWAT with diverse normal modes, 5-10 samples provide better coverage of the normality manifolds. However, even on complex datasets, NCL never requires extensive data, and five samples consistently approach asymptotic performance across all tested scenarios.
Based on these empirical observations, we recommend using five normal samples as the default configuration for NCL, which provides an excellent balance between sample efficiency and detection performance. This configuration achieves near-optimal performance while minimizing data collection requirements. For deployment scenarios with extremely limited access to normal data, even 1-3 samples can yield substantial improvements over vanilla TSFMs. For critical applications where maximal performance is required and data collection is feasible, using 10-20 samples provides marginal additional gains with minimal additional cost.
Sensitivity Analysis for Singular Vectors
The number of top singular vectors k k k retained in NormSpace directly determines the dimensionality of the normality subspace and the number of normality transformation views produced by PatchNT. To understand how this critical hyperparameter affects performance, we conduct comprehensive sensitivity analysis by varying k ∈ { 8 , 12 , 16 , 20 , 24 } k \in\{8, 12, 16, 20, 24\} k ∈ { 8 , 12 , 16 , 20 , 24 } across three representative TSFMs.
Figure 13 presents the VUS-PR performance changes. This shows that too few singular vectors result in suboptimal performance because the normality subspace becomes overly simplistic and fails to capture the full spectrum of normal variation. For instance, on the NYC dataset, UniTS only achieves VUS-PR of 1.686 using k = 8 k = 8 k = 8 , which is substantially lower than the peak performance. Conversely, too many singular vectors also degrade performance because minor singular vectors corresponding to noise or dataset-specific idiosyncrasies are included, diluting the discriminative power of the principal normal directions. Importantly, different TSFMs on various datasets exhibit slightly different sensitivity patterns, which depend on the complexity of the architecture and the data itself. Simpler univariate datasets like NAB with more homogeneous normal patterns show relatively flat performance curves with less pronounced peaks, suggesting that even moderate values of k k k capture the essential normal structure. More complex multivariate datasets like SWAT exhibit sharper peaks, indicating that these datasets require a more carefully balanced subspace dimensionality to effectively separate normal and abnormal patterns.
Figure 13. VUS-PR performance of three NCL-augmented TSFMs w.r.t. different number of singular vectors.
Beyond detection performance, the choice of k k k also affects computational efficiency. Smaller k k k values reduce both the number of transformation views computed in PatchNT and the number of cluster centers maintained in ConNC, leading to faster training and inference. The fact that k = 16 k = 16 k = 16 delivers good performance while remaining computationally modest (16 parallel transformations per patch) represents an ideal trade-off. Higher k k k would increase the transformation cost while may not improve performance.
Full Experimental Results of Vanilla and NCL-Augmented TSFMs
We report the full experimental results of ten vanilla TSFMs and their NCL-augmented variants on ten TSAD benchmarks in Table 7 and 8, evaluated by both PR-based and ROC-based metrics. Overall, NCL demonstrates strong and consistent effectiveness across a wide range of TSFMs and datasets. In the PR evaluation, NCL improves the performance of nearly all backbones in most cases. Similar trends are also observed in ROC metrics, where NCL substantially boosts the anomaly discrimination capability of the underlying TSFMs. Moreover, the paired t-tests show statistically significant improvements for almost all model groups, with very small p p p -values in both PR and ROC results, confirming that the observed improvements are not due to random variation.
Table 7: PR results of ten vanilla and NCL-augmented TSFMs that use forecasting/reconstruction errors to detect anomalies on ten TSAD datasets. Meanwhile, we perform the paired t-tests, and p p p -values are reported.
Table 7.
To further understand the relationships among TSFMs before and after NCL augmentation, we visualize the pairwise correlation matrices in Figure 14 and 15. In PR metrics, the vanilla TSFMs already exhibit several strong correlations, especially among models with similar forecasting/reconstruction behaviors. However, after applying NCL, the correlations among the augmented TSFMs become even more uniformly high, with many pairwise coefficients approaching 1.0. This suggests that NCL drives different TSFMs toward a more aligned notion of normality, despite their heterogeneous architectures and pretrained representations. In other words, while vanilla TSFMs may capture broad temporal patterns, NCL encourages them to converge to a shared normality-centered representation space. Meanwhile, the correlations between vanilla TSFMs and NCL-augmented TSFMs are noticeably lower than the correlations within the vanilla group, indicating that NCL-augmented TSFMs are recalibrated through explicit normality learning to enhance the anomaly detection performance. A similar but more revealing trend is observed in ROC correlations.
Figure 14. Pairwise correlation in PR metrics.
Together, the full experimental results and the pairwise correlation analyses provide strong evidence for the effectiveness and universality of NCL. Across diverse TSFMs, datasets, and evaluation metrics, NCL consistently improves anomaly detection performance. This demonstrates that NCL is not merely a model-specific enhancement, but a general normality-learning framework that can reliably constrain pre-trained TSFM features toward compact and discriminative normality manifolds.
Table 8. ROC results of ten vanilla and NCL-augmented TSFMs that use forecasting/reconstruction errors to detect anomalies on ten TSAD datasets. Meanwhile, we perform the paired t-tests, and p -values are reported.
Figure 15. Pairwise correlation in ROC metrics.