← Latest papers
🌀 nonlinear sciences

A Geometric Theory for Nonequilibrium Transformer Dynamics

This paper establishes a variational and geometric framework based on statistical physics to model the joint evolution of Transformer attention and token representations, proving global well-posedness and convergence properties for the resulting coupled Hamiltonian and gradient flow systems.

Original author: Aythami Bethencourt de León, Darryl D. Holm

Published 2026-11-10
📖 5 min read🧠 Deep dive

Original author: Aythami Bethencourt de León, Darryl D. Holm

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the author. For technical accuracy, refer to the original paper. Read full disclaimer

Modern artificial intelligence relies heavily on a type of computer program called a Transformer, which powers everything from language translation to creative writing. At the heart of these programs is a mechanism known as self-attention. Imagine a reader scanning a sentence; self-attention is the mental process that decides which words are most important to focus on at any given moment. In a computer, this works by taking a sequence of data points, called tokens, and calculating how much each one should influence the others. The system assigns a weight to every possible pair of tokens, turns those weights into a probability distribution using a standard mathematical tool called softmax, and then uses those probabilities to blend information together. For years, researchers have treated this weighting process as an instantaneous calculation: the computer looks at the current data, computes the weights, and moves on. However, this view ignores a crucial possibility: that the attention mechanism itself might have a history, a memory of past scores that evolves over time rather than resetting instantly.

Two researchers, Aythami Bethencourt de León and Darryl D. Holm, have developed a new mathematical theory that treats the evolution of these attention weights as a physical process, similar to how heat spreads through a material or how a fluid flows. They propose that the attention weights do not simply snap to their optimal values the moment the data changes. Instead, they relax toward those values over time, driven by a concept from statistical physics known as free energy. In their framework, the system seeks a state of balance where the attention weights minimize a specific energy function. This function rewards the system for focusing on high-scoring tokens but also penalizes it for becoming too rigid or concentrated, encouraging a degree of flexibility. By modeling the change in attention weights as a gradient flow on a specific geometric landscape, the authors show that the system naturally settles into the standard softmax distribution when the data is static, but behaves differently when the data is moving.

The core of their discovery is that if the underlying data representations change over time, the attention weights lag behind. They do not instantly match the new optimal configuration; instead, they carry an exponentially weighted memory of past scores. The researchers proved that this lag can be described precisely using a change of variables that turns the complex, non-linear movement of the weights into a simple, linear equation. This linearization allows them to calculate exactly how far the current attention weights are from the ideal, instantaneous weights. They found that if the data changes slowly enough, the attention mechanism can track it closely. However, if the data shifts rapidly, the attention weights will inevitably fall behind, creating a measurable gap between what the system is doing and what it would do if it could react instantly. This gap is not an error in the traditional sense but a fundamental feature of a system with memory and inertia.

To make this theory complete, the authors coupled the evolution of the attention weights with the evolution of the data tokens themselves. They constructed a unified system where the tokens move according to the laws of Hamiltonian dynamics, a framework used to describe the motion of physical objects like planets or pendulums, while the attention weights relax according to the free energy gradient. In this coupled system, the movement of the tokens generates forces that push the attention weights, and the attention weights, in turn, influence how the tokens move. The researchers demonstrated that this combined system is mathematically well-behaved: it has a unique solution that exists for all time, and the total energy of the system decreases steadily as the attention weights relax, eventually stabilizing. They also explored two alternative ways to link the tokens and attention, one that penalizes differences between a token and the values it attends to, and another that directly sets the speed of the tokens based on the attention output. In all three cases, they proved that the system remains stable and that the attention weights stay positive and properly normalized, ensuring they always function as valid probabilities.

This work shifts the perspective on how artificial intelligence models process information. Rather than viewing attention as a static calculation performed at every step, it reveals attention as a dynamic, evolving entity with its own internal state and history. The findings suggest that the "lag" in attention is a natural consequence of the system trying to balance immediate performance with the stability of its internal state. By providing a rigorous mathematical description of this process, the authors offer a new way to understand how these models learn and adapt. Their theory does not just describe what happens; it provides a set of tools to predict how the system will behave under different conditions, such as when the input data changes rapidly or when the system is initialized with different starting conditions. This geometric and physical approach opens the door to designing more robust and efficient models that can better handle the complexities of real-world data, where information is rarely static and the cost of reacting too quickly or too slowly can be significant.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →