Spending Flow Compute Where the Cut Is: Rare-Region Background Estimation for Resonant Anomaly Searches

Collider searches for unknown particles increasingly use a learned "background template". A normalizing flow, which is a neural density model that maps data to a Gaussian through invertible layers and so gives exact likelihoods, is trained on events next to the signal mass window. It is then asked how many ordinary background events should survive a very tight anomaly cut inside that window. The answer is usually computed by brute force: draw many synthetic events from the flow, run the anomaly classifier on them, and count how many pass. At the extreme working points where these methods now claim discoveries, the cut keeps only one background event in $10^3$ to $10^5$. The count therefore rests on a tiny, poorly modeled corner of the flow. Brute-force sampling spends almost all of its compute on events the cut throws away, and its sampling noise is hard to separate from genuine flow errors in that corner.

This note proposes to treat the post-cut background count as a rare-event integral and to estimate it the way rare-event engineers do. A second, cheap proposal flow is trained to concentrate on the cut-passing region through a nested sequence of tightening classifier thresholds. Its samples are reweighted by the background flow's exact density. Because the estimator returns a variance, the uncertainty budget can be split into Monte Carlo noise and model error in the tail. Only when model error dominates do we add a small number of frozen-base "tail refinement" layers, fit on sideband events that pass the same cut. The claim is that this gives background estimates at $\epsilon_B$ down to $10^{-5}$ with calibrated uncertainties, and uses orders of magnitude fewer flow and classifier evaluations per mass window than brute-force templating.

Core Claim

The computational cost of normalizing flows matters in signal-to-background discrimination, but it is not the cost per sample that the flow-compression literature targets. What matters is the cost of reaching a fixed relative precision on a rare-region integral. Writing $p_\theta(x \mid m)$ for the background flow's density over features $x$ at mass $m$, $s(x)$ for the anomaly score, $t$ for the cut threshold, and $N_{SR}$ for the expected background count in the signal region before the cut, the quantity of interest is the selected background count. Our estimator for it is

$$\hat N_{bkg} = N_{SR}\,\frac{1}{n}\sum_{i=1}^{n} \frac{p_\theta(x_i \mid m_i)}{q_\phi(x_i \mid m_i)}\,\mathbf{1}[s(x_i) > t], \qquad x_i \sim q_\phi,$$

where $q_\phi$ is a proposal flow and $n$ is the number of proposal samples. Brute-force templating is the special case $q_\phi = p_\theta$. The fraction of its samples that pass the cut is binomial with success rate about $\epsilon_B$, so it needs roughly $n \approx 1/(\epsilon_B r^2)$ samples to reach relative precision $r$. At $\epsilon_B = 10^{-4}$ and $r = 1\%$ that is about $10^8$ flow samples and classifier calls per window, multiplied by every window in a mass scan and every classifier in an ensemble. A proposal concentrated on $\{s > t\}$ removes the $1/\epsilon_B$ factor, up to the mismatch between $q_\phi$ and the restricted target. The estimator also needs only density evaluations of $p_\theta$, not samples. This changes which flow architectures are cheap: autoregressive flows evaluate density in one pass but sample sequentially, as documented by Latent Bayesian Optimization via Autoregressive Normalizing Flows.

Relation to Prior Work

Three physics papers motivate the problem by showing that flow-based background templates now drive discovery-level claims. Isolating Unisolated Upsilons with Anomaly Detection in CMS Open Data trains a conditional flow on dimuon sidebands, samples a background template into the signal window, and lifts the significance of anti-isolated Upsilons from 1.6σ to 6.4σ, with a same-sign control showing no fake peak. Accurate and robust methods for direct background estimation in resonant anomaly detection goes further and reads the expected post-cut count directly off the generative template rather than fitting a curve. It reports over 5σ at $\epsilon_B = 10^{-3}$ and $10^{-4}$ on the LHC Olympics R&D set (8σ for an idealized detector). It introduces a systematic shift parameter $\delta_{sys}$ to calibrate template bias. The same paper explicitly warns that flow density degrades in the tails. Unsupervised in-distribution anomaly detection of new physics through conditional density estimation uses an iterative slicing flow and a density-ratio score to find the 834-event Black Box 1 resonance. None of these profile cost, and none separate sampling noise from tail mismodeling in the template. Our proposal keeps their pipeline and replaces the counting step.

The method comes from rare-event engineering. Rare Event Probability Learning by Normalizing Flows (NOFIS) estimates failure probabilities near $10^{-6}$ by training a flow through nested, progressively rarer subsets, freezing earlier layers as it goes. On a 62-dimensional ResNet-18 reliability task it reaches an error of 0.61 with 18,000 samples. We reuse its nested-subset and layer-freezing schedule, but with a convenient twist: in our setting the nested subsets are defined by classifier thresholds, which we already have, so NOFIS's open problem of choosing subset boundaries becomes trivial. Rare event modeling with self-regularized normalizing flows: what can we learn from a single failure? supplies a constraint rather than a method. Its calibrated flow helps under extreme scarcity only when rare events share structure with nominal data, and it is computationally heavy. Our tail refinement is deliberately lighter: a few layers on a frozen base.

Two papers constrain the design. Distilling Normalizing Flows compresses GLOW-style flows (per-batch sampling 3.89 ms to 2.45 ms on CIFAR-10, an 8x smaller student on CelebA). This is the obvious "make the physics flow cheaper" move. However, it reduces cost uniformly over the density, and Learnable Explicit Density for Continuous Latent Space and Variational Inference argues that cutting capacity costs accuracy, which should hurt most in exactly the tail we care about. The Dark Machines Anomaly Score Challenge found that a simple autoencoder transferred to a blinded dataset more robustly than large flow hybrids. This warns us against solving tail problems by adding capacity, and it is why tail refinement is gated and small.

Research Program

The first stage builds the rare-region estimator on top of an unchanged CATHODE pipeline. For each signal window we take the trained background flow and the trained classifier ensemble. We then fit a proposal flow $q_\phi$ in stages. The first stage is $p_\theta$ itself. Each later stage adds a few layers on top of the frozen earlier ones and is trained on importance-weighted samples passing threshold $t_k$, with $t_1 < t_2 < \dots < t$ chosen so that each stage keeps about a tenth of the previous stage's mass. The final estimate uses the display equation above. Its variance comes from the empirical variance of the weights, and an effective-sample-size diagnostic flags when the proposal has missed part of the region.

The second stage is an error decomposition. With Monte Carlo variance now cheap to drive down, any remaining mismatch between the template and truth (on simulation) or between template and data in sidebands (on real data) can be attributed to $p_\theta$. We apply the same cut in the sidebands, where no signal is expected. This is the data-driven check of Accurate and robust methods for direct background estimation in resonant anomaly detection, but here it is computed at precisions that brute force cannot afford at $\epsilon_B \le 10^{-4}$. Tail refinement is triggered only if sideband model error exceeds Monte Carlo error. In that case a small stack of layers is trained on the frozen background flow using sideband events that pass progressively tighter cuts, conditioned on mass as before, and then interpolated into the window. We will report how much of $\delta_{sys}$ in the existing method is actually template sampling noise. That is a useful finding whichever way it comes out.

The third stage is a cost accounting that the physics papers lack. It reports wall-clock time and the number of flow-density, flow-sample, and classifier calls per full mass scan at fixed target precision, for coupling and autoregressive flows.

Baselines

The naive reference point is a parametric bump-hunt fit to the post-cut mass spectrum. Das et al. show it breaks down at $\epsilon_B = 10^{-3}$ to $10^{-4}$ for lack of events, and we include it to reproduce that failure on our splits.

The strongest existing method is CATHODE with direct background estimation, as in Accurate and robust methods for direct background estimation in resonant anomaly detection. Its reported result is over 5σ discovery significance at $\epsilon_B = 10^{-3}$ and $10^{-4}$ on the LHC Olympics R&D set. We run it with the same background flow, classifier ensemble, features, and windows as our method, so that the only difference is how the post-cut count is computed. Brute-force sampling gets the same GPU-hour budget as our proposal training plus estimation. No reported result found on Lacuna for the compute cost or template sampling variance of CATHODE, so we measure both. Beating this baseline means one of two things. Either we match its significance and pull calibration at $\epsilon_B = 10^{-4}$ with at least ten times fewer classifier and flow calls, or, at equal compute, we deliver calibrated estimates at $\epsilon_B = 10^{-5}$ where brute force cannot reach 5% relative precision. On real data, we must also reproduce the 6.4σ of Isolating Unisolated Upsilons with Anomaly Detection in CMS Open Data within uncertainty while the same-sign control stays null.

The compression competitor is a distilled student background flow, using the latent and intermediate-latent objectives of Distilling Normalizing Flows, with brute-force counting. It gets the same total compute and is judged on tail error versus cost.

The CWoLa template is included as a non-generative reference.

Two ablations isolate the key ingredients. The first uses a single-stage proposal with no nesting, to test whether nesting matters. The second turns tail refinement either always on or always off, to test whether the gate prevents the overfitting that Dark Machines warns about.

Why not just…?

Why not just draw more samples from the flow? In four to six feature dimensions, flow sampling is cheap, and this is the most serious threat. If brute force reaches 1% precision across a full scan and ensemble in a few GPU-minutes even at $\epsilon_B = 10^{-5}$, the speed argument collapses. The contribution would then reduce to the error decomposition, which brute force can also provide given enough samples. The cost accounting in stage three settles this directly. The $1/(\epsilon_B r^2)$ scaling says the gap should grow tenfold per decade of rejection, and classifier-ensemble evaluation rather than flow sampling should dominate. If the measurement shows otherwise, we will report that and re-scope the work to tail-error diagnosis.

Why not just distill or shrink the flow? Distillation lowers per-sample cost but leaves the $1/\epsilon_B$ waste untouched. It has also only been shown on image benchmarks, where FID is insensitive to tail mass. The capacity-accuracy tension in Learnable Explicit Density for Continuous Latent Space and Variational Inference predicts that the student will be worst in the selected region. The distilled baseline tests this prediction head on.

Why not just reweight flow samples to sideband data with a classifier? Classifier-based correction is standard and cheap. It is a genuine alternative to our tail refinement, though not to the importance-sampled estimator. The difficulty is that at $\epsilon_B \le 10^{-4}$ there are only a handful of real sideband events past the cut to train the reweighter on, which is the same data starvation that kills curve fitting. We include it as an alternative refinement stage at equal compute. If it matches the refinement layers, we will adopt it and drop ours.

Why not just use a bigger flow or an ensemble of flows? More capacity spread over the whole density is the brute-force answer to tail error. Dark Machines found that heavier flow models transferred worse to blinded data, and an ensemble multiplies every downstream cost. The gated refinement ablation, compared against a flow ensemble with matched parameter count, shows whether targeted capacity beats uniform capacity on sideband tail error.

Proposed Experiments

The LHC Olympics R&D dataset, described in The LHC Olympics 2020 a community challenge for anomaly detection in high energy physics, provides truth labels. On it we inject signal at several strengths and measure five things for $\epsilon_B$ from $10^{-2}$ to $10^{-5}$: relative error of $\hat N_{bkg}$ against the true post-cut background count, pull-distribution width over repeated trainings (uncertainty calibration), discovery significance, false-positive rate across windows with no injected signal, and compute per scan. Black Box 2, which contains background only, is the decisive safety check: across the full scan, the method must produce no excess beyond what the claimed uncertainties allow. Black Box 1 checks that the 834-event resonance is still found at tighter cuts than earlier work used. We also repeat the Pythia-to-Herwig++ drift test of Das et al. to see whether the decomposition correctly attributes the shift to model error rather than sampling noise.

On CMS Open Data dimuons, we rerun the Upsilon analysis with both counting methods and compare significance, uncertainty, and the same-sign null.

The decisive result for the project has two parts. The importance-sampled estimator should match brute-force estimates where brute force is affordable, at a small fraction of the calls. Where brute force is not affordable, at $\epsilon_B = 10^{-5}$, it should produce pull distributions with unit width. A wider pull, or an effective sample size that collapses, would mean the proposal is missing parts of the cut region, and the claim fails.