Mathematical modeling study uncovers a unified path-cocycle framework in deep transformers, demonstrating exact dynamical invariants across curvature, memory, and in-context optimization.
Transformer theory uses several precise but disconnected mathematical objects: attention flows, residual Jacobian products, Fisher metrics, curvature, in-context optimization, and test-time memory. We unify them through a path--cocycleframework in which a depth-indexed transformer is a nonautonomous differentiable dynamical system. Its Jacobian products form a first-order cocycle, while a block-triangular lift on symmetric tensors transports second variations. For the architecture itself, we derive the exact single-head attention differential, the sharp row-softmax factor $1/2$, the LayerNorm derivative and shift-gauge kernel, and an explicit local certificate for a sequential pre-norm transformer block. Under stated stationarity, ergodicity, and integrability assumptions, multiplicative ergodic theory yields Lyapunov exponents; the lifted spectrum combines first-order exponents with their pairwise sums. The cocycle induces output-relative observable exponents and Fisher pullback metrics. A terminal-loss Hessian separates into a positive Gauss--Newton/Fisher term and residual curvature governed by the second-order cocycle. Its endpoint-anchored integral gives an exact finite-displacement identity. We also prove a criticality--intermittency theorem for independentscalar gains, derive the exact exponent of linear-gradient-descent in-context learning, and compute a scalar gated-memory exponent within a common augmented-state model for transformers, xLSTMs, Titans, and self-adaptive architectures. For modular addition, Fourier characters turn additive paths into multiplicative cocycles, the Chinese remainder theorem supplies an exact product decomposition, finite Cayley-path neighborhoods formalize approximate cosets, and disc features are linear projections of torus features. This connects approximate-CRT and representation-manifold accounts while separating exact algebra from empirical claims about learned circuits. An accompanying Lean~4 project contains 58 machine-checked theorem declarations for the indexed finite proof kernels and conditional reductions, including softmax and centering gauges, curvature,gated memory, cyclic transport, CRT, approximate cosets, and torus--disc factorization. Deep ergodic, probabilistic, architectural, and empirical inputs remain explicitly conditional or external. Thus the framework connects these theories without identifying Lyapunov stability with generalization, causality, memory capacity, universality, or global optimality.
No takes yet. Share an insight, caveat, or question.
Miquel Noguer Alonso (2026) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: