Table of Contents
Fetching ...

Scaling can lead to compositional generalization

Florian Redhardt, Yassir Akram, Simon Schug

TL;DR

This work asks whether standard neural networks can generalize compositionally and demonstrates that scaling data and model size enables compositional generalization (CG) across a broad class of tasks called Hyperteachers. It provides a formal framework for compositional task families and encodings, proves that a multilayer perceptron can approximate any hyperteacher with a number of neurons that grows linearly with the number of modules, and shows that task constituents become linearly decodable from hidden activations when CG succeeds. Empirically, CG emerges under various task encodings and across MLP and transformer architectures as data/task coverage increases, and there is a strong link between decodability of constituents and success in image composition tasks. The findings imply that, with sufficiently rich training distributions, standard networks can achieve compositional generalization without explicit architectural priors, though discovery dynamics under stochastic optimization remain an open question.

Abstract

Can neural networks systematically capture discrete, compositional task structure despite their continuous, distributed nature? The impressive capabilities of large-scale neural networks suggest that the answer to this question is yes. However, even for the most capable models, there are still frequent failure cases that raise doubts about their compositionality. Here, we seek to understand what it takes for a standard neural network to generalize over tasks that share compositional structure. We find that simply scaling data and model size leads to compositional generalization. We show that this holds across different task encodings as long as the training distribution sufficiently covers the task space. In line with this finding, we prove that standard multilayer perceptrons can approximate a general class of compositional task families to arbitrary precision using only a linear number of neurons with respect to the number of task modules. Finally, we uncover that if networks successfully compositionally generalize, the constituents of a task can be linearly decoded from their hidden activations. We show that this metric correlates with failures of text-to-image generation models to compose known concepts.

Scaling can lead to compositional generalization

TL;DR

This work asks whether standard neural networks can generalize compositionally and demonstrates that scaling data and model size enables compositional generalization (CG) across a broad class of tasks called Hyperteachers. It provides a formal framework for compositional task families and encodings, proves that a multilayer perceptron can approximate any hyperteacher with a number of neurons that grows linearly with the number of modules, and shows that task constituents become linearly decodable from hidden activations when CG succeeds. Empirically, CG emerges under various task encodings and across MLP and transformer architectures as data/task coverage increases, and there is a strong link between decodability of constituents and success in image composition tasks. The findings imply that, with sufficiently rich training distributions, standard networks can achieve compositional generalization without explicit architectural priors, though discovery dynamics under stochastic optimization remain an open question.

Abstract

Can neural networks systematically capture discrete, compositional task structure despite their continuous, distributed nature? The impressive capabilities of large-scale neural networks suggest that the answer to this question is yes. However, even for the most capable models, there are still frequent failure cases that raise doubts about their compositionality. Here, we seek to understand what it takes for a standard neural network to generalize over tasks that share compositional structure. We find that simply scaling data and model size leads to compositional generalization. We show that this holds across different task encodings as long as the training distribution sufficiently covers the task space. In line with this finding, we prove that standard multilayer perceptrons can approximate a general class of compositional task families to arbitrary precision using only a linear number of neurons with respect to the number of task modules. Finally, we uncover that if networks successfully compositionally generalize, the constituents of a task can be linearly decoded from their hidden activations. We show that this metric correlates with failures of text-to-image generation models to compose known concepts.

Paper Structure

This paper contains 45 sections, 7 theorems, 19 equations, 12 figures, 3 tables, 1 algorithm.

Key Result

Theorem 3.1

Let $\left ( \bm{\Theta}_{m} \in \mathbb{R}^{I \times H} \right )$ be a sequence of uniformly bounded matrices. Then, for any $M\in\mathbb{N}$, $\varepsilon > 0$, and on any compact input set, $\mathcal{X} \times \mathcal{Z}$ with $\mathcal{Z} = \{ \bm{z}: \|\bm{z}\|_1 \leq 1 \}$, there exists a ReL

Figures (12)

  • Figure 1: Scaling can lead to compositional generalization. We consider compositional task families that compose $K$ out of $M$ modules into tasks, each of which is modeled as a function. This gives rise to an exponential number of $\mathcal{O}(M^K)$ tasks. We train standard feedforward networks on a subset of tasks and evaluate compositional generalization on held-out tasks. We find that scaling the size of the model and the data leads to compositional generalization.
  • Figure 2: Scaling data and model size leads to compositional generalization.Top-left Scaling the number of training tasks by increasing the number of modules, task components or decreasing the fraction of tasks held-out from training leads to compositional generalization on the hyperteacher task family. Top-right The number of training tasks required to achieve compositional generalization, here defined as a $R^2>0.95$, scales sub-exponentially as the number of total tasks in the task family grows. Bottom Scaling model size by increasing the number of hidden neurons and the number of hidden layers leads to compositional generalization on the hyperteacher across different task encodings. Error bars denote SEM over three seeds.
  • Figure 3: Task encodings. Illustration of the different task encodings $\varphi(\bm{z}, r)$ used in Table \ref{['tab:task-encodings']}. The first three encodings are linear with respect to the task constituents while the last three are nonlinear.
  • Figure 4: The support of the training distribution needs to sufficiently cover the task space.: Left Illustration of the different types of task support for the special case of a compositional task family with two components. Turquoise tiles denote module combinations that are part of the training distribution, red tiles are reserved for evaluation. Right Compositional generalization as a function of the different types of task support on the hyperteacher for $M=16$ and $K=3$.
  • Figure 5: Compositional generalization correlates with linear decodability of task constituents.Top Relationship between linear decodability of the task constituents and compositional generalization across hyperteachers with $M=8$ modules and varying $K$. Bottom Relationship between linear decodability of the task constituents and compositional generalization across different task encodings for varying model sizes on the hyperteacher with $M=16$, $K=3$. Error bars denote SEM over three seeds. Top/Bottom We report the $R^2$ and corresponding p-value for an ordinary least square estimator in the facet titles.
  • ...and 7 more figures

Theorems & Definitions (16)

  • Definition 2.1: Compositional task family
  • Definition 2.2: Compositional generalization
  • Theorem 3.1
  • Theorem 4.1: Decodability under compositional generalization
  • Definition A.1: Connected support
  • Theorem : \ref{['thm:mlp-hyperteacher']}
  • proof
  • Lemma A.2
  • proof
  • Lemma A.3
  • ...and 6 more