arXiv is now an independent nonprofit! Learn more
License: arXiv.org perpetual non-exclusive license
arXiv:2609.35755v1 [hep-ph] 28 Sep 2026

Covariant Contrastive Learning for Uncertainty-Aware Anomaly Detection

Preprint: APS/123-QED
Shelley Tong Email: tshelley@mit.edu Affiliation:  NSF AI Institute for Artificial Intelligence and Fundamental Interactions, Cambridge, MA
MIT Laboratory for Nuclear Science, Cambridge, MA
   Philip Harris Email: pcharris@mit.edu Affiliation:  NSF AI Institute for Artificial Intelligence and Fundamental Interactions, Cambridge, MA
MIT Laboratory for Nuclear Science, Cambridge, MA
   Gaia Grosso Email: gaiag795@mit.edu Affiliation:  NSF AI Institute for Artificial Intelligence and Fundamental Interactions, Cambridge, MA
MIT Laboratory for Nuclear Science, Cambridge, MA
September 28, 2026
Abstract

Machine-learning-based anomaly detection (AD) offers a promising, model-agnostic alternative to traditional LHC analyses, allowing to search for many signals at once. Recent advances in representation learning motivate the use of neural embeddings to map high-dimensional physics observables into low-dimensional latent spaces better suited to statistical inference. However, the propagation of systematic uncertainty in embedded spaces remains poorly understood, severely limiting the application of these methods to real LHC analyses. We address this gap with a machine learning strategy that uses a likelihood-based regularization to improve the structure of embedded spaces. Building on previous work using supervised contrastive learning for physics-aware embeddings, our approach trains them jointly with a downstream parameterized classification task that incorporates continuous uncertainties as nuisance parameters. This method returns a latent space that covaries predictably with systematic shifts, and a model of such distortions that can be exploited in the downstream statistical test for anomaly detection. Using simulated CMS Level-1 trigger data, we show that our method successfully models continuous uncertainties in a 4D latent space with a linear parametric downstream classifier, improving both the interpretability and robustness of the statistical anomaly detection task. This framework offers a general way to study and control systematic uncertainties in latent spaces, opening the way to a new scalable statistical analysis workflow for anomaly detection at the LHC, and other high energy physics experiments.

I Introduction

The Large Hadron Collider (LHC) experiments have performed several tests of the Standard Model (SM) of particle physics, and continue to produce measurements of increasingly high precision. However, they have yet to find any convincing evidence of new physics. One reason may be methodological: most searches are optimized for a specific signal hypothesis and lose sensitivity to signatures that fall outside it. Since the space of possible new-physics signatures is far larger than the set of models that can be tested individually, dedicated searches can only ever cover a small fraction. This has motivated the development of signal-agnostic searches based on anomaly detection (AD), which leverages machine learning to identify deviations between the observed data and the SM expectation. By searching for deviations without assuming a particular signal model, a single analysis can be sensitive to a wide range of possible new-physics signatures [1, 2, 3, 4, 5].

The proton-proton collision events collected and analyzed by the LHC experiments are characterized by very high-dimensional representations, and the most viable strategy to robustly perform statistical analysis is to compress the representation into a low-dimensional summary statistic, and perform statistical inference in the reduced space. While for a signal-specific search, one knows the best way to reduce the data to one or a few summary statistics thanks to physics knowledge and supervised machine learning algorithms, in signal-agnostic approaches, the target is not known a priori, and the risk of detection failure due to a wrong summarization becomes critical. Supervised contrastive learning has emerged as an effective way to build such a summary for AD, organizing events by physics process while preserving the structure that separates background from potential anomalies [6, 7, 8, 9]. Compressions of this kind mitigate the look-elsewhere effect inherent in high-dimensional searches and simultaneously reduce the complexity of the problem, retaining power in the downstream statistical test and making it scalable to the full rate of LHC data (see panel A of Figure 1).

Refer to caption
Figure 1: Calibration enables robust detection. (A) We map a dd-dimensional space of physics observables into a kk-dimensional contrastive latent space to perform anomaly detection. The ratio plots at the bottom show that ±2​σ\pm 2\sigma distortions of the nominal (signal-free) data distribution (left and center) produce latent-space deformations resembling those of a genuine signal, such as the 1% A→4​ℓA\to 4\ell injection shown in the rightmost panel, and can therefore be mistaken for anomalous signal if not properly modeled. (B) We illustrate the risks of false detection in the absence of a rigorous calibration: systematic effects altering the data distribution trigger an AD test to fire as if a real signal was present (top). Incorporating uncertainties in the AD test makes its response invariant to systematic distortions, recovering a correct false positive rate (bottom).

For any of this to translate into a complete LHC result, however, systematic uncertainties must be propagated rigorously through the entire pipeline. A credible discovery claim requires a calibrated and robust statistical test. At LHC experiments, every source of uncertainty is treated as a nuisance parameter and profiled. This is exactly where current latent-space AD methods fall short. A nonlinear encoder can turn a simple, smooth systematic shift of the observables into an arbitrarily complicated deformation of the latent space. The dependence of the background density on the nuisance parameters can then become difficult to model, breaking down the profile-likelihood machinery and any robustness guarantee with it. Without robustness guarantees, the test can mistake a systematic shift for a signal leading to an increased chance of false discovery. Panel B of Figure 1 illustrates the problem: when systematic uncertainties are inadequately modeled in the test, the resulting shifts in the data can trigger false alarms (dashed red histogram) that mimic genuine new physics signals (blue step histograms). Treating systematic uncertainties properly and rigorously in the embedding space is, therefore, not just an additional refinement, but a central challenge that must be addressed before these methods can be used in real analyses.

In this work we propose to address this gap by introducing a likelihood-based regularization to jointly train a contrastive encoder so that its latent space covaries linearly with the nuisance parameters. This restores a tractable, analytic model of the background density ratio in the latent space, which we feed into the New Physics Learning Machine (NPLM) profile-likelihood test [10, 11, 12]. The result is an AD workflow that is simultaneously low-dimensional and statistically rigorous: systematic distortions are absorbed by the nuisance model rather than faked as signal. Using simulated CMS Level-1 trigger data, we demonstrate that the method models a realistic jet-energy-scale uncertainty in a 4D latent space, passes closure tests on nuisance-shifted backgrounds, and retains sensitivity to a range of injected beyond-the-SM (BSM) signals.

The rest of this work is organized as follows. Section II reviews related work, covering contrastive learning for anomaly detection at the LHC, equivariant contrastive learning, and the profile-likelihood treatment of systematic uncertainties on which we build. Section III presents our method: a likelihood-based regularization that fine-tunes a contrastive encoder so that its latent space covaries linearly with the nuisance parameters, together with the resulting profile-likelihood anomaly-detection test. Section IV validates the approach on simulated CMS Level-1 trigger data, reporting both closure tests on nuisance-shifted backgrounds and sensitivity to a range of injected BSM signals. Section V summarizes our findings and outlines directions for future work.

II Related Work

II.1 Contrastive learning for anomaly detection

Contrastive learning constructs a latent representation by pulling together the representations of similar examples and pushing apart dissimilar ones. Choosing a latent space with fewer dimensions than the input space also allows this representation to compress the inputs and perform dimensionality reduction. Since the introduction of instance-discrimination frameworks such as SimCLR [13], it has become a standard tool for representation learning. In high energy physics it was first deployed in a self-supervised form to build symmetry-aware jet representations: JetCLR [14] maps jet constituents into a space that is approximately invariant to physically motivated augmentations, later it was used in the context of augmenting simulations to mitigate systematics [15], and closely related self-supervised approaches have since been applied directly to model-agnostic anomaly detection [16]. Building on this line of work, Metzger et al. [6] and related studies [7] established that supervised contrastive losses with physics-process labels produce latent spaces well suited for signal-agnostic AD at the LHC, with domain-knowledge-informed label encoding being the key ingredient for statistical discovery performance. Our encoder is built with exactly this supervised contrastive strategy. None of these works, however, address how systematic uncertainties propagate through the learned embedding once it is used for inference—the gap we fill here.

II.2 Equivariant contrastive learning

Controlling how a learned representation responds to a transformation of its input is precisely the subject of equivariant representation learning. Standard contrastive learning enforces invariance, training representations to be unchanged under a chosen set of augmentations. Invariance is a special case of the more general notion of equivariance, in which a transformation of the input induces a corresponding, specified transformation of its representation. Dangovski et al. [17] added an auxiliary prediction task to self-supervised learning based on invariance: identifying the transformation applied to each input. This encourages broken equivariance for some transformations while retaining invariance for others. They showed that this approach improves the semantic quality of the learned representations. We adapt this idea to the physics setting: the transformations of interest are not geometric augmentations but the systematic distortions of the observables parameterized by nuisance parameters ν\nu, and the property we require is not invariance but a controlled, linear covariance of the latent density with ν\nu. Rather than requiring invariance under these distortions, we require the latent density to vary with ν\nu in a controlled, linear manner (cf. Eq. 8). Enforcing this equivariance-like structure is what renders the downstream profile-likelihood test tractable, as detailed in Section III.

II.3 Dealing with systematic uncertainties in statistical anomaly detection

The statistical framework in which we ultimately deploy the embedding is the “New Physics Learning Machine” (NPLM) [10, 11], a statistical test for signal-agnostic detection based on the likelihood-ratio, which includes a treatment of systematic uncertainties using nuisance parameters. Since our work is directly built on this framework, we review it below.

The NPLM hypothesis test.

The NPLM method [10, 11] treats signal-agnostic anomaly detection as a likelihood-ratio test between an an empirical model of the observed dataset 𝒟={xi}\mathcal{D}=\{x_{i}\} and the Standard Model (SM) hypothesis represented by a reference set ℛ\mathcal{R}. In the language of hypothesis testing, RR is simply the null hypothesis—the Standard Model prediction in the absence of new physics—which,in NPLM terminology, we call the Reference and denote by RR throughout. Under the alternative hypothesis HζH_{\zeta}, the data density distribution is defined as a local reweighting of the Reference distribution by the exponential of a neural network hζh_{\zeta} with trainable parameters ζ∈Ω\zeta\in\Omega,

n⁡(x|Hζ)=ehζ​(x)​n​(x|R).n(x|H_{\zeta})=e^{\,h_{\zeta}(x)}\,n(x|R). (1)

The test statistic is the maximum log-likelihood-ratio

t⁡(𝒟)=2​maxζ∈Ω​log⁡ℒ⁡(Hζ|𝒟)ℒ⁡(R|𝒟),t(\mathcal{D})=2\,\max_{\zeta\in\Omega}\,\log\frac{\mathcal{L}(H_{\zeta}|\mathcal{D})}{\mathcal{L}(R|\mathcal{D})}, (2)

obtained directly from the minimum of a training loss acting on 𝒟\mathcal{D} and ℛ\mathcal{R}. Because hζh_{\zeta} is a flexible, unbiased approximant, the test is sensitive to generic departures from the SM rather than to a single signal model. Ref. [11] showed that, under the Reference hypothesis and with a suitable regularization scheme for the test network hζh_{\zeta}, tt closely follows a χ2\chi^{2} distribution.

Continuous systematics as nuisance parameters.

The treatment above assumes the Reference is known exactly, which is never the case: detector calibration, theory, and PDF uncertainties all distort the expected SM distribution, and these effects must be propagated into any LHC result for it to be trusted. Ref. [12] extends NPLM to incorporate them following the canonical profile-likelihood treatment, by associating each source of uncertainty with a nuisance parameter ν\nu constrained by an auxiliary likelihood ℒaux​(ν)\mathcal{L}_{\rm aux}(\nu). The Reference hypothesis becomes composite, RνR_{\nu}, and the alternative gains the same nuisance dependence, Hν,ζH_{\nu,\zeta}:

t⁡(𝒟)=2​log⁡maxν,ζ⁡[ℒ⁡(Hν,ζ|𝒟)⋅ℒaux​(ν)]maxν′⁡[ℒ⁡(Rν′|𝒟)⋅ℒaux​(ν′)],t(\mathcal{D})=2\log\frac{\max_{\nu,\,\zeta}\,[{\cal L}(H_{\nu,\zeta}\,|\,\mathcal{D})\cdot{\cal L}_{\rm aux}(\nu)]}{\max_{\nu^{\prime}}\,[{\cal L}(R_{\nu^{\prime}}\,|\,\mathcal{D})\cdot{\cal L}_{\rm aux}(\nu^{\prime})]}, (3)

Normalizing both likelihoods to that of the central-value Reference Rν0R_{\nu_{0}}, where ν0\nu_{0} is the best prior estimate of the nuisance parameter, allows us to express the test statistic as the difference of two positive-definite terms:

t⁡(𝒟,𝒜)=τ⁡(𝒟,𝒜)−Δ⁡(𝒟,𝒜),t(\mathcal{D},\mathcal{A})=\tau(\mathcal{D},\mathcal{A})-\Delta(\mathcal{D},\mathcal{A}), (4)

and the nuisances ν\nu,

τ\displaystyle\tau =2​maxν,ζ​log⁡[ℒ⁡(Hν,ζ|𝒟)ℒ⁡(Rν0|𝒟)⋅ℒaux​(ν)ℒaux​(ν0)],\displaystyle=2\,\max_{\nu,\zeta}\,\log\!\left[\frac{\mathcal{L}(H_{\nu,\zeta}|\mathcal{D})}{\mathcal{L}(R_{\nu_{0}}|\mathcal{D})}\cdot\frac{\mathcal{L}_{\rm aux}(\nu)}{\mathcal{L}_{\rm aux}(\nu_{0})}\right], (5)
Δ\displaystyle\Delta =2​maxν​log⁡[ℒ⁡(Rν|𝒟)ℒ⁡(Rν0|𝒟)⋅ℒaux​(ν)ℒaux​(ν0)].\displaystyle=2\,\max_{\nu}\,\log\!\left[\frac{\mathcal{L}(R_{\nu}|\mathcal{D})}{\mathcal{L}(R_{\nu_{0}}|\mathcal{D})}\cdot\frac{\mathcal{L}_{\rm aux}(\nu)}{\mathcal{L}_{\rm aux}(\nu_{0})}\right]. (6)

Intuitively, τ\tau is the full “discovery” term: it measures how much better the flexible alternative Hν,ζH_{\nu,\zeta} with nuisances describes the data than the central-value Reference. As a result, we see the test statistic deviates from Rν0R_{\nu_{0}} for any reason, whether it is a genuine signal or a mismodeled systematic. The correction Δ\Delta contains no test network: it measures how much of that same departure can be absorbed by the Reference alone, simply by pulling the nuisance ν\nu away from its central value. Subtracting Δ\Delta from τ\tau therefore removes the part of the discrepancy that is explainable as a systematic distortion, so that t=τ−Δt=\tau-\Delta isolates genuinely anomalous structure. Both terms are maximum-likelihood log-ratios and are asymptotically χ2\chi^{2}-distributed; the cancellation between them is precisely what keeps P⁡(t|Rν)P(t|R_{\nu}) close to a ν\nu-independent χ2\chi^{2}, so that a single calibration on Rν0R_{\nu_{0}} yields a pp-value valid across the allowed range of ν\nu.

Refer to caption
Figure 2: Overview of the three-stage end-to-end workflow. (Step 1) A contrastive encoder compresses high-dimensional physics observables into a low-dimensional latent space, trained jointly with a regularization that makes the effect of the nuisance parameters ν\nu on the latent distributions linear. (Step 2) The learned linear nuisance model is fine-tuned and validated with closure tests in the New Physics Learning Machine (NPLM) framework. (Step 3) Signal is injected and detected as a shift of the NPLM test-statistic distribution.

Modeling the nuisance dependence.

Both τ\tau and Δ\Delta require the density ratio between the shifted and nominal Reference distributions,

r⁡(x|ν)=n⁡(x|Rν)n⁡(x|Rν0),r(x|\nu)=\frac{n(x|R_{\nu})}{n(x|R_{\nu_{0}})}, (7)

to be known as a function of ν\nu at every point xx. Ref. [12] models its logarithm with a low-order polynomial in ν\nu,

log⁡r⁡(x|ν)=ν​δ1​(x)+12​ν2​δ2​(x)+…,\log r(x|\nu)=\nu\,\delta_{1}(x)+\tfrac{1}{2}\nu^{2}\,\delta_{2}(x)+\dots, (8)

whose coefficient functions δa​(x)\delta_{a}(x) are learned by training a parameterized classifier between the nominal and shifted samples with a quadratic (mean-squared) loss. This expansion is tractable only when the systematic effect is a small, smooth deformation of the distribution—a condition that holds in the space of physical observables, and is not guaranteed to survive a nonlinear encoder. Related strategies for handling systematics in learned classifiers include parameterized networks [18], uncertainty-aware inference [19], and invariance via adversarial decorrelation [20, 21].

Linear Nuisance Dependence.

The methods we build on were designed to act on physical observables, where the small-deformation condition behind Eq. (8) may or may not hold depending on the problem under study, limiting the application of the method. Our goal is move the statistical test from the space of the physical observables to the latent space of a contrastive encoder fθf_{\theta}, that we have the freedom to train or fine-tune. A nuisance shift x⁡(ν0)↦x⁡(ν)x(\nu_{0})\mapsto x(\nu) induces a transformation z⁡(ν0)↦z⁡(ν)z(\nu_{0})\mapsto z(\nu) of the embedding. The latter could be large and difficult to approximate with a polynomial expansion. The polynomial model of log⁡r⁡(z|ν)\log r(z|\nu) then breaks down resulting in a poor estimation of the correction term Δ\Delta (Eq. (6)). We resolve it by training the encoder so that the latent log-density-ratio is, by construction, linear in ν\nu. This recovers a controlled Δ\Delta term and an interpretable, profilable nuisance model directly in the embedded space.

III Method

Our end-to-end analysis workflow includes three stages, as illustrated in Figure 2:

  1. 1.

    Building Contrastive Embeddings with Controlled Covariance. We map high-dimensional physics observables into a low-dimensional latent space with supervised contrastive learning, training the encoder jointly with a likelihood-based regularization. The resulting embedding preserves the physics structure needed for anomaly detection while forcing continuous systematic uncertainties to act on the latent space in a controlled way, such that their effect is linear in the nuisance parameter ν\nu.

  2. 2.

    Fine-tuning and Validating the Linear Nuisance Model. We freeze the embedding, further fine-tune the linear model of the nuisance dependence, and validate it with NPLM closure tests performed in the presence of systematic uncertainties.

  3. 3.

    Signal Injection and Anomaly Detection. We inject signal and run the profile-likelihood NPLM test directly in the latent space, quantifying the resulting shift of the test-statistic distribution and converting it into a calibrated significance.

We describe the three stages in turn below; their empirical implementation and validation are reported in Section IV.

III.1 Stage 1: Building neural embeddings with a controlled covariance

Supervised contrastive learning offers a scalable route to anomaly detection by performing dimensionality reduction through neural embeddings: it compresses physics observables into a low-dimensional latent space while preserving sensitivity to statistical anomalies. Refs. [6, 7] showed that contrastive losses defined with physics-process labels yield latent spaces well suited to signal-agnostic anomaly detection at the LHC, with domain-informed label encoding being the key ingredient for statistical discovery performance.

We train a transformer-based encoder fθ:ℝd→ℝkf_{\theta}:\mathbb{R}^{d}\rightarrow\mathbb{R}^{k} (k≪dk\ll d) with the supervised contrastive loss [22],

ℒsupCL=−∑i1|P⁡(i)|∑p∈P⁡(i)loge𝐳i⋅𝐳p/τ∑a≠ie𝐳i⋅𝐳a/τ,\mathcal{L}_{\mathrm{supCL}}=-\sum_{i}\frac{1}{|P(i)|}\sum_{p\in P(i)}\log\frac{e^{\mathbf{z}_{i}\cdot\mathbf{z}_{p}/\tau}}{\sum_{a\neq i}e^{\mathbf{z}_{i}\cdot\mathbf{z}_{a}/\tau}}, (9)

where 𝐳i=fθ​(𝐱i)/‖fθ​(𝐱i)‖\mathbf{z}_{i}=f_{\theta}(\mathbf{x}_{i})/\|f_{\theta}(\mathbf{x}_{i})\| is the ℓ2\ell_{2}-normalized embedding, P⁡(i)P(i) indexes the events in the batch produced by the same background physics process as event ii, and τ\tau is a hyperparameter denoted temperature. With labels taken from simulation, this organizes the latent space by background physics process, clustering SM events of the same type. This loss does not account for systematic uncertainties. To include systematic uncertainties, we add an additional term to the loss that controls systematic variations on the latent space.

A continuous systematic uncertainty is described by a nuisance parameter ν\nu that induces a deterministic distortion of the observables, 𝐱⁡(ν0)↦𝐱⁡(ν)\mathbf{x}(\nu_{0})\mapsto\mathbf{x}(\nu). After encoding, this becomes a transformation of the latent distribution, 𝐳⁡(ν0)↦𝐳⁡(ν)\mathbf{z}(\nu_{0})\mapsto\mathbf{z}(\nu). Without any constraint on fθf_{\theta}, this transformation can be arbitrarily nonlinear in ν\nu, making the latent log-density-ratio

r⁡(𝐳|ν)=n⁡(𝐳|Rν)n⁡(𝐳|Rν0)r(\mathbf{z}|\nu)=\frac{n(\mathbf{z}|R_{\nu})}{n(\mathbf{z}|R_{\nu_{0}})} (10)

difficult to model. As discussed in Section II.3, the NPLM strategy requires uncertainties to be well approximated by a polynomial model, so recovering a well behaved transformation in the embedded space is essential.

To this end, we impose a linear covariance condition on the latent space. Under this penalty loss the encoder is induced to organize the embedding so that the log-density-ratio is linear in ν\nu,

log⁡r⁡(𝐳|ν)=log⁡n⁡(𝐳|Rν)n⁡(𝐳|Rν0)=gϕ​(𝐳)⋅ν,\log r(\mathbf{z}|\nu)=\log\frac{n(\mathbf{z}|R_{\nu})}{n(\mathbf{z}|R_{\nu_{0}})}=g_{\phi}(\mathbf{z})\cdot\nu, (11)

where gϕ​(𝐳)g_{\phi}(\mathbf{z}) depends on the embedding alone. Under this condition ν\nu is directly estimable by maximum likelihood in the latent space, and the nuisance profiling required by the statistical test becomes tractable.

We enforce condition (11) by training the encoder jointly with a model gϕg_{\phi} of the log-density-ratio. This mirrors equivariant self-supervised learning [17], where an auxiliary head that predicts the applied transformation improves representation quality; here we replace the geometric transformations with systematic effects parameterized by ν\nu. Concretely, we generate labeled pairs (𝐱⁡(ν0),𝐱⁡(ν))(\mathbf{x}(\nu_{0}),\,\mathbf{x}(\nu)) on a discrete grid of ν\nu spanning the expected range [−σ,+σ][-\sigma,+\sigma], and train gϕg_{\phi} as a parameterized classifier between the nominal and shifted distributions following [12], minimizing the quadratic loss

ℒcov=1Nν​∑ν[∑𝐳∼Rν0σ​(gϕ​(𝐳)⋅ν)2+∑𝐳∼Rν[1−σ⁡(gϕ​(𝐳)⋅ν)]2],\mathcal{L}_{\mathrm{cov}}=\frac{1}{N_{\nu}}\sum_{\nu}\left[\sum_{\mathbf{z}\sim R_{\nu_{0}}}\sigma\!\left(g_{\phi}(\mathbf{z})\cdot\nu\right)^{2}+\sum_{\mathbf{z}\sim R_{\nu}}\!\left[1-\sigma\!\left(g_{\phi}(\mathbf{z})\cdot\nu\right)\right]^{2}\right], (12)

where σ\sigma denotes the sigmoid function and the sum runs over the grid of nuisance values. By the likelihood-ratio argument of [12], the minimizer satisfies gϕ​(𝐳)⋅ν→log⁡r⁡(𝐳|ν)g_{\phi}(\mathbf{z})\cdot\nu\to\log r(\mathbf{z}|\nu), so training gϕg_{\phi} enforces the linear model in (11).

The encoder and the ratio model are therefore optimized together, from the beginning of training, with the combined objective

ℒ=ℒsupCL+α​ℒcov,\mathcal{L}=\mathcal{L}_{\mathrm{supCL}}+\alpha\,\mathcal{L}_{\mathrm{cov}}, (13)

where α>0\alpha>0 balances the two terms. Backpropagating through gϕg_{\phi} into fθf_{\theta} encourages the encoder to learn a representation in which the nuisance dependence of the density ratio is well described by the linear nuisance model.

III.2 Stage 2: Fine-tuning and validating the linear nuisance model with NPLM

Refer to caption
Figure 3: Treatment of systematic uncertainties in the NPLM framework. From left to right: (1) Fine-tune linear model gϕ​(𝐳)​νg_{\phi}(\mathbf{z})\nu to capture the nuisance dependence of log⁡(Nν/N0)\log(N_{\nu}/N_{0}), where NνN_{\nu} and N0N_{0} are shifted and nominal SM counts in latent-space. The nuisance parameter ν\nu has standard uncertainty σ\sigma. (2) Construct t=τ−Δt=\tau-\Delta: τ\tau allows both SM departures, parametrized by the alternative-hypothesis network hζh_{\zeta}, and nuisance shifts, while Δ\Delta allows nuisance shifts alone. (3) Tune the weight clipping of hζh_{\zeta} for agreement between nominal SM pseudo-experiments (toys) and the expected χ2\chi^{2} distribution. (4) Validate closure by checking agreement of the background-only tt distributions at ν=0,±1​σ\nu=0,\pm 1\sigma. All distributions are schematic.

Once this joint optimization has converged, we freeze the embedding and validate the linear nuisance model within the NPLM framework, following the strategy outlined in [12]. The procedure, summarized in Fig. 3, consists of four steps: we fine-tune the linear model, use it to build the profiled test statistic, tune the weight clipping of test network hζh_{\zeta} for χ2\chi^{2} compatibility, and finally validate the modeling via closure checks.

With the encoder frozen, we first fine-tune gϕg_{\phi} further to reach the accuracy needed for the statistical test. The frozen encoder fθf_{\theta} and the fine-tuned linear model gϕg_{\phi} then integrate directly into the profile-likelihood NPLM framework described in Section II.3. The test statistic is the profile-likelihood ratio defined in Eq. (3), evaluated in the latent space 𝐳\mathbf{z}, with gϕg_{\phi} modeling the density ratio r⁡(𝐳|ν)r(\mathbf{z}|\nu) given in Eq. 10.

To calibrate the test, we identify an architecture and regularization for the test network hζh_{\zeta} that render the test statistic approximately χ2\chi^{2}-distributed under the null in the absence of uncertainties. We then incorporate the systematic via the linear model of Eq. (11) and validate the modeling via closure checks. We describe the regularization and closure checks below.

Weight clipping for regularization.

The flexibility of the test network hζh_{\zeta} must be controlled for the test to behave well. Left unconstrained, the maximum-likelihood fit in Eq. (3) is unbounded: hζh_{\zeta} can grow without limit to chase the statistical fluctuations of a finite sample, overfitting the data and driving the null distribution of tt into heavy, non-universal tails that spoil the asymptotic behavior. Following the NPLM prescription [11, 12], we regularize the fit by weight clipping such that after every gradient update, the trainable weights of hζh_{\zeta} are projected back onto a bounded box |w|≤W|w|\leq W, where the weight-clipping parameter WW caps the effective capacity of the network. This bounds the achievable log-density-ratio, and, although the formal conditions of Wilks’ theorem are not satisfied in this setting, we find the null distribution remains close to the asymptotic regime. As a consequence, the function P⁡(t|Rν0)P(t\,|\,R_{\nu_{0}}) approaches a χ2\chi^{2} whose number of degrees of freedom matches the number of trainable parameters of hζh_{\zeta}.

The value of WW is a hyperparameter that trades calibration against sensitivity: if WW is too small, hζh_{\zeta} is too rigid to capture genuine departures and the NPLM test loses power; if WW is too large, the network overfits and the null distribution drifts away from the asymptotic χ2\chi^{2}. Following [11, 12], we choose the weight clipping for which the empirical null distribution—built from an ensemble of central value Reference pseudo-experiments—remains statistically compatible with a χ2\chi^{2} with number of degrees of freedom matching the number of trainable parameters. The value of W selected this way is then used in the computation of likelihood.

Closure tests for the linear nuisance model

The choice of weight clipping and the fine tuning of the linear model gϕg_{\phi} fully determine the statistical model used in the test. The next step is to check the robustness of the latter to systematic variations of the data. In particular, the test statistics is considered robust to systematic effects if its distribution under the null does not change under mild systematic variations. Operationally,

∂νP⁡(t|Rν)=0∀ν∈[−σ,+σ].\partial_{\nu}P(t|R_{\nu})=0\quad\forall\nu\in[-\sigma,+\sigma]. (14)

To verify this property, we build the null distribution P⁡(t|Rν0)P(t\,|\,R_{\nu_{0}}) from an ensemble of pseudo-experiments (toys) drawn from the central-value reference. The analogous distribution P⁡(t|Rν)P(t\,|\,R_{\nu}) is ontained from toys drawn from a reference with nuisance shifted of ±1​σ\pm 1\sigma from the central value. We then quantify their agreement with a two-sample Kolmogorov–Smirnov (KS) test. The resulting KS pp-value measures whether the two empirical distributions are statistically compatible. A large value confirms that the profiled nuisance model absorbs the systematic shift, i.e. that P⁡(t|Rν)P(t\,|\,R_{\nu}) is effectively independent of ν\nu, as anticipated by the τ−Δ\tau-\Delta cancellation. This construction uses the entire distribution on both sides, each estimated from a large set of toys. We refine the linear model and perform this check recursively, until a good agreement is found.

III.3 Stage 3: Signal injection and anomaly detection

After the test has passed the robustness checks it is ready to be deployed for anomaly detection. When applied to real data 𝒟\cal D, a single value of the test statistic tobst_{\rm obs} is observed and thus a single global p-value p⁡(𝒟)p({\cal D}) is reported:

p=∫tobs∞P⁡(t|null)​𝑑t.p=\int_{t_{\rm obs}}^{\infty}P(t\,|\,{\rm null})\,dt. (15)

To assess the expected sensitivity to a simulated signal, we apply the test to many pseudo-experiments containing both background and signal. This gives the distribution of the test statistic under the alternative hypothesis. We then estimate the power at a given false-positive rate as the fraction of these pseudo-experiments in which the null hypothesis is rejected. We also report the p-value corresponding to the median test statistic, calculated using Eq. (15), as a measure of typical sensitivity. For probabilities estimated from finite samples of pseudo-experiments, we report Clopper–Pearson confidence intervals. Throughout this article we will often refer to p-values by their significance expressed as Z=Φ−1​(1−p)Z=\Phi^{-1}(1-p), with Φ\Phi the standard-normal cumulative distribution function.

We evaluate this against three choices of null: (a) the empirical distribution P⁡(t|Rν0)P(t\,|\,R_{\nu_{0}}) from central-value toys; (b) the empirical distributions P⁡(t|Rν)P(t\,|\,R_{\nu}) of the nuisance-shifted references at +1​σ+1\sigma and −1​σ-1\sigma; and (c) the analytic χ2\chi^{2} survival function of the asymptotic distribution discussed above. In all three cases, we used the median of the signal distribution, exactly as the significance would be quoted for a single observed dataset. To assess how residual nuisance dependence affects the expected significance, we compare the nominal null distribution with those obtained for nuisance shifts of ±1​σ\pm 1\sigma. Although the test statistic is designed to be approximately independent of the nuisance parameter, small differences may remain, particularly in the tails of these distributions. At the same median test statistic, a heavier tail gives a larger pp-value and lower significance. Comparing the nominal and shifted null distributions allows us to check whether using only the nominal reference would overstate the expected sensitivity. Close agreement among (a), (b), and (c) then doubles as a check that P⁡(t|Rν)P(t\,|\,R_{\nu}) is effectively ν\nu-independent, so that the single calibration on Rν0R_{\nu_{0}} remains valid across the allowed range of the nuisance. In Section IV we use the KS construction as a closure test on nuisance-shifted backgrounds and the median-ZZ construction as our sensitivity measure for injected signals.

IV Numerical Experiments on LHC Data

In this section, we apply the approach proposed in Section III to a simulated LHC dataset. We evaluate the role of co-training in achieving closure by comparing the test-statistic distributions under nominal and nuisance-shifted background conditions. We also study its impact on signal sensitivity, considering both an idealized setting without nuisance parameters in the NPLM test and a nuisance-aware setting that includes them.

IV.1 Dataset

We apply the method to simulated CMS Level-1 trigger data [23] available on Zenodo [24, 25, 26, 27, 28]. Each event is represented by up to 19 reconstructed objects: 4 electrons/photons, 4 muons, 10 jets, and one missing transverse energy (MET) slot. Each object is described by (pT,η,ϕ)(p_{T},\eta,\phi), yielding 57 input features per event, with zero padding applied when fewer objects are present. The background sample consists of WW (59.2%59.2\%), QCD multijet (33.8%33.8\%), ZZ (6.7%6.7\%), and t​t¯t\bar{t} (0.3%0.3\%) events, while the signal benchmarks are LQ→b​τ\mathrm{LQ}\to b\tau, A→4​ℓA\to 4\ell, h0→τ​τh^{0}\to\tau\tau, and h±→τ±​νh^{\pm}\to\tau^{\pm}\nu.

To model a realistic systematic effect, we introduce a nuisance parameter ν\nu that rescales the jet transverse momentum as pT​(ν)=eν​pT​(0)p_{T}(\nu)=e^{\nu}p_{T}(0), with nominal value ν0=0\nu_{0}=0. We set the standard uncertainty to σ=2.5%\sigma=2.5\%, a typical percent-level size of jet energy scale uncertainties in LHC analyses [29].

After rescaling, we apply the same jet-level cut of pT≥23​GeVp_{T}\geq 23\,\mathrm{GeV} to the nominal and nuisance-shifted samples, giving them a common selection threshold. This ordering reflects an experimental selection, where trigger or analysis cuts act on the measured jet momenta, which already include any underlying systematic shift. Jets can therefore move across the selection threshold as ν\nu varies.

Refer to caption
Figure 4: Unlinearized contrastive embeddings. Marginal distributions of the 4-dimensional learned embedding for the nominal reference sample, ν=0\nu=0 (gray filled histogram), and nuisance-shifted test samples (colored step histograms). The lower panels show the corresponding binned log-ratios, log⁡(Nν/N0)\log(N_{\nu}/N_{0}). The nuisance-shifted distributions do not vary in a linear way across values of ν\nu, making their deformation in the embedding space difficult to capture with the linear nuisance model gϕg_{\phi}.
Refer to caption
Figure 5: Linearized contrastive embeddings. Same as Figure 5 for a contrastive embedding regularized with the covariance loss ℒcov\mathcal{L}_{\mathrm{cov}}. The nuisance-shifted samples exhibit a smoother and more coherent dependence on ν\nu. The improved linear covariance makes the nuisance variation easier to model with linear nuisance model gϕg_{\phi}.

IV.2 Contrastive Embedding Models

Following Ref. [6], we use a Transformer-based encoder fθf_{\theta} to map the 57-dimensional input to a 4-dimensional embedding, which gave the strongest AD performance among the dimensions tested. We leave the systematic study of nuisance uncertainty in higher-dimensional embeddings to future work. Nominal SM background events are used for the supervised contrastive task with physics labels. The initial contrastive embedding is shown in Figure 5. Before co-training with the linear nuisance model, the empirical log-ratios log⁡(Nν/N0)\log(N_{\nu}/N_{0}) are not always smoothly ordered or approximately linear across values of ν\nu, making their nuisance dependence difficult to model with the linear log-density-ratio parametrization of Eq. (11).

To impose a more controlled nuisance dependence, we performed the regularized training described in Section III.1. The encoder is trained in a 5-fold co-training setup with the linear model gϕg_{\phi}, using 2.1×1062.1\times 10^{6} events per fold per ν\nu dataset, 60 epochs, a batch size of 1024, and a learning rate of 2×10−62\times 10^{-6}.The resulting embedding is shown in Figure 5. After co-training with the covariance loss ℒcov\mathcal{L}_{\mathrm{cov}}, the nuisance-shifted marginal distributions vary more smoothly and coherently with ν\nu, making the latent deformation easier to describe with the linear log-density-ratio model gϕ​(𝐳)⋅νg_{\phi}(\mathbf{z})\cdot\nu. Although co-training takes longer than standard contrastive training, the encoder is trained only once and then frozen for the statistical tests. The covariance loss ℒcov\mathcal{L}_{\mathrm{cov}} plateaus during training, while the nuisance model gϕg_{\phi} benefits from longer fine-tuning.

Refer to caption
Figure 6: Empirical and modeled log⁡(Nν/N0)\log(N_{\nu}/N_{0}) as a function of the nuisance parameter, before and after embedding linearization. Each panel shows one bin (xx) of the first-dimension marginal of the embedding. Solid lines show empirical values at ν=−1​σ\nu=-1\sigma, 00, and +σ+\sigma, with error bars indicating statistical uncertainties; dashed lines show the linear nuisance model predictions. Blue denotes the original embedding and red the embedding trained with the linear regularization. In the absence of linear regularization, the empirical nuisance dependence deviates from the linear model, whereas with regularization the linear assumption is recovered.

Figure 6 directly compares the nuisance dependence of log⁡(Nν/N0)\log(N_{\nu}/N_{0}) before and after co-training. Each panel shows a selected bin in the first embedding dimension, with the bin center indicated above the panel. These bins are chosen only to illustrate the effect of linearization and are not representative of every bin in the embedding space. Here, NνN_{\nu} is the number of events in that bin for a nuisance-shifted sample, while N0N_{0} is the corresponding nominal count. The solid lines with error bars show the empirical values at ν=−1​σ\nu=-1\sigma, 00, and +1​σ+1\sigma, while the dashed lines show the fits from the linear nuisance model. Results for the original embedding are shown in blue, while those for the linearized embedding are shown in red.

Before co-training, the empirical blue lines can deviate substantially from the corresponding predictions of the linear model, indicating that the nuisance dependence encoded in the original embedding is not sufficiently linear to be accurately described by the linear parameterization of log⁡(Nν/N0)\log(N_{\nu}/N_{0}). After co-training, the empirical red lines follow the dashed predictions much more closely across the selected bins, demonstrating a clear improvement in the quality of the linear fit. These results show that jointly training the contrastive embedding and linear nuisance models reshapes the embedding such that its nuisance dependence is more accurately described by gϕ​(𝐳)⋅νg_{\phi}(\mathbf{z})\cdot\nu. In this sense, co-training effectively linearizes the nuisance response of the embedding, making the chosen linear parameterization a substantially better approximation of the observed variations.

Refer to caption
Figure 7: Validation of the linear nuisance model in the latent space. Each column corresponds to one of the four embedding dimensions. Top: distributions for the nominal sample at ν=0\nu=0 (gray fill), the nuisance-shifted test samples at ν=±1​σ\nu=\pm 1\sigma (solid lines), and the fitted model predictions (dash-dotted lines). Middle: log⁡(Nν/N0)\log(N_{\nu}/N_{0}) for the test samples and the fitted model. Bottom: ratio of model predictions to test distributions, Nνfit/NνtestN_{\nu}^{\mathrm{fit}}/N_{\nu}^{\mathrm{test}}. The close agreement in the upper panels and ratios near unity in the bottom panels show that the linear model accurately captures the nuisance dependence in all four dimensions.

IV.3 Linear Model

We co-train the linear nuisance model gϕg_{\phi} of Eq. (11) on the learned embeddings. It is linear in the nuisance parameter ν\nu and, as a function of the embedding 𝐳\mathbf{z}, is implemented as a fully connected network with architecture (4,512,256,128,64,32,1)(4,512,256,128,64,32,1), ReLU activations in the hidden layers, and a linear output. It is trained jointly with the contrastive encoder (Eq. (13)) using a learning rate of 2×10−62\times 10^{-6}, L2L_{2} regularization of 10−610^{-6}, and co-training weight α=0.1\alpha=0.1, then further fine-tuned on 1.6×1061.6\times 10^{6} events per nuisance parameter. Both nominal and nuisance-shifted samples at ±1​σ\pm 1\sigma and ±2​σ\pm 2\sigma are used for this task. Figure 7 compares the nuisance-shifted test samples with the predictions of the fitted linear model across the four latent dimensions. The top row shows the nominal distribution at ν=0\nu=0 in gray, together with the test distributions at ν=±1​σ\nu=\pm 1\sigma (solid lines) and their corresponding model predictions (dash-dotted lines). The middle row shows the same comparison in terms of log⁡(Nν/N0)\log(N_{\nu}/N_{0}). In both rows, the test and model samples are visually in close agreement across all four latent dimensions, indicating that the model accurately captures how the latent distributions change with ν\nu. This agreement is further confirmed by the bottom-row ratios of the model prediction to the test distribution, Nνfit/NνtestN_{\nu}^{\mathrm{fit}}/N_{\nu}^{\mathrm{test}}, which remain close to one throughout most regions in the latent space. Overall, the close visual agreement demonstrates that the linear nuisance model accurately captures the nuisance dependence of the embedding, suggesting that co-training has successfully linearized the nuisance dependence of the embedding.

IV.4 Weight clipping regularization

The alternative-hypothesis network hζh_{\zeta} in Eq. (3)is implemented as a fully connected neural network with architecture (4,4,4,1)(4,4,4,1), corresponding to 45 trainable parameters, with sigmoid activations in the hidden layers and a linear output. Following the calibration procedure of Section III, a weight-clipping regularizer is tuned with 400 pseudo-experiments drawn from the nominal reference sample Rν0R_{\nu_{0}} so that the empirical null distribution matches the asymptotic χ452\chi^{2}_{45} (45 degrees of freedom, one per trainable parameter) [11]. Weight clipping bounds the absolute value of the network’s trainable parameters during training, which constrains the smoothness of the learned density ratio and prevents the model from overfitting statistical fluctuations in DD; tuning the clipping value is what brings the empirical null into fair agreement with the asymptotic χ452\chi^{2}_{45}. We train using 52,00052{,}000 reference events and 10,00010{,}000 background events DD per replica. We tune the weight clipping for two different implementations: (1) NPLM implemented in the original embedding from [6] as it is before co-training with the linear nuisance model, and (2) NPLM implemented in the embedding co-trained with the linear nuisance model as explained in Section IV.3. The optimal weight-clipping is 2.12 in the first case and 1.94 in the second case. Table 1 reports the results of the Kolmogorov–Smirnov, Anderson–Darling, Cramér–von Mises, and Pearson χ2\chi^{2} compatibility tests between the analytical χ452\chi^{2}_{45} distribution and the empirical R0R_{0} test-statistic distributions obtained with the original and linearized embeddings. Pearson χ2\chi^{2} tests are performed using binnings corresponding to 10 and 25 degrees of freedom, and each embedding is evaluated at its selected weight-clipping value. All of the resulting pp-values are greater than 0.50.5, indicating good agreement with the analytical distribution and supporting the chosen weight-clipping values.

Table 1: Compatibility between the empirical nominal test-statistic distributions and the analytical χ452\chi^{2}_{45} distribution. We compare the empirical distribution of the test statistic under R0R_{0} with the asymptotic χ452\chi^{2}_{45}, for the linearized and unlinearized embeddings. The table reports the pp-values from various goodness-of-fit tests: the Kolmogorov–Smirnov (KS), Anderson–Darling (AD), Cramér–von Mises (CvM), and Pearson χ2\chi^{2} (χp2\chi^{2}_{p}) performed using 10 and 25 degrees of freedom (DoF). For both embeddings, the empirical distribution is obtained using 400 replicas and the NPLM test is performed accounting for uncertainties, and using the best weight-clipping value.
Test Unlinearized Linearized
(wclip=2.12w_{\mathrm{clip}}=2.12) (wclip=1.94w_{\mathrm{clip}}=1.94)
KS 0.77120.7712 0.83020.8302
AD 0.81240.8124 0.92420.9242
CvM 0.71120.7112 0.92880.9288
χp2\chi^{2}_{p} (10 DoF) 0.95770.9577 0.92370.9237
χp2\chi^{2}_{p} (25 DoF) 0.80990.8099 0.73150.7315

IV.5 NPLM Validations

We perform the closure test described in Section III.2 to verify that nuisance-induced background variations are not misidentified as signal-like excesses. Specifically, we apply the NPLM test to nuisance-shifted SM samples D∼RνD\sim R_{\nu}, using the same luminosity as in the nominal calibration. Since these samples do not contain injected signal, their test-statistic distributions should remain consistent with the central-value null distribution P⁡(t∣R0)P(t\mid R_{0}) once nuisance effects are properly modeled.

Figure 8 compares the background-only test-statistic distributions for R0R_{0} and Rν=±1​σR_{\nu=\pm 1\sigma} under three configurations. In all three panels, the filled red histogram represents the empirical distribution under the central-value reference hypothesis, while the orange and brown step histograms represent the distributions under Rν=+1​σR_{\nu=+1\sigma} and Rν=−1​σR_{\nu=-1\sigma}, respectively. Panel 8(a) shows the NPLM test without treatment of uncertainties. In this case, the test has no way to account for the expected nuisance-induced variations, so the shifted background distributions move away from R0R_{0} and can appear signal-like. In panel 8(b), nuisance parameters are included in the NPLM test, but the original unlinearized embedding from Ref. [6] is used. The shifted distributions still do not reach closure because the nuisance dependence is encoded nonlinearly in the learned representation and cannot be fully absorbed by adding only a downstream linear nuisance model. This motivates linearizing the embedding itself rather than relying on the NPLM nuisance fit alone. Finally, panel 8(c) shows the result of our method, co-training the embedding with the linear nuisance model. The nominal and nuisance-shifted distributions are now in good agreement, demonstrating that the linearized embedding, together with the nuisance-aware NPLM test, successfully prevents the systematic variations from causing false positives.

Refer to caption
(a) Unlinearized embedding without uncertainties in the NPLM test.
Refer to caption
(b) Unlinearized embedding with uncertainties in the NPLM test.
Refer to caption
(c) Linearized embedding with uncertainties in the NPLM test (ours).
Figure 8: Background-only closure of the NPLM test statistic in presence of uncertainties. Each distribution contains 400 background-only replicas. The pink filled histogram shows the empirical central-value distribution R0R_{0}, while the dark-red and coral step histograms show the nuisance-shifted distributions Rν=±1​σR_{\nu=\pm 1\sigma}; the black curve shows the analytical χ452\chi^{2}_{45} distribution. The lower panels show the RνR_{\nu} to R0R_{0} ratios. Panel 8(a) shows the NPLM test without nuisance parameters included, for which the nuisance-induced shifts are left unmodeled and appear signal-like. Panel 8(b) includes nuisance parameters in the NPLM test but uses the unlinearized embedding, whose nuisance dependence cannot be fully captured by the downstream linear nuisance model, resulting in milder right-shifted RνR_{\nu} distributions. Panel 8(c) is our proposed approach. Using the linearized embedding and the linear nuisance-model in the NPLM test, our approach brings the nominal and nuisance-shifted distributions into agreement.

We quantify the agreement in the final linearized configuration shown in panel 8(c) using 400 background-only replicas for each nuisance value. Table 2 presents two complementary checks. First, we assess closure by comparing the nuisance-shifted test-statistic distributions, Rν=±1​σR_{\nu=\pm 1\sigma}, with the nominal reference R0R_{0} using the Kolmogorov–Smirnov (KS), Anderson-Darling (AD), and Cramer-von-Mises (CvM) tests, and binned Pearson χ2\chi^{2} compatibility tests with 10 and 25 degrees of freedom. All closure-test pp-values exceed 0.5, indicating that the shifted distributions are consistent with the nominal reference. Second, we compare the same nuisance-shifted distributions with the analytical χ452\chi^{2}_{45} distribution using the KS, Anderson–Darling (AD), Cramér–von Mises (CvM), and Pearson χ2\chi^{2} tests. These pp-values range from 0.24 to 0.86 and show no significant departure from the analytical reference. Together, these results support the interpretation that the linear model gϕg_{\phi}, combined with the co-trained embedding, describes the nuisance-induced deformation sufficiently well to preserve the background-only test-statistic distribution. This closure is essential for latent-space anomaly detection, where an unmodeled systematic shift could otherwise produce an artificially significant excess.

To assess the role of co-training in achieving this closure, Table 3 reports the same tests for the unlinearized embedding with nuisance parameters included in the NPLM test, corresponding to panel 8(b). Although the nominal distribution agrees with the analytical χ452\chi^{2}_{45} reference, both nuisance-shifted distributions are inconsistent with R0R_{0} and with the analytical reference, with small pp-values across all tests. Agreement at the nominal nuisance value therefore does not ensure closure under nuisance shifts. Together with the linearized results, this comparison shows that the downstream linear nuisance model alone is insufficient to describe the shifts in the original embedding, while co-training enables the same model to achieve closure.

Table 2: Validation of the NPLM test in the linearized embedding. We compare the nuisance-shifted background-only NPLM test-statistic distributions Rν=±1​σR_{\nu=\pm 1\sigma} with two references: the empirical nominal distribution R0R_{0} (left block) and the analytical χ452\chi^{2}_{45} distribution (right block). The table reports pp-values from various goodness-of-fit tests: the Kolmogorov–Smirnov (KS), Anderson–Darling (AD), Cramér–von Mises (CvM), and Pearson χ2\chi^{2} (χp2\chi^{2}_{p}) performed using 10 and 25 degrees of freedom (DoF). Each empirical distribution is obtained using 400 replicas.
Test empirical R0R_{0} analytical χ452\chi^{2}_{45}
ν=+1​σ\nu=+1\sigma ν=−1​σ\nu=-1\sigma ν=+1​σ\nu=+1\sigma ν=−1​σ\nu=-1\sigma
KS 0.75830.7583 0.94160.9416 0.45140.4514 0.44800.4480
AD 0.65260.6526 0.82870.8287 0.24020.2402 0.40430.4043
CvM 0.78240.7824 0.88860.8886 0.39170.3917 0.50690.5069
χp2\chi^{2}_{p} (10 DoF) 0.78330.7833 0.82290.8229 0.67270.6727 0.46760.4676
χp2\chi^{2}_{p} (25 DoF) 0.81220.8122 0.79660.7966 0.86050.8605 0.43520.4352
Table 3: Validation of the NPLM test in the unlinearized embedding. With nuisance parameters included in the NPLM test, we compare the nuisance-shifted background-only test-statistic distributions Rν=±1​σR_{\nu=\pm 1\sigma} with the empirical nominal distribution R0R_{0} and the analytical χ452\chi^{2}_{45} distribution. Each empirical distribution contains 400 replicas. The small pp-values indicate a lack of closure and disagreement with the analytical reference. AD values are reported at the vailable precision.
Test empirical R0R_{0} analytical χ452\chi^{2}_{45}
ν=+1​σ\nu=+1\sigma ν=−1​σ\nu=-1\sigma ν=+1​σ\nu=+1\sigma ν=−1​σ\nu=-1\sigma
KS 5.806×10−145.806\times 10^{-14} 1.371×10−71.371\times 10^{-7} 2.555×10−282.555\times 10^{-28} 2.870×10−172.870\times 10^{-17}
AD 1.000×10−41.000\times 10^{-4} 1.000×10−41.000\times 10^{-4} 1.000×10−41.000\times 10^{-4} 1.000×10−41.000\times 10^{-4}
CvM <10−6<10^{-6} <10−6<10^{-6} <10−6<10^{-6} <10−6<10^{-6}
χp2\chi^{2}_{p} (10 DoF) 1.227×10−101.227\times 10^{-10} 3.374×10−83.374\times 10^{-8} 1.054×10−361.054\times 10^{-36} 1.532×10−211.532\times 10^{-21}
χp2\chi^{2}_{p} (25 DoF) 7.566×10−107.566\times 10^{-10} 3.704×10−63.704\times 10^{-6} 3.393×10−323.393\times 10^{-32} 1.770×10−201.770\times 10^{-20}

IV.6 Signal Sensitivity

We then assess signal sensitivity by injecting a small signal component into the SM background sample. We consider 0.5% and 1% signal injections, corresponding in our luminosity settings to 50 and 100 injected signal events, respectively. For each injected sample, we compute the NPLM test statistic and convert it into an empirical zz-score relative to the chosen background-only calibration distribution, estimated from 400 replicas. Figure 9 compares the test-statistic distributions obtained for a 1%1\% H±→τ±​νH^{\pm}\to\tau^{\pm}\nu injection under the three nuisance-treatment configurations considered in this work. The first configuration, Figure 9(a), omits nuisance parameters from the NPLM test and shows how the test responds when systematic variations are not explicitly accounted for. In the second configuration, shown in Figure 9(b), the nuisance parameters are included in the test using the original, unlinearized embedding. Figure 9(c) combines the nuisance-aware NPLM test with the co-trained, linearized embedding and therefore corresponds to the full procedure proposed in this work.

Refer to caption
(a) Unlinearized embedding without uncertainties in the NPLM test.
Refer to caption
(b) Unlinearized embedding with uncertainties in the NPLM test.
Refer to caption
(c) Linearized embedding with uncertainties in the NPLM test (ours).
Figure 9: Sensitivity to 1%1\% H±→τ±​νH^{\pm}\to\tau^{\pm}\nu signal injection in presence of uncertainties. Each distribution is estimated from 400 replicas. The pink filled histogram shows the nominal background-only distribution R0R_{0}, while the dark-red and coral hatched histograms show the nuisance-shifted background distributions Rν=+1​σR_{\nu=+1\sigma} and Rν=−1​σR_{\nu=-1\sigma}, respectively. The light-blue, dark-blue, and medium-blue step histograms show the corresponding signal-plus-background distributions at ν=0\nu=0, +1​σ+1\sigma, and −1​σ-1\sigma. The black curve shows the analytical χ2\chi^{2} distribution with 45 degrees of freedom. Panel (a) omits nuisance parameters from the NPLM test; panel (b) includes the nuisance parameter in the NPLM test, using the original, unlinearized embedding; and panel (c) includes the nuisance parameter in the NPLM test, using the co-trained, linearized embedding. The markers and error bars show the binwise estimates of the background-only densities and their statistical uncertainties.

The distributions in Figure 9 show that, when nuisance parameters are omitted from the NPLM test, the test statistic distribution under nuisance-shifted background-only (orange and brown) and under signal-injection (shades of blue) both shift toward larger values and cannot be reliably distinguished. Including the nuisance parameters with the original, unlinearized embedding also does not fully resolve this problem, as shown in Figure 9(b), where the shifted background distributions remain separated from R0R_{0} and alter the calculation of p-values. On the other hand, after co-training, the background-only distributions achieve closure, while the signal-injected distributions remain right-shifted toward larger tt for all tested nuisance values. The linearized embedding therefore allows nuisance-induced variations to be calibrated retaining sensitivity to the signal injection across the tested values of ν\nu.

The detection results of our method on experiments with signal-injection across the four signal benchmarks are summarized in Table 4. The table reports the median observed zz-scores obtained by calibrating each test sample against the empirical background-only distribution Rν=+1​σR_{\nu=+1\sigma}. We use the same reference for the unlinearized results in Table 5 to allow a direct comparison. These results show that the NPLM test retains sensitivity to small injected signals across the tested nuisance values. To further show the stability of our results, we report in Appendix A the same study using the nominal reference R0R_{0}, the nuisance-shifted reference Rν=−1​σR_{\nu=-1\sigma}, and the asymptotic χ452\chi^{2}_{45} distribution for calibration.

Table 4: Sensitivity to signal benchmarks using the linearized embedding and including the uncertainties in the NPLM test. Median observed zz-scores for each injected signal benchmark and test-sample nuisance value, calibrated against the empirical background-only distribution obtained with +1​σ+1\sigma (Rν=+1​σR_{\nu=+1\sigma}). Each signal benchmark is evaluated at 0.5%0.5\% and 1%1\% signal injection, shown in the left and right columns, respectively. For each benchmark and injection fraction, we generate 400 null toys and 400 signal-injected toys. Uncertainties denote 68% Clopper–Pearson confidence intervals. Values reported as ≥2.81\geq 2.81 saturate the finite-sample calibration limit.
Test sample L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
(calibrated by Rν=+1​σR_{\nu=+1\sigma}) 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
ν=0\nu=0 0.29−0.06+0.070.29^{+0.07}_{-0.06} 1.08−0.07+0.091.08^{+0.09}_{-0.07} 0.82−0.07+0.080.82^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.11−0.06+0.070.11^{+0.07}_{-0.06} 0.65−0.07+0.080.65^{+0.08}_{-0.07} 1.01−0.07+0.091.01^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=+1​σ\nu=+1\sigma 0.28−0.06+0.070.28^{+0.07}_{-0.06} 0.98−0.07+0.090.98^{+0.09}_{-0.07} 0.91−0.07+0.080.91^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.17−0.06+0.070.17^{+0.07}_{-0.06} 0.61−0.07+0.080.61^{+0.08}_{-0.07} 0.99−0.07+0.090.99^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=−1​σ\nu=-1\sigma 0.24−0.06+0.070.24^{+0.07}_{-0.06} 0.93−0.07+0.090.93^{+0.09}_{-0.07} 0.86−0.07+0.080.86^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.17−0.06+0.070.17^{+0.07}_{-0.06} 0.61−0.06+0.070.61^{+0.07}_{-0.06} 0.85−0.07+0.080.85^{+0.08}_{-0.07} ≥2.81\geq 2.81
Table 5: Signal-injection zz-scores using the original, unlinearized embeddings with nuisance parameters included in the NPLM test. Median observed zz-scores are reported for each injected signal benchmark and test-sample nuisance value. Each signal benchmark is evaluated at 0.5%0.5\% and 1%1\% signal injection, shown in the left and right columns, respectively. For each benchmark and injection fraction, we generate 400 null toys and 400 signal-injected toys. The zz-scores are calibrated against the empirical background-only distribution Rν=+1​σR_{\nu=+1\sigma}. This distribution has the longest high-tt tail among the tested nuisance values and therefore provides the most conservative calibration when the unlinearized embedding does not achieve closure between R0R_{0} and RνR_{\nu}. Negative zz-scores occur when the median test statistic of a signal-injected distribution lies below the median of this conservative reference, corresponding to a one-sided empirical pp-value greater than 0.50.5. Uncertainties denote 68% Clopper–Pearson confidence intervals. Values reported as ≥2.81\geq 2.81 saturate the finite-sample calibration limit.
Test sample L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
(calibrated by Rν=+1​σR_{\nu=+1\sigma}) 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
ν=0\nu=0 −0.58−0.07+0.07-0.58^{+0.07}_{-0.07} 0.97−0.07+0.090.97^{+0.09}_{-0.07} 0.39−0.06+0.070.39^{+0.07}_{-0.06} 2.24−0.14+0.322.24^{+0.32}_{-0.14} −0.12−0.06+0.07-0.12^{+0.07}_{-0.06} 0.39−0.06+0.070.39^{+0.07}_{-0.06} 0.72−0.07+0.080.72^{+0.08}_{-0.07} ≥2.81\geq 2.81
ν=+1​σ\nu=+1\sigma 0.37−0.06+0.070.37^{+0.07}_{-0.06} 1.46−0.09+0.121.46^{+0.12}_{-0.09} 0.68−0.07+0.080.68^{+0.08}_{-0.07} 2.24−0.14+0.322.24^{+0.32}_{-0.14} 0.32−0.06+0.070.32^{+0.07}_{-0.06} 0.96−0.07+0.090.96^{+0.09}_{-0.07} 1.14−0.08+0.101.14^{+0.10}_{-0.08} ≥2.81\geq 2.81
ν=−1​σ\nu=-1\sigma 0.35−0.06+0.070.35^{+0.07}_{-0.06} 1.19−0.08+0.101.19^{+0.10}_{-0.08} 0.67−0.07+0.080.67^{+0.08}_{-0.07} 2.17−0.13+0.282.17^{+0.28}_{-0.13} 0.10−0.06+0.070.10^{+0.07}_{-0.06} 0.76−0.07+0.080.76^{+0.08}_{-0.07} 0.96−0.07+0.090.96^{+0.09}_{-0.07} ≥2.81\geq 2.81

Table 5 instead evaluates the original embedding after nuisance parameters are incorporated into the NPLM test. Because the unlinearized embedding does not achieve closure between R0R_{0} and RνR_{\nu}, the nominal distribution R0R_{0} cannot be treated as a nuisance-independent null reference. Among the tested reference distributions, Rν=+1​σR_{\nu=+1\sigma} has the longest high-tt tail and yields slightly more conservative significances. We therefore calibrate these results against Rν=+1​σR_{\nu=+1\sigma} as the conservative reference where closure is not achieved. Even under this conservative calibration, the significance of the same signal injection remains strongly dependent on the nuisance value of the test sample. Although some variation is expected from finite-sample fluctuations and further reduced sensitivity can be caused by nuisance coupling with the injected signal, the variations observed across nuisance values within the same signal-injection column in Table 5 indicate that the reported sensitivity is strongly driven by the lack of background closure. In particular, the sensitivity is systematically larger when the nuisance is not in the central value, suggesting that the observed z-score is inflated by the residual mismodeling of the uncertainties. The instability is further reflected in the negative zz-scores, which occur when the median test statistic of a signal-injected distribution lies below the median of the conservative Rν=+1​σR_{\nu=+1\sigma} reference distribution, corresponding to a one-sided empirical pp-value greater than 0.50.5. In these cases, the nuisance-induced displacement of the unlinearized background distribution is larger than the displacement produced by the injected signal. The negative values therefore do not indicate a “negative signal,” but instead demonstrate that a post-hoc correction for the absence of closure causes a systematic shift that can obscure or overwhelm the signal response. Overall, this nuisance dependence makes the resulting significances unreliable. The same underlying signal can appear more significant, less significant, or even shifted below the reference median, causing loss in sensitivity and even chances of false claims.

Refer to caption
Figure 10: Nuisance-induced shifts can overwhelm the signal response. Test-statistic distributions in the unlinearized embedding for a 0.5%0.5\% L​Q→b​tLQ\to bt injection, with nuisance parameters included in the NPLM test. Pink and red histograms show the nominal and nuisance-shifted SM backgrounds; blue histograms show signal-injected samples. The black curve shows the analytical χ452\chi^{2}_{45} distribution.The nominal signal-injected median lies below that of Rν=+1​σR_{\nu=+1\sigma}, yielding a negative ZZ-score when calibrated against this reference.

Unlinearized embedding

(a) L​Q→b​tLQ\to bt
(b) A→4​ℓA\to 4\ell
(c) h→τ​τh\to\tau\tau
(d) H±→τ±​νH^{\pm}\to\tau^{\pm}\nu

Linearized embedding

(e) L​Q→b​tLQ\to bt
(f) A→4​ℓA\to 4\ell
(g) h→τ​τh\to\tau\tau
(h) H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
Figure 11: Power curves for 0.5%0.5\% signal injection using the unlinearized and linearized embeddings. The top row shows the unlinearized results, and the bottom row shows the linearized results, both empirically calibrated against Rν=+1​σR_{\nu=+1\sigma}. Each panel is evaluated using 400 null and 400 signal-injected toys. From left to right, the signal benchmarks are LQ→b​t\mathrm{LQ}\to bt, A→4​ℓA\to 4\ell, h→τ​τh\to\tau\tau, and H±→τ±​νH^{\pm}\to\tau^{\pm}\nu. The colored curves correspond to signal-injected samples evaluated at ν=0\nu=0 and ν=±1​σ\nu=\pm 1\sigma. The gray curve corresponds to the SM-only reference sample Rν=+1​σR_{\nu=+1\sigma}, calibrated against its own empirical test-statistic distribution. For the unlinearized embedding, Rν=+1​σR_{\nu=+1\sigma} has the largest high-tt tail among the tested nuisance-shifted SM samples, so using it as the calibration reference gives a more conservative estimate of the expected discovery power. We use the same reference for the linearized results to allow a direct comparison.

Figure 10 illustrates this effect for a 0.5%0.5\% injection of the L​Q→b​tLQ\to bt signal. The background-only distribution at ν=+1​σ\nu=+1\sigma has a larger median test statistic than the signal-injected distribution at ν=0\nu=0. Calibrating the latter against Rν=+1​σR_{\nu=+1\sigma} therefore gives a median pp-value above 0.50.5 and a negative ZZ-score, despite the presence of signal. This example shows how, without co-training, residual nuisance effects can exceed the response to an injected signal,limiting the test’s ability to distinguish new physics from nuisance-induced shifts.

Conversely, the detection performed in the linearized embedding (Table ) yields zz-scores that are substantially more stable across the tested nuisance values: within each benchmark and injection fraction, the spread across ν\nu is at most 0.160.16, compared with up to 0.950.95 for the unlinearized embedding. At the nominal value ν=0\nu=0, the linearized embedding also yields equal or higher significance for every benchmark. At ν=±1​σ\nu=\pm 1\sigma the unlinearized embedding can return larger zz-scores, but, as discussed above, these are inflated by residual nuisance mismodeling rather than reflecting genuine sensitivity. The closure between R0R_{0} and RνR_{\nu} provides a consistent background-only calibration, ensuring that the inferred significances primarily reflect the injected signals rather than unknown nuisance variations. The linearized embedding therefore provides both improved sensitivity and reliably calibrated significances, making it the more robust and practically usable representation for an uncertainty-aware anomaly search.

The power curves in Figures 11 and 12 provide a richer view of the discovery sensitivity, inspecting all discovery thresholds simultaneously for 0.5%0.5\% and 1%1\% signal injections, respectively. Each figure compares the unlinearized embedding in the top row with the linearized embedding in the bottom row, both calibrated against Rν=+1​σR_{\nu=+1\sigma}. Each curve gives the probability that the observed significance exceeds a threshold ZαZ_{\alpha}; better performance is indicated by signal-injected curves that lie well above the gray calibration curve and retain high power as ZαZ_{\alpha} increases. For the linearized embedding, the power curves corresponding to different nuisance values overlap closely in most cases, indicating that the discovery power is both strong and mostly independent of ν\nu. In contrast, the unlinearized embedding shows much larger shifts and fluctuations across nuisance values. Overall, the linearized embedding yields power curves that are nearly independent of ν\nu and, at the nominal value ν=0\nu=0, lie at or above those of the unlinearized embedding. The higher power of the unlinearized embedding at ν=±1​σ\nu=\pm 1\sigma in some panels reflects the lack of background closure rather than genuine discovery sensitivity. These trends are consistent with the test-statistic distributions in Fig.  and the median zz-scores reported in Tables  and : the linearized embedding gives stable sensitivity across nuisance values, whereas the unlinearized embedding produces a less reliable and strongly nuisance-dependent response.

IV.7 Computational Resources.

Encoder (fθf_{\theta}) training was performed on a 48 GB GPU, with a typical training time of 4 hours and 45 minutes. Linear model (gϕg_{\phi}) fine-tuning was performed on a 48 GB GPU, with a typical training time of 3 hours. The test network hζh_{\zeta} was trained on CPUs, with a typical training time of 50 minutes.

IV.8 Code Availability.

The code and detailed documentation to reproduce the experiments can be found at https://github.com/tshelley200/cl4ad_uncertainty.

Unlinearized embedding

(a) L​Q→b​tLQ\to bt
(b) A→4​ℓA\to 4\ell
(c) h→τ​τh\to\tau\tau
(d) H±→τ±​νH^{\pm}\to\tau^{\pm}\nu

Linearized embedding

(e) L​Q→b​tLQ\to bt
(f) A→4​ℓA\to 4\ell
(g) h→τ​τh\to\tau\tau
(h) H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
Figure 12: Power curves for 1%1\% signal injection using the unlinearized and linearized embeddings. The top row shows the unlinearized results, and the bottom row shows the linearized results, both empirically calibrated against Rν=+1​σR_{\nu=+1\sigma}. Each panel is evaluated using 400 null and 400 signal-injected toys. The signal benchmarks, nuisance settings, and gray reference curves follow the same conventions as in Fig. 11.

V Conclusion

We introduced a method for incorporating continuous systematic uncertainties into contrastive latent spaces. The approach imposes a controlled linear covariance structure, with the goal of enabling statistically rigorous profile-likelihood anomaly detection at the LHC. We regularized the training of a contrastive neural embedding using an auxiliary objective that encourages the learned log-density ratio to vary linearly with the nuisance parameter. This keeps the latent space compact, while preserving the information needed to model systematic variations.

This construction integrates naturally with the anomaly detection framework of [12]. It provides a scalable workflow in which nuisance-dependent effects can be included directly in the likelihood-based test statistic, rather than treated through post-hoc calibration.

The results presented in this work demonstrate that we can build anomaly detection methods that capture high-dimensional event structure, while remaining tractable and enabling robust and interpretable inference. Contrastive representations can be made compatible with continuous nuisance profiling, allowing the quantitative study of systematic uncertainties affecting an arbitrarily complex input representation in the flat, low-dimensional representation of an embedded space.

Enforcing linearity in ν\nu carries two additional benefits: (1) it simplifies the modelling and combination of multiple nuisance parameters and (2) it enables powerful combination of the test statistic across batches of data [30]. The proposed approach therefore offers a path toward the deployment of contrastive anomaly detection pipelines in full-scale LHC analyses, where a robust treatment of systematic uncertainties is essential. Future work will extend the method to multiple nuisance parameters and to higher luminosity, towards more realistic experimental settings.

Acknowledgements.
This work is supported by the National Science Foundation under Cooperative Agreement PHY-2019786, the NSF AI Institute for Artificial Intelligence and Fundamental Interactions, http://iaifi.org/. Computations in this paper were run on the FASRC Cannon cluster supported by the FAS Division of Science Research Computing Group at Harvard University.

Appendix A Additional calibration tables

We report in Tables 4 and 6 the observed median z-scores of the signal injection experiments using as empirical calibration the test statistic distribution under ν=0\nu=0 and ν=−σ\nu=-\sigma. Results in these Tables are compatible with the ones reported in Table 7, further confirming that the NPLM test was implemented in a robust way.

Table 6: Signal-injection zz-scores calibrated against the nominal background hypothesis R0R_{0}. Median observed zz-scores for each injected signal benchmark when calibrated against the nominal empirical distribution, R0R_{0}. Uncertainties denote 68% Clopper–Pearson confidence intervals. Values reported as ≥2.81\geq 2.81 saturate the finite-sample calibration limit.
Test sample L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
(calibrated by R0R_{0}) 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
ν=0\nu=0 0.33−0.06+0.070.33^{+0.07}_{-0.06} 1.05−0.07+0.091.05^{+0.09}_{-0.07} 0.73−0.07+0.080.73^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.12−0.06+0.070.12^{+0.07}_{-0.06} 0.60−0.07+0.080.60^{+0.08}_{-0.07} 0.96−0.07+0.090.96^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=+1​σ\nu=+1\sigma 0.31−0.06+0.070.31^{+0.07}_{-0.06} 0.91−0.07+0.080.91^{+0.08}_{-0.07} 0.83−0.07+0.080.83^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.18−0.06+0.070.18^{+0.07}_{-0.06} 0.56−0.06+0.070.56^{+0.07}_{-0.06} 0.92−0.07+0.090.92^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=−1​σ\nu=-1\sigma 0.26−0.06+0.070.26^{+0.07}_{-0.06} 0.86−0.07+0.080.86^{+0.08}_{-0.07} 0.81−0.07+0.080.81^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.18−0.06+0.070.18^{+0.07}_{-0.06} 0.56−0.06+0.070.56^{+0.07}_{-0.06} 0.80−0.07+0.080.80^{+0.08}_{-0.07} ≥2.81\geq 2.81
Table 7: Signal-injection zz-scores calibrated against Rν=−1​σR_{\nu=-1\sigma}. Median observed zz-scores for each injected signal benchmark when calibrated against the empirical distribution of Rν=−1​σR_{\nu=-1\sigma}. Uncertainties denote 68% Clopper–Pearson confidence intervals. Values reported as ≥2.81\geq 2.81 saturate the finite-sample calibration limit.
Test sample L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
(calibrated by Rν=−1​σR_{\nu=-1\sigma}) 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
ν=0\nu=0 0.28−0.06+0.070.28^{+0.07}_{-0.06} 1.14−0.08+0.101.14^{+0.10}_{-0.08} 0.84−0.07+0.080.84^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.09−0.06+0.070.09^{+0.07}_{-0.06} 0.61−0.07+0.080.61^{+0.08}_{-0.07} 0.99−0.07+0.090.99^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=+1​σ\nu=+1\sigma 0.28−0.06+0.070.28^{+0.07}_{-0.06} 0.97−0.07+0.090.97^{+0.09}_{-0.07} 0.96−0.07+0.090.96^{+0.09}_{-0.07} ≥2.81\geq 2.81 0.13−0.06+0.070.13^{+0.07}_{-0.06} 0.57−0.06+0.070.57^{+0.07}_{-0.06} 0.97−0.07+0.090.97^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=−1​σ\nu=-1\sigma 0.23−0.06+0.070.23^{+0.07}_{-0.06} 0.97−0.07+0.090.97^{+0.09}_{-0.07} 0.92−0.07+0.090.92^{+0.09}_{-0.07} ≥2.81\geq 2.81 0.14−0.06+0.070.14^{+0.07}_{-0.06} 0.56−0.06+0.070.56^{+0.07}_{-0.06} 0.91−0.07+0.080.91^{+0.08}_{-0.07} ≥2.81\geq 2.81

We report in Table 8 the observed median z-scores of the signal injection experiments using as calibration the asymptotic χ452\chi^{2}_{45}. The results in this Table are compatible with the ones reported in Table 6, further confirming the compatibility of the null distribution with χ452\chi^{2}_{45} obtained via weight clipping tuning.

Table 8: Signal-injection zz-scores from analytical χ452\chi^{2}_{45} calibration. zz-scores obtained using the analytical χ2\chi^{2} calibration with 45 degrees of freedom. Each signal benchmark is evaluated at 0.5%0.5\% and 1%1\% signal injection, shown in the left and right columns, respectively. For each benchmark and injection fraction, we generate 400 null toys and 400 signal-injected toys.
Test sample L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
(cal. by χ452\chi^{2}_{45}) 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
ν=0\nu=0 0.33 1.08 0.82 3.19 0.17 0.65 0.99 3.05
ν=+1​σ\nu=+1\sigma 0.31 0.96 0.90 3.03 0.20 0.61 0.96 2.80
ν=−1​σ\nu=-1\sigma 0.28 0.93 0.87 3.06 0.21 0.61 0.86 2.72

Appendix B The effect of linearization in the latent representation

Table 9 shows the detection performance of NPLM in the absence of uncertainties, for both the original embedding, trained with supervised contrastive learning alone, and our proposed embedding, co-trained with a linearization penalty. While this is not a realistic scenario it informs us about the properties of the embedding as an input to the NPLM test. After linearization the sensitivity of NPLM is moderately degraded, telling us that accounting for systematics in the embedding come at the cost of degraded sensitivity. This is a price we are willing to pay in order to make the detection robust and reliable.

Table 9: Comparison of idealized signal-injection zz-scores before and after embedding linearization, without nuisance parameters included in the NPLM test. Median observed zz-scores for each injected signal benchmark, evaluated using nominal samples with ν=0\nu=0 and calibrated against the empirical nominal background-only distribution R0R_{0}. Each signal benchmark is evaluated at 0.5%0.5\% and 1%1\% signal injection, shown in the left and right columns, respectively. For each benchmark and injection fraction, we generate 400 null toys and 400 signal-injected toys. Comparing the two rows isolates the effect of embedding linearization in the absence of systematic variations and nuisance parameters. This table represents an idealized sensitivity that is not achievable in a realistic analysis, where uncertainties cannot be ignored and must instead be incorporated as nuisance parameters in the NPLM test. Uncertainties denote 68% Clopper–Pearson confidence intervals. Values reported as ≥2.81\geq 2.81 saturate the finite-sample calibration limit.
Embedding L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
Before Linearization 0.38−0.06+0.070.38^{+0.07}_{-0.06} 1.70−0.10+0.151.70^{+0.15}_{-0.10} 1.01−0.07+0.091.01^{+0.09}_{-0.07} ≥2.81\geq 2.81 0.29−0.06+0.070.29^{+0.07}_{-0.06} 1.13−0.08+0.101.13^{+0.10}_{-0.08} 1.42−0.09+0.121.42^{+0.12}_{-0.09} ≥2.81\geq 2.81
After Linearization 0.37−0.06+0.070.37^{+0.07}_{-0.06} 1.21−0.08+0.101.21^{+0.10}_{-0.08} 1.06−0.07+0.091.06^{+0.09}_{-0.07} ≥2.81\geq 2.81 0.17−0.06+0.070.17^{+0.07}_{-0.06} 0.76−0.07+0.080.76^{+0.08}_{-0.07} 0.96−0.07+0.090.96^{+0.09}_{-0.07} ≥2.81\geq 2.81

Appendix C Quadratic Nuisance Model

Throughout the main text, we use a linear nuisance model in the NPLM test, corresponding to the simplest nontrivial polynomial dependence on the nuisance parameter. This choice is motivated primarily by its use in “stacking,” where multiple datasets are combined to increase the effective luminosity beyond that of the individual 10,000-event samples considered here; a detailed treatment of this procedure is left to a separate future work. However, a higher-order polynomial model can generally better describe residual nonlinearities in the nuisance dependence across the embedding space. In particular, a quadratic model can improve closure where the linear approximation is insufficient and yield more stable signal significances across different nuisance values.

In this section, we evaluate a quadratic nuisance model using the same linearized embeddings, closure tests, and signal-injection studies as in the main text. In Table 10, we report compatibility tests between the nominal and nuisance-shifted background-only distributions, R0R_{0} and RνR_{\nu}, and in Table 11 the observed median ZZ-scores for the signal-injection experiments, calibrated against the empirical nominal distribution R0R_{0}. The results are broadly consistent with those obtained using the linear nuisance model in Tables 6 and 4, with slight improvements in closure tests. The quadratic model yields results in close agreement with those of the linear model, indicating that the additional complexity provides no meaningful improvement. The linear assumption is therefore good enough for this study.

Table 10: Closure validation of the NPLM test using a quadratic nuisance model. The table reports pp-values comparing each nuisance-shifted background-only test-statistic distribution, Rν=±1​σR_{\nu=\pm 1\sigma}, with the empirical nominal distribution R0R_{0}. Each distribution contains 400 replicas, with nuisance parameters included in the NPLM test and the embedding evaluated at the selected weight-clipping value wclip=1.94w_{\mathrm{clip}}=1.94. Closure is assessed using the two-sample Kolmogorov–Smirnov test and binned Pearson χ2\chi^{2} tests with the degrees of freedom listed below.
Test DoF ν=+1​σ\nu=+1\sigma ν=−1​σ\nu=-1\sigma
Kolmogorov–Smirnov — 0.9840.984 0.8130.813
Pearson χ2\chi^{2} 10 0.80820.8082 0.79290.7929
14 0.97860.9786 0.68440.6844
17 0.97970.9797 0.75380.7538
20 0.97930.9793 0.55260.5526
25 0.93050.9305 0.81380.8138
Table 11: Signal-injection zz-scores with nuisance parameters included in the NPLM test. Median observed zz-scores for each injected signal benchmark and test-sample nuisance value, calibrated against the empirical nominal background-only distribution R0R_{0}. Each signal benchmark is evaluated at 0.5%0.5\% and 1%1\% signal injection, shown in the left and right columns, respectively. For each benchmark and injection fraction, we generate 400 null toys and 400 signal-injected toys. Uncertainties denote 68% Clopper–Pearson confidence intervals. Values reported as ≥2.81\geq 2.81 saturate the finite-sample calibration limit.
Test sample L​Q→b​tLQ\to bt A→4​ℓA\to 4\ell h→τ​τh\to\tau\tau H±→τ±​νH^{\pm}\to\tau^{\pm}\nu
0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\% 0.5%0.5\% 1%1\%
ν=0\nu=0 0.28−0.06+0.070.28^{+0.07}_{-0.06} 1.13−0.08+0.101.13^{+0.10}_{-0.08} 0.90−0.07+0.080.90^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.25−0.06+0.070.25^{+0.07}_{-0.06} 0.71−0.07+0.080.71^{+0.08}_{-0.07} 0.98−0.07+0.090.98^{+0.09}_{-0.07} ≥2.81\geq 2.81
ν=+1​σ\nu=+1\sigma 0.27−0.06+0.070.27^{+0.07}_{-0.06} 0.83−0.07+0.080.83^{+0.08}_{-0.07} 0.81−0.07+0.080.81^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.10−0.06+0.070.10^{+0.07}_{-0.06} 0.53−0.06+0.070.53^{+0.07}_{-0.06} 0.81−0.07+0.080.81^{+0.08}_{-0.07} ≥2.81\geq 2.81
ν=−1​σ\nu=-1\sigma 0.27−0.06+0.070.27^{+0.07}_{-0.06} 0.88−0.07+0.080.88^{+0.08}_{-0.07} 0.81−0.07+0.080.81^{+0.08}_{-0.07} ≥2.81\geq 2.81 0.12−0.06+0.070.12^{+0.07}_{-0.06} 0.47−0.06+0.070.47^{+0.07}_{-0.06} 0.88−0.07+0.080.88^{+0.08}_{-0.07} 2.43−0.16+0.482.43^{+0.48}_{-0.16}

References

  • [1] G. Aad et al. (ATLAS), Dijet resonance search with weak supervision using s=13\sqrt{s}=13 TeV p​ppp collisions in the ATLAS detector, Phys. Rev. Lett. 125, 131801 (2020), arXiv:2005.02983 [hep-ex] .
  • [2] G. Aad et al. (ATLAS), Anomaly detection search for new resonances decaying into a Higgs boson and a generic new particle XX in hadronic final states using s=13\sqrt{s}=13 TeV p​ppp collisions with the ATLAS detector, Phys. Rev. D 108, 052009 (2023), arXiv:2306.03637 [hep-ex] .
  • [3] G. Aad et al. (ATLAS), Weakly supervised anomaly detection for resonant new physics in the dijet final state using proton-proton collisions at s=13  TeV with the ATLAS detector, Phys. Rev. D 112, 072009 (2025), arXiv:2502.09770 [hep-ex] .
  • [4] V. Chekhovsky et al. (CMS), Model-agnostic search for dijet resonances with anomalous jet substructure in proton–proton collisions at s\sqrt{s} = 13 TeV, Rept. Prog. Phys. 88, 067802 (2025), arXiv:2412.03747 [hep-ex] .
  • [5] A. Hayrapetyan et al. (CMS), Machine-learning techniques for model-independent searches in dijet final states 10.5281/zenodo.16656501 (2025), arXiv:2512.20395 [hep-ex] .
  • [6] K. Metzger, L. Xu, M. Sodini, T. K. Arrestad, K. Govorkova, G. Grosso, and P. Harris, Anomaly-preserving contrastive neural embeddings for end-to-end model-independent searches at the LHC, Phys. Rev. D 112, 072011 (2025), arXiv:2502.15926 [hep-ex] .
  • [7] S. Bright-Thonney, C. Reissel, G. Grosso, N. Woodward, K. Govorkova, A. Novak, S. E. Park, E. Moreno, and P. Harris, Autoscidact: Automated scientific discovery through contrastive embedding and hypothesis testing, arXiv preprint arXiv:2510.21935 (2025).
  • [8] R. Li, B. Nachman, and D. Noll, Signal-Aware Contrastive Latent Spaces for Anomaly Detection, (2026), arXiv:2603.25794 [hep-ph] .
  • [9] C. L. Cheng, J. Gonski, R. Li, Q. Liu, B. Nachman, D. Noll, J. K. Romman, and L. Wu, Towards anomaly detection searches for new physics signatures including Higgs bosons with weakly supervised machine learning, (2026), arXiv:2607.19323 [hep-ex] .
  • [10] R. T. D’Agnolo and A. Wulzer, Learning new physics from a machine, Physical Review D 99, 015014 (2019).
  • [11] R. T. D’Agnolo, G. Grosso, M. Pierini, A. Wulzer, and M. Zanetti, Learning multivariate new physics, Eur. Phys. J. C 81, 89 (2021), arXiv:1912.12155 [hep-ph] .
  • [12] R. T. D’Agnolo, G. Grosso, M. Pierini, A. Wulzer, and M. Zanetti, Learning new physics from an imperfect machine, Eur. Phys. J. C 82, 275 (2022), arXiv:2111.13633 [hep-ph] .
  • [13] T. Chen, S. Kornblith, M. Norouzi, and G. Hinton, A simple framework for contrastive learning of visual representations, in Proceedings of the 37th International Conference on Machine Learning (ICML), Vol. 119 (2020) pp. 1597–1607, arXiv:2002.05709 [cs.LG] .
  • [14] B. M. Dillon, G. Kasieczka, H. Olischläger, T. Plehn, P. Sorrenson, and L. Vogel, Symmetries, safety, and self-supervision, SciPost Physics 12, 188 (2022a), arXiv:2108.04253 [hep-ph] .
  • [15] P. Harris, M. Kagan, J. Krupa, B. Maier, and N. Woodward, Re-Simulation-based Self-Supervised Learning for Pre-Training Foundation Models, (2024), arXiv:2403.07066 [hep-ph] .
  • [16] B. M. Dillon, R. Mastandrea, and B. Nachman, Self-supervised anomaly detection for new physics, Physical Review D 106, 056005 (2022b), arXiv:2205.10380 [hep-ph] .
  • [17] R. Dangovski, L. Jing, C. Loh, S. Han, A. Srivastava, B. Cheung, P. Agrawal, and M. Soljačić, Equivariant contrastive learning, arXiv preprint arXiv:2111.00899 (2021).
  • [18] P. Baldi, K. Cranmer, T. Faucett, P. Sadowski, and D. Whiteson, Parameterized neural networks for high-energy physics, The European Physical Journal C 76, 235 (2016).
  • [19] P. De Castro and T. Dorigo, Inferno: inference-aware neural optimisation, Computer Physics Communications 244, 170 (2019).
  • [20] G. Louppe, M. Kagan, and K. Cranmer, Learning to pivot with adversarial networks, Advances in neural information processing systems 30 (2017).
  • [21] G. Kasieczka and D. Shih, Disco fever: Robust networks through distance correlation, arXiv preprint arXiv:2001.05310 (2020).
  • [22] P. Khosla, P. Teterwak, C. Wang, A. Sarna, Y. Tian, P. Isola, A. Maschinot, C. Liu, and D. Krishnan, Supervised contrastive learning, Advances in neural information processing systems 33, 18661 (2020).
  • [23] E. Govorkova, E. Puljak, T. Aarrestad, M. Pierini, K. A. Woźniak, and J. Ngadiuba, Lhc physics dataset for unsupervised new physics detection at 40 mhz, Scientific Data 9, 118 (2022).
  • [24] T. Aarrestad, E. Govorkova, J. Ngadiuba, E. Puljak, M. Pierini, and K. A. Wozniak, Unsupervised new physics detection at 40 mhz: Training dataset, 10.5281/zenodo.5046389 (2021a).
  • [25] T. Aarrestad, E. Govorkova, J. Ngadiuba, E. Puljak, M. Pierini, and K. A. Wozniak, Unsupervised new physics detection at 40 mhz: A -¿ 4 leptons signal benchmark dataset, 10.5281/zenodo.5046446 (2021b).
  • [26] T. Aarrestad, E. Govorkova, J. Ngadiuba, E. Puljak, M. Pierini, and K. A. Wozniak, Unsupervised new physics detection at 40 mhz: Lq -¿ b tau signal benchmark dataset, 10.5281/zenodo.5055454 (2021c).
  • [27] T. Aarrestad, E. Govorkova, J. Ngadiuba, E. Puljak, M. Pierini, and K. A. Wozniak, Unsupervised new physics detection at 40 mhz: h0 -¿ tau tau signal benchmark dataset, 10.5281/zenodo.5061633 (2021d).
  • [28] T. Aarrestad, E. Govorkova, J. Ngadiuba, E. Puljak, M. Pierini, and K. A. Wozniak, Unsupervised new physics detection at 40 mhz: h+ -¿ tau nu signal benchmark dataset, 10.5281/zenodo.5061688 (2021e).
  • [29] ATLAS Collaboration, A precise measurement of the jet energy scale derived from single-particle measurements and in situ techniques in proton-proton collisions at 13 TeV with the ATLAS detector, (2024), arXiv:2407.15627 [hep-ex] .
  • [30] G. Grosso, Anomaly-aware summary statistic from data batches, JHEP 12, 093, arXiv:2407.01249 [hep-ex] .
  • [31] R. Jiang, P. Y. Lu, and R. Willett, Embed and emulate: Contrastive representations for simulation-based inference, arXiv preprint arXiv:2409.18402 (2024).
  • [32] G. Cowan, K. Cranmer, E. Gross, and O. Vitells, Asymptotic formulae for likelihood-based tests of new physics, Eur. Phys. J. C 71, 1554 (2011), [Erratum: Eur.Phys.J.C 73, 2501 (2013)], arXiv:1007.1727 [physics.data-an] .

*