How Many Different Outputs Can a Transformer Generate?
AuthorsMaxime Meyer, Mario Michelessa, Caroline Chaux, Vincent Y. F. Tan
Resources
This paper shows that transformers can only generate a surprisingly limited set of outputs, with the reachable sequence space growing linearly with prompt length and shrinking sharply beyond a threshold.
Key results
With prompt length m, the paper proves a transformer of precision ε and embedding radius r can access only a finite number of distinct sequences, bounded by the packing-number argument in Theorem 4.5.
Beyond this threshold, some length-n sequences become inaccessible and the fraction of accessible sequences decays exponentially, as stated in Corollary 4.6.
For fixed prompt length m, the proportion of accessible length-n sequences decays exponentially once the threshold is exceeded, matching Corollary 4.6.
In the cramming experiments, the 50% accessibility length n50 scales almost perfectly linearly with memory size m on PG19.
In the same cramming experiments, n50 also scales almost perfectly linearly with m for random target sequences.
In the copying-length generalization experiment, sigmoid fits capture the sharp accuracy drop with a median R² of 0.95 across models.
What the paper found
This paper argues that a transformer’s output diversity is sharply limited by geometry and finite numerical precision, not just by training or scale. The authors define an accessible sequence as one that can be forced by some prompt under greedy decoding, then prove that every transformer generates only a finite set of such sequences: with prompt length m, the number of accessible outputs is bounded by the packing number of the bounded embedding support, yielding a maximal accessible length that grows only linearly with m. Under a worst-case ball enclosure, the critical slope is at most d·ln(1+2r/ε)/ln|V|, and beyond that threshold the fraction of accessible length-n sequences decays exponentially as O((1/|V|)^n). They extend the argument to arbitrary prompt lengths using a mean-field transformer formulation and Wasserstein precision, obtaining a comparable finite-output bound even with unbounded context and computation. Empirically, they test the theory with the cramming task on Pythia, Qwen-2.5, Llama-3.2, and Gemma-3 models: accessibility stays high until a sharp length cutoff, then collapses, and the 50% accessibility length n50 scales almost perfectly linearly with memory size m, with R² values of 0.999 on PG19 and 0.995 on random sequences. The theoretical slope is within a factor of about 5 to 20 of the measured slope, and this gap shrinks to roughly 4.6–10.8 when they replace the spherical-support assumption with ellipsoid or cone enclosures and non-uniform decoder-cell volumes. A copying experiment shows the same abrupt transition, with sigmoid fits achieving median R² = 0.95 across models.
Original abstract
We study how we can leverage only a handful of characteristics of a transformer's architecture to closely predict the number of different sequences it can output, both qualitatively and quantitatively. We provide an upper bound depending on the length of the prompt, which we show empirically to be tight up to a factor less than 10, across architectures and model sizes. Our analysis also provides a theoretical explanation for previously observed empirical failures of transformers on simple sequence tasks, such as copying and cramming. Formally, we prove that (i) the maximal length of accessible sequences (those that the transformer can output for some prompt) grows linearly with the prompt length, (ii) beyond a critical threshold, the proportion of accessible sequences decays exponentially with sequence length, and (iii) the linear coefficient relating prompt length to accessible sequence length admits a theoretical upper bound. Notably, these results hold even with unbounded context and computation time.
Read the original paperMore in Transformers
Browse all 51 papers →Hierarchical Residuals: A Minimalist Decoupling of Residual Width from Compute Width
Ziteng Wang, Jianqiao Lu, Xinyu Ma, Jintao Zhang, Jun Zhu, Yiyuan Ma, Jianfei Chen
HiRes gives Transformers a wider memory path between blocks without making each layer more computationally expensive.
How to Loop Your Transformer: Loop Scaling, Specialization, and Parallel Inference
Chanakya Ekbote, Artidoro Pagnoni, Devendra Singh Sachan, Shruti Bhosale, Mike Lewis, Maryam Fazel-Zarandi, Shashank Rajput, Sujan Kumar Gonugondla
The paper explores how to make transformers deeper through weight reuse while balancing model quality, training cost, and inference speed.
StateLoop: Persistent State for Looped Transformers
Feichen Song, Boyi Zeng, He Li, Shixiang Song, Yiqin Hao, Zitong Wang, Yizhou Yang, Yifan Liu, Ziwei He, Zhouhan Lin
StateLoop gives repeatedly applied Transformers a persistent memory to carry useful information across computation loops.