Training Agents to Fail Predictably: Fine-Tuning for Forecastable Tail Risk

Will Schwarzer, Scott NiekumNeurIPS 2026

TL;DR

Before deploying an AI to billions of users, we test it on much smaller evaluation sets—meaning its worst, rarest failures often stay hidden until it's too late. Instead of trying to build a psychic crystal ball to predict these freak edge cases, the authors flip the problem on its head: they fine-tune the AI model itself so that its failure distribution becomes well-behaved and extrapolatable. The result is an agent whose worst-case deployment behavior can be accurately predicted from a tiny test set, without sacrificing capability or safety.

What Problem Does This Paper Address?

Suppose one prompt in a hundred million tricks your chatbot into giving dangerous advice. A pre-deployment safety evaluation of a million prompts will likely see zero failures, yet a deployment of ten billion prompts will trigger a hundred of them.

To catch this without intentionally inducing dangerous failures during testing, researchers recently proposed assigning every test input a continuous "risk score" (measuring how close the model came to failing, like the probability of a harmful token). On a logarithmic scale, the highest scores in a small evaluation set often form a straight line. Extrapolating that line lets you forecast the worst-case failure in a massive deployment.

There’s a catch, though. That straight-line extrapolation breaks badly if the tail of the model's risk distribution curves upward, or if deployment contains a rare category of input that never showed up in the small evaluation set. In fact, when the authors tested eleven open-weight language models on real-world toxic prompts, this standard forecasting method under-predicted worst-case failures across every single model. If common inputs carry no signal about how a model handles rare inputs, no statistical forecaster can save you.

Methods

Instead of changing the forecaster, Schwarzer and Niekum change the model. Because the shape of a risk-score tail is a property of the model's weights, you can reshape it via gradient descent.

Figure 1: Fine-tuning a model for accurate forecasts of its tail risk. (a) A risk score measures how close the model comes to failure on each task. At test time, we forecast the worst case in deployment from a small fit set of new tasks. To train for this, we split each training task set at random into a small fit set and a large deployment set, so called because it simulates deployment. (b) Following Jones et al. [2025], we fit a line to the top k fit scores and extrapolate it to rarer tasks. We train the model to reduce the line’s errors on the deployment set (red), passing each score’s gradient (arrows) only when following it would lower that task’s risk score, and we add a regularizer to preserve the primary behavior. (c) Safety training that lowers every score by the same factor does not change the tail’s shape, so the forecast may still under-predict the worst case (top). Our training changes the shape, so that on new tasks, a forecast from the fit set alone is accurate (bottom).

During fine-tuning, the authors take a large pool of tasks and repeatedly split it at random into a small fit set (simulating pre-deployment evaluation) and a much larger deployment set. Following standard extreme-value extrapolation, they fit a straight line to the top $k$ risk scores in the fit set and project it outward to predict the worst scores in the deployment set. Because this OLS linear fit is completely differentiable, they use the squared gap between the forecast and the actual deployment scores as their training objective—the forecastability loss.

Of course, a clever optimizer might cheat: if the forecast is too low, the model could "fix" the error by making itself more dangerous on the fit set to tilt the line upward! To prevent this, the authors introduce two safety guardrails (paired with standard KL or return regularization to preserve everyday capabilities):

  • Improving-only mask: Gradients are zeroed out for any individual score if following that gradient would make the model riskier on that task.
  • Minimal-change training: Designed for scenarios where you want to barely touch the base model, this replaces the mask with an anchor constraint (penalizing scores that rise above their pretrained values) and a spread constraint (preventing the optimizer from lazily squashing the entire tail flat).

Datasets

The authors evaluate their approach across three distinct environments:

  • The Password Game (Synthetic LLM Jailbreaking): A dual-use-free "model organism" of jailbreaking where a language model is told in its system prompt never to reveal a secret password. Task sets mix common template jailbreaks with rare (0.32%) adversarial suffixes optimized via Greedy Coordinate Gradient (GCG)—rare enough to usually miss the fit set, but hit deployment.
  • Gridworld with Rare Traps (Multi-task RL): A navigation task where an agent's risk score is its exact expected regret. Common layouts have no traps, while rare layouts (0.15% of the distribution) are filled with them.
  • WildChat Toxic Prompts (Natural LLM Inputs): Real user prompts flagged as toxic from the WildChat dataset, scored by the probability that the model's very first response token is an offensive word from a standard blocklist.

Key Insights and Ideas

  • Decomposing extrapolation failure: Mathematically, forecast error breaks down into a rank term (universal statistical noise from finite samples that actually biases standard Weibull plots toward over-prediction), a curvature term (whether the tail decays faster or slower than exponential), and an occupancy term (the sudden jump caused by rare failure modes missing from the evaluation set). Training can't erase the universal rank noise, so it learns to reshape curvature and pull down rare-event spikes to compensate.
  • Plain safety training doesn't make tails predictable: Standard risk minimization lowers risk scores across the board, which is great—but shifting a jagged tail downward leaves it jagged. Forecastability training actively straightens the tail, aligning rare failure modes with common near-misses.
  • Auditing the auditor: Training against a single-token risk score invites Goodhart's Law—what if the model just learns to blurt out the password on the second token? When audited over 8,064 multi-token rollouts, the 4B pretrained model leaked the password 388 times, while the forecastability-trained model leaked it zero times. Furthermore, tails straightened for one linear forecaster generalized cleanly to five other unseen statistical forecasters (including Generalized Pareto fits).

Key Results

WildChat failure tail before and after minimal-change training, shrinking a 1.8 order-of-magnitude under-prediction down to 0.3.

Figure 2: A natural failure tail before and after training. Each point is a WildChat prompt marked as toxic, with risk score ψ = −log(−log p), where p is the probability that Qwen3-0.6B begins its response with an offensive word. We show one held-out task set, split at random into 250 fit prompts and 2,050 deployment prompts, before training (left) and after 200 steps of minimal-change training (right; Section 5.3). We fit the line to the top k = 50 fit scores rather than k = 10 (Section 6.3). Before training, the highest deployment scores were far above the line beyond the fit set, and the forecast was 1.8 orders of magnitude too low. After training, the deployment scores were close to the line, and the forecast was within 0.3 orders of magnitude. We chose this task set to illustrate a large pretrained error (the ninth largest under-prediction among the 40 held-out task sets of the five seeds). Over 200 random fit/deployment splits, training divided its squared forecast error by 5.2, compared with a median of 3.3 over all 40 (Appendix C).
  • Password Game (Qwen3-0.6B to 8B): Forecastability training slashed held-out squared forecast error by 60x on Qwen3-0.6B (and 75x when combined with post-hoc calibration), crushing standard safety fine-tuning and post-hoc calibration baselines (all below 6x). It lowered worst-case leak probability by ~40 orders of magnitude while causing >100x less capability drift (KL divergence on normal prompts) than standard safety training. Across hardened prompts up to 8B parameters, error dropped by at least 131x.
  • RL Gridworld: Reduced squared forecast error by 14x (52x with calibration), while simultaneously improving average task return by 27% and cutting worst-case regret by a factor of 3.5. A model-free REINFORCE variant using sampled rollouts achieved up to 29.7x error reduction.
  • Minimal-Change on WildChat: Just 200 steps of minimal-change training reduced squared forecast error by 3.2x across held-out WildChat sets (shrinking a 1.8 order-of-magnitude error to 0.3 in the highlighted run above) with a microscopic KL drift of $4.0 \times 10^{-5}$.

Limitations and Future Work

  • Scale and scope: Experiments top out at 8B-parameter models using LoRA adapters, and rely on single-token probabilities or short-horizon RL returns rather than long, multi-turn agentic trajectories. Testing at true frontier scale remains open.
  • Data hungry at train time: While test-time evaluation only needs a tiny fit set, training requires scoring deployment-sized batches on training task sets. Thus, this method shines brightest when you have to repeatedly evaluate new task distributions at deployment using small test sets.
  • Co-training learned forecasters: Because the framework works with any differentiable forecaster, future work could jointly train neural forecasters alongside the main model—teaching the AI and its safety evaluator to speak the same language.

Summary updated

Abstract

Before deployment, an AI system might be evaluated on thousands or even millions of inputs, but after deployment it may encounter billions, so its worst failures may not appear during evaluation. Jones et al. [2025] proposed forecasting how risky the riskiest deployment inputs will be by scoring how close the system comes to failure on each evaluation input and extrapolating from the highest scores. We show that the error of this forecast splits into a noise term, whose distribution is the same for every model up to scale, and terms that depend on the shape of the tail of the model's risk scores. These model-dependent terms can make the forecast under-predict badly, both in theory, whenever the evaluation set lacks a rare kind of input that deployment contains, and in practice: on real user prompts marked as toxic, the forecast under-predicted the probability that a response begins with an offensive word for all eleven language models we tested. Because the shape of this tail is a property of the model, we propose fine-tuning the model itself to make the forecast accurate, using the forecast error as the training loss. In a model organism of jailbreaking and in an RL gridworld with rare traps, our method reduced the held-out squared forecast error by factors of 14 to 60, lowered worst-case risk about as much as direct risk minimization (or more), and preserved the model's primary behavior. For settings in which the model should change as little as possible, we show that training with an alternative safety constraint and an added loss term improved the forecast with far smaller changes to the model. Our method also improved the forecast in RL from sampled returns, in language models of up to 8B parameters, and (with minimal-change training) on the toxic user prompts.
BibTeX
@inproceedings{schwarzer2026training,
  author = {Will Schwarzer and Scott Niekum},
  title = {{Training Agents to Fail Predictably: Fine-Tuning for Forecastable Tail Risk}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=nbRdWENRb8},
}

Loading related content...

Figure