Rare language model behaviors can be difficult to study, because obtaining them through ordinary sampling can take a very large number of samples. Alternatively, one can build a sampler that cheaply generates transcripts with a given behavior that are likely under the model. We introduce PosteriorBench, a benchmark that compares such sampling methods by their compute cost and how closely they match ground-truth model samples with a target behavior. We find that no method we evaluate is both efficient and faithful, and we hope PosteriorBench can measure progress toward one that is.
Note: This post includes sensitive content, such as offensive language.
As language models become more capable and more widely deployed, rare unwanted behaviors have increasingly serious consequences. OpenAI models being tested on a cybersecurity benchmark broke into Hugging Face's production infrastructure, and AI agents working on ordinary data retrieval tasks have attempted to hack government websites. Even a single occurrence of such behavior can cause harm, so we want to know before deployment when it comes up and what it looks like.
The usual way to look for such behaviors is to generate many transcripts with a model across a diversity of evaluation scenarios. But a deployed model is called far more times than in testing, so a behavior too rare to show up in testing can still happen after release. We therefore ask: given a language model and a behavior, can we efficiently sample from the model's distribution over transcripts that show the behavior? We call this the behavior posterior sampling problem. More formally, let be the model's distribution over transcripts and the event that a transcript shows the behavior. We want to sample from conditioned on , the behavior posterior .

Samples from the posterior (yellow) are responses from the model's distribution that exhibit the behavior .
Although many methods have been proposed for posterior sampling, they have not been compared in equivalent settings for behavior posterior sampling. PosteriorBench is a testbed with a simple problem: how cheaply can we build a sampler that closely approximates the posterior over responses to a fixed prompt, for a behavior that a regular expression can check? Each regular expression checks for a simple version of a real unwanted behavior, such as profanity or language switching. To collect exact posterior samples as ground truth, we sampled a billion responses from Qwen3.5-0.8B to create 21 prompt–behavior tasks for PosteriorBench, with behavior probabilities from to .
For each method, PosteriorBench measures how many model inferences it takes to build the sampler, how often the sampler shows the behavior, and how close its samples are to the posterior. A good sampler covers the posterior without producing responses that are unlikely under it, and we use forward and reverse KL divergence to measure both.

The original model rarely shows the behavior . A behavior posterior sampling method builds a sampler that shows it more often. PosteriorBench measures the method's cost and how close stays to the posterior .
We evaluate two kinds of methods. Training methods sample from the model repeatedly and train it on the responses that show the behavior. Training-free methods instead write a system prompt or add a steering vector. Even in this simplest form, no method is both efficient and faithful. The training-free methods are cheap, but they plateau at a high KL divergence. The training methods can pass this plateau, but become effective only at a prohibitive cost. Moreover, no training method from prior work beats the SFT baseline, which fine-tunes the model on true posterior samples found by rejection sampling. The figure below shows the results.
Loading the interactive figure…
Posterior fidelity against construction cost on 21 tasks. See the paper for a detailed explanation.
The benchmark also helps answer more detailed design questions. For example, to choose among candidate samplers, a selection signal that estimates reverse KL works best, and sampling from a mixture of the top candidates, weighted by the same signal, lowers forward KL without raising reverse KL. Interpolating between a sampler and the original model [6] within each response also greatly lowers KL when KL is high.
Qualitatively, we find that samplers with lower KL produce samples that look more like true posterior samples. Below are samples from posterior samplers with different levels of KL.
Loading the sample browser…
Overall, behavior posterior sampling remains an open problem. The methods that come closest to the posterior still have to sample the model many times to find examples of the behavior, which is the cost posterior sampling is meant to avoid. Many ideas for new methods are left to explore. For example, can we train a sampler on off-policy examples, which are cheap to obtain, and still have it be faithful to the true posterior? Or, can we better use the model's latent knowledge of the posterior, beyond fine-tuning it on examples? We hope PosteriorBench can serve as a consistent way to measure progress toward building efficient and faithful posterior samplers.
Acknowledgements
We thank Dami Choi, Robin Jia, Eric Price, John Schulman, and Jacob Steinhardt for helpful discussions and feedback.
How to Cite
@misc{xun2026posteriorbench,
title={{PosteriorBench}: Evaluating Behavior Posterior Sampling in Language Models},
author={Xun, Zhiyang and Johnson, Daniel D and Schwettmann, Sarah and Chowdhury, Neil},
year={2026},
eprint={2611.25735},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2611.25735},
}