mlsanityData to 14 Oct 2026

Self-Attention as a Parametric Endofunctor: A Categorical Framework for Transformer Architectures

arXiv 2501.02931 ↗First posted 6 Jan 2025cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Self-attention mechanisms have revolutionised deep learning architectures, yet their core mathematical structures remain incompletely understood. In this work, we develop a category-theoretic framework focusing on the linear components of self-attention. Specifically, we show that the query, key, and value maps naturally define a parametric 1-morphism in the 2-category Para(Vect). On the underlying 1-category Vect, these maps induce an endofunctor whose iterated composition precisely models multi-layer attention. We further prove that stacking multiple self-attention layers corresponds to constructing the free monad on this endofunctor. For positional encodings, we demonstrate that strictly additive embeddings correspond to monoid actions in an affine sense, while standard sinusoidal encodings, though not additive, retain a universal property among injective (faithful) position-preserving maps. We also establish that the linear portions of self-attention exhibit natural equivariance to permutations of input tokens, and show how the "circuits" identified in mechanistic interpretability can be interpreted as compositions of parametric 1-morphisms. This categorical perspective unifies geometric, algebraic, and interpretability-based approaches to transformer analysis, making explicit the underlying structures of attention. We restrict to linear maps throughout, deferring the treatment of nonlinearities such as softmax and layer normalisation, which require more advanced categorical constructions. Our results build on and extend recent work on category-theoretic foundations for deep learning, offering deeper insights into the algebraic structure of attention mechanisms.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). First posted on arXiv 6 Jan 2025.

Builds on

0 of 0 references.

No references here yet.

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025The underlying structures of self-attention: symmetry, directionality, and emergent dynamics in Transformer training
  2. 2025Attentive Convolution: Unifying the Expressivity of Self-Attention with Convolutional Efficiency
  3. 2025Towards Understanding the Nature of Attention with Low-Rank Sparse Decomposition
  4. 2025Is Random Attention Sufficient for Sequence Modeling? Disentangling Trainable Components in the Transformer
  5. 2026Rational Transductors
  6. 2023Manifold-Preserving Transformers are Effective for Short-Long Range Encoding
  7. 2026Mixture-of-Top-k Attention: Efficient Attention via Scalable Fast Weights
  8. 2025Sigmoid Self-Attention has Lower Sample Complexity than Softmax Self-Attention: A Mixture-of-Experts Perspective