TL;DR
Large Language Models (LLMs) often correctly state the parameters of a probability distribution but fail miserably when asked to actually sample from it. This paper introduces the witness advantage, a novel per-rollout reward for Group Relative Policy Optimization (GRPO) that uses Maximum Mean Discrepancy (MMD) to align a model's output probabilities with its stated targets without sacrificing general reasoning capabilities.
What Problem Does This Paper Address?
We increasingly rely on LLMs to simulate survey respondents, generate synthetic data, or act as randomized agents in games. While instruction-tuned models are surprisingly good at describing distributions (e.g., "Flip a coin where Heads has a 0.5% chance"), they are notoriously bad at sampling from them. A model might correctly state $P(\text{Heads}) = 0.005$ but then proceed to generate "Heads" 67.8% of the time.
Current fixes like clever prompting or specialized decoding rules only bridge a small fraction of this gap. Traditional supervised fine-tuning can fix the sampling behavior but often causes "catastrophic forgetting," significantly degrading the model's general performance on benchmarks like MMLU. The authors seek a way to teach models to "sample what they say" using policy optimization while keeping their general intelligence intact.
Methods
The authors build upon Group Relative Policy Optimization (GRPO), a popular RLHF variant. GRPO typically compares a group of model outputs (rollouts) to a baseline. However, distribution matching is a "group-level" property—you can't tell if a single coin flip is "wrong," only if a hundred flips don't match the target ratio.
If you reward the entire group based on how well their collective distribution matches the target, GRPO’s internal centering mechanism sets all advantages to zero, providing no learning signal. To solve this, the authors introduce the witness advantage:
- Maximum Mean Discrepancy (MMD): They use MMD to measure the distance between the model's empirical distribution and the target distribution.
- The Witness Function: In MMD, the witness function identifies exactly which outcomes are being over-produced or under-produced.
- Per-Rollout Credit: Instead of a group reward, each individual rollout receives a reward based on the negative witness at its specific outcome.
- If a rollout produces an outcome that the rest of the group under-produces, it gets a positive reward.
- If it produces an outcome that is over-produced, it gets a negative reward.
- Closed-Form Computation: The advantage is calculated efficiently using leave-one-out frequencies within the group.
The authors prove that this approach performs gradient descent on the squared MMD distance between the model and the target.
Datasets
The researchers evaluated their method across several tiers of complexity:
- Synthetic Distributions (Spectrum Suite): Biased coin, binomial, geometric, Poisson, hypergeometric, and Zipf.
- Unseen Families: Benchmarks not used during training, including "number of empty boxes," discrete triangular, and logarithmic series.
- Real-World Tasks:
- Urn draws: Simulating drawing colored balls.
- GlobalOpinionQA: Matching cross-country opinion distributions.
- NYTimes books: Simulating book preferences by demographic.
- Structured Outputs: A sibling-discovery task requiring the model to identify valid pairs before sampling.
Key Insights and Ideas
- The "Stating vs. Sampling" Paradox: The error isn't in the model's knowledge or the sampling step itself, but in the underlying output probabilities. The model "knows" the truth but its logits are biased.
- Credit Assignment is King: The core innovation is turning a global distribution error into a local, per-sample signal. Without this "per-outcome credit," policy optimization fails to converge.
- Size Matters: The authors compared their "witness advantage" (which scales with the size of the mismatch) to a "sign witness" (which only looks at the direction of the error). They found that for distributions with "low-mass" outcomes (rare events, like in Zipf distributions), the magnitude of the reward is essential for reaching the target.
Key Results
- Dramatic Error Reduction: On a biased coin ($P=0.005$), the model's probability of Heads dropped from 0.678 to 0.041 after training.
- Generalization: The model removed 36% of the excess error on distribution families it had never seen during training, suggesting it learned a general capability to follow distribution instructions.
- Capability Preservation: Unlike supervised baselines that tanked general performance, the witness advantage maintained MMLU and IFEval scores within the noise band of the original untrained model.
- Efficiency: Substantial improvements were achieved with only one to three GPU-hours of training on a single 48 GB GPU.
Limitations and Future Work
- Finite Outcome Spaces: The current method requires a parser to map text responses to a finite set of discrete outcomes (e.g., mapping "The result is 3" to the integer 3).
- Scaling to Free-Form Text: The authors suggest that the witness advantage could be extended to free-form text by using kernels that measure semantic similarity rather than exact matches. This would allow for distribution alignment in open-ended creative or conversational tasks.
- Spread-out Distributions: The model still struggles slightly with highly spread-out distributions (like Poisson), where it tends to produce samples that are more dispersed than the target.
Summary updated