cs.LGOct 12, 2026

Autoregressive Decoding as a Martingale: Characterizing the Stochastic Dynamics of LLM Generation

Authors: Xiahui Zhu, Zhenyi Qi, Wanwei Liu, Haoang Chi, Yang Tan, Xinyu Sun, Ji Wang

Organizations: College of Computer, National University of Defense Technology, Changsha, Hunan, China

Abstract

Large language models (LLMs) have achieved remarkable success across a wide range of language tasks. At their core, autoregressive LLMs are conditional probability models that learn to approximate the next-token distribution given the preceding context. Despite this probabilistic nature, the stochastic dynamics of autoregressive decoding have rarely been investigated from a rigorous probabilistic perspective. In this work, we define the per-step prediction error as the difference between the sampled token indicator and the model's conditional predictive distribution, and prove that the cumulative error process is a martingale with respect to the decoding filtration, implying that its conditional first-order moment is identically zero. Beyond this first-order property, we derive a closed-form expression for the second-order behavior of the martingale sequence: its predictable quadratic variation reduces to ∑t(1−p(yt∣y<t))\sum_t\left(1-p(y_t\mid y_{<t})\right), computable from realized token probabilities alone. This identity establishes a direct theoretical connection between sequence fluctuations and predictive uncertainty during autoregressive decoding. White-box experiments on Llama-3.x and Qwen2.5 families (1B to 72B parameters) verify that the empirically measured second-order moments closely match the theoretical predictions derived from our martingale analysis. These results provide a probabilistic framework for analyzing autoregressive LLM decoding, reveal intrinsic probabilistic fingerprints of different language models, and establish a rigorous mathematical foundation for LLM-generated text detection and uncertainty quantification.

Figures & tables

Explore similar work

Aug 7, 2026

Stochastic Autoregressive Learning

Motivated by LLMs, which generate outputs by iteratively sampling from next-token distributions, we introduce a PAC-learning model for binary stochastic autoregressive learning. This generalizes the deterministic autoregressive learning framework of Joshi et al., COLT 2025. In our model, one fixed generator assigns a Bernoulli next-token distribution to every prompt string. Starting from an input prompt, a token is sampled and appended to the prompt; the same generator is then applied again to this expanded prompt; this procedure is repeated for MM steps. Three forms of supervision are considered: base one-step samples, chain-of-thought (CoT) samples that reveal full random trajectories of length MM, and end-to-end (e2e) samples that reveal only the final token of length MM trajectories. For a generator class, we study the minimum number of samples mbase(ε),mCoT(ε),me2e(ε)m_{base}(\varepsilon),m_{CoT}(\varepsilon), m_{e2e}(\varepsilon), resp., required to learn the one-step probabilities in the base model, and the final-token probability in the CoT and e2e models, under squared loss error~ε\varepsilon. We show that stochastic autoregressive learning fundamentally differs from the deterministic theory. At scale ε\varepsilon, there is no universal comparison between the three learning tasks: both mCoT/mbasem_{CoT}/m_{base} and me2e/mCoTm_{e2e}/m_{CoT} can be made simultaneously arbitrarily larger than M/εM/\varepsilon, the natural analogue for the existing deterministic results. Nevertheless, after altering scales, for every class, CoT learning at scale ε\varepsilon is upper-bounded by base learning at scale ε/M2\varepsilon/M^2, whereas e2e learning at scale ε\varepsilon is upper-bounded, up to logarithmic factors, by (M/ε)mCoT(Θ(ε))(M/\varepsilon) m_{CoT}(Θ(\varepsilon)). These dependencies and scales are essentially tight. We complement these bounds by studying dimension dd logistic functions in our model.
Oct 20, 2026

Predictive Latents for Autoregressive Language Models: Possibility, Gauge, and Obstruction

Autoregressive language models are trained by next-token cross-entropy, yet several recent systems also iterate a hidden state without emitting a token: continuous thoughts, pause steps, and recurrent depth. This note separates three risks on one latent process. The token risk RtokR_{\mathrm{tok}} scores a readout. The teacher-forced latent risk R1R_1 scores a one-step map that sees the true hidden state. The open-loop risk RHR_H scores the same map after it has been iterated on its own outputs. If the Bayes next-token posterior is a function of a kk-dimensional statistic with full-rank covariance, a width-kk latent, a linear least-squares transition, and a refit unembedding match the Bayes token predictor. The statistic is identified only up to an invertible gauge: whitening the residual stream does not change the token law once the unembedding is refit. The matching obstructions are sharp. A constant latent drives R1R_1 to zero while token cross-entropy falls back to the marginal entropy. A perfect token predictor can still hide a null-space walk whose open-loop error grows linearly in the horizon. A small next-latent loss does not certificate next-token prediction, and a small next-token loss does not certificate free latent rollout, unless a rank or injectivity condition is stated with the number.
Sep 20, 2026

The Probabilistic Structure of Large Language Models

This paper presents a probabilistic perspective on large language models (LLMs), developed with the aim of bringing together, in a single self-contained account, tools that are usually treated separately across the literature. LLMs are described through probability measures on the set of sequences of tokens, specified via their autoregressive conditional distributions. Training is formulated as a maximum-likelihood estimation problem, addressed by stochastic gradient methods, while text generation is viewed as the sequential simulation of the resulting stochastic process. The role of the asymmetry of the Kullback--Leibler divergence in text generation is examined in relation with characteristic phenomena such as hallucination and the distinction between statistical plausibility and truth. As a complementary illustration of the same viewpoint, we also discuss diffusion models, built around the score function, which cast generation not as sequential token prediction but as the simulation of a reverse-time stochastic process transforming noise into data both in discrete and continuous time.