LGMay 21

How Many Different Outputs Can a Transformer Generate?

arXiv:2605.2222366.4
AI Analysis

This work offers a theoretical explanation for empirical failures of transformers on simple tasks like copying, providing fundamental limits for practitioners.

The paper provides theoretical bounds on the number of distinct sequences a transformer can generate, showing that accessible sequence length grows linearly with prompt length and that beyond a threshold, the proportion of accessible sequences decays exponentially. These bounds are empirically tight within a factor of 10 across architectures.

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.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes