NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

The Illusion of Stochasticity in LLMs

Xiangming Gu, Soham De, Michalis Titsias, Larisa Markeeva, Petar Veličković, Razvan Pascanu

TL;DR

Large Language Models (LLMs) suffer from an "illusion of stochasticity": while their outputs appear random, they are fundamentally unable to sample reliably from specific probability distributions. This failure creates a "knowing-doing gap" where an agentic model may understand an optimal stochastic strategy but remains unable to execute it, leading to predictable and exploitable behaviors.

What Problem Does This Paper Address?

As LLMs are increasingly deployed as autonomous agents, they are required to do more than just reason—they must act. In many complex environments, the optimal action isn't deterministic; it requires sampling from a distribution (e.g., for exploration in Reinforcement Learning or to remain unpredictable in game-theoretic scenarios).

The authors identify a critical failure point: LLMs fail to map their internal probability estimates to their stochastic outputs. While standard RL agents use external random number generators, LLMs are often expected to "be random" natively. This paper investigates whether LLMs can actually perform this sampling or if their perceived randomness is merely an artifact of training data biases and logit entropy.

Methods

The researchers conducted a rigorous empirical analysis across several frontier model families, including Gemini (2.5 Flash/Pro, 3.0 Pro), Qwen3, and OLMo-3. Their evaluation framework included:

  • Direct Prompting: Asking models to sample from simple discrete (e.g., integers 0-9, colors, letters) and continuous (Uniform [0,1], Gaussian) distributions.
  • Decoding Ablations: Testing if varying parameters like temperature ($T$), top-p, and top-k could fix sampling biases.
  • Sampling Strategies: Comparing independent sampling (one call per sample) against batched sampling and sequential sampling (where the model sees its own history).
  • Distribution Conversion: A clever "control" experiment where the model is provided with a true random seed and asked to perform the deterministic math (e.g., Inverse Transform Sampling) to map that seed to a target distribution.
  • Statistical Rigor: Using Chi-Square and Kolmogorov-Smirnov tests to quantify how far LLM outputs deviate from target distributions.

Datasets

The paper primarily uses synthetic benchmarks and agentic scenarios rather than traditional static datasets:

  • MCQ Generation: Prompting models to generate multiple-choice questions where the correct answer position should be randomized.
  • Stackelberg Security Games: A scenario where a "patrol agent" must choose one of four servers to inspect uniformly at random to avoid being exploited by an adaptive attacker.
  • Standard Statistical Distributions: Sampling tasks for Uniform and Gaussian distributions.

Key Insights and Ideas

  • The "C" Bias: One of the most relatable findings is the "positional bias." When asked to randomize the correct answer in a four-choice question, models across families showed a massive preference for option "C".
Figure 1: LLMs are heavily biased towards “C” rather than sampling uniformly when being prompted to generate a multi-choice question.
  • Math vs. Randomness: Crucially, the authors found that powerful models can follow complex deterministic algorithms to convert a provided random seed into a Gaussian distribution. This proves the failure isn't in the model's mathematical reasoning, but specifically in its inability to generate the initial "randomness."
  • Repulsive Sequential Bias: When models are shown their own history to help them "be more random," they often develop a "repulsive" bias—they become obsessed with not repeating the previous number, which is itself a non-random, predictable pattern.
  • Post-Training Amplification: Interestingly, base (pre-trained) models are often closer to uniform than their instruction-tuned or RLHF-tuned counterparts. This suggests that the process of making models "smarter" and more helpful may actually be stripping away their ability to act stochastically by reinforcing specific high-probability patterns.

Key Results

  • Exploitability: In the security game simulation, a uniform policy should result in a 75% attack success rate. However, because the LLMs were so predictable, an adaptive attacker achieved success rates between 96.6% and 99.9%.
  • Statistical Failure: In almost every direct sampling test, p-values were near zero, meaning the null hypothesis (that the LLM is sampling correctly) was resoundingly rejected.
  • Temperature is not a Cure: Even at extremely high temperatures (e.g., $T=2.0$), the models still fell into the same biased patterns (preferring numbers like 7 or 42) while also suffering from increased parsing errors.
  • Simulation Accuracy: While models failed at native sampling, they achieved over 90% accuracy in simulating a Pseudo-Random Number Generator (PRNG) when provided with the code and a seed in the prompt.

Limitations and Future Work

The authors acknowledge that simulating PRNGs via Chain-of-Thought is computationally expensive and slow, making it impractical for high-frequency agentic tasks. Furthermore, LLMs are stateless, whereas true PRNGs require state management to avoid repeating sequences.

The paper suggests that a pragmatic path forward involves providing LLMs with access to stateful sampling tools rather than relying on native generation. They also point toward future research into whether Transformers can be specifically trained to learn complex probability distributions, potentially bridging the "knowing-doing gap" in agentic stochasticity.

Summary updated

BibTeX
@inproceedings{gu2026illusion,
  author = {Xiangming Gu and Soham De and Michalis Titsias and Larisa Markeeva and Petar Veličković and Razvan Pascanu},
  title = {{The Illusion of Stochasticity in LLMs}},
  booktitle = {COLM},
  year = {2026},
  url = {https://openreview.net/forum?id=5GZRQVmSJ7},
}
Figure