Approximation Theory for Lipschitz Continuous Transformers

Takashi Furuya, Davide Murari, Carola-Bibiane Schönlieb

Transformers have become the de facto engine of modern artificial intelligence, yet they harbor a fundamental vulnerability: a lack of inherent stability. Standard dot-product attention is not globally Lipschitz continuous, meaning that microscopic changes to the input—such as adversarial perturbations—can trigger massive, unpredictable variations in the output.

While researchers have attempted to force stability by constraining the model's Lipschitz constant (a mathematical bound on a function's sensitivity), a critical theoretical question has remained unanswered: Does a Lipschitz-constrained Transformer retain the property of Universal Approximation? In other words, does enforcing strict safety constraints inherently cripple the model's ability to learn complex functions?

This purely theoretical paper provides the first rigorous proof that stability and expressivity are not mutually exclusive. By redesigning attention and MLP layers, the authors demonstrate that Transformers can be both perfectly stable and mathematically universal.

Architecture by Optimization

To bridge the gap between robustness and expressivity, the authors introduce a novel architecture: the Lipschitz gradient-descent-type Transformer.

Rather than relying on standard layer formulations, the authors define both MLP and attention blocks as explicit Euler steps of negative gradient flows. In this paradigm, every layer in the Transformer is mathematically equivalent to a single step of an optimization algorithm working to minimize a specific potential function.

This optimization-based perspective allows for built-in stability. By enforcing specific structural constraints—such as setting the "Value" matrix equal to the "Key" matrix in the attention mechanism—and carefully choosing step sizes ($\tau$ and $\eta$), the model is guaranteed to be 1-Lipschitz by construction. Consequently, the magnitude of the output's change will never exceed the magnitude of the input's change.

A Measure-Theoretic Framework

A significant challenge in Transformer theory is accounting for variable sequence lengths. The authors bypass this by adopting a measure-theoretic framework. Instead of treating the context as a fixed-length sequence of discrete tokens, they model it as a probability measure.

Using Wasserstein distances on measures, the mathematical guarantees derived in this paper hold regardless of the number of tokens in the input. This ensures that the theoretical stability and approximation guarantees do not degrade as sequence lengths increase—a critical property for modern, long-context models.

Key Results: Universal Approximation

The paper's crowning achievement is a novel Universal Approximation Theorem for stable Transformers. Using a modified version of the Restricted Stone–Weierstrass Theorem, the authors prove that for any continuous, Lipschitz in-context target function, there exists a gradient-descent-type Transformer that can approximate it to any desired level of accuracy ($\epsilon$) across the entire input space.

The proof relies heavily on showing that these stable Transformers form a mathematical "lattice." If you have two stable Transformers, you can apply "max" or "min" operations to them to create a new, equally stable Transformer within the same architectural family. Furthermore, while the proof focuses on 1-Lipschitz models, the authors note this is without loss of generality; any $L$-Lipschitz map can be represented as a rescaled 1-Lipschitz map.

Limitations and Future Directions

As a foundational theoretical work, the paper does not include empirical datasets or experiments, and several practical hurdles remain:

  • Parameter Estimation: The "safe" step size ($\eta$) for the attention layer depends heavily on the input domain. Accurately estimating this domain in practice to guarantee the Lipschitz bound is challenging.
  • Non-Quantitative Bounds: While the theorem proves that an approximating Transformer exists, it does not specify the required depth (number of layers) or width (hidden dimension) needed to achieve a specific accuracy.
  • Scalar vs. Vector Outputs: The current proof is restricted to scalar-valued targets. Extending this lattice-based mathematical framework to multi-dimensional vector outputs—as required by standard Large Language Models—is highly non-trivial.
  • Implementation Gaps: Although the framework is constructive, certain components derived from Kantorovich-Rubinstein duality are not yet formulated in an explicit, easily programmable manner.

Ultimately, this work lays a rigorous mathematical foundation for the future design of robust, Lipschitz-continuous Transformer architectures, proving that we do not have to sacrifice the universal learning power of AI to make it safe.

Summary updated

BibTeX
@inproceedings{furuya2026approximation,
  author = {Takashi Furuya and Davide Murari and Carola-Bibiane Schönlieb},
  title = {{Approximation Theory for Lipschitz Continuous Transformers}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=OVBpXUvwMi},
}
Figure