On Provable Length and Compositional Generalization
Kartik Ahuja, Amin Mansouri
TL;DR
The paper provides the first provable guarantees for length and compositional generalization in sequence-to-sequence models, covering deep sets, transformers, SSMs, and RNNs under structured (limited-capacity) and broader hypothesis classes. It formalizes length generalization and compositional generalization, introduces the RASP-L conjecture to guide when these guarantees hold, and demonstrates linear identification between learned and true representations under realizability. Chain-of-thought supervision is shown to enhance length generalization, especially for high-capacity models, by supplying privileged intermediate computations. The work blends rigorous theory with comprehensive experiments, and extends to finite and infinite hypothesis classes, offering new perspectives on learning under distribution shifts beyond the training support. These results provide a foundational step toward understanding when and how provable OOD generalization can emerge in practical seq-to-seq architectures.
Abstract
Out-of-distribution generalization capabilities of sequence-to-sequence models can be studied from the lens of two crucial forms of generalization: length generalization -- the ability to generalize to longer sequences than ones seen during training, and compositional generalization: the ability to generalize to token combinations not seen during training. In this work, we provide first provable guarantees on length and compositional generalization for common sequence-to-sequence models -- deep sets, transformers, state space models, and recurrent neural nets -- trained to minimize the prediction error. We show that \emph{limited capacity} versions of these different architectures achieve both length and compositional generalization provided the training distribution is sufficiently diverse. In the first part, we study structured limited capacity variants of different architectures and arrive at the generalization guarantees with limited diversity requirements on the training distribution. In the second part, we study limited capacity variants with less structural assumptions and arrive at generalization guarantees but with more diversity requirements on the training distribution. Further, we also show that chain-of-thought supervision enables length generalization in higher capacity counterparts of the different architectures we study.
