From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputs

Anastasiia Alokhina, Pan Li
12/14/2025
cs.LGcs.AI

No confident code implementation found for this paper.

Abstract

Transformers exhibit a notable property of \emph{size generalization}, demonstrating an ability to extrapolate from smaller token sets to significantly longer ones. This behavior has been documented across diverse applications, including point clouds, graphs, and natural language. Despite its empirical success, this capability still lacks some rigorous theoretical characterizations. In this paper, we develop a theoretical framework to analyze this phenomenon for geometric data, which we represent as discrete samples from a continuous source (e.g., point clouds from manifolds, graphs from graphons). Our core contribution is a bound on the error between the Transformer's output for a discrete sample and its continuous-domain equivalent. We prove that for Transformers with stable positional encodings, this bound is determined by the sampling density and the intrinsic dimensionality of the data manifold. Experiments on graphs and point clouds of various sizes confirm the tightness of our theoretical bound.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{alokhina2025from,
  title  = {From Small to Large: Generalization Bounds for Transformers on Variable-Size Inputs},
  author = {Anastasiia Alokhina and Pan Li},
  year   = {2025},
  eprint = {2512.12805},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2512.12805v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2512.12805.svg)](https://codeofpaper.com/paper/2512.12805)

Discussion