A deployed model sees a stream of inputs, and labels usually arrive late or never. Unsupervised drift detectors therefore ask one question of the unlabeled inputs: "has the input distribution changed from the reference data?" Over a long stream the honest answer is almost always yes. Something small always changes, and a detector that tests exact equality with enough power will eventually fire on shifts that no one cares about. What an operator needs is a narrower claim that the detector can back statistically: at least ε of today's traffic falls in a region that is at least γ times more common than in the reference data, and here is that region. That claim has a magnitude, it has a location, and it stays meaningful however long the monitor runs.
We propose to build a monitor that makes exactly this claim. It rests on one observation. The hockey-stick divergence measures the largest amount of probability mass that one distribution places in some region beyond γ times what another places there. Its variational (convex-dual) form is a linear objective over witness functions bounded in [0,1]. That linearity turns a learned witness directly into a betting game that stays valid under a null hypothesis of the form "the shift is smaller than ε." The result is a detector with type-I error control at every stopping time. It tests a tolerance-based null instead of exact equality, and the witness it learns is itself the certified drift region.
Core Claim
Let $P$ be the reference distribution and $Q_t$ the deployment distribution at time $t$. For a ratio threshold $\gamma \ge 1$, the hockey-stick divergence has the Fenchel-dual representation
$$E_\gamma(Q_t \,\|\, P) \;=\; \sup_{A}\,\big[Q_t(A) - \gamma P(A)\big] \;=\; \sup_{T:\mathcal{X}\to[0,1]} \Big( \mathbb{E}_{Q_t}[T] - \gamma\,\mathbb{E}_{P}[T] \Big).$$
This holds because the generator $f(u)=\max(u-\gamma,0)$ has conjugate $f^*(t)=\gamma t$ on $[0,1]$ and $+\infty$ elsewhere. At each step a witness $T_t$, trained only on past data, scores a fresh deployment point $x_t$ and a fresh reference point $y_t$. The payoff is
$$g_t = T_t(x_t) - \gamma\,T_t(y_t) - \varepsilon .$$
Under the composite null "$E_\gamma(Q_s\|P)\le\varepsilon$ for all $s$," this payoff has non-positive conditional mean. It is also bounded in $[-\gamma-\varepsilon,\,1-\varepsilon]$. The wealth $W_t=\prod_{s\le t}(1+\lambda_s g_s)$, with a predictable bet size $\lambda_s\in[0,1/(\gamma+\varepsilon)]$, is therefore a non-negative supermartingale. Ville's inequality then gives $\Pr(\sup_t W_t \ge 1/\alpha)\le\alpha$. If we invert this test over a grid of ε values, we obtain an anytime-valid lower confidence sequence on the excess mass the learned witnesses capture.
When the monitor rejects, the evidence was produced by the specific witnesses $T_t$. The region $\{T_t > 1/2\}$ is therefore certified to be overrepresented, and it is not a post-hoc explanation. In practice the witness is learned as a cost-sensitive classifier with a sigmoid output: the Bayes-optimal hockey-stick region is $\{q_t/p > \gamma\}$, which is exactly the decision region of a classifier whose reference class is weighted by γ. For images and text, the classifier runs on frozen pretrained features.
The new element is not betting-based testing, and it is not neural density ratios. It is using the linear dual of a threshold-type divergence to obtain three things at once: a tolerance null (ε, γ), a certified magnitude, and a certified region. Existing sequential detectors provide at most one of these.
Position Relative to Prior Work
Two papers supply the statistical machinery we reuse. Deep anytime-valid hypothesis testing trains a neural bettor against a null hypothesis of equality and rejects when wealth passes $1/\alpha$. We keep the betting construction. We change the null from equality to a divergence tolerance, and we tie the payoff to a divergence whose value and witness mean something to an operator. That paper does not evaluate on temporal drift streams, and it does not report a magnitude or a location. Sequential Covariate Shift Detection Using Classifier Two-Sample Tests contributes the evaluate-then-train protocol, in which each point is scored before the model updates on it. We adopt that protocol because it makes our witnesses predictable. The paper's own acknowledged weakness motivates us: its Clopper-Pearson guarantee holds per step, not uniformly over the stream.
Several papers motivate the localization and tolerance aspects. Regularized f-Divergence Kernel Tests shows that the choice of divergence matters: χ² and hockey-stick tests catch localized bumps (Expo-1D) and privacy violations that MMD misses. The paper is strictly batch-mode and relies on kernel matrix inversions. We carry its insight into a streaming, anytime-valid setting. Regional Concept Drift Detection and Density Synchronized Drift Adaptation localizes drift with k-nearest-neighbour density comparisons, which the file notes become slow at 500 features. Our witness replaces that neighbour search with a learned function and attaches a guarantee. Context-Aware Drift Detection documents that MMD signals drift "with 100% certainty" under benign subpopulation shifts. Our tolerance null addresses the small-magnitude version of that failure. It does not address large, context-explained shifts, and we treat that as a constraint on our claims.
Two neural density-ratio change detectors are the closest in spirit. Deep density ratio estimation for change point detection and Change Point Detection with Neural Online Density-Ratio Estimator both produce heuristic change scores without error control. The second of these reads its ratio from cross-entropy logits. Our witness is bounded by construction, which sidesteps the unbounded-ratio instabilities the first paper had to fix with special losses.
Research Program
The work has three parts.
The first part is theoretical. We will state the supermartingale result for the tolerance null, including under non-stationary $Q_s$. Rejection then implies that the time-average of $\mathbb{E}_{Q_s}[T_s]-\gamma\mathbb{E}_P[T_s]$, and hence the divergence at some step, exceeded ε. We will add a restart variant for change detection that restarts wealth, CUSUM-style, and bounds the rate of false alarms. We will also give a growth-rate analysis showing how power depends on the witness's excess mass. We expect detection time to scale roughly as $\log(1/\alpha)$ divided by the per-step expected log-growth, which is the standard form for betting tests.
The second part is algorithmic. Mixing over a small grid of γ values costs only a constant factor in wealth, because averages of e-processes remain valid. This mixture removes the need to pick γ in advance and plays the role that $f$-Agg plays in the batch kernel tests. The witness and the betting fraction are updated online on frozen features, one gradient step per point.
The third part evaluates whether certified regions are useful. We will check whether they match planted shifted subpopulations. We will also check whether reweighting only the certified region recovers accuracy, in the spirit of LDD-DSDA's selective adaptation.
Baselines
The naive reference point is to monitor nothing and retrain the ERM model on a fixed schedule. On Wild-Time this is known to be hard to beat for accuracy: Wild-Time reports a 20% average drop from in-distribution to future data, with Yearbook falling from about 98% to about 79%. This baseline tells us whether monitoring adds anything beyond a calendar. We run it with the same retraining budget that our monitor would trigger.
The strongest existing sequential detector with error control is the evaluate-then-train C2ST of Sequential Covariate Shift Detection Using Classifier Two-Sample Tests. On ImageNet multiple-shift streams it needed 190 shifted samples to reach an 80% detection rate while respecting a 1% false positive rate, compared with 640 to 720 or more for data-splitting and Wald baselines. We run it with the same frozen features, the same classifier architecture, and the same α. We count it as beaten if our method matches its 190-sample figure at γ=1 and ε=0, while keeping false alarms below α over the entire stream rather than per step.
The anytime-valid neural bettor of Deep anytime-valid hypothesis testing is the strongest competitor on validity. The file lists no reported result on Lacuna for it on drift streams, so we reimplement it with the same network and feature budget. We beat it if our method issues far fewer alarms on streams whose shift is below the tolerance, while detecting above-tolerance shifts no more slowly.
For low-dimensional and localized settings, we include three further baselines. The first is the batch regularized χ² and $f$-Agg test of Regularized f-Divergence Kernel Tests, run on sliding windows. The second is IKS from Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test, run per feature with a Bonferroni correction. The third is MMD-ADiTT, which reports an AUC of 0.97 for mean shifts at n=512 on the benchmark of Context-Aware Drift Detection.
Two ablations isolate the key ingredient. The first swaps the linear hockey-stick payoff for a payoff from a witness trained with cross-entropy, keeping the betting wrapper. The second sets ε=0, which leaves region certification intact but removes the tolerance null.
Why not just…?
Why not just run the C2ST with an accuracy margin, i.e. test accuracy > 0.5 + δ? Classifier accuracy above one half bounds the total variation distance, and total variation is our γ=1 case. So this alternative is a real threat whenever the relevant shift is symmetric and global. Three things separate the two methods. The margin C2ST keeps its per-step guarantee, so it still accumulates false alarms over a long stream. Its accuracy mixes over- and under-represented regions, whereas γ>1 targets newly overrepresented subpopulations specifically. And it produces no certified region. Our γ=1, ε-matched ablation runs exactly this comparison. If that ablation performs as well as the γ-mixture on the localized benchmarks, we will report that the region certificate is the only gain.
Why not just raise the rejection threshold of an equality-null betting test? A larger $1/\alpha$ changes how much evidence is required. It does not change which shifts count. A tiny persistent shift still makes wealth grow without bound and eventually triggers an alarm, so the threshold only sets how long the monitor waits before firing. The sub-tolerance drift streams described below test this directly by measuring alarm rate as a function of stream length.
Why not just use per-feature IKS or MMD? IKS is fast but univariate, and the shifts in our image and text streams are joint shifts in the feature representation. MMD misses localized bumps, as shown on Expo-1D in Regularized f-Divergence Kernel Tests, and it fails under benign context shift, as shown in Context-Aware Drift Detection. Both methods also lack anytime validity. We include both as baselines rather than assuming they lose.
Proposed Experiments
The first decisive check tests validity and tolerance. We build semi-synthetic streams from ImageNet features by injecting a controlled fraction of shifted images, with the excess mass set either below or above ε. We then measure three things over streams 10 to 100 times longer than the cold-start window. These are the fraction of runs with any false alarm, the detection delay when the shift exceeds tolerance, and coverage of the true excess mass by our lower confidence sequence.
The second check tests localization. On Expo-1D and on IWildCam streams, a planted camera or species subpopulation drives the shift. We score overlap between the certified region and the planted subpopulation. We compare against LDD's k-nearest-neighbour regions for both accuracy and runtime, and against the batch χ² witness.
The third check tests whether certified magnitude tracks harm. On Wild-Time Yearbook, FMoW-Time, and HuffPost, we compute the rank correlation between our certified lower bound per time period and the observed ERM accuracy drop in that period. We also ask whether retraining only when an alarm fires, and reweighting only the certified region, matches periodic retraining at lower cost.
A negative result on the third check would be informative in its own right. It would say that input-space excess mass at a fixed γ does not predict harm in these benchmarks. That outcome would narrow our claim to detection and localization, and would drop the claim that the monitor tracks model degradation.
References
- Deep anytime-valid hypothesis testing
- Sequential Covariate Shift Detection Using Classifier Two-Sample Tests
- Regularized $f-$Divergence Kernel Tests
- Regional Concept Drift Detection and Density Synchronized Drift Adaptation
- Context-Aware Drift Detection
- Deep density ratio estimation for change point detection
- Change Point Detection with Neural Online Density-Ratio Estimator
- Wild-Time: A Benchmark of in-the-Wild Distribution Shift over Time
- Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test