Abstract
We present a gauge-theoretic reconstruction of the structural identity between quantum mechanics and the attention mechanism of the Transformer. The original observation—that the conjugate transpose, or dagger, is the defining operation of both theories—is here derived from a single principle: local U(dk) gauge invariance. We formulate attention as a lattice gauge theory on the sequence bundle E = M × Cdk , with the attention weights as the gauge connection, the score matrix as the parallel transport phase, and the attention output as the covariant derivative. The softmax is identified as a gauge-fixing term that breaks the U(1) phase symmetry, and the phase-preserving complex softmax is identified as the gauge-invariant normalization. The density matrix and the Born rule are recovered as the gauge-invariant measurement postulate. We derive the Yang–Mills analogue of attention, introduce the attention curvature Fijk, write down the full gauge-theoretic Lagrangian, and derive the equations of motion. Standard attention is shown to be the real, flat limit of the gauge theory. Complex attention is shown to be the gauge-covariant extension. We make falsifiable predictions, identify open problems, and argue that the dagger is not merely an analogy between quantum mechanics and deep learning but the generator of local gauge transformations in both. The theory is rigorous, derivable from first principles, and reduces to the original formulation in the appropriate limit.