Statistical Mechanics Theory Explains Transformer Next-Token Prediction
A new arXiv paper applies statistical mechanics and random matrix theory to derive an exact theory of next-token prediction in self-attention transformers. It characterizes free energy, the state equation, and test-error scaling for both finite and infinite context lengths. The analysis reveals a double descent phenomenon in zero-temperature learning, indicating that data load and context length are coupled, and shows that infinite-context errors match deterministic ridge shrinkage. The theory is claimed to predict all single-instance learning for finite but large token dimensions.