Beyond the Black Box: A Statistical Model for LLM Reasoning and Inference
Siddhartha Dalal, Vishal Misra
TL;DR
The paper develops a Bayesian lens on LLMs, positing an ideal world where words follow a multinomial transition matrix with a prior and showing that real LLMs approximate this matrix via training data and embedding-based representations. It proves a continuity theorem linking prompt embeddings to the induced next-token distribution and establishes that any prior over multinomials can be decomposed into a finite mixture of Dirichlet priors, enabling tractable Bayesian updating and a principled view of in-context learning (ICL) as posterior adaptation. The framework provides a statistical foundation for understanding phenomena such as ICL scaling, chain-of-thought reasoning, and hallucinations, by connecting embedding geometry, prior mixtures, and posterior updates under cross-entropy loss. It also discusses architectural considerations, the importance of embeddings, and strategies to mitigate hallucinations, with empirical validation on an instrumented Llama model and implications for LLM design and training.
Abstract
This paper introduces a novel Bayesian learning model to explain the behavior of Large Language Models (LLMs), focusing on their core optimization metric of next token prediction. We develop a theoretical framework based on an ideal generative text model represented by a multinomial transition probability matrix with a prior, and examine how LLMs approximate this matrix. Key contributions include: (i) a continuity theorem relating embeddings to multinomial distributions, (ii) a demonstration that LLM text generation aligns with Bayesian learning principles, (iii) an explanation for the emergence of in-context learning in larger models, (iv) empirical validation using visualizations of next token probabilities from an instrumented Llama model Our findings provide new insights into LLM functioning, offering a statistical foundation for understanding their capabilities and limitations. This framework has implications for LLM design, training, and application, potentially guiding future developments in the field.
