Manuscript Offprint
arXiv:2611.00234Localized anomaly detection with a calorimeter normalizing flow
Abstract
Normalizing flows trained as fast calorimeter simulators also give the likelihood of each shower, which can serve as an anomaly score. Because this likelihood sums over every voxel, a signal confined to a few voxels can be lost in the fluctuations of the rest of the shower. For example, in a public benchmark dataset in which a long-lived neutral particle decays to two photons, the CaloFlow likelihood used in previous work selects less than 5% of the signal at a background efficiency of when the particle has the largest simulated mass and decays at or just behind the front face of the calorimeter. In this work, we define a regional anomaly score by summing the squared latent coordinates of the same flow within small detector regions around the point where the particle enters the calorimeter, with the threshold set using background showers alone. At the same background efficiency, this regional anomaly score selects more than 95% of the signal. The per-coordinate likelihood terms, summed over the same regions, perform equally well, but the squared latent coordinates have a known distribution for background showers and clearly illustrate when a shower departs from it. Therefore, normalizing flows may be sensitive to new physics, even if the global likelihood is not.
Copyright attribution to authors. This work is a submission to SciPost Physics. License information to appear upon publication. Publication information to appear upon publication.
Received Date Accepted Date Published Date
Contents
1 Introduction 2 2 Dataset and model 3 2.1 Displaced-diphoton benchmark 3 2.2 CaloFlow likelihood and latent space 5 3 Regional anomaly score 5 3.1 Detector regions 5 3.2 Conformal calibration 6 4 Results 7 4.1 Front-face samples 7 4.2 Why the summed scores miss the signal 9 4.3 Dependence on mass and decay position 10
Submission
| 5 Conclusions | 10 |
|---|---|
| A Implementation details | 12 |
| A.1 Detector, samples, and preprocessing | 12 |
| A.2 Latent assignment, regions, and further checks | 13 |
| A.3 Calibration | 14 |
| A.4 Flow-I preprocessing | 14 |
| A.5 Decomposition of the image likelihood | 14 |
| A.6 Supervised reference classifiers | 15 |
| References | 15 |
Generative models are also being developed as fast surrogates for calorimeter shower simulation, which takes a large share of the computing needed for LHC detector simulation [10, 11]. A normalizing flow maps a shower, represented by the energies deposited in the calorimeter cells or voxels, through an invertible transformation to Gaussian latent coordinates. Unlike most other generative models, it provides the exact likelihood of any shower and can generate new ones [12], so a flow trained for simulation can be reused for inference [13] and anomaly detection [14]. Reference [14] used the likelihood of CaloFlow [15, 16] to separate the showers of a long-lived neutral particle X that decays to two photons from single photons. This signature is relevant to searches for displaced or collimated photons [17, 18] and for long-lived particles that decay in the calorimeters [19]. Based on the greatest improvement in significance over all thresholds, the likelihood was the least sensitive in two cases. For the three lightest masses, up to 0.5 GeV, decays in front of the calorimeter or at its front face were difficult to detect, which Ref. [14] attributed to highly collimated photon pairs whose showers resemble those of single photons [20]. For the heaviest mass, 5 GeV, decays at the front face were less anomalous than decays farther upstream, because the two photons have little distance to separate before showering. At a fixed background efficiency of , the likelihood selects less than 5% of the 5 GeV decays at or just behind the front face (Sec. 4.1). Reference [14] also trained supervised classifiers on the voxel energies. Each did better than the likelihood on the mass it was trained on, but the classifier trained on the lightest mass lost much of its sensitivity to the heaviest.
For these 5 GeV decays, and for upstream decays of 0.5 GeV particles, the flow has the information needed to find the signal, but the likelihood combines it poorly. The likelihood sums contributions from all voxels of the shower. When the two photons overlap, the signal shower differs from a photon shower mainly in a few voxels near the shower core, and this difference is diluted by the fluctuations of the many other voxels. The situation resembles the choice between a global goodness-of-fit test and a bump hunt in a narrow mass window. Restricting the test to a small region makes it more sensitive to a signal there, at the cost of a trials factor for the number of regions searched, the look-elsewhere effect [21, 22].
Submission
We therefore build a regional anomaly score from the latent representation of CaloFlow. Its second flow, Flow-II, maps each shower to one latent coordinate per voxel, and its likelihood contains the sum of the squares of all of them. Without retraining the flow, we assign each latent coordinate to its voxel and sum the squares within detector regions centered on the point where the particle enters the calorimeter, which we call the impact position. The largest standardized sum is the score. Its threshold is set on background photons alone with conformal calibration, which controls the fraction of background showers selected, the background efficiency. For a particle of mass 5 GeV that decays at or just behind the front face, the regional score selects almost all of the signal, while the likelihood selects only a few percent at the same background efficiency. It also selects most of the upstream decays of 0.5 GeV particles, which the likelihood misses. The per-coordinate terms of the Flow-II likelihood, summed over the same regions, perform equally well, so the gain comes from localizing the score.
That a likelihood can be a poor anomaly score is known in machine learning. Deep generative models can assign higher likelihoods to unfamiliar inputs than to their own training data [23], an effect that has been attributed to low-level input statistics [24–27]. Even a perfect density model does not guarantee anomaly detection, because the density depends on how the input is represented [28]. In collider physics, density-based and autoencoder-based scores likewise favor some anomalies over others [29–32]. Proposed alternatives include typicality tests [33], model ensembles [34], and goodness-of-fit tests on flow latent coordinates [35,36]. In industrial inspection, defects are located with per-position maps built from patch features or from the latent coordinates and likelihoods of flows [37–41], and U-Flow [42] scores an image by the maximum of a map of squared latent coordinates. U-Flow also locates anomalous regions with a test on these coordinates, with a threshold on the expected number of false alarms among all regions tested. We apply this idea to a calorimeter flow whose latent coordinates are not arranged on the detector grid. We calibrate the score with split-conformal -values for outlier detection [43, 44], separately in bins of reconstructed energy [45]. Conformal -values have also been used in high-energy physics [46, 47].
Section 2 describes the benchmark and the CaloFlow likelihood, Sec. 3 defines the regional score and its calibration, Sec. 4 presents the results, and Sec. 5 concludes.
2 Dataset and model
2.1 Displaced-diphoton benchmark
We use the public displaced-diphoton benchmark of Refs. [14, 48], simulated with Geant4 [49] in a three-layer electromagnetic sampling calorimeter based on the CaloGAN detector [50, 51]. The three layers, numbered 0 to 2 from the front, have 288, 144, and 72 voxels, 504 in total, and Appendix A.1 gives the geometry. Every particle is emitted from the origin along the calorimeter axis, which meets the front face at the corner shared by the four central voxels of layer 1. This point is the impact position introduced in Sec. 1.
The background consists of two independent samples of photons with energies distributed uniformly between 1 and 100 GeV. We train CaloFlow five times, with different random seeds, on the first sample and use the second for design, calibration, and testing (Sec. 3.2). In the signal samples, a neutral particle of mass and energy GeV decays to two photons at a distance from the origin, for the 28 combinations
Reference [14] denotes the particle by and the decay position by , a symbol we use for the latent coordinates of the flow. The front face of the calorimeter is at 1.00 m. We call decays at
Submission

Figure 1: Energy deposited in the three calorimeter layers (rows) by individual showers. The columns show a particle with GeV decaying upstream at m, a particle of the same mass decaying at the calorimeter front face at m, and a background photon. The upstream decay produces two separate cores, while the front-face decay produces a single core that is hard to tell from that of the photon. The axes give the voxel indices in the two transverse directions, labeled and as in Ref. [14]. All panels use the same logarithmic energy scale; white voxels contain no deposited energy.
m and 0.66 m upstream decays and those at 1.00 m and 1.04 m front-face decays. Sections 4.1 and 4.2 study the two front-face samples with GeV.
The opening angle between the two photons is at least
which for GeV is 0.2 rad. Each smaller mass in Eq. (1) reduces the angle by about a factor of ten. When a particle with GeV decays upstream, the two photons enter the calorimeter far apart and produce two separate cores (Fig. 1, left). When it decays at the front face, their axes enter layer 1 only about 2 cm apart, half the width of a layer-1 voxel, and the two showers overlap (center).
Submission
2.2 CaloFlow likelihood and latent space
CaloFlow factorizes the shower density into a flow for the three layer energies , and , called Flow-I, and a flow for the shower image normalized to the energy of each layer, called Flow-II. Both are conditioned on the incident energy , and the model density is
In an application is unknown and is replaced by its estimate from the layer energies (Appendix A.1). We use , the anomaly score of Ref. [14] with the Flow-I preprocessing of Appendix A.4, as the likelihood score and baseline, and call the Flow-I term.
Flow-II maps the preprocessed image through an invertible transformation to latent coordinates , with and a standard normal base density. Leaving out the conditioning, the change-of-variables formula of normalizing flows [12, 15] gives
where is the Jacobian of . The first two terms are the negative logarithm of the standard normal density at , which grows with the distance of from the origin. The last term accounts for how strongly stretches or compresses the space of images near the shower. We call the image likelihood, the last term the log-Jacobian term, and the global latent norm. All scores in this paper are oriented so that a higher value is more anomalous. Because Flow-II is autoregressive, the log-Jacobian term is exactly a sum of one contribution per latent coordinate (Appendix A.5), so that, up to a constant, is a sum of the per-coordinate likelihood terms .
3 Regional anomaly score
3.1 Detector regions
The regional score needs each Flow-II latent coordinate to be assigned to a voxel. We obtain the assignment by following each coordinate through the fixed permutations of the flow, which act separately within each layer. Because the flow is autoregressive, a latent coordinate also depends on other voxels, but for the four central layer-1 coordinates most of the dependence is on those four voxels (Appendix A.2).
Photons arrive along the calorimeter axis, and their showers are symmetric about it. In each layer we therefore use a central square and square rings around it, centered on the impact position and bounded by voxel edges, together with the three complete layers (Fig. 2). This gives 14 regions, chosen from the detector geometry and the symmetry of photon showers without using the signal. The smallest region contains the four layer-1 voxels around the impact position. Appendix A.2 gives the construction.
For a region of voxels, we sum the squared latent coordinates assigned to its voxels and standardize the sum with the mean and standard deviation of a distribution with degrees of freedom,
The maximum runs over the 14 regions, and we call the regional score. Like a scan statistic [52, 53], it is a maximum over spatial windows.
The per-coordinate likelihood terms, summed over regions in the same way, perform as well (Sec. 4.1). We use the squared latent coordinates because they have a known distribution
Submission

Figure 2: Concentric square regions in (a) layer 0, (b) layer 1, and (c) layer 2. The impact position is at the origin of each panel. Together with the three complete layers, these regions form the 14 regions of the regional score. Dashed lines show the region boundaries, and darker shading denotes regions closer to the impact position. All panels cover the same 480 mm × 480 mm transverse area.
for photons. The flow is trained to map photon showers to independent standard normal coordinates, so every voxel has the same reference, and a large marks a voxel that the model does not expect for a photon. The values for all voxels form an anomaly map that shows where in the detector a shower departs from the background (Sec. 4.1), similar to the maps of flow-based defect detectors [40–42]. The same reference sets the standardization in Eq. (5). Under the model each follows a distribution, and each is a goodness-of-fit statistic for the latent coordinates of its region [35, 36]. For the test photons this holds in all 14 regions except far in the tail (Appendix A.2), so we take the threshold from the photons themselves rather than from the distribution. The log-Jacobian contributions have no such reference. Their split among the coordinates follows the internal order of the flow, so the sum of the likelihood terms over a region, the regional likelihood of Sec. 4.1, is not the likelihood of the voxels in that region, although it can still serve as a score.
3.2 Conformal calibration
We split the second photon sample once into a design sample, which fixes the five bins of reconstructed energy (Appendix A.3) and the standardizations of the scores other than , a calibration sample, which sets the thresholds, and a test sample, on which the background efficiency is measured. A shower in energy bin is ranked against the calibration photons of the same bin. Its conformal -value is
where is the indicator function. If the score and the bins are fixed independently of the calibration and test showers, and if calibration and future background showers are exchangeable within a bin, selecting the showers with has a false-positive probability of at most in every bin, where the probability is taken also over the draw of the calibration sample. This binned form is known as Mondrian conformal prediction [43, 45].
We compute from after the maximization over regions, so the calibration accounts for the number of regions and their correlations, as in the single-step max- procedure [54]. A related method, Max-Rank [55], calibrates the maximum of the per-region ranks instead of the maximum of the scores. The other scores are calibrated in the same way, and Appendix A.3 checks the background efficiency achieved by the regional score.
Submission
Because the conformal -values are discrete, the threshold selects slightly different background fractions for different scores. To compare scores at nearly the same background efficiency, we instead threshold each one at the quantile of its -values on the test photons and report the signal efficiency , the fraction of signal showers selected, at a background efficiency . This matched threshold carries no finite-sample guarantee. The conformal threshold is used in Sec. 4.2 and in Appendices A.2 and A.3. Values and uncertainties are means and standard deviations over the five trained flows, evaluated on the same test photons.
4 Results
4.1 Front-face samples
Table 1 lists the signal efficiencies for the two front-face samples. The likelihood score selects less than 5% of the signal, and the image likelihood, without the Flow-I term, does no better. The global latent norm, which drops the log-Jacobian term but still sums over all coordinates, selects a little under half. The regional score selects more than 95%.
Table 1: Signal efficiency at for the two front-face samples ( GeV, m and m). For each latent coordinate , the term , its log-Jacobian contribution (Appendix A.5), or the per-coordinate likelihood term is summed over all 504 coordinates, over the three complete layers, or over the 14 regions. In the last two cases the largest standardized sum defines the score. Only the sums over regions select nearly all of the signal.
| term per coordinate | summed over | , 1.00 m | , 1.04 m |
|---|---|---|---|
| all coordinates (global latent norm) | |||
| three layers | |||
| regions (regional score ) | |||
| all coordinates | |||
| regions | |||
| all coordinates (image likelihood) | |||
| three layers | |||
| regions (regional likelihood) | |||
| likelihood score |
Because the log-Jacobian term is a sum of the per-coordinate contributions (Sec. 2.2), it can be restricted to regions in the same way as the squared latent coordinates. Summed over all coordinates, neither the log-Jacobian contributions nor the per-coordinate likelihood terms select more than a few percent of the signal. Maximized over the regions, the log-Jacobian contributions alone select most of it, and the per-coordinate likelihood terms, a score we call the regional likelihood, perform as well as the regional score. Sums over complete layers remain far less efficient. The gain therefore comes from restricting the sum to a small region, not from the choice of terms.
Figure 3 extends the comparison to other background efficiencies. The regional score and the regional likelihood nearly coincide, except at the lowest background efficiencies, where the regional likelihood is slightly higher. Both stay above the global latent norm and the likelihood score over the whole range.
Figure 4 shows the anomaly map, averaged over showers and for single showers. For
Submission
(a)

(b)
Figure 3: Background rejection as a function of the signal efficiency for the front-face samples at (a) m and (b) 1.04 m. Each score is thresholded at the quantile of its conformal p-values on the test photons. The dashed line marks , the working point of Table 1, and the dotted line a random selection, . The regional score and the regional likelihood run close to along the right edge of each panel. The likelihood score was evaluated only at the seven marked background efficiencies, the lowest of which lies on the upper edge of each panel. Bands show the standard deviation over the five trained flows.
(a)

(b)
Figure 4: Squared latent coordinate of each voxel for (a) test photons in the energy bin of the front-face samples and (b) signal showers with GeV decaying at m. The left block shows the mean over showers and over three of the five trained flows, and the right block shows, for one flow, the shower with the median regional score in each sample. Columns show the three layers, drawn to scale over the same area as in Fig. 2, and the dashed square marks the innermost layer-1 region. For photons the mean is close to one almost everywhere and a single shower fluctuates about it, while for the signal the excess is concentrated at the impact position, on average and in a single shower.
photons, the mean of is close to one in almost every voxel, as the model expects, and somewhat lower at the impact position. For the signal it is more than ten times larger in the four voxels of the innermost layer-1 region and along the central strips of layer 0, at the impact position. About half of the total excess over photons lies in those four layer-1 voxels. A typical single signal shower, the one with the median regional score, shows the same excess at the impact position, while a typical single photon shows only scattered fluctuations.
Submission
(a)

(b)
(c)
Figure 5: Fraction of test photons and of signal showers with GeV and m selected as a function of the threshold on , for (a) the global latent norm and (b) the regional score. The dashed line marks . For calibrated -values the fraction of photons selected is close to , so the photon curve follows the diagonal, and a score separates the signal when its signal curve stays high where the photon curve is low. Panel (c) gives the fraction of signal showers at 1.00 m and 1.04 m for which each region attains the maximum; “inner” and “second” denote the innermost region of a layer and the one surrounding it, and “other” collects the remaining regions. Bands and error bars show the standard deviation over the five trained flows.
The regional score depends on the assignment of latent coordinates to voxels. Randomly permuting the assignment, which keeps the size of every region, lowers the efficiency of the regional score at every grid point with GeV (Appendix A.2). A sum of only the few largest squared latent coordinates, which ignores their position, recovers most but not all of the front-face signal.
Photon-identification variables, including the layer-0 strip variables that reject decays, select less than half of the signal when they are combined without labels (Appendix A.6). Trained with signal labels, a classifier on the same variables selects about as much as the regional score at , and one on the latent coordinates selects slightly more. The regional score, which uses no signal showers, thus comes close to these supervised references.
4.2 Why the summed scores miss the signal
The dilution can be seen in the separation between signal showers at 1.00 m and photons, measured for each score as the difference of the medians in units of the standard deviation of the photons in the energy bin of the signal. This separation is 33 for the sum over the innermost layer-1 region, 5 for the global latent norm, and 1 for the image likelihood. At the thresholds lie a few standard deviations above the photon median, so the sum over the innermost layer-1 region selects almost all of the signal, the global latent norm about half, and the image likelihood almost none. Figure 5 shows, for the global latent norm and the regional score, the fractions of photons and signal showers selected as a function of the conformal threshold. At both select about of the photons. For most signal showers the maximum of the regional score is attained in the innermost layer-1 region (Fig. 5(c)).
The global latent norm compares the excess in four coordinates with the fluctuations of all 504, the known weakness of sum-type tests against sparse signals [56]. The image likelihood adds the log-Jacobian term, whose spread among photons is about ten times that of
Submission
(Appendix A.2). Almost all of this spread comes from the log-Jacobian contributions of the layer-0 coordinates, which the signal at 1.00 m changes only slightly.
4.3 Dependence on mass and decay position
Figure 6 shows the signal efficiency for all 28 combinations of mass and decay position. The efficiency of the regional score is set mainly by the separation of the two photon axes at the back of layer 1, which decreases with decreasing mass and with increasing . It is low when the axes are less than about a centimeter apart, which is the case at every point with and for the decays of 0.5 GeV particles at or behind the front face. It is high at every decay position for and for the upstream decays of 0.5 GeV particles, whose axes are only about half a layer-1 voxel apart at the back of layer 1, so the score does not need two resolved showers. For , the photon axes are at most a few millimeters apart, finer than the layer-0 strips, and no score selects upstream or front-face decays more than about six times as often as photons.
Reference [14] reports the largest significance improvement over all thresholds rather than at a fixed , and the likelihood score in Fig. 6(c) shows qualitatively the same dependence on mass and decay position as Fig. 3 of that reference. Its efficiency does not follow the separation, and it misses the upstream decays of 0.5 GeV particles, which the regional score selects. For particles that decay at least 8 cm inside the calorimeter, it selects a third or more of the signal, more than the global latent norm. These decays occur near the back of layer 0 or behind it, so layer 0 receives little energy, and the signal moves the Flow-I term by several standard deviations of the photons, more for deeper decays (Appendix A.2). The regional score, built from Flow-II alone, does not use this information. Across the grid, the regional likelihood selects nearly the same fraction of the signal as the regional score, slightly more for the two deepest 5 GeV decays and slightly less for 0.5 GeV particles decaying at 0.66 m (Appendix A.2).
5 Conclusions
The global likelihood of a generative model can miss a signal that changes only a small part of the detector. For a neutral particle of mass 5 GeV that decays to two photons at or just behind the calorimeter front face, the CaloFlow likelihood selects less than 5% of the signal at a background efficiency of . A regional score built from the latent coordinates of the same flow, without retraining, selects almost all of it at the same background efficiency.
The signal produces a large response in a few latent coordinates at the impact position. The likelihood sums this response with the contributions of all other coordinates. The sum dilutes it, so that even the global latent norm selects only about half of the signal, and the fluctuations of the layer-0 log-Jacobian contributions hide it almost completely. Summed over the same regions, the per-coordinate terms of the image likelihood also recover the signal.
For anomaly detection with generative models, a likelihood that misses a signal is thus not evidence that the model is insensitive to it, and localized versions of the likelihood are worth including when anomaly scores are compared. Without signal labels, the regional score selects about as much of the front-face signal as classifiers trained on these samples (Sec. 4.1). A flow trained as a fast calorimeter simulator can be used in this way as long as its latent coordinates can be assigned to voxels, and other flow-based calorimeter simulators [57–59] can be tested in the same way. The anomaly map shows where a signal shower departs from the background, on average and for a single shower (Fig. 4), and the region that attains the maximum of the regional score indicates this location for each shower (Fig. 5(c)). Because the threshold is set on background showers, the background efficiency stays at or below the
Submission

Figure 6: Signal efficiency at as a function of the mass and the decay position for (a) the regional score, (b) the global latent norm, and (c) the likelihood score , the baseline of Ref. [14]. Each entry is the mean over the five trained flows. Panels (a) and (b) come from a separate evaluation of the flows compared to the one in Table 1, and at the front-face points, the two agree within the spread over the flows. The color scale is logarithmic and saturates at , the background efficiency, so the darkest entries are not separated from photons. The calorimeter front face is at m.
chosen level even though the trained flow departs from its Gaussian reference far in the tail. In data, the threshold would be set in the same way on background showers from a control sample. If that sample represents the background of the search, mismodeling by a flow trained on simulation affects the signal efficiency but not the background efficiency.
Every shower in the benchmark enters the calorimeter at the same point, an inherent limitation of the dataset, so the flows are trained and the regions defined at a single impact position. Photon showers moved by two layer-1 voxels are almost all selected as anomalous, and smaller displacements cannot be emulated reliably by moving the voxel images, because the interpolation this requires changes the response of the flow by itself (Appendix A.2). In a real detector the impact position varies, so the flow would have to be conditioned on it and the regions centered on its value reconstructed for each shower, which requires showers simulated at different impact positions. The benchmark also uses a single signal energy and a simplified three-layer detector without electronic noise, and contains only single photons as background. Since the regional score responds to small local differences, it also needs a flow that describes the core of the background showers well. The regional score ignores the layer energies modeled by Flow-I, which change when the particle decays inside the calorimeter. For particles with GeV decaying at 1.08 m and 1.16 m, it selects almost none of the signal and the likelihood score a few percent, so a combination with the Flow-I term could be tested there. Particles light enough that the two photons are closer than the smallest voxels, here those with GeV decaying upstream or at the front face, are barely distinguished from photons
Submission
by any of the scores.
Acknowledgements
This work used resources of the National Research Platform (NRP) at the University of California San Diego, which is supported in part by National Science Foundation (NSF) awards CNS-1730158, ACI-1540112, ACI-1541349, OAC-1826967, OAC-2112167, CNS-2100237, and CNS-2120019.
Author contributions Following the Contributor Roles Taxonomy (CRediT), R. M. contributed to Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Visualization, Writing (Original Draft), and Writing (Review & Editing); J. W. contributed to Supervision and Writing (Review & Editing); and J. D. contributed to Writing (Review & Editing), Supervision, and Funding acquisition. The authors acknowledge the use of generative AI writing assistance and coding assistance, and take full responsibility for the content of the publication.
Funding information This work was supported by the U.S. Department of Energy (DOE), Office of Science, Office of High Energy Physics under Award Number DE-SC0009919. J. W. was also supported by a Western Advanced Training for Computational High Energy Physics (WATCHEP) fellowship sponsored by the DOE, Office of Science, Office of High Energy Physics under Award Number DE-SC0023527.
Code and data availability The photon and signal samples are publicly available on Zenodo [48], and the analysis code is available at https://github.com/raunavm/caloflow_ad and archived on Zenodo [60].
A Implementation details
A.1 Detector, samples, and preprocessing
The front face of the calorimeter, a 480 mm × 480 mm square, is located 1.00 m from the origin, and the layer boundaries behind it lie at 1.09 m and 1.437 m. Layers 0, 1, and 2 are divided into 3 × 96, 12 × 12, and 12 × 6 voxels. In the two Cartesian transverse directions, labeled and in Ref. [14], the voxel sizes are (160, 5) mm, (40, 40) mm, and (40, 80) mm. The benchmark also contains decays at 1.32 m, 1.40 m, and 1.44 m, deeper in the calorimeter, which we exclude because the median reconstructed energy of their GeV samples is at most 59% of . At the minimum opening angle, the two photon axes of a 5 GeV particle decaying at 1.00 m are 18 mm apart at the entrance of layer 1 and 88 mm apart at its exit, and for the two upstream positions they are 153 mm and 86 mm apart at the entrance of layer 1.
Since the incident energy is unknown in an application, the public code of Ref. [14] reconstructs it from the layer energies as
where the constant is that of the code. Reference [14] describes the factor 1/0.937 as the mean ratio of incident to deposited energy in the training sample, and in the second photon sample the mean ratio of the summed voxel energy to the incident energy is also 0.937. The
Submission
flows are conditioned on the true incident energy during training and on during evaluation. Dividing each voxel energy by the total energy of its layer gives the normalized image . As in Ref. [14], Flow-II models the logit of the normalized voxel energies after the mapping with , and we use the architecture and training settings of the public code. The first photon sample is split into 70% for training and 30% for validation, and each signal sample contains showers. As in that code, noise drawn uniformly between 0 and 1 keV is added to every voxel in training and evaluation, similar to the dequantization of discrete data [61]. The likelihood score is evaluated in the preprocessed coordinates on which the flows are trained, and Flow-I uses the logarithmic preprocessing of Ref. [14] (Appendix A.4).
A.2 Latent assignment, regions, and further checks
The fixed permutations of the public architecture act within blocks of 288, 144, and 72 coordinates, one block per layer, so each latent coordinate can be followed to one voxel. For the four latent coordinates assigned to the central layer-1 voxels, 86% of the summed squared derivatives with respect to the voxel inputs of Flow-II, averaged over 512 photons of the second sample, come from those four voxels. For the next two square rings of layer 1 the fractions are 34% and 50%.
For a voxel whose center is offset from the impact position by , where are the voxel sizes of its layer, the outer edge of the voxel lies at the radial coordinate
The offsets are half-integers, except in layer 0, where the impact position lies at a voxel center. We place a region boundary at every value of that coincides with a voxel edge in both directions, at 80 mm and 240 mm in layer 0, at multiples of 40 mm in layer 1, and at multiples of 80 mm in layer 2. This divides layers 0, 1, and 2 into two, six, and three regions, and the three complete layers bring the total to 14.
For the test photons, averaged over the five flows, the mean of lies between and 0.11 and its standard deviation between 0.97 and 1.09 in every region, close to the values of 0 and 1 expected under the model. Far in the tail the trained flow departs from this reference. The fraction of photons above the quantile at tail probability is 1.5 to 5.6 times the expected value.
For each of five random permutations of the assignment of all 504 latent coordinates to voxels, the efficiency of the regional score decreases at all 14 points of Eq. (1) with GeV, by a median factor of 2.5 and by factors of 1.8 and 1.6 for the two front-face samples. Without any assignment, the sum of the one, four, or eight largest squared latent coordinates selects at most 86% and 87% of the front-face samples.
Among the test photons in the energy bin of the front-face samples, the log-Jacobian term has a standard deviation of 153 nats, compared with 15.8 nats for . The log-Jacobian contributions of the 288 layer-0 coordinates together have a standard deviation of 150 nats, compared with 0.4 nats for the innermost layer-1 region, and the signal at 1.00 m shifts their sum by 16 nats on average over the five flows. For GeV, the signal shifts the Flow-I term, averaged over the five flows, by 2.2, 5.9, and 11.6 of its standard deviations among photons at m, 1.16 m, and 1.24 m.
To compare the regional likelihood with the regional score over the 28 points of Eq. (1), we evaluate the five flows a second time, with newly drawn dequantization noise, and compute both scores from the same evaluation. The regional score reproduces Fig. 6 to within 0.02 at every point. In this evaluation the regional likelihood and the regional score differ in signal efficiency by at most 0.02, except for GeV at 1.16 m and 1.24 m, where the regional
Submission
likelihood selects 0.97 and 0.96 against 0.94 and 0.91, and for GeV at 0.66 m, where it selects 0.63 against 0.67.
To test a displaced impact position, we move 20 000 of the test photon showers by 80 mm along . This is a whole number of voxels in every layer, 16, 2, and 1 in layers 0, 1, and 2, so the showers are moved exactly, apart from the energy that leaves the calorimeter at its edge. With the threshold set on unshifted photons, the regional score selects more than 99.9% of the moved photons for each of the five flows, so the trained flows and regions apply only at the impact position of the benchmark. Smaller displacements are not a whole number of voxels in every layer, and moving a shower then requires interpolating between neighboring voxels, which smooths the image. The interpolation alone changes the response of the flow. Moving the showers by 2.5 mm and back, with no net displacement, already raises the fraction selected to between 46% and 61%, depending on the flow, so smaller displacements cannot be studied in this way.
A.3 Calibration
The design, calibration, and test samples contain 20 000, 30 000, and 30 000 photons, and the remaining 20 000 photons of the second sample are not used by the conformal scores. Together with the design sample, they train the photon-identification classifier of Appendix A.6. The five quantile bins of defined on the design sample have inner edges at 20.5, 40.3, 60.2, and 80.0 GeV, and each bin holds about 6000 calibration photons. The front-face samples fall in the third bin. Because the calibration sample is finite, the conformal -values are discrete with steps of , and the largest attainable level that does not exceed ranges from to across the bins. Over 40 random partitions into calibration and test samples, the threshold on the regional score selects a fraction of the test photons, the mean and standard deviation over the partitions and the five flows. A parametric threshold with a Bonferroni correction for the 14 regions selects six times the nominal fraction.
A.4 Flow-I preprocessing
With the default settings of the public implementation of Ref. [14], Flow-I is trained on the logit transformation of the layer energies scaled to the unit interval, as in the original CaloFlow [15]. The likelihood evaluation of that code instead always applies the logarithmic transformation , which Ref. [14] describes for Flow-I with an offset of 1 keV.¹ With the default settings, Flow-I is therefore evaluated in a different representation from the one on which it was trained. We trained Flow-I with the logarithmic transformation and left the architecture, optimizer, and training schedule unchanged.
A.5 Decomposition of the image likelihood
Flow-II consists of eight masked autoregressive blocks [62, 63]. Each block transforms every coordinate with a monotonic rational-quadratic spline [64] whose parameters depend on the preceding coordinates, and fixed permutations connect consecutive blocks. The Jacobian of a block is triangular, so its log-determinant is a sum of one term per coordinate. Tracking a coordinate through the permutations assigns its eight terms to the latent coordinate in which
¹In run.py of https://github.com/Ian-Pang/AD_with_CF at commit 6aec256, Flow-I training applies the logarithmic transformation only with the non-default flag --log_preprocess, and the likelihood evaluation always applies it.
Submission
it ends. With denoting their sum, the image likelihood is
The extracted reproduce the log-determinant returned by the unmodified flow to within nats, and the tracked coordinate order reproduces the assignment of Sec. 3.1. For each region , the regional likelihood of Table 1 is built from . We standardize each regional sum with the mean and standard deviation of the design photons in the same energy bin, take the maximum over the regions, and apply the calibration of Sec. 3.2.
A.6 Supervised reference classifiers
The 13 photon-identification variables are computed from the voxel energies. They are the energy fractions in layers 0 and 2; the strip variables , , , , and of ATLAS [65], computed from the layer-0 profile summed over the three rows; the ATLAS ratios and and width in layer 1, with windows of 2 and 4 voxels in place of 3 and 7 cells, centered on the impact position; and and of CMS [66], together with the analogous width . Without labels, we score each variable alone with a two-sided conformal -value and combine all 13, standardized in each energy bin on the design photons, in a Mahalanobis distance calibrated like the regional score. This distance is the most efficient of these shower-shape scores and selects 47% and 22% of the two front-face samples. With signal labels, we train a single gradient-boosted tree classifier [67] on the 13 variables of the 40000 photons used neither for calibration nor for testing and of one half of each front-face sample. It is calibrated like the other scores and evaluated on the other half of each sample. Over five trainings it selects and of the two samples, compared with 96% and 97% for the regional score.
The classifier on the latent coordinates is a multilayer perceptron with hidden layers of 256, 128, and 64 units, trained separately for each flow and each front-face sample. Half of the photons of the second sample, drawn from all of its subsets, and half of the signal showers are used for training, and the other halves for evaluation, with the threshold set so that a fraction of the evaluation photons is selected. Averaged over the five flows and eight random splits, it selects 99% of both front-face samples.
References
[1] G. Kasieczka et al., The LHC Olympics 2020: a community challenge for anomaly detection in high energy physics, Rept. Prog. Phys. 84, 124201 (2021), doi:10.1088/1361-6633/ac36b9, arXiv:2101.08320.
[2] G. Karagiorgi, G. Kasieczka, S. Kravitz, B. Nachman and D. Shih, Machine learning in the search for new fundamental physics, Nature Rev. Phys. 4, 399 (2022), doi:10.1038/s42254-022-00455-1, arXiv:2112.03769.
[3] V. Belis, P. Odagiu and T. K. Aarrestad, Machine learning for anomaly detection in particle physics, Rev. Phys. 12, 100091 (2024), doi:10.1016/j.revip.2024.100091, arXiv:2312.14190.
[4] M. Farina, Y. Nakai and D. Shih, Searching for new physics with deep autoencoders, Phys. Rev. D 101, 075021 (2020), doi:10.1103/PhysRevD.101.075021, arXiv:1808.08992.
Submission
[5] T. Heimel, G. Kasieczka, T. Plehn and J. M. Thompson, QCD or what?, SciPost Phys. 6, 030 (2019), doi:10.21468/SciPostPhys.6.3.030, arXiv:1808.08979.
[6] J. H. Collins, K. Howe and B. Nachman, Anomaly detection for resonant new physics with machine learning, Phys. Rev. Lett. 121, 241803 (2018), doi:10.1103/PhysRevLett.121.241803, arXiv:1805.02664.
[7] B. Nachman and D. Shih, Anomaly detection with density estimation, Phys. Rev. D 101, 075042 (2020), doi:10.1103/PhysRevD.101.075042, arXiv:2001.04990.
[8] V. Mikuni and B. Nachman, High-dimensional and permutation invariant anomaly detection, SciPost Phys. 16, 062 (2024), doi:10.21468/SciPostPhys.16.3.062, arXiv:2306.03933.
[9] F. Vaselli et al., It's not a FAD: first demonstration of flows for unsupervised anomaly detection at 40 MHz for use at the Large Hadron Collider, Mach. Learn.: Sci. Technol. 7, 025052 (2026), doi:10.1088/2632-2153/ae51dd, arXiv:2508.11594.
[10] C. Krause et al., CaloChallenge 2022: a community challenge for fast calorimeter simulation, Rept. Prog. Phys. 88, 116201 (2025), doi:10.1088/1361-6633/ae1304, arXiv:2410.21611.
[11] B. Hashemi and C. Krause, Deep generative models for detector signature simulation: a taxonomic review, Rev. Phys. 12, 100092 (2024), doi:10.1016/j.revip.2024.100092, arXiv:2312.09597.
[12] G. Papamakarios, E. Nalisnick, D. J. Rezende, S. Mohamed and B. Lakshminarayanan, Normalizing flows for probabilistic modeling and inference, J. Mach. Learn. Res. 22(57), 1 (2021), arXiv:1912.02762.
[13] H. Du, C. Krause, V. Mikuni, B. Nachman, I. Pang and D. Shih, Unifying simulation and inference with normalizing flows, Phys. Rev. D 111(7), 076004 (2025), doi:10.1103/PhysRevD.111.076004, arXiv:2404.18992.
[14] C. Krause, B. Nachman, I. Pang, D. Shih and Y. Zhu, Anomaly detection with flow-based fast calorimeter simulators, Phys. Rev. D 110, 035036 (2024), doi:10.1103/PhysRevD.110.035036, arXiv:2312.11618.
[15] C. Krause and D. Shih, Fast and accurate simulations of calorimeter showers with normalizing flows, Phys. Rev. D 107, 113003 (2023), doi:10.1103/PhysRevD.107.113003, arXiv:2106.05285.
[16] C. Krause and D. Shih, Accelerating accurate simulations of calorimeter showers with normalizing flows and probability density distillation, Phys. Rev. D 107, 113004 (2023), doi:10.1103/PhysRevD.107.113004, arXiv:2110.11377.
[17] ATLAS Collaboration, Search in diphoton and dielectron final states for displaced production of Higgs or Z bosons with the ATLAS detector in TeV pp collisions, Phys. Rev. D 108, 012012 (2023), doi:10.1103/PhysRevD.108.012012, arXiv:2304.12885.
[18] ATLAS Collaboration, Search for short- and long-lived axion-like particles in decays with the ATLAS experiment at the LHC, Eur. Phys. J. C 84, 742 (2024), doi:10.1140/epjc/s10052-024-12979-0, arXiv:2312.03306.
Submission
[19] ATLAS Collaboration, Search for neutral long-lived particles that decay into displaced jets in the ATLAS calorimeter in association with leptons or jets using pp collisions at TeV, JHEP 11, 036 (2024), doi:10.1007/JHEP11(2024)036, arXiv:2407.09183.
[20] CMS Collaboration, Search for exotic Higgs boson decays with events containing two merged diphotons in proton-proton collisions at TeV, Phys. Rev. Lett. 131, 101801 (2023), doi:10.1103/PhysRevLett.131.101801, arXiv:2209.06197.
[21] E. Gross and O. Vitells, Trial factors for the look elsewhere effect in high energy physics, Eur. Phys. J. C 70, 525 (2010), doi:10.1140/epjc/s10052-010-1470-8, arXiv:1005.1891.
[22] M. Hein, B. Nachman and D. Shih, Look everywhere effects in anomaly detection, arXiv e-prints (2025), arXiv:2512.13787.
[23] E. Nalisnick, A. Matsukawa, Y. W. Teh, D. Gorur and B. Lakshminarayanan, Do deep generative models know what they don't know?, In International Conference on Learning Representations (2019), arXiv:1810.09136.
[24] P. Kirichenko, P. Izmailov and A. G. Wilson, Why normalizing flows fail to detect out-of-distribution data, In Advances in Neural Information Processing Systems, vol. 33 (2020), arXiv:2006.08545.
[25] J. Serrà, D. Álvarez, V. Gómez, O. Slizovskaia, J. F. Núñez and J. Luque, Input complexity and out-of-distribution detection with likelihood-based generative models, In International Conference on Learning Representations (2020), arXiv:1909.11480.
[26] J. Ren, P. J. Liu, E. Fertig, J. Snoek, R. Poplin, M. DePristo, J. Dillon and B. Lakshminarayanan, Likelihood ratios for out-of-distribution detection, In Advances in Neural Information Processing Systems, vol. 32 (2019), arXiv:1906.02845.
[27] R. T. Schirrmeister, Y. Zhou, T. Ball and D. Zhang, Understanding anomaly detection with deep invertible networks through hierarchies of distributions and features, In Advances in Neural Information Processing Systems, vol. 33 (2020), arXiv:2006.10848.
[28] C. Le Lan and L. Dinh, Perfect density models cannot guarantee anomaly detection, Entropy 23(12), 1690 (2021), doi:10.3390/e23121690, arXiv:2012.03808.
[29] G. Kasieczka, R. Mastandrea, V. Mikuni, B. Nachman, M. Pettee and D. Shih, Anomaly detection under coordinate transformations, Phys. Rev. D 107, 015009 (2023), doi:10.1103/PhysRevD.107.015009, arXiv:2209.06225.
[30] T. Buss, B. M. Dillon, T. Finke, M. Krämer, A. Morandini, A. Mück, I. Oleksiyuk and T. Plehn, What's anomalous in LHC jets?, SciPost Phys. 15, 168 (2023), doi:10.21468/SciPostPhys.15.4.168, arXiv:2202.00686.
[31] T. Finke, M. Krämer, A. Morandini, A. Mück and I. Oleksiyuk, Autoencoders for unsupervised anomaly detection in high energy physics, JHEP 06, 161 (2021), doi:10.1007/JHEP06(2021)161, arXiv:2104.09051.
[32] K. Fraser, S. Homiller, R. K. Mishra, B. Ostdiek and M. D. Schwartz, Challenges for unsupervised anomaly detection in particle physics, JHEP 03, 066 (2022), doi:10.1007/JHEP03(2022)066, arXiv:2110.06948.
[33] E. Nalisnick, A. Matsukawa, Y. W. Teh and B. Lakshminarayanan, Detecting out-of-distribution inputs to deep generative models using typicality, arXiv e-prints (2019), arXiv:1906.02994.
Submission
[34] H. Choi, E. Jang and A. A. Alemi, WAIC, but why? Generative ensembles for robust anomaly detection, arXiv e-prints (2018), arXiv:1810.01392.
[35] D. Jiang, S. Sun and Y. Yu, Revisiting flow generative models for out-of-distribution detection, In International Conference on Learning Representations, https://openreview.net/forum?id=6y2KBh-0Fd9 (2022).
[36] P. Bomatter, J. Geary and H. Gouk, The signal in the noise: OOD detection through goodness-of-fit testing in factorised latent spaces, arXiv e-prints (2026), arXiv:2605.22496.
[37] T. Defard, A. Setkov, A. Loesch and R. Audigier, PaDiM: a patch distribution modeling framework for anomaly detection and localization, In Pattern Recognition. ICPR International Workshops and Challenges, vol. 12664 of Lecture Notes in Computer Science, pp. 475–489, doi:10.1007/978-3-030-68799-1_35 (2021), arXiv:2011.08785.
[38] K. Roth, L. Pemula, J. Zepeda, B. Schölkopf, T. Brox and P. Gehler, Towards total recall in industrial anomaly detection, In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14298–14308, doi:10.1109/CVPR52688.2022.01392 (2022), arXiv:2106.08265.
[39] D. Gudovskiy, S. Ishizaka and K. Kozuka, CFLOW-AD: real-time unsupervised anomaly detection with localization via conditional normalizing flows, In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1819–1828, doi:10.1109/WACV51458.2022.00188 (2022), arXiv:2107.12571.
[40] M. Rudolph, T. Wehrbein, B. Rosenhahn and B. Wandt, Fully convolutional cross-scale-flows for image-based defect detection, In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1829–1838, doi:10.1109/WACV51458.2022.00189 (2022), arXiv:2110.02855.
[41] Y. Zhou, X. Xu, J. Song, F. Shen and H. T. Shen, MSFlow: multiscale flow-based framework for unsupervised anomaly detection, IEEE Trans. Neural Netw. Learn. Syst. 36(2), 2437 (2025), doi:10.1109/TNNLS.2023.3344118, arXiv:2308.15300.
[42] M. Tailanian, Á. Pardo and P. Musé, U-Flow: a U-shaped normalizing flow for anomaly detection with unsupervised threshold, J. Math. Imaging Vis. 66(4), 678 (2024), doi:10.1007/s10851-024-01193-y, arXiv:2211.12353.
[43] V. Vovk, A. Gammerman and G. Shafer, Algorithmic Learning in a Random World, Springer, doi:10.1007/b106715 (2005).
[44] S. Bates, E. Candès, L. Lei, Y. Romano and M. Sesia, Testing for outliers with conformal p-values, Ann. Stat. 51(1), 149 (2023), doi:10.1214/22-AOS2244, arXiv:2104.08279.
[45] V. Vovk, Conditional validity of inductive conformal predictors, In Proceedings of the Asian Conference on Machine Learning, vol. 25 of PMLR, pp. 475–490 (2012), arXiv:1209.2673.
[46] J. Y. Araz and M. Spannowsky, Another fit bites the dust: conformal prediction as a calibration standard for machine learning in high-energy physics, arXiv e-prints (2025), arXiv:2512.17048.
[47] J. Y. Araz and M. Spannowsky, Conformal calibration and look-elsewhere effect in anomaly detection for new-physics searches, arXiv e-prints (2026), arXiv:2606.13780.
[48] C. Krause, B. Nachman, I. Pang, D. Shih and Y. Zhu, Electromagnetic sampling calorimeter shower images, Zenodo, doi:10.5281/zenodo.10393540 (2023).
Submission
[49] S. Agostinelli et al., Geant4—a simulation toolkit, Nucl. Instrum. Meth. A 506, 250 (2003), doi:10.1016/S0168-9002(03)01368-8.
[50] M. Paganini, L. de Oliveira and B. Nachman, Accelerating science with generative adversarial networks: an application to 3D particle showers in multilayer calorimeters, Phys. Rev. Lett. 120, 042003 (2018), doi:10.1103/PhysRevLett.120.042003, arXiv:1705.02355.
[51] M. Paganini, L. de Oliveira and B. Nachman, CaloGAN: Simulating 3D high energy particle showers in multilayer electromagnetic calorimeters with generative adversarial networks, Phys. Rev. D 97, 014021 (2018), doi:10.1103/PhysRevD.97.014021, arXiv:1712.10321.
[52] M. Kulldorff, A spatial scan statistic, Commun. Stat. Theory Methods 26(6), 1481 (1997), doi:10.1080/03610929708831995.
[53] E. Arias-Castro, R. M. Castro, E. Tánczos and M. Wang, Distribution-free detection of structured anomalies: Permutation and rank-based scans, J. Am. Stat. Assoc. 113(522), 789 (2018), doi:10.1080/01621459.2017.1286240, arXiv:1508.03002.
[54] P. H. Westfall and S. S. Young, Resampling-Based Multiple Testing: Examples and Methods for p-Value Adjustment, Wiley, New York (1993).
[55] A. Timans, C.-N. Straehle, K. Sakmann, C. A. Naesseth and E. Nalisnick, Max-Rank: efficient multiple testing for conformal prediction, In Proceedings of the 28th International Conference on Artificial Intelligence and Statistics, vol. 258 of PMLR, pp. 3898–3906 (2025), arXiv:2311.10900.
[56] D. Donoho and J. Jin, Higher criticism for detecting sparse heterogeneous mixtures, Ann. Stat. 32(3), 962 (2004), doi:10.1214/009053604000000265.
[57] M. R. Buckley, C. Krause, I. Pang and D. Shih, Inductive simulation of calorimeter showers with normalizing flows, Phys. Rev. D 109, 033006 (2024), doi:10.1103/PhysRevD.109.033006, arXiv:2305.11934.
[58] F. Ernst, L. Favaro, C. Krause, T. Plehn and D. Shih, Normalizing flows for high-dimensional detector simulations, SciPost Phys. 18, 081 (2025), doi:10.21468/SciPostPhys.18.3.081, arXiv:2312.09290.
[59] S. Diefenbacher, E. Eren, F. Gaede, G. Kasieczka, C. Krause, I. Shekhzadeh and D. Shih, L2LFlows: generating high-fidelity 3D calorimeter images, JINST 18(10), P10017 (2023), doi:10.1088/1748-0221/18/10/P10017, arXiv:2302.11594.
[60] R. Mendiratta, J. Weitz and J. Duarte, Code for “Localized anomaly detection with a calorimeter normalizing flow”, version 1.0.0, Zenodo, doi:10.5281/zenodo.23720786 (2026).
[61] L. Theis, A. van den Oord and M. Bethge, A note on the evaluation of generative models, In International Conference on Learning Representations (2016), arXiv:1511.01844.
[62] G. Papamakarios, T. Pavlakou and I. Murray, Masked autoregressive flow for density estimation, In Advances in Neural Information Processing Systems, vol. 30 (2017), arXiv:1705.07057.
[63] M. Germain, K. Gregor, I. Murray and H. Larochelle, MADE: masked autoencoder for distribution estimation, In Proceedings of the 32nd International Conference on Machine Learning, vol. 37 of PMLR, pp. 881–889 (2015), arXiv:1502.03509.
Submission
[64] C. Durkan, A. Bekasov, I. Murray and G. Papamakarios, Neural spline flows, In Advances in Neural Information Processing Systems, vol. 32 (2019), arXiv:1906.04032.
[65] ATLAS Collaboration, Measurement of the photon identification efficiencies with the ATLAS detector using LHC Run 2 data collected in 2015 and 2016, Eur. Phys. J. C 79, 205 (2019), doi:10.1140/epjc/s10052-019-6650-6, arXiv:1810.05087.
[66] CMS Collaboration, Performance of photon reconstruction and identification with the CMS detector in proton-proton collisions at TeV, JINST 10, P08010 (2015), doi:10.1088/1748-0221/10/08/P08010, arXiv:1502.02702.
[67] F. Pedregosa et al., Scikit-learn: machine learning in Python, J. Mach. Learn. Res. 12, 2825 (2011), arXiv:1201.0490.