SAI
← All ICML 2026 orals

Rare Event Analysis of Large Language Models

Jake McAllister Dorman, Edward Gillman, Dominic C Rose, Jamie F. Mair, Juan P. Garrahan

OralReplication not startedPaper PDFCode repoOpenReview

Rare Event Analysis of Large Language Models

SAI paper + code review · Referee report

Summary

This paper introduces a systematic framework for rare event analysis (REA) of large language models, transposing techniques from statistical mechanics — transition path sampling (TPS), umbrella / MBAR reweighting, and bootstrap / Wilson confidence intervals — into the LLM setting. The conceptual move is straightforward but well motivated: treat an LLM as a stochastic process over token sequences, define a target and biasing observable over completions, sample from exponentially tilted distributions via annealed TPS, and reconstruct densities of arbitrary observables in tails that direct sampling cannot reach. The authors instantiate this on TinyStories-8M with two illustrative observables (ARI and completion log-probability), report tail densities several orders of magnitude below the direct-sampling floor at a matched token budget, and use the extra reach to expose a genuinely interesting failure mode: very high-ARI completions that lie outside the training-data range but that the model still assigns non-trivial probability, apparently because it "falls back" on token repetition. The main strength is the deliberately end-to-end and practical framing: theory, TPS/MBAR algorithms, hyperparameter guidance, convergence diagnostics (Gelman–Rubin, MBAR overlap), a bias-versus-variance check, and a case study of exploratory data analysis are all in one place, and the appendix collects operational advice — burn-in, annealing, proposal choices, parallel tempering, infilling — that would otherwise be scattered across the molecular-simulation literature. The main limitations are that the empirical demonstration is narrow — one small open-weights model, one main prompt for headline results, a single bias schedule per observable, and no comparison against the alternative rare-event samplers the authors themselves cite (SMC, cloning, RL-based) — and that some of the more forward-looking claims (that the small-model setting "is not a limitation", that Gemini-scale REA would need only "about one second" of aggregate throughput) go beyond what is actually demonstrated. There are also several avoidable internal inconsistencies in Section 4 and Appendix B/C, and a light exploration section, that a careful reader will trip on.

Strengths

  • Conceptual contribution. The paper cleanly connects an established stat-mech/computational-chemistry toolbox (TPS, umbrella sampling, MBAR, GR, bootstrap CIs) to a currently ad-hoc problem in LLM analysis, and frames the connection at a level of generality — target vs biasing observable, tilted distributions, importance-sampling reweighting — that will let practitioners plug in their own observables.
  • Practical, end-to-end orientation. Section 4 and Appendix C are unusually detailed: annealing schedules, burn-in policy, GR threshold, overlap cutoff, bias-selection heuristics, forward-shooting versus infilling proposals, small-model / jailbreak / finetuned proposals, and parallel tempering are all discussed with concrete guidance rather than left as citations.
  • Genuinely informative empirical finding. Figure 5's excursion of high-ARI, high-log-prob, highly-repetitive completions is a nice concrete illustration of what "rare event exploration" can surface — an OOD behaviour that direct sampling would essentially never see, and that has a plausible mechanistic story.
  • Honest treatment of statistical caveats within the reported setup. The authors flag the coverage caveat, run a chain-doubling bias check, report the overlap matrix as a diagnostic, and use the ARI cap deliberately to keep acceptance rates viable.
  • Released code and documented data. A repository is provided; the notebooks implement the individual building blocks (biased TPS, pymbar MBAR, bootstrap CIs, Wilson intervals, overlap-matrix output), and the paper's key hyperparameters appear as commented-out defaults, giving a useful scaffold to work from.

Weaknesses

  • Empirical scope is narrower than the framing. All headline results come from one model (TinyStories-8M), one prompt, and one bias schedule per observable. Appendix D partly addresses prompt sensitivity for ARI only, and even there one panel (7c) is a visible failure. The claim that the small-model choice "is not a limitation" is asserted rather than demonstrated; TPS acceptance, MCMC mixing, MBAR overlap, and small-model-proposal effectiveness can all degrade non-linearly with scale.
  • Missing comparison to alternative rare-event samplers. SMC / particle filtering, cloning, and RL-based tilted-distribution samplers are all cited in Section 2 as principled alternatives, but the empirical comparison is only against direct sampling. This makes the reported order-of-magnitude improvement trivially true and leaves open which method a practitioner should actually pick.
  • Compute extrapolation to production LLMs is rhetorical. Dividing the total token budget by Gemini's aggregate monthly throughput conflates single-user sequential MCMC on an 8M-parameter model with production-scale batched inference; it does not support the implicit claim that the same analysis is imminently feasible on frontier models.
  • Statistical-error accounting is incomplete. The chain-doubling analysis shows tail bias that is comparable to the CI half-width, but this is presented as a case for more within-chain steps rather than as evidence that the reported CIs likely under-cover. No coverage validation (e.g., against a toy problem with known tail) is provided.
  • Section 6 EDA is thin. A single ARI-vs-log-prob scatter and one repetitive-completion anecdote support the interesting "extrapolation-by-repetition" claim, but there is no quantitative validation of "consecutive-token repeats" as a proxy (calibration, per-bin precision/recall, false-positive rate on typical completions).
  • Internal inconsistencies. "4×1044\times 10^4 TPS steps" versus "4×1054\times 10^5 samples per bias"; "4.2 million" versus "4.1 million" direct-sampling completions; Algorithm 1 (billed as generic MH) parameterised by "Number of TPS steps"; the Gelman–Rubin quantity BB described as "the mean of the variances of the chains" while the surrounding notation makes it the variance of the chain means; the Figure 7 caption describing horizontal / vertical and dashed / dotted reference lines inconsistently. These are individually small but collectively make the methodology harder to reconstruct.
  • A few technical claims are overstated in the appendices. Detailed balance is presented as sufficient for a unique stationary distribution (it is not — irreducibility is required). The MBAR overlap matrix is asserted to be symmetric when Ni=NjN_i=N_j without derivation, though the symmetry is estimator-specific. The column-stochastic convention deviates from textbook Markov-chain notation without pointing out the implication for the update / eigenvalue equations.
  • Impact statement. The paper's own motivation repeatedly invokes AI safety, red-teaming, and probing rare undesirable behaviours; a boilerplate "no consequences to highlight" statement is at odds with that framing.

Reproducibility & code

Based on inspection of the released repository (read, not executed):

  • Building blocks are shipped, orchestration is not. The notebooks contain the annealed TPS sampling loop, MBAR reweighting via pymbar, bootstrap CIs, the Wilson-interval routine, and the overlap-matrix computation. Paper-scale hyperparameters (10 biases in [0.1,1.0][0.1,1.0] / [0.005,0.05][0.005,0.05], 10 % burn-in, GR < 1.1, 96 % bootstrap CIs, 0.03 overlap cutoff) are present as commented-out defaults. This is a solid scaffold for someone who already knows what to plot.
  • Headline aggregates require code the reader must write. No cell reproduces Figure 3's four-panel layout with the training-data histogram (green) and the "<10 samples" OOD shading, Figure 4(b)'s half-chain bias-check panel, Figure 5's ARI-vs-log-prob scatter with the consecutive-repeat colormap and inset, Figure 6's overlap-matrix heatmap with the 0.03 white cutoff, or Figure 7's four-prompt panel. A "minimal implementation" is an accurate description, but the paper's language suggests fuller reproducibility than the artefacts deliver.
  • Observable divergence: uncapped ARI in the released code. The paper's compute_ari caps ARI at 15 for methodological reasons (acceptance-rate stability, linguistic interpretation), but the shipped implementation wraps textstat's uncapped ARI. A reader who regenerates trajectories with the released code will obtain a different observable and correspondingly different acceptance behaviour.
  • Exploration pipeline is absent. No code launches the 2.1×1062.1\times 10^6-completion ARI-biased TPS run, computes the "Repeats" observable, or produces Figure 5. The illustrative "Trurururu…" completion cannot be located in shipped artefacts.
  • Multi-prompt experiment is absent. No code loads the TinyStories validation split, selects the >272-token subset, orders by ARI, picks the 0/33/67/100 percentile prompts, or runs the per-prompt TPS budget needed for Figure 7. In particular, the failure case in panel (c) — the most informative panel about method limits in the whole paper — cannot be independently examined.
  • Training-data histogram and OOD reference not provided. The green training-data histogram and the derived "<10 samples per bin" OOD shading in Figures 3 and 5 have no loading or computation code and are not shipped as pre-computed CSVs.
  • Data is external and manual. The trajectories used to populate the paper figures are on Zenodo rather than in-repo, and the notebooks assume the user has manually placed them in data/paper/.

Recommended Changes

Essential

  • Reconcile the sampling schedule. In Section 4 / Figure 2 caption, state exactly what one "TPS step" produces and reconcile "4×1044\times 10^4 TPS steps" with "4×1054\times 10^5 samples per bias"; likewise reconcile "4.2 million" (Section 4) with "4.1×1064.1\times 10^6" (Figure 3 caption) direct completions.
  • Fix the Gelman–Rubin description. State BB as the variance of the chain means (between-chain), WW as the mean of the chain variances (within-chain), and correct the limit statement so that the quantity going to zero is BB, not "the mean of the variances of the chains".
  • Qualify the detailed-balance uniqueness claim. Rewrite Appendix B.1 to say detailed balance is sufficient for π\pi to be a stationary distribution, with irreducibility (and aperiodicity for convergence) needed for uniqueness.
  • Clarify the overlap-matrix symmetry. Either give a short derivation that Oij=OjiO_{ij}=O_{ji} when Ni=NjN_i=N_j for the specific mixture-based estimator used, or drop the general symmetry claim in Appendix C.8.
  • Correct the Figure 7 caption. Change "horizontal dashed lines" to "vertical" and reconcile the "dotted" / "dashed" descriptions; remove the redundant sentence.
  • Rename Algorithm 1's iteration count. Replace "Number of TPS Steps" with a generic "Number of iterations" (or "MH steps") to match Algorithm 1's stated role as generic MH.
  • Bring reproducibility artefacts up to the level of the framing. Ship the training-data ARI histogram (or a script that computes it) and enforce the ARI-cap-at-15 in the released compute_ari; add plotting cells that produce Figures 3, 4(b), 5, 6, and 7 from the Zenodo trajectories; and add the exploration TPS pipeline (with the Repeats observable) and the Appendix D multi-prompt orchestration.

Suggested

  • Broaden the empirical evaluation. At least one additional model at a different scale (e.g., TinyStories-33M or a small open-weights instruction-tuned LM), and a small prompt sweep for Log-Prob as well as ARI, would substantially strengthen the generality claim currently expressed by "this is not a limitation".
  • Add a baseline against another rare-event sampler. Given that the paper explicitly cites SMC (Cerou et al., Lew et al., Loula et al.) and RL-based tilted-sampling methods as directly relevant, a one-observable head-to-head at matched token budget would let readers calibrate the TPS + MBAR choice.
  • Report total error, not variance alone, in the tails. Extend the chain-doubling bias check until Δh|\Delta h| is clearly sub-CI, or attach a bias-inflated error band; add a small toy-problem coverage check for the reported 96 % CIs.
  • Retire or reframe the Gemini extrapolation. Replace the "one second of Gemini" comparison with a per-GPU-hour or per-dollar estimate that accounts for model scale and the sequential nature of TPS.
  • Validate the "repeats" proxy quantitatively. In Section 6, add a calibration curve or per-bin precision/recall of "high ARI given many consecutive repeats" on a modest test set of typical completions, so that the proxy claim is anchored numerically rather than by one anecdote.
  • Strengthen the impact statement. Briefly acknowledge the dual-use nature of TPS-based rare-event sampling for LLMs (red-teaming vs jailbreak discovery), given that the paper itself invokes AI-safety and jailbreaking prompts as applications.
  • State the small-model-proposal condition precisely. In Appendix C.6.2, replace "sufficiently similar distributions" with a condition on the log-importance-ratio (bounded, low variance) or on the effective sample size.
  • Note the column-stochastic convention explicitly. In Appendix B.1, spell out the resulting update rule p(t+1)=Pp(t)p^{(t+1)}=P\, p^{(t)} and π=Pπ\pi = P\pi so that a reader habituated to the row-stochastic convention does not silently transpose.