Conditional conformal test martingales provide sequential tests for detecting distribution shifts, using a fixed reference dataset to avoid contamination from test-time samples. Prior work used a penalized betting function via online optimization with smoothing, clipping, and other hyperparameters, which can adapt slowly when a shift occurs after a long stationary period. In this work, we introduce an approach that requires no hyperparameters and provably adapts quickly to shifts occurring at unknown times. Our key idea is to frame the penalized betting problem as portfolio selection in a three-asset market. Then, we use a restarting universal portfolio, with a heavy-tailed wealth allocation over time. We establish anytime false-alarm control and derive optimal finite-sample bounds on detection delay under detectable alternatives. We also develop an FFT-based implementation that computes the portfolio sequence over T rounds in O(T2lnT) time, instead of O(T3) of the naive implementation. Synthetic and real-world experiments suggest that the proposed approach adapts rapidly after long periods of null samples, with detection delays depending substantially less on shift time than prior baselines.
Figures & tables
Figure 1: Median detection delay vs. shift time on logarithmic y axes: (a) sharp change to N(1,1) and (b) gradual drift, with 100 runs per t0 , and (c) ImageNet-C with n=1000 , with 150 runs per t0 .
Figure 2: Power given no false alarm , versus the number of rounds t−t0 after the shift.
Figure 3: ImageNet-C by corruption group. For each seed, we take the median ratio over the corruptions of the group; lines show the mean over 10 seeds and bands one standard error. Values above 1 indicate faster detection by our detector.
Appendix figures & tables26 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 4: The grid for N=5 .
Figure 5: (a) The pairs of start rounds s and rounds t≥s . The split at K handles the dark block at once, later splits handle the lighter blocks, and the gray cells are computed directly. (b) The portfolios started in [L,K) are merged at round K into one polynomial, whose integrals are needed at every round in [K,R) (white dots). (c) Without a known horizon, doubling trick is used, and all earlier portfolios are merged at the start of each epoch.
largest allocation difference
reversal stream
T
null
shift
drift
τ
reversal
lnM there
first difference
500
3.3⋅10−16
5.6⋅10−16
1.3⋅10−15
218
333
25
360
1000
3.3⋅10−16
1.2⋅10−15
9.4⋅10−16
401
666
84
694
2000
2.2⋅10−16
7.4⋅10−16
1.0⋅10−15
712
1333
165
1350
4000
3.3⋅10−16
1.6⋅10−15
7.8⋅10−16
1371
2666
330
2687
8000
3.3⋅10−16
1.1⋅10−15
5.8⋅10−16
2721
5333
644
5348
Appendix
Table 1: Agreement of the direct and the divide-and-conquer methods. Left: largest difference \max_{t\leq T}\max_{i}\ \mathopen{}\mathclose{{\left|w_{t}^{i}-\tilde{w}_{t}^{i}}}\right| between the allocations wt and w~t of the two methods. Right, for the reversal stream: the alarm time τ (the same for both methods), the round ⌊2T/3⌋ of the reversal, lnM at the reversal, and the first round at which the allocations differ by more than 10−9 .
Figure 6: Cost of the direct and the divide-and-conquer methods on one core, against the horizon T : (a) wall-clock time, with reference lines through the last point of each method, and (b) peak memory of the process, including about 0.1 GiB for the Python interpreter.
t0=0
t0=600
t0=4000
Ours
CCTM
CTM
Ours
CCTM
CTM
Ours
CCTM
CTM
Oracle
Sharp change, d=1
22
24
31
48
73
84
54
216
227
11
Sharp change, d=1.5
14
13
21
32
52
61
36
150
168
7
Sharp change, d=2
12
11
17
26
43
51
30
122
141
6
Gradual drift, λ=1.5
65
64
67
81
98
104
88
179
197
73
Gradual drift, λ=3
41
43
47
56
70
77
60
142
161
42
Appendix
Table 2: Median detection delay τ−t0 in the synthetic experiments, over the trials without a false alarm; Ours is the restarting universal portfolio. Bold : the fastest method for each configuration and shift time excluding oracle (not implementable). Note that the oracle’s delay depends very weakly on t0 (here we only show it for t0=4000 ). Tables 3 – 8 give further statistics.
Figure 7: Type-I error against the reference size n : fraction of 100 null streams of T=4500 rounds on which the test martingale ( Mt for the restarting portfolio) reaches 1/α . The two lines coincide except at n=2500 .
Figure 8: Synthetic experiments: median delay τ−t0 against the shift time , over the trials without a false alarm, for every sharp change (top) and every drift (bottom), on logarithmic vertical axes.
Figure 9: Synthetic experiments: power given no false alarm , P{τ≤t∣τ>t0} , against the number of rounds after the shift, for every configuration (rows) and t0∈{0,600,4000} (columns).
Figure 10: Synthetic experiments: median log-wealth after the shift , for the sharp change with d=1 (top) and the drift with λ=1.5 (bottom), and t0∈{200,600,4000} (columns). For the restarting portfolio, the wealth is its test martingale Mt . The dashed line is the rejection threshold ln(1/α) , and the vertical axes are linear between −1 and 1 and logarithmic outside.
Figure 11: Synthetic null streams : fraction of the 100 streams whose wealth ( Mt for the restarting portfolio) has reached 1/α by round t , for (a) n=1000 and (b) n=2000 . The CCTM never rejects, and its line is hidden under that of the restarting portfolio.
delay after t0
ln\WealthT
lnMT
t0
strategy
false al.
power
median
mean
median
mean
median
mean
0
restarting UP
0.00
1.00
22
22.6
1157.0
1159.2
1158.4
1160.7
conditional CTM (ONS)
0.00
1.00
24
24.0
747.8
747.5
747.8
747.5
standard CTM
0.00
1.00
31
31.6
171.8
172.0
171.8
172.0
best CRP after shift (oracle)
0.00
1.00
10
13.6
1164.0
1166.1
1164.0
1166.1
200
restarting UP
0.00
1.00
43
45.6
1088.2
1090.7
1090.9
1093.1
Appendix
Table 3: Sharp change point, d=1 . Xt∼N(1,1) after t0 . Reference set n=1000 , stream length T=4500 , 100 trials; details in Appendix F.1 . False al. : fraction rejecting at or before t0 ; power : fraction of the trials without a false alarm that reject by T , P(τ≤T∣τ>t0) . Delays are over the trials without a false alarm; the median counts misses as ∞ , the mean counts them as T−t0+1 . The restarting portfolio rejects on its test martingale Mt ; \WealthT is its portfolio wealth, and \WealthT=MT for the others. Bold : best implementable strategy in the block.
delay after t0
ln\WealthT
lnMT
t0
strategy
false al.
power
median
mean
median
mean
median
mean
0
restarting UP
0.00
1.00
14
14.6
1905.2
1903.6
1905.7
1904.2
conditional CTM (ONS)
0.00
1.00
13
14.4
1113.4
1112.8
1113.4
1112.8
standard CTM
0.00
1.00
21
21.1
259.5
258.7
259.5
258.7
best CRP after shift (oracle)
0.00
1.00
7
7.5
1914.2
1912.5
1914.2
1912.5
200
restarting UP
0.00
1.00
28
28.4
1801.7
1801.3
1803.2
1802.9
Appendix
Table 4: Sharp change point, d=1.5 . Xt∼N(1.5,1) after t0 . Reference set n=1000 , stream length T=4500 , 100 trials; details in Appendix F.1 . False al. : fraction rejecting at or before t0 ; power : fraction of the trials without a false alarm that reject by T , P(τ≤T∣τ>t0) . Delays are over the trials without a false alarm; the median counts misses as ∞ , the mean counts them as T−t0+1 . The restarting portfolio rejects on its test martingale Mt ; \WealthT is its portfolio wealth, and \WealthT=MT for the others. Bold : best implementable strategy in the block.
delay after t0
ln\WealthT
lnMT
t0
strategy
false al.
power
median
mean
median
mean
median
mean
0
restarting UP
0.00
1.00
12
12.4
2333.2
2333.5
2333.7
2333.9
conditional CTM (ONS)
0.00
1.00
11
11.8
1344.8
1343.7
1344.8
1343.7
standard CTM
0.00
1.00
17
17.6
315.5
315.0
315.5
315.0
best CRP after shift (oracle)
0.00
1.00
6
6.2
2342.5
2342.8
2342.5
2342.8
200
restarting UP
0.00
1.00
23
23.2
2221.1
2221.6
2222.5
2223.1
Appendix
Table 5: Sharp change point, d=2 . Xt∼N(2,1) after t0 . Reference set n=1000 , stream length T=4500 , 100 trials; details in Appendix F.1 . False al. : fraction rejecting at or before t0 ; power : fraction of the trials without a false alarm that reject by T , P(τ≤T∣τ>t0) . Delays are over the trials without a false alarm; the median counts misses as ∞ , the mean counts them as T−t0+1 . The restarting portfolio rejects on its test martingale Mt ; \WealthT is its portfolio wealth, and \WealthT=MT for the others. Bold : best implementable strategy in the block.
delay after t0
ln\WealthT
lnMT
t0
strategy
false al.
power
median
mean
median
mean
median
mean
0
restarting UP
0.00
1.00
65
62.4
2814.1
2814.6
2815.0
2815.4
conditional CTM (ONS)
0.00
1.00
64
63.7
1634.8
1634.5
1634.8
1634.5
standard CTM
0.00
1.00
67
68.1
575.6
575.6
575.6
575.6
best CRP after shift (oracle)
0.00
1.00
76
72.4
2819.0
2818.6
2819.0
2818.6
200
restarting UP
0.00
1.00
79
78.5
2682.9
2682.5
2684.2
2683.8
Appendix
Table 6: Gradual drift, λ=1.5 . Xt∼N(1.5(t−t0)/100,1) after t0 . Reference set n=2000 , stream length T=4500 , 100 trials; details in Appendix F.1 . False al. : fraction rejecting at or before t0 ; power : fraction of the trials without a false alarm that reject by T , P(τ≤T∣τ>t0) . Delays are over the trials without a false alarm; the median counts misses as ∞ , the mean counts them as T−t0+1 . The restarting portfolio rejects on its test martingale Mt ; \WealthT is its portfolio wealth, and \WealthT=MT for the others. Bold : best implementable strategy in the block.
delay after t0
ln\WealthT
lnMT
t0
strategy
false al.
power
median
mean
median
mean
median
mean
0
restarting UP
0.00
1.00
41
40.8
2842.2
2842.4
2842.9
2843.0
conditional CTM (ONS)
0.00
1.00
43
42.3
1649.9
1649.9
1649.9
1649.9
standard CTM
0.00
1.00
47
47.0
575.6
575.6
575.6
575.6
best CRP after shift (oracle)
0.00
1.00
43
42.4
2848.6
2848.5
2848.6
2848.5
200
restarting UP
0.00
1.00
54
53.2
2709.5
2709.6
2710.7
2710.8
Appendix
Table 7: Gradual drift, λ=3 . Xt∼N(3(t−t0)/100,1) after t0 . Reference set n=2000 , stream length T=4500 , 100 trials; details in Appendix F.1 . False al. : fraction rejecting at or before t0 ; power : fraction of the trials without a false alarm that reject by T , P(τ≤T∣τ>t0) . Delays are over the trials without a false alarm; the median counts misses as ∞ , the mean counts them as T−t0+1 . The restarting portfolio rejects on its test martingale Mt ; \WealthT is its portfolio wealth, and \WealthT=MT for the others. Bold : best implementable strategy in the block.
delay after t0
ln\WealthT
lnMT
t0
strategy
false al.
power
median
mean
median
mean
median
mean
0
restarting UP
0.00
1.00
31
31.1
2852.6
2852.9
2853.2
2853.4
conditional CTM (ONS)
0.00
1.00
33
33.0
1655.8
1655.7
1655.8
1655.7
standard CTM
0.00
1.00
38
37.8
575.6
575.6
575.6
575.6
best CRP after shift (oracle)
0.00
1.00
29
29.2
2860.5
2860.5
2860.5
2860.5
200
restarting UP
0.00
1.00
41
41.4
2720.3
2720.3
2721.6
2721.5
Appendix
Table 8: Gradual drift, λ=5 . Xt∼N(5(t−t0)/100,1) after t0 . Reference set n=2000 , stream length T=4500 , 100 trials; details in Appendix F.1 . False al. : fraction rejecting at or before t0 ; power : fraction of the trials without a false alarm that reject by T , P(τ≤T∣τ>t0) . Delays are over the trials without a false alarm; the median counts misses as ∞ , the mean counts them as T−t0+1 . The restarting portfolio rejects on its test martingale Mt ; \WealthT is its portfolio wealth, and \WealthT=MT for the others. Bold : best implementable strategy in the block.
n=1000
n=2000
strategy
rejected
median final log-wealth
rejected
median final log-wealth
restarting UP
0.00
-0.88
0.00
-0.97
conditional CTM (ONS)
0.00
-2.56
0.00
-2.75
standard CTM
0.02
-0.68
0.02
-0.76
Appendix
Table 9: Type-I error. Fraction of 100 null streams ( Xt∼N(0,1) throughout, T=4500 ) whose wealth ever reaches 1/α=20 ( Mt for the restarting portfolio, the martingale itself for the CTMs), and the median final log-wealth, for the reference sizes of the sharp change point ( n=1000 ) and the drift ( n=2000 ).
t0=0
t0=1000
t0=8000
All
Noise
Blur
Weather
Digital
All
Noise
Blur
Weather
Digital
All
Noise
Blur
Weather
Digital
Ours
17
18
16.5
12
27.5
42
41.5
38
27.5
88.5
50.5
54.5
45
31
130.5
CCTM
67
69
65.5
61
77.5
84.5
85
74.5
59.5
143
244.5
250
220.5
165
425.5
CTM
75
76
72.5
66
85
78
82
74
58
106.5
264
270
241
192.5
390.5
Oracle
8
7
8.5
6
19
8
7
8.5
6
19
8
7
8.5
6
19
Appendix
Table 10: Median detection delay τ−t0 on ImageNet-C with n=1000 , by corruption group, over 10 seeds and the corruptions of each group. The delays of the CTMs include their warm-up of 50 rounds. Bold : the fastest implementable method. Table 14 gives the false-alarm rates, the power, and the mean delays, and Tables 11 – 15 give the other reference sizes.
Figure 12: ImageNet-C: median delay τ−t0 against the length t0 of the clean phase , for every reference size n , over 15 corruptions and 10 seeds. Runs that miss the shift within 2000 rounds count as infinite delays. The vertical axes are logarithmic, and the horizontal axes are logarithmic beyond t0=0 .
Figure 13: ImageNet-C: power given no false alarm , P{τ≤t∣τ>t0} , against the number of rounds after the shift, for every reference size n (rows) and t0∈{0,1000,8000} (columns), over 15 corruptions and 10 seeds.
median delay
mean
t0
strategy
false al.
power
all
noise
blur
weather
digital
delay
0
restarting UP
0.00
0.93
30
30
26.5
16.5
177.5
235.5 †
conditional CTM (ONS)
0.00
0.93
83
89
78
65.5
203
269.6 †
standard CTM
0.00
0.96
93
97
88
75.5
126.5
194.2 †
best CRP after shift (oracle)
0.00
0.93
18.5
18.5
16
9
136.5
189.4 †
1000
restarting UP
0.00
0.92
90.5
99.5
66.5
40.5
818
360.5 †
Appendix
Table 11: ImageNet-C, n=100 . 15 severity-5 corruptions × 10 seeds after t0 clean images; every method runs H=2000 rounds past the change. False al. : rejection at or before t0 ; power : P(τ≤t0+H∣τ>t0) . Delays τ−t0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ ; the mean counts misses as H+1 ( † : some runs missed, so the mean is a lower bound). The restarting portfolio rejects on Mt . Groups as in Shaer et al. [2026] , Figure 4. Bold : best implementable strategy.
median delay
mean
t0
strategy
false al.
power
all
noise
blur
weather
digital
delay
0
restarting UP
0.00
0.98
21
21
19
14
67
118.0 †
conditional CTM (ONS)
0.00
0.99
73
75
68.5
63
102
151.9 †
standard CTM
0.00
1.00
79
84
75.5
69
102.5
92.7
best CRP after shift (oracle)
0.00
0.99
11
11
11
7
29
78.5 †
1000
restarting UP
0.00
0.96
60.5
65.5
49
31.5
185
194.2 †
Appendix
Table 12: ImageNet-C, n=250 . 15 severity-5 corruptions × 10 seeds after t0 clean images; every method runs H=2000 rounds past the change. False al. : rejection at or before t0 ; power : P(τ≤t0+H∣τ>t0) . Delays τ−t0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ ; the mean counts misses as H+1 ( † : some runs missed, so the mean is a lower bound). The restarting portfolio rejects on Mt . Groups as in Shaer et al. [2026] , Figure 4. Bold : best implementable strategy.
median delay
mean
t0
strategy
false al.
power
all
noise
blur
weather
digital
delay
0
restarting UP
0.00
1.00
19
20
17.5
13
29.5
48.3
conditional CTM (ONS)
0.00
1.00
70
71
67
61.5
82
91.5
standard CTM
0.00
1.00
76
78.5
74
68
93
84.3
best CRP after shift (oracle)
0.00
1.00
9
8
9
6.5
20
29.3
1000
restarting UP
0.00
1.00
46.5
44
41.5
29
134.5
106.9
Appendix
Table 13: ImageNet-C, n=500 . 15 severity-5 corruptions × 10 seeds after t0 clean images; every method runs H=2000 rounds past the change. False al. : rejection at or before t0 ; power : P(τ≤t0+H∣τ>t0) . Delays τ−t0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ ; the mean counts misses as H+1 . The restarting portfolio rejects on Mt . Groups as in Shaer et al. [2026] , Figure 4. Bold : best implementable strategy.
median delay
mean
t0
strategy
false al.
power
all
noise
blur
weather
digital
delay
0
restarting UP
0.00
1.00
17
18
16.5
12
27.5
31.8
conditional CTM (ONS)
0.00
1.00
67
69
65.5
61
77.5
80.3
standard CTM
0.00
1.00
75
76
72.5
66
85
81.3
best CRP after shift (oracle)
0.00
1.00
8
7
8.5
6
19
17.3
1000
restarting UP
0.00
1.00
42
41.5
38
27.5
88.5
74.1
Appendix
Table 14: ImageNet-C, n=1000 . 15 severity-5 corruptions × 10 seeds after t0 clean images; every method runs H=2000 rounds past the change. False al. : rejection at or before t0 ; power : P(τ≤t0+H∣τ>t0) . Delays τ−t0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ ; the mean counts misses as H+1 . The restarting portfolio rejects on Mt . Groups as in Shaer et al. [2026] , Figure 4. Bold : best implementable strategy.
median delay
mean
t0
strategy
false al.
power
all
noise
blur
weather
digital
delay
0
restarting UP
0.00
1.00
16
16
16
12
25
23.9
conditional CTM (ONS)
0.00
1.00
65
66
64
60.5
73.5
73.8
standard CTM
0.00
1.00
74
76
71.5
66
83.5
79.9
best CRP after shift (oracle)
0.00
1.00
7
7
7
6
17.5
13.9
1000
restarting UP
0.00
1.00
39.5
41.5
36
26
73.5
58.0
Appendix
Table 15: ImageNet-C, n=4000 . 15 severity-5 corruptions × 10 seeds after t0 clean images; every method runs H=2000 rounds past the change. False al. : rejection at or before t0 ; power : P(τ≤t0+H∣τ>t0) . Delays τ−t0 (warm-up rounds included), medians over the trials without a false alarm, misses counted as ∞ ; the mean counts misses as H+1 . The restarting portfolio rejects on Mt . Groups as in Shaer et al. [2026] , Figure 4. Bold : best implementable strategy.
restarting UP
conditional CTM
standard CTM
n
rejected
med. final
rejected
med. final
rejected
med. final
100
0.00
-0.56
0.00
-0.89
0.03
-0.80
500
0.00
-0.79
0.00
-1.54
0.02
-0.94
4000
0.01
-1.07
0.00
-2.33
0.01
-0.86
Appendix
Table 16: ImageNet null check. The stream is the rest of the clean holdout ( T=12400 for n=100 , T=12000 for n=500 , T=8500 for n=4000 ), 100 seeds per n : fraction of streams whose wealth ever reaches 1/α ( Mt for the restarting portfolio, the martingale itself for the CTMs), and the median final log-wealth.
A fundamental assumption in statistics and machine learning is that ``the future looks like the past,'' formalized as exchangeability: the joint data distribution is order-invariant. In practice, this assumption is often violated due to distribution shifts over time. Early detection of exchangeability violations is crucial to prevent performance degradation and enable timely interventions like model retraining. Conformal test martingales offer a flexible, distribution-free framework for sequential exchangeability testing with guaranteed false-alarm rate control by betting against the uniformity of conformal p-values. While alternatives such as plug-in martingales and mixture-based strategies exist, computationally efficient baselines like the Simple Jumper are limited to detecting mean location shifts. We propose a family of conformal test martingales based on shifted Legendre polynomials that extend the Simple Jumper to higher-order moments. The Simple Legendre Jumper replaces linear betting functions with polynomials of arbitrary degree, enabling rapid detection of variance, skewness, and other higher-order deviations. The Product Legendre Jumper combines multiple polynomial degrees into a single betting function but suffers from exponential state-space growth, termed the jumping tax. To resolve this, we introduce the Variational Legendre Jumper, which employs a mean-field approximation to reduce complexity to constant time per step with minimal power loss, providing an expressive, scalable framework for real-time distribution shift monitoring.
A rapidly growing range of sequential data tasks, such as identifying trend reversals in financial markets, auto-segmenting video and audio recordings, detecting changes in movement direction from motion sensors cannot be fully addressed without detection of distributional shifts in time-ordered data. We consider a sequential change-point detection problem where the conditional density switches at an unknown time, yet neither the pre- nor post-change distribution admits a closed-form. Classical likelihood-ratio statistics are inapplicable in this settings. A conditional diffusion model, trained on pre-change-point data with a frozen context encoder, defines a deterministic bijection via the probability flow ODE. Pre-change observations are mapped onto standard Gaussian latent variables. Post-change observations, processed through the same frozen map, deviate from this reference. We employ the Maximum Mean Discrepancy as the test statistic, derive closed-form expressions for its components under the Gaussian null, and establish its asymptotic distribution as a degenerate U-statistic. Afterwards we apply an online detection procedure of Shiryaev--Roberts to the resulting statistic with exact threshold calibration. The method detects arbitrary distributional shifts, including covariance rotations and higher-order structural breaks, without parametric assumptions on either regime.
Artem Kraevskiy, Artem Prokhorov
National Research University Higher School of Economics Moscow, Russia · The University of Sydney Business School & CIREQ & CEBDA Sydney, Australia
This paper introduces a distribution-free framework for constructing post-detection confidence sets for changepoints after stopping a sequential change detection procedure. It is well known that conformal test martingales can be used to sequentially detect changes in distribution, but by themselves provide no inference for the time at which a proclaimed change occurred. Past work on post-detection inference requires pre- and post-change classes of distributions to be known, but this paper accomplishes localization of the changepoint without any distributional assumptions. We establish finite-sample coverage guarantees (conditional on correct detection). We provide non-asymptotic bounds on the conditional expected size of the confidence sets. Under suitable asymptotic regimes, we prove that the conditional expected size of the confidence set remains uniformly bounded and demonstrate strong empirical performance on simulated and real data. To the best of our knowledge, this is the first general distribution-free framework for sequential changepoint localization with valid post-detection coverage.
Aytijhya Saha, Aaditya Ramdas
Massachusetts Institute of Technology · Carnegie Mellon University