Scaling can lead to compositional generalization

Florian Redhardt, Yassir Akram, Simon Schug

The "Holy Grail" of artificial intelligence has long been compositional generalization—the ability to take familiar building blocks (like "red," "blue," "car," and "bike") and understand a novel combination it has never seen before (like a "blue car"). For decades, researchers have debated whether standard, "monolithic" neural networks can do this, or if we must explicitly build modular, symbolic structures into our architectures.

A new paper, "Scaling can lead to compositional generalization," suggests that the answer might be simpler than we thought: just add more data and more neurons.

TL;DR

Standard neural networks (like MLPs) can achieve systematic compositional generalization without specialized architectures, provided they are scaled up in size and trained on a distribution that sufficiently covers the task space. The researchers prove that successful generalization is inextricably linked to the model’s ability to "linearize" task components within its internal hidden representations.

What Problem Does This Paper Address?

The debate over compositionality usually pits connectionism (distributed neural networks) against symbolism (explicit rules and modules). Critics of standard neural networks argue that they are "stochastic parrots" that merely memorize training data. While scaling has led to the impressive capabilities of Large Language Models (LLMs), these models still frequently fail at simple compositional tasks—like putting the right hat on the right animal in an image.

Overview of the compositional task family, the generalization challenge, and the impact of scaling.

The authors ask: Is this failure a fundamental flaw of the architecture, or is it a matter of scale and data coverage? Specifically, they investigate what it takes for a standard Multilayer Perceptron (MLP) to learn the underlying "generative rule" of a task family rather than just memorizing individual instances.

Methods

The researchers used a "Hyperteacher" framework to create controlled experiments:

  1. The Task: A "teacher" network generates a task (a function) by combining $K$ modules out of a pool of $M$.
  2. The Student: A standard MLP is trained to solve these tasks. Crucially, the student is only shown a tiny fraction of the exponentially large number of possible combinations.
  3. Task Encodings: To see if the way a task is described matters, they tested everything from simple ID vectors and natural language instructions to highly non-linear encodings like "Interval Shuffles" and "Few-shot" examples.
  4. Linear Probing: They used linear decoders to probe the model’s hidden layers, checking if the individual "constituents" of a task could be extracted from the model's internal activations.

Datasets

  • Hyperteacher Task Family: A synthetic regression benchmark where tasks are defined by summing weight matrices.
  • Compositional Preference Grid: A reinforcement learning-style environment where models must navigate based on combined preferences.
  • Image Composition Benchmark: The authors introduced a new set of 27 task families for text-to-image models, such as "animals with food eyes and clothes" or "nested containment" (e.g., a jar inside a chest). They evaluated state-of-the-art diffusion models including FLUX.1-dev, Stable Diffusion 3.5, and SD XL.

Key Insights and Ideas

  • Scale is a Substitute for Structure: Simply increasing the number of hidden neurons and the number of training tasks allows an MLP to transition from memorization to generalization.
  • The "Linearity" Requirement: The most striking finding is that even when the input task encoding is a tangled, non-linear mess, a successful model will internally "untangle" it. If a model generalizes well, you can almost always find a linear representation of the task's components in its hidden layers.
  • Data Coverage Matters (Connected Support): You don't need to see every combination, but you do need "connected support." This means every module must appear in the training set, and no group of modules should be entirely isolated from the rest in the training distribution.
  • Theoretical Efficiency: The authors provide a mathematical proof showing that MLPs can approximate compositional functions using a number of neurons that scales linearly with the number of modules, whereas a memorization strategy would require exponential growth.

Key Results

  • Sub-exponential Scaling: The number of training tasks required to reach high generalization ($R^2 > 0.95$) grows much slower than the total number of possible tasks.
  • Universal Generalization: Compositional generalization emerged across all tested task encodings (Language, Invertible NNs, etc.), provided the model was large enough.
Compositional generalization improves with model size across various task encodings.
  • Predicting Image Failures: In text-to-image models, the ability to linearly decode concepts from the model's internal "thought process" (hidden states) correlated strongly with the actual success rate of the generated image. For example, in SD 3.5, the correlation ($R^2$) between internal decodability and generation success was 0.76.

Limitations and Future Work

  • Discovery vs. Existence: The theoretical proof shows that a generalizing solution exists within an MLP, but it doesn't guarantee that Stochastic Gradient Descent (SGD) will always find it in the wild.
  • Real-World Data Distributions: The study relies heavily on synthetic data where the "ground truth" modules are known. In the real world (like the internet), we don't know if the data distribution provides the "connected support" necessary for models to learn these structures.
  • Task Ambiguity: The experiments assumed the task was fully specified. Future work could explore how models handle ambiguous prompts where they must infer missing compositional components.

Final Thought: This paper suggests that the "black box" of neural networks isn't as chaotic as it seems. When they work well, they are essentially building internal, linear "dictionaries" of the world—proving that scaling isn't just about bigger memory, but about learning better algorithms.

Summary updated

BibTeX
@inproceedings{redhardt2025scaling,
  author = {Florian Redhardt and Yassir Akram and Simon Schug},
  title = {{Scaling can lead to compositional generalization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=hZt0daVIZi},
}
Figure