Manuscript Offprint
arXiv:2610.37656Attention as Lattice Gauge Theory: Relations Interact Only Through Wilson Loops
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Relations compose through the entity they share—Alice is Bob’s mother and Bob is Carol’s father, so Alice is Carol’s grandmother—and the order matters, since a father’s mother is not a mother’s father; verifying a composed relation means closing the loop. We show that if each entity’s coordinate frame may be rotated independently (per-entity frame freedom [1]), three things follow. In the pure-gauge sector, relations that share no cycle cannot interact at all. The only gauge-invariant score of a triangle is a class function of its holonomy —a Wilson loop. And the only equivariant update of an edge is with conjugation-equivariant. Edge attention by Wilson loops is therefore not one design among many but the unique form the symmetry permits. Three communities hold pieces of this form: the commuting-operator embeddings of knowledge graphs [32, 33] are its abelian (commuting) sector; AlphaFold’s triangle update [2] and the Edge Transformer [3] have its shape—an edge updated through the third vertex—without its constraints; and lattice QCD builds it equivariantly on lattices [22, 27]. We instantiate the equivariant sub-family on general relational graphs as holonomy attention. With no training and composition alone, it infers unobserved relations on sparse graphs at 0.88 with a fifth of the edges corrupted, at or slightly below specialist synchronization algorithms, where every commutative architecture is capped at 0.083; its holonomy score flags corrupted triangles at AUC 0.99 where commuting scores are capped at 0.76 by a second selection rule, and it separates clusters without labels.
1 Frame freedom and the transport sector
In a lattice gauge theory, matter fields live at sites and gauge fields on links; comparing matter across sites requires parallel transport, and the gauge field interacts only around plaquettes, the elementary closed loops [19]. We show this structure is forced in attention: per-entity frame freedom requires transported scores between entities and plaquette-mediated interaction between relation operators. The dictionary is direct: sites map to entities, link variables to relation transports , plaquette holonomies to Wilson loops of relation triangles, flat connections to standard attention [1], and the gauge self-coupling to the forced form proved here.
Holonomy and frame freedom. Transporting a vector around a closed path multiplies it by the holonomy, the net rotation the loop accumulates; its trace, the Wilson loop, is a number independent of the coordinate system at every vertex. Entities introduced on the fly—a name in a story, a variable in a program—have no intrinsic coordinate system: rotating their embedding alone does not change
Preprint. Accepted at the 9th Workshop on Machine Learning and the Physical Sciences (ML4PS 2026).
(a) the forced update

(b) , 14 entities, zero-shot

(c) corruption detection, p = 0.3
(d) two clusters, no labels
Figure 1: Holonomy attention, zero-shot. (a) The forced update. (b) Accuracy on unobserved relations versus corrupted fraction (14 entities, degree 8, four rounds; mean and sd, 10 instances). (c) Holonomy score tr H/d of observed triangles at p=0.3 (discrete: permutation traces are integers). (d) The same score separates within- from cross-cluster triangles with no labels.
the task. A recent study [1] proves that under this symmetry any admissible attention score depends on the entities only through and (for isometries, through ), and that because any equivariant map is rank one, the transport cannot be computed from the two entities and must be supplied by relation data outside the pair. The symmetry is the task's, not a network's: a fresh entity's frame carries no information, so any predictor must be invariant to it; a shared-basis model meets that only by learning transports. The flat limit. When every loop's holonomy is trivial, a shared frame exists and the forced score reduces to plain dot-product attention; a standard head realizes exactly this form with a constant per-head transport composed only through depth, so standard attention is the flat-connection limit of a richer theory [1].
Prior work. On lattices the form is known: gauge-equivariant flows, smearing, Wilson-loop attention, and gauge-covariant message passing all realize conjugation-equivariant plaquette updates [22–24, 27, 28], and such layers are known to suffice [12, 13]. In synchronization, holonomy classifies edge potentials [29] and cycle inconsistency is the standard diagnostic [11, 30]. In ML more broadly, gauge structure appears through frames on meshes [6, 7], operator readings of attention [4], orthogonal state models [5], and sheaf networks [20, 21, 35], none with interaction between edge maps. What we add is the derivation from per-entity frame freedom on general relational graphs—the closed-form statement, where the reflections matter—its reading across three literatures, and the measurements below. Each edge carries with , and a gauge transformation (an independent change of coordinates at each entity) acts by .
No cycle, no interaction. If a set of edges contains no cycle, gauge-fixing along its spanning tree sends every transport to I. Any function of the transports invariant under (one rotation per vertex) is therefore constant. An equivariant update of an edge must, at the identity, commute with the residual diagonal , so by Schur it is a scalar, ; undoing the gauge gives . In the pure-gauge sector the edge cannot be moved by the others (with entity vectors, is an equivariant edge term with no cycle). Two edges sharing a vertex but no closing edge form a tree, so no “global edge attention” respects the symmetry: relation operators interact only around cycles. What cycle-mediated interaction looks like is then the question, and the answer is unique.
Plaquette invariants are Wilson loops. Let be the transports of a triangle and its holonomy. Setting , , sends the triple to , and the only freedom left is the diagonal, . The orbits are therefore the conjugacy classes of , and the continuous invariants are exactly the class functions of : functions with , which see the eigenvalues and not the basis, generated by , [8]. The reflections are load-bearing—in the rotations share a characteristic polynomial but are not conjugate—and the same argument holds for a cycle of any length ; for several cycles the invariants are functions of under simultaneous conjugation. On a graph this is the classification of [29]; on a lattice it is loop reconstruction [31].
Theorem 1 (Edge-level forced form). Every continuous equivariant update of from a cycle through it, with holonomy H based at i, is with , and in the closure of , class functions, intersected with .
Proof intuition. In the gauge set . Equivariance under the diagonal gives , and returning to the original gauge supplies the prefactor . On , , so words in and reduce to integer powers (the polynomial case is [8]); continuous equivariant maps are limits of polynomial ones. The same gauge fixing gives, for several cycles through the edge, under simultaneous conjugation—with a candidate in place of for an absent edge—which is the case run below.
Instances. Setting gives : composition through the third vertex. With several third vertices and class-function scores , the forced aggregate is with the polar projection to (the nearest orthogonal matrix). Since is equivariant wherever the sum is invertible, the aggregate stays in the forced family, with a function of the several holonomies. Commuting operators are simultaneously diagonalizable, so their composition is a coordinate-wise product: the abelian sector is the commuting-operator knowledge-graph embeddings—RotatE, ComplEx, DistMult [32–34]—whose commutative composition DihEdral [26] escapes with a finite non-abelian group at the node level; none has an edge-level update. In this sector , , so edges couple only linearly, through the synchronization Laplacian [9, 10], as photons do not interact with each other; the Wilson action’s commutator term (Appendix B) is the self-interaction that makes the non-abelian sector gluon-like, and this paper’s subject.
The Edge Transformer’s and AlphaFold’s triangle updates have the form’s shape—an edge updated by a weighted sum over third vertices of a bilinear message from the other two edges—but none of its constraints: states are not transports, the bilinear map is unconstrained (with channels it contains matrix multiplication), and scores are not invariant. They are the unconstrained superset, the forced form its equivariant sub-family. A design rule follows: one cycle through an edge has the same holonomy whichever of its edges is wrong, so one loop detects but cannot localize; two triangles do, via the square that avoids the edge—score a candidate only by loops that avoid it, as the Edge Transformer’s logit already does.
The update is APE smearing [25] with two-link staples (the paths around a link) and Wilson-loop weights [24, 27], known on lattices since 1987; what we add is the proof that nothing else exists on general graphs, the reading that unifies three literatures, and two selection rules that the form predicts and the experiments confirm.
3 The non-abelian sector: holonomy attention
We instantiate the non-abelian sector as holonomy attention: an edge-level attention mechanism whose scores are Wilson loops and whose messages are compositions through shared vertices, projected back to (Figure 1a). Load the group’s faithful permutation representation ( ) as a library, run four rounds of with , the mean over of , (a five-fold sweep moves the routing gain by points), and snap to the nearest group element in Frobenius norm.
Observed edges are held fixed; an absent edge is scored by the mutual consistency of its candidates , and is the holonomy of the square , a loop that avoids the edge, as the design rule requires. Scoring an edge instead by a triangle that contains it is self-confirming and costs 5–12 points (Table 1, “literal”). No parameters are learned; code is released with the paper.
We test it on group synchronization—recovering frames from noisy pairwise relations—with outliers: fourteen entities carry hidden frames in , the 24 permutations of four objects; a random set of pairs of fixed size, resampled until connected, is observed; each observed relation is replaced with probability by a different uniform random element, with kept; the task is the relation between an unobserved pair, a standard problem in cryo-EM and sensor calibration [9]. Holonomy attention is not a better synchronizer: Singer’s eigenvector method [9] ties it and edges it by 0–5 points with one reweighting pass, and cycle-edge message passing [11] is ahead on a matched
| Protocol () | p | single path | uniform | holonomy attn. | literal | spectral | spectral+1 |
|---|---|---|---|---|---|---|---|
| sparse, deg. 5 | 0.2 | 0.625 | 0.872 | 0.886 | 0.753 | 0.897 | 0.912 |
| dense, deg. 8 | 0.2 | 0.645 | 0.982 | 0.988 | 0.935 | 0.987 | 0.990 |
| dense, deg. 8 | 0.3 | 0.488 | 0.912 | 0.937 | 0.820 | 0.933 | 0.949 |
| dense, deg. 8 | 0.45 | 0.309 | 0.623 | 0.700 | 0.559 | 0.678 | 0.753 |
Table 1: Accuracy on unobserved pairs, four rounds, , 1000 instances per cell, released harness, seed 2026 (95% CI ); paired holonomy-uniform: , , , . “Literal” scores an edge by a triangle containing it; abelian ceiling 0.083. Figure 1b–d: earlier implementation, 10–15 instances.
pilot by 3, 3, 0, 11 points at , 0.2, 0.3, 0.45 (standard error ). The numbers test the theory, in three results (Table 1).
Composition is the capability. On sparse graphs at (Table 1) holonomy attention reaches 0.89 where the single path reaches 0.63, and composition through cycles is 26 to 45 points above the single path on every row; any architecture confined to the abelian sector—the commuting-operator embeddings—is capped at , the fraction of a group that commuting operators distinguish (the kernel argument of [1]), and a character-level composition measures exactly that (0.083).
Routing is the refinement. On the dense graphs of Figure 1b holonomy scores and uniform weights coincide at low corruption; the uniform mean bends where clean two-hop paths become a minority, at , and the paired gain opens there, at and at 0.45; iterated reweighting does better still.
The holonomy score is the invariant statistic. Cycle inconsistency is the classical corruption statistic [11, 30]; the forced form says it is the only gauge-invariant one, and it obeys a second selection rule. tr separates corrupted from clean triangles with area under the ROC curve (AUC) 0.99: clean triangles score exactly 1, one corrupted edge never closes a loop, so the only ties are triangles with two or more cancelling corruptions (1.4% in closed form at ), and the AUC sits at its ceiling 0.993. A commuting score sees only , so with one corrupted edge its AUC is capped at : 0.80 for , 0.93 for and , 0.86 for , 0.76 for (measured 0.759 against 0.993), and chance for —the commutator subgroup of [1] capping detection as it caps composition. On a two-cluster graph with random cross-cluster relations it separates within- from cross-cluster triangles at AUC 0.98 (Figure 1d), with no group labels: unsupervised community detection from non-abelian frustration; structural balance in signed networks [18] is the det sign product; tr carries the loop-level content.
4 Discussion
The node-level and edge-level forced forms are two halves of one architecture. The node step—entity vectors updated by transported messages, scored by —is the matter propagator: content flows through a fixed gauge field, the operator resolvent closing all paths at once [1], the gauge lift of the random-walk resolvent that word embeddings on graphs factorize [14, 15]. The operators never touch each other. The edge step proved here is the gauge propagator: relation operators compose through shared vertices, scored by Wilson loops, and refine each other—including for pairs never observed. A full layer alternates the two: matter propagates in a background field, the field updates itself, matter propagates again in the refined field. The resolvent after holonomy attention is exact exactly when the effective connection is flat on the attention support, which is what the routing works toward.
The next step is making the gauge field dynamical: operators generated from context rather than retrieved from a library. The rank-one result of [1] already constrains the generator—the transport cannot come from the two entities, so it must come from relation data the context supplies outside the pair—and the forced form constrains how generated operators interact: through plaquettes, by Wilson-loop scores, in the form and no other. The same reading predicts something about a model everyone has used: AlphaFold's pair stack is learned flattening, its triangle updates driving pairwise geometry toward zero plaquette holonomy, so the pair representation's triangle inconsistency should fall with depth and recycling. The non-abelian sector belongs where order is physically attested: multi-plane lensing, where image rotation is a non-commutative Wilson line of shears [16, 17] that commutative emulators miss (0.51 against 0.92; Appendix B); cryo-EM orientation recovery; kinematic chains. Relations compose through the entity they share, and the composition is forced; what remains is learning the operators themselves.
References
[1] A. Sarkar, A. Mukherjee, M. Sato. Relational composition as parallel transport: What per-entity frames force in attention. arXiv:2610.34945, 2026.
[2] J. Jumper et al. Highly accurate protein structure prediction with AlphaFold. Nature, 596:583–589, 2021.
[3] L. Bergen, T. J. O'Donnell, D. Bahdanau. Systematic generalization with edge transformers. NeurIPS, 2021.
[4] B. Lin, W. Chen, Y. Li, W. Wang, J. Ye, X. He. From self-attention to connection Laplacian: A unified operator view of transformers. arXiv:2607.10677, 2026.
[5] I. Sung. Robust reasoning as a symmetry-protected topological phase. arXiv:2601.05240, 2026.
[6] T. S. Cohen, M. Weiler, B. Kicanaoglu, M. Welling. Gauge equivariant convolutional networks and the icosahedral CNN. ICML, 2019.
[7] L. He, Y. Dong, Y. Wang, D. Tao, Z. Lin. Gauge equivariant transformer. NeurIPS, 2021.
[8] C. Procesi. The invariant theory of matrices. Adv. Math., 19:306–381, 1976.
[9] A. Singer. Angular synchronization by eigenvectors and semidefinite programming. Appl. Comput. Harmon. Anal., 30:20–36, 2011.
[10] A. S. Bandeira, A. Singer, D. A. Spielman. A Cheeger inequality for the graph connection Laplacian. SIAM J. Matrix Anal., 34:1611–1630, 2013.
[11] G. Lerman, Y. Shi. Robust group synchronization via cycle-edge message passing. Found. Comput. Math., 22:1665–1741, 2022.
[12] M. Favoni, A. Ipp, D. I. Müller, D. Schuh. Lattice gauge equivariant convolutional neural networks. PRL, 128:032003, 2022.
[13] D. Luo, G. Carleo, B. K. Clark, J. Stokes. Gauge equivariant neural networks for quantum lattice gauge theories. PRL, 127:276402, 2021.
[14] J. Qiu et al. Network embedding as matrix factorization: Unifying DeepWalk, LINE, PTE, and node2vec. WSDM, 2018.
[15] O. Levy, Y. Goldberg. Neural word embedding as implicit matrix factorization. NeurIPS, 2014.
[16] P. Schneider, J. Ehlers, E. E. Falco. Gravitational Lenses. Springer, 1992.
[17] E. Krause, C. M. Hirata. Weak lensing power spectra for precision cosmology: Multiple-deflection, reduced shear and lensing bias corrections. A&A, 523:A28, 2010.
[18] D. Cartwright, F. Harary. Structural balance: A generalization of Heider's theory. Psych. Rev., 63:277–293, 1956.
[19] K. G. Wilson. Confinement of quarks. PRD, 10:2445–2459, 1974.
[20] J. Hansen, T. Gebhart. Sheaf neural networks. NeurIPS Workshop on Topological Data Analysis and Beyond, 2020.
[21] C. Bodnar, F. Di Giovanni, B. Chamberlain, P. Liò, M. Bronstein. Neural sheaf diffusion: A topological perspective on heterophily and oversmoothing in GNNs. NeurIPS, 2022.
[22] G. Kanwar, M. S. Albergo, D. Boyda, K. Cranmer, D. C. Hackett, S. Racanière, D. J. Rezende, P. E. Shanahan. Equivariant flow-based sampling for lattice gauge theory. PRL, 125:121601, 2020.
[23] D. Boyda et al. Sampling using SU(N) gauge equivariant flows. PRD, 103:074504, 2021.
[24] Y. Nagai, A. Tomiya. Gauge covariant neural network for quarks and gluons. PRD, 111:074501, 2025.
[25] M. Albanese et al. Glueball masses and string tension in lattice QCD. PLB, 192:163–169, 1987.
[26] C. Xu, R. Li. Relation embedding with dihedral group in knowledge graph. ACL, 2019.
[27] Y. Nagai, H. Ohno, A. Tomiya. CASK: A gauge covariant transformer for lattice gauge theory. arXiv:2501.16955, 2025.
[28] A. Rayat, Y. Li, G.-W. Chern. Gauge-equivariant graph neural networks for lattice gauge theories. arXiv:2604.20797, 2026.
[29] T. Gao, J. Brodzki, S. Mukherjee. The geometry of synchronization problems and learning group actions. Discrete Comput. Geom., 65:150–211, 2021.
[30] C. Zach, M. Klopschitz, M. Pollefeys. Disambiguating visual relations using loop constraints. CVPR, 2010.
[31] R. Giles. Reconstruction of gauge potentials from Wilson loops. PRD, 24:2160–2168, 1981.
[32] Z. Sun, Z.-H. Deng, J.-Y. Nie, J. Tang. RotatE: Knowledge graph embedding by relational rotation in complex space. ICLR, 2019.
[33] T. Trouillon, J. Welbl, S. Riedel, É. Gaussier, G. Bouchard. Complex embeddings for simple link prediction. ICML, 2016.
[34] B. Yang, W. Yih, X. He, J. Gao, L. Deng. Embedding entities and relations for learning and inference in knowledge bases. ICLR, 2015.
[35] F. Barbero, C. Bodnar, H. Sáez de Ocáriz Borde, P. Liò. Sheaf attention networks. NeurIPS Workshop on Symmetry and Geometry in Neural Representations, 2022.
A Forced Form and Flat Limit (from [1])
Forced Form. Let entities carry with independent frames , , and let a transport transform as . Any continuous invariant score depends on the entities only through and ; for isometries, . Any equivariant message lies in span . No fixed bilinear is invariant (, forces ); no equivariant transport is orthogonal (it is , rank one).
Flat Limit. On a connected graph, trivial holonomy for frames a gauge with every . In that gauge the forced score is : attention in one shared frame. A standard head has transport (score) and (value), constant, covariant only under the global , composed only through depth.
B Proof of Theorem 1, the cubic coefficient, and the lensing cell
Lensing cell. Twelve lens planes with i.i.d. convergence and shear give Jacobians and total distortion ; the label is sign , . An additive emulator (sum of per-plane features), an elementwise one (coordinate-wise products) and a matrix composition are each trained on sequences and tested on , three seeds: 0.507/0.515/0.510, 0.509/0.515/0.518, and 0.923/0.920/0.922. Reversing the planes maps and exactly, so any order-invariant predictor sits at .
Proof of Theorem 1. In the gauge of §2, define . The residual gauge freedom is the diagonal , under which and, by equivariance, ; hence . Undoing the gauge transformation gives . For the form of : on , , so equivariant polynomial maps spanned by words in , reduce to integer powers of (the polynomial classification is [8]); continuous maps are limits of polynomial ones by Stone–Weierstrass on the compact group. The cubic coefficient follows analytically: with , skew-symmetry gives , so and the three cyclic commutator traces, two entering with opposite signs, collapse to the single term; numerically the ratio of the residual to converges to 1.000 as .