Organizations: Key Laboratory of Organ Regeneration and Reconstruction, Chinese Academy of Sciences, Beijing, China · Institute of Industrial Science, The University of Tokyo, Tokyo, Japan · Westlake University, Hangzhou, China · Beijing Life Science Academy, Beijing, China
We consider the probability that a reversible Markov chain started in a set A is in a rare set B after a fixed horizon, a quantity often needed for many start laws, down to single states. Twisted sequential Monte Carlo (SMC) estimates such probabilities without bias, with small variance when its proposal and twist approximate the dynamics conditioned on reaching B, but these components are usually learned from forward simulations, which contain almost no successful paths when the event is rare. We introduce Foresight-SMC, which learns both components from the target side: under reversibility, relaxations started in B that return to A are, read backwards, exact samples of the conditioned paths, and their number is governed by the return probability rather than by the rare probability. Extending this reversal to the recorded propose--accept decisions of a Metropolis-adjusted sampler, we fit a controlled Langevin proposal with exact likelihood ratios by maximum likelihood, together with a classifier twist; the resulting estimator is unbiased for any start law. A variance analysis shows that resampling reduces the variance when the importance weights degenerate, as they do over long horizons. On an Allen--Cahn field, the learned proposal alone suffices, and one trained model is more accurate than splitting at equal cost. On alanine tripeptide, resampling with the learned twist is necessary, and Foresight-SMC needs less computation per query than adaptive multilevel splitting on localized start sets.
Figures & tables
Figure 1: Overview of Foresight-SMC. (a) Relaxations start from Y0∼μB ; those that end in A , read backwards, are samples of PμA⋆ (Proposition 3.1 ) and train the proposal and the twist. (b) For a query, particles move from A (blue) toward B (red) under the controlled kernel Kθ and are resampled at block ends. Inset: one step, in which the reference Gaussian proposal (dashed) is shifted by 2τ∇xgθ and the acceptance is tilted by egθ ; crosses mark rejected proposals. (c) Twisted SMC with proposal Kθ and twist Hk returns an unbiased estimate of p(ν,T) ; with L=1 it reduces to importance sampling.
Figure 2: Allen–Cahn field, one trained model for all queries. (a) Absolute log error of the 60 point queries at equal total cost. (b) Cumulative evaluations of U and ∇U : Foresight-SMC pays a one-off cost, whereas AMS and FFS, run to 20% RSE, pay again for every query.
Method
Cost
Elog (nat) ↓
In 2 SE
Foresight-SMC, L=1
1.32
0.070±0.002
56–58
Foresight-SMC, 50-step blocks
1.31
0.119±0.027
52–60
Reference-proposal SMC
1.31
∞
–
AMS, equal cost
1.29
0.296
48
AMS, to 20% RSE
4.02
0.175
51
FFS, to 20% RSE
127
0.059
57
Table 1: Allen–Cahn field. Cost: 109 evaluations for all 66 queries, including the one-off cost of Foresight-SMC. Elog : over the 60 point queries; Foresight-SMC gives mean ± SE over three training seeds. In 2 SE: point queries within two standard errors of the reference. ∞ : zero estimates on some queries. Further baselines: Appendix E .
Figure 3: Alanine tripeptide, eight broad queries. (a) Effective sample size of the weights along the horizon (median and 10–90 % band over queries), over the whole path for L=1 and per block otherwise. (b) Mean number of residues with ϕi>0 among the resampled particles. Elog of each variant: Table 2 .
Figure 4: Alanine tripeptide, four narrow start sets, against the fraction rS of relaxations that end in each set. (a) Work-normalized variance; the cost of reverse counting grows as 1/rS (dashed). (b) Absolute log error against the reverse-counting reference. RC: reaction coordinate.
Broad (8 sets)
Narrow (4 sets)
Method
Cost
Elog↓
Elog↓
WNV ratio ↓
Foresight-SMC, twist:
tempered classifier
6.6
0.13±0.03
0.15
1
classifier
6.6
0.18±0.01
0.16
0.45–5.8
egθ
6.6
0.47
0.34
3.3–30
Foresight-SMC, L=1
6.6
1.26
1.03
3.3–17 †
Table 2: Alanine tripeptide. Cost: 107 evaluations per broad query, excluding one-off costs; on the narrow sets, costs are similar except for learned-RC AMS (Appendix F.2 ). Elog : mean absolute log error (nat); ± : SE over three training seeds. WNV ratio: work-normalized variance relative to the first row, range over the four narrow sets. The plug-in gives no error bar; reverse counting is the narrow-set reference. † : effective sample size below 12 , so the WNV is underestimated. Per-set values: Tables F.2 and F.1 .
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
Figure D.1 : Number of blocks L at a fixed number of evaluations, mean over four repetitions (bars: SE). (a) Mean absolute log error: alanine tripeptide, two broad queries, tempered classifier twist; Allen–Cahn field, six point queries at T=500 , twist egθ . (b) Fraction of particles in B at T . Values differ from Tables 1 and F.1 , which average over all queries.
Allen–Cahn field
Alanine tripeptide
MALA step
τ=0.006 , T∈{250,500}
τ=10−3 on unwrapped increments, T=16000
Sampling μB
MALA restricted to B : 1024 chains, burn-in 6×105 steps, 128 draws per chain
exact: rejection sampling of ϕ , then ψ∼π(ψ∣ϕ)
Relaxation pool
131072 paths of 500 steps ( 74% in A at t=500 ); train/validation/test 90/5/5 , split by chain
32768 paths ( rB=0.33 ); held-out pool of 4096 for checkpoint selection
Records used
all ages, both horizons
128 per returning path, ages uniform
gθ
1-D CNN, 4 layers × 64 channels, kernel 7; remaining steps enter through Fourier features
MLP, 4 layers × 256, SiLU; inputs cos / sin of the angles, U , Fourier features of the remaining steps, 1B
Proposal
two-component mixture, Appendix B.1
same
Appendix
Table E.1 : Settings for the Allen–Cahn field and alanine tripeptide.
Figure E.1 : Allen–Cahn field: reference dynamics as space–time plots of the field ui (color; red: ui<0 , the unfavored phase) over the sites i and the steps t . (a) From a point start in A without a negative site, no droplet forms within T=500 . (b) A relaxation from μB : the droplet shrinks and vanishes; read backwards, the relaxation is a training path.
Seed
KL, T=500
KL, T=250
Elog , L=1
Elog , 50-step blocks
1
3.24±0.07
5.67±0.17
0.073 (58)
0.065 (60)
2
3.27±0.07
5.68±0.18
0.067 (56)
0.146 (55)
3
3.26±0.08
5.67±0.17
0.071 (56)
0.146 (52)
Appendix
Table E.2 : Allen–Cahn field: training seeds. KL is the held-out path KL for the start law μA ; for comparison, −logp is 22.3 nat at T=500 and 23.3 nat at T=250 . Elog over the 60 point queries, with the number of queries within two standard errors in parentheses. Seed 1 has the best validation objective.
T
Start
Foresight-SMC
Reference
TV
500
μA
.397 / .436 / .167
.394 / .381 / .225
0.058
0
.423 / .285 / .292
.396 / .316 / .288
0.031
1
.347 / .259 / .394
.408 / .228 / .364
0.060
2
.009 / .005 / .986
.010 / .010 / .981
0.005
3, interior
.001 / .002 / .998
.000 / .003 / .997
0.001
3, left end
.990 / .002 / .008
.991 / .000 / .009
0.001
Appendix
Table E.3 : Allen–Cahn field: channel shares (left end / right end / interior) against the reference, and their total variation (TV). Starts: μA (reference: reverse counting) and one point start of each stratum, labeled by its number of negative sites (reference: AMS).
Figure E.2 : Allen–Cahn field: paths generated by Foresight-SMC with L=1 from the droplet-free point start, one per channel (rows: interior, left end, right end), each the path of median importance weight in its channel. Columns show the field ui at t=0,100,…,500 ; the dashed line is u=0 and the shaded area marks negative sites.
Figure F.1 : Alanine tripeptide: start sets on the (ϕi,ψi) plane of each residue, over the marginal free energy (saturated above 40 kJ mol -1 ). The box is the range of ϕi in A ; dashed lines mark the band ψi∈[−120∘,50∘) , where ei=1 . Each broad set Sj fixes (e1,e2,e3) . Points: 300 start states of each narrow set Sjε .
Method
Cost
Elog (nat) ↓
Diagnostic
Foresight-SMC, twist:
tempered classifier
5.24
0.13±0.03
77 % in B
classifier
5.24
0.18±0.01
18 % in B
egθ
5.24
0.47
16 % in B
Foresight-SMC, L=1
5.24
1.26
ESS 4–15
Reference-proposal SMC
5.24
1.03
46/64 zero
Appendix
Table F.1 : Alanine tripeptide: eight broad queries with diagnostics. Cost: 108 evaluations for all eight queries, excluding one-off costs (Appendix F.2 ). Diagnostic: fraction of particles in B at T (SMC), effective sample size out of 4096 ( L=1 ), islands with a zero estimate out of 64 , or RSE of a single run. ± : SE over three training seeds.
S1ε
S6ε
S4ε
S8ε
103rS
0.55
4.0
4.6
16
Log error ∣logp^−logp∣ (nat)
Foresight-SMC
0.17
0.17
0.21
0.04
Foresight-SMC, untempered classifier
0.02
0.31
0.12
0.17
Foresight-SMC, twist egθ
0.38
0.43
0.52
0.03
Foresight-SMC, L=1
2.66
0.22
1.14
0.09
Appendix
Table F.2 : Alanine tripeptide: four narrow start sets, ordered by increasing rS , at about 6.6×107 evaluations per query (learned-RC AMS: two to three times more). WNV ratio: relative to Foresight-SMC with the tempered classifier twist, the default variant; above one means more work for the same precision. Reverse counting provides the reference. Naive Monte Carlo finds no hit. † : effective sample size below 12 , so the WNV is underestimated.
Start
Reference
Tempered
Untempered
Plug-in
xˉ1
−20.02 ( 6.0% )
0.14
0.11
0.03
xˉ4
−17.72 ( 5.6% )
0.05
0.16
0.07
xˉ6
−18.03 ( 6.6% )
0.11
0.23
0.14
xˉ8
−16.42 ( 5.3% )
0.18
0.11
0.09
Appendix
Table F.3 : Alanine tripeptide, point starts at the narrow-set centers: reference logp (RSE) from an independent Foresight-SMC run (untempered twist, 64 islands) and absolute log errors of Foresight-SMC ( 8 islands) with the two classifier twists and of the classifier plug-in.
Residue 1
Residue 2
Residue 3
μB
0.26
0.25
0.23
Prediction, S1
0.40
0.43
0.38
Foresight-SMC, S1
0.40–0.53
0.32–0.54
0.38–0.53
Prediction, S8
0.09
0.10
0.09
Foresight-SMC, S8
0.10–0.13
0.08–0.12
0.09–0.16
Appendix
Table F.4 : Alanine tripeptide: fraction of end states in the upper basin of B ( ψi∈[−30∘,150∘) ) for residues 1,2,3 . Prediction: initial states Y0∼μB of relaxations, weighted by 1A∩S(YT) . Foresight-SMC: range over three training seeds.
Figure F.2 : Alanine tripeptide: paths of Foresight-SMC over T=16000 steps from the broad set S1 (top) and the narrow set S1ε (bottom), on the (ϕi,ψi) plane of each residue (columns) over the free energy of Figure F.1 . Each row shows 20 paths from a start state (white) to an end state in B (magenta), chosen so that the end states follow the full sample.
Figure F.3 : Alanine tripeptide: potential energy βth−1U(xt) , with βth−1=kB×300 K, shifted to a minimum of zero, along one path from the top row of Figure F.2 (light: every tenth step; dark: running mean over 201 steps). Above: all-atom structures at the marked steps, with residues in the rare conformation in blue. The residues flip one at a time, and each flip raises the potential. None of 32 reference paths from the same start state flips a single residue within T .
Diffusion models are increasingly used as surrogates for expensive simulators in weather prediction, molecular dynamics, and materials design. In these models, computing the probability p0[E] of an event E is difficult, especially when the event of interest is rare. A stable estimate using Monte Carlo becomes computationally intractable, requiring a growing sample size ∝1/p0[E] to compensate for an increasing rarity. In this paper, we present Diffusion rare event sampling with Sequential Monte Carlo (DireSMC), a sequential Monte Carlo scheme that guides a population of weighted samples towards the rare event, giving access not only to samples but also to a calibrated estimate of its probability. We set up our guidance using an analytical relaxation of the event set, allowing the method to easily extend to a wide range of user-defined rare events. We validate our method on a toy problem with analytical solutions and on a score-based climate emulator, where we obtain accurate rare-event probabilities on a range of rarities from 10−3 to 10−5, achieving net speed-ups of 9× to 1413× over Monte Carlo.
Aavash Subedi, Tim Reichelt, Christopher Williams +3
Department of Statistics, University of Oxford · Department of Physics, University of Oxford · Department of Statistics, University of British Columbia
Rare unsafe behaviors in large language models can remain practically significant even when their probability is extremely small, particularly at deployment scales involving millions or billions of interactions. Twisted Sequential Monte Carlo (SMC) provides a principled framework for rare-event probability estimation by learning twist functions that guide generation toward a target event. However, the standard twist learning framework relies on positive samples from the rare-event target distribution, which may be nearly absent before an informative twist has been learned, resulting in unreliable rare-event estimation. We propose Adaptive Multilevel Twisted SMC, which learns the rare-event twist through a sequence of progressively rarer intermediate events. At each level, the learned twist provides more informative positive examples for learning the next twist, ultimately leading to a more accurate final twist for the target rare event. Experiments across diverse tasks and model scales show that the proposed method produces more accurate rare-event probability estimates. By enabling more reliable discovery of hard-to-observe unsafe behaviors, our method provides a practical tool for strengthening the evaluation and safety alignment of deployed language models.
Zixuan Liu, Fangzheng Wu, Brian Summa +1
Department of Computer Science, Tulane University, New Orleans, LA, 70118, USA
We study estimating rare-event probabilities I=P(g(X)>γ) with X∼N(μ,Σ) and general g:Rd→R. We address this problem through importance sampling, and propose a framework that substantially improves efficiency and robustness over baselines such as crude Monte Carlo, adaptive cross-entropy, variational-inference-based methods (including reverse- and forward-KL approaches), as well as Safe-ICE, Subset Simulation, and Sequential Monte Carlo, drawing on ideas from both rare-event estimation and cross-entropy optimization. The key contribution has two parts: first, we separate the problem into coverage, to overcome the cold-start barrier, and fitting, to refine proposals once a meaningful signal is available; second, we constrain the final GMM proposal so that it has finite importance-sampling variance (since coverage alone is not sufficient -- without safeguards, importance sampling may still suffer from infinite variance). Together, these ingredients yield expressive proposals; finite variance does not by itself guarantee practical stability at a fixed sampling budget. Extensive experiments demonstrate substantial variance reduction, strong robustness across diverse benchmarks, and favorable cost--efficiency trade-offs, with the proposed approach often outperforming these baselines, particularly in high-dimensional and multimodal settings where competing methods frequently become unstable or fail. Our code is available at https://github.com/lorek/robust-cfi-is.
Paweł Lorek, Rafał Nowak, Rafał Topolnicki +2
University of Wrocław · Tooploox · TRAILS University of Warsaw +3