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

Propagation of Chaos in Contextual Flow Maps

Shi Chen, Zhengjiang Lin, Kaizhao Liu, Philippe Rigollet

TL;DR

This paper introduces a formal mathematical framework called "contextual flow maps" to analyze how transformers behave as their context length grows arbitrarily large. By leveraging the mathematical machinery of propagation of chaos, the authors prove that finite-context transformers approximate their idealized infinite-context counterparts at an optimal, dimension-free statistical rate of $n^{-1/2}$ during both inference and training. This provides a rigorous theoretical foundation explaining why transformers handle long contexts and scale so stably.

What Problem Does This Paper Address?

As large language models scale, understanding the mathematical impact of context length ($n$) becomes crucial. While previous theoretical work formalized transformers as sequence-to-sequence or measure-to-measure maps, these views often obscure the unique role of the "distinguished token"—such as the [CLS] token in encoder models or the final token used to predict the next word in decoder models.

Figure 1. Three formalizations of transformers.

To bridge this gap, the authors tackle a fundamental question: How accurately does a finite-context transformer approximate an idealized infinite-context limit? They treat context length as a statistical resource, where the tokens provided at inference or training act as empirical samples drawn from an underlying population distribution. The challenge is to track how errors and token correlations propagate across a deep stack of attention layers during both the forward pass (inference) and backward pass (training).

Methods

The authors model the transformer architecture as a continuous-time dynamical system (an ODE/PDE system) across layers, which they term a Contextual Flow Map (CFM).

To analyze this system, they employ two key mathematical techniques:

  1. Propagation of Chaos: Borrowed from statistical physics and the study of McKean–Vlasov equations, this machinery is used to bound the deviation between a system driven by a finite number of interacting particles (the finite context tokens) and its mean-field limit (the infinite population context).
  2. Eulerian Adjoint Formulation: To analyze training stability via Online Gradient Descent (OGD), the authors derive a novel adjoint equation. Unlike classical neural-ODE adjoints that only track a single vector for the distinguished token, this formulation couples a covector adjoint for the token with a scalar adjoint test function that tracks the sensitivity of the entire contextual measure.

Datasets

Not discussed in the paper. This work is entirely theoretical and mathematical; it focuses on proving non-asymptotic statistical convergence rates rather than evaluating performance on empirical datasets or benchmarks.

Key Insights and Ideas

  • Context as a Sample Size: The context length $n$ can be viewed directly as a sample size used to estimate the true background population distribution of tokens.
  • Beating the Curse of Dimensionality: For general dynamical systems, the empirical approximation error scales at a slow rate of $n^{-1/d}$, where $d$ is the token embedding dimension. Because $d$ is typically in the thousands for modern LLMs, this rate would be catastrophically slow. However, because self-attention applies the contextual measure linearly, transformers upgrade to the parametric rate of $n^{-1/2}$, completely bypassing the curse of dimensionality.
  • Scale-Agnostic Stability: The stability constants derived for both the forward flow and the loss gradients are entirely independent of the embedding dimension $d$ and the parameter count $p$. This provides a structural explanation for why transformers remain remarkably stable during training across vastly different model scales.

Key Results

  • Forward Pass Accuracy: Under standard transformer assumptions, the difference between the finite-context token trajectory and the infinite-context ideal is bounded by $O(n^{-1/2})$ uniformly across all layers.
  • Backward Pass Training Stability: During Online Gradient Descent, the parameter trajectory of a finite-context model closely tracks its infinite-context counterpart at the same $O(n^{-1/2})$ rate. This uniform-in-time stability holds over a finite horizon, or across all iterations if a sufficiently large weight decay (ridge penalty) is applied.

Limitations and Future Work

  • Smoothness Assumptions: The core proofs require the activation functions to be twice continuously differentiable ($C^2$-regular), which fits activations like GELU but technically excludes the standard piecewise-linear ReLU. Although the authors note that ReLU can be handled via a separate piecewise analysis, the main elegant theory assumes smoothness.
  • Linearity Dependence: The fast $n^{-1/2}$ rate heavily exploits the fact that the contextual measure enters the self-attention vector field linearly. A compelling direction for future work is to identify weaker, non-linear structural conditions under which this dimension-free parametric rate still holds.

Summary updated

BibTeX
@inproceedings{chen2026propagation,
  author = {Shi Chen and Zhengjiang Lin and Kaizhao Liu and Philippe Rigollet},
  title = {{Propagation of Chaos in Contextual Flow Maps}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=dQwi4yaHoE},
}
Figure