When can transformers reason with abstract symbols?
Enric Boix-Adsera, Omid Saremi, Emmanuel Abbe, Samy Bengio, Etai Littwin, Joshua Susskind
TL;DR
The paper formalizes relational reasoning with abstract symbols through template tasks and proves that transformer architectures can learn abstract relations and generalize to unseen symbols when trained with sufficiently diverse data, in contrast to classical MLPs which fail to generalize. It provides a kernel-theoretic analysis of transformers via a transformer random features kernel $K_{ ext{trans}}$ and shows universality under disjoint-template and data-diversity conditions, then introduces a simple per-head parametrization ${W_KW_Q^T} + aI$ to improve data efficiency. The authors also address the copying problem in next-token-prediction settings by adding an attention-modulated skip connection, improving generalization to unseen symbols. Empirically, the proposed modifications yield substantial data-efficiency gains on template tasks and improvements in language-modeling tasks like GPT-2 fine-tuning. Overall, the work outlines when transformers can robustly reason with abstract symbols and offers practical architectural tweaks to enhance data efficiency for relational reasoning.
Abstract
We investigate the capabilities of transformer models on relational reasoning tasks. In these tasks, models are trained on a set of strings encoding abstract relations, and are then tested out-of-distribution on data that contains symbols that did not appear in the training dataset. We prove that for any relational reasoning task in a large family of tasks, transformers learn the abstract relations and generalize to the test set when trained by gradient descent on sufficiently large quantities of training data. This is in contrast to classical fully-connected networks, which we prove fail to learn to reason. Our results inspire modifications of the transformer architecture that add only two trainable parameters per head, and that we empirically demonstrate improve data efficiency for learning to reason.
