# Length Generalization for Transformers via Compression

*Georg Zetzsche, Hongjian Jiang, Andy J Yang, Pascal Bergsträßer, Marco Sälzer, David Chiang, Anthony Lin*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/150600) · [OpenReview](https://openreview.net/forum?id=gx6QOo6yY5) · [Open on the map](../papers.html#p150600)

Category: [Interpretability & Model Adaptation](../pcat/15.md) › [Transformer Length and Memory Scaling](../pgroup/429.md) · Type: theory · Keywords: length generalization, transformer models, C-RASP hypothesis, sample size bounds, power words, compressed strings

## Summary
We provide an exponentially tighter sample size bound for C-RASP, yielding a polynomial length generalization bound for transformers via compressed strings and power words.

## Explained to a 5-year-old
We want computers to understand long sentences just like they understand short ones. Scientists have a guess about when computers will do this well, but it needs a lot of examples. They found that guess might need even more examples than they thought. This paper shows a smarter way to count those examples, making the guess easier. Now we know computers can learn longer sequences with far fewer examples.

## Explained to a 5-year-old, longer
We want computers to read long sentences and understand them. There is a rule that says when a computer will learn to do this. That rule needs a huge number of examples to work. Scientists were not sure if that huge number could be made smaller. This paper looks at a new version of that rule. It uses two simpler parts of the rule that are easier to count. By using these parts, they find a much smaller number of examples needed. This smaller number helps the computer learn faster. The new rule also connects to a special kind of word pattern. This pattern helps the computer see the meaning in longer text. As a result, computers can now handle longer sequences with less training. This makes the theory more useful for real-world language tasks.

## For a technical reader
We refine the C-RASP hypothesis using the CRASP+ and CRASP1 fragments, which admit computable bounds. By establishing an exponentially tighter sample-size bound, we achieve a polynomial length-generalization guarantee for transformers when compressed strings are considered. The key insight links this guarantee to power words, providing a fine-grained analysis that reconciles contradictory experimental evidence. This theoretical advance yields a more reliable predictor of transformer learnability on longer sequences. The result enables practitioners to estimate required data sizes without exhaustive empirical trials.

## Problem
It is unknown whether the double exponential sample size bounds for C-RASP are tight, and there is a lack of computable length generalization bounds for transformers. The paper seeks to resolve this open question by providing a tighter bound.

## Method
We refine the C-RASP hypothesis using the CRASP+ and CRASP1 fragments, which admit computable bounds, and we establish an exponentially tighter bound that leads to a polynomial length generalization guarantee for transformers when compressed strings are considered, leveraging a connection to power words.

## Results
The work demonstrates an exponentially tighter sample size bound and a polynomial length generalization guarantee for transformers under compressed strings.

## Contributions
We tighten the sample size bounds for C-RASP, resolve the open question of tightness, and provide a polynomial length generalization bound for transformers via compressed strings and power words.

## Research questions this paper is counted under

- [How can we provide tight theoretical bounds on Transformers' generalization and approximation capabilities?](../q/817.md)

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/150600)
