Transformers for Learning on Noisy and Task-Level Manifolds: Approximation and Generalization Insights

Zhaiming Shen, Alex Havrilla, Rongjie Lai, Alexander Cloninger, Wenjing LiaoarXiv 2025 · DOI

Abstract

Transformers have demonstrated remarkable success in processing high-dimensional data, yet a rigorous theoretical understanding of their resilience to noise has remained elusive. This paper provides a mathematical foundation for this phenomenon, proving that Transformers can effectively ignore high-dimensional ambient noise by focusing on the underlying low-dimensional manifold of the data. By constructing Transformers that implement fundamental arithmetic operations, the authors demonstrate that model complexity scales with intrinsic rather than ambient dimensionality, achieving optimal generalization rates on noisy manifolds.

Introduction: The Challenge of High-Dimensional Noise

In real-world applications, data such as images and text often reside in high-dimensional "ambient" spaces (dimension $D$), while the actual information is contained within a much simpler, low-dimensional "intrinsic" manifold (dimension $d$). For instance, while a high-resolution image may contain tens of thousands of pixels, the set of all valid images for a specific category occupies only a tiny fraction of that space.

Existing manifold learning theories often assume data lies exactly on these structures. However, real-world data is inherently noisy, containing measurement errors or stochastic variations. This research addresses this gap by analyzing Transformer performance within a "tubular neighborhood"—a noisy region surrounding a manifold.

Theoretical Framework: Learning on Noisy Manifolds

The authors model data as existing within a region $\mathcal{M}(q)$ around a $d$-dimensional Riemannian manifold. The objective is to approximate a target function that depends solely on the projection of noisy data onto this clean manifold.

Figure 1: Illustration of a data point $x$ within a noisy tubular neighborhood of a manifold $\mathcal{M}$, and its projection $\pi_{\mathcal{M}}(x)$ onto the intrinsic structure.

Methodology: Constructive Approximation via Arithmetic

Rather than treating Transformers as black boxes, the study employs a constructive proof strategy. The authors demonstrate that Transformer blocks can be configured to perform essential arithmetic operations—including addition, component-wise products, squaring, and division—using specific arrangements of attention heads and Feed-Forward Networks (FFNs).

These arithmetic "building blocks" are used to construct a Transformer that mimics a piecewise-constant "oracle" function. This oracle partitions the manifold into small cells and assigns values based on local data. A key technical contribution is the "Interaction Lemma," which shows that Transformers can execute different arithmetic operations on various tokens in parallel, making the architecture naturally suited for these manifold-based calculations.

Figure 2: The proposed Transformer architecture construction, showing the progression from input embedding to the approximation of the target function $T(\theta; x)$ through intermediate arithmetic stages.

Key Theoretical Insights

  • Efficiency in Depth: A significant finding is that Transformers can remain shallow while maintaining high accuracy. The required depth scales as $O(d + \ln \ln \epsilon^{-1})$, a significant improvement over standard ReLU networks which typically require $O(\ln \epsilon^{-1})$ depth.
  • Overcoming the Curse of Dimensionality: The network's complexity (width and head count) is governed by the intrinsic dimension $d$, not the ambient dimension $D$. This explains the architecture's robustness in high-dimensional settings.
  • Built-in Denoising: The theory suggests that the Transformer architecture inherently "projects" noisy input back toward the manifold, effectively denoising the data during the forward pass.

Empirical Validation and Results

The theory was validated using ImageNet-1k datasets and a specific "Water Buffalo" subset. The researchers observed that while adding Gaussian noise to raw pixels significantly increases the measured intrinsic dimension (ID), passing this noisy data through a pre-trained Vision Transformer (ViT) results in embeddings where the ID remains nearly constant. This confirms the "built-in denoising" effect predicted by the mathematical model.

Furthermore, the authors proved a squared generalization error convergence rate of $n^{-2\alpha/(2\alpha+d)}$ (where $n$ is the sample size and $\alpha$ is function smoothness), matching the optimal minimax rate for manifold learning.

Conclusion and Future Directions

This work provides the first theoretical proof that Transformers efficiently approximate and generalize functions on noisy manifolds. While currently focused on Hölder continuous functions with smoothness $\alpha \in (0, 1]$, future work may extend these insights to more regular functions and explore the transition from ReLU-based attention to standard Softmax mechanisms. Additionally, practical methods for automated parameter estimation remain an open area for research.

Summary updated

BibTeX
@misc{shen2025transformers,
  author = {Zhaiming Shen and Alex Havrilla and Rongjie Lai and Alexander Cloninger and Wenjing Liao},
  title = {{Transformers for Learning on Noisy and Task-Level Manifolds: Approximation and Generalization Insights}},
  year = {2025},
  eprint = {2505.03205},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.03205},
}
Figure