stat.MLMar 26, 2026

On the Expressive Power of Transformers for Contextual Relations

Authors: Demián Fraiman

Organizations: Instituto de Cálculo Universidad de Buenos Aires

Abstract

Transformers have revolutionized machine learning by making attention a central mechanism for modeling interactions within a context. Despite the central role of attention, the theoretical capabilities of Transformers for representing contextual relations remain unclear. In this work, we address this question by developing a mathematical framework based on probability and optimal transport. We view a text as a distribution of its representations and attention as a probabilistic relation between them. This perspective reveals a connection between attention normalization and optimal transport: standard softmax normalization produces conditional relations, while Sinkhorn normalization produces joint relations with prescribed marginals. Thus, both mechanisms provide structured probabilistic relations from attention scores. Under mild conditions, we establish universal approximation results for both settings. We show that Transformer architectures with Sinkhorn normalization can approximate arbitrary contextual relations represented as joint probabilities, while standard softmax Transformers can approximate arbitrary contextual relations represented as conditional probabilities. These results provide a mathematical characterization of the expressive power of Transformers for contextual relations and show how the choice of normalization determines the probabilistic structure of the relations represented by attention.

Figures & tables

Explore similar work

CardsList
  1. Transformers Efficiently Perform In-Context Logistic Regression via Normalized Gradient Descent

    May 7, 2026Chenyang Zhang, Yuan CaoLogistic RegressionSelf-Attention

  2. Transformers Learn Latent Mixture Models In-Context via Mirror Descent

    Apr 12, 2026Francesco D'Angelo, Nicolas FlammarionIn-Context LearningTransformer Attention

  3. On the Expressive Power of Transformers for Maxout Networks and Continuous Piecewise Linear Functions

    Mar 3, 2026Linyan Gu, Lihua Yang, Feng ZhouTransformer ExpressivityNeural Network Approximation Theory