Human intelligence is characterized by the ability to "make infinite use of finite means." If you know what a "red square" is and what a "blue circle" is, you can immediately recognize a "red circle," even if you have never seen one. This ability—compositional generalization—is the capacity to recognize or produce novel combinations of familiar primitives.
Despite their scale, modern neural networks often fail this basic test. They tend to learn "shortcuts"—superficial correlations between specific combinations of features—rather than the underlying rules of composition. To diagnose and fix this, researchers have moved away from standard random data splits toward strategic partitioning methods that force models to demonstrate true structural understanding.
The Atom and the Compound
To understand why models fail, we must distinguish between atoms (the basic building blocks) and compounds (their combinations). In a Visual Question Answering (VQA) task, an atom might be the color "red" or the shape "cube." A compound is the specific instance of a "red cube."
Standard machine learning evaluation uses random splits, where the distribution of compounds in the test set mirrors the training set. As Aishwarya Agrawal and colleagues argue in C-VQA: A Compositional Split of the Visual Question Answering (VQA) v1.0 Dataset, this allows models to succeed by memorizing common question-answer pairs rather than reasoning about the scene. If "What color is the banana?" is always answered with "yellow" in the training set, a model will learn to ignore the image entirely.
Maximum Compound Divergence
The most rigorous way to test compositionality is to ensure that while the training and test sets share the same atoms, they have maximally different compounds. This is known as Maximum Compound Divergence (MCD).
In Compositional Generalization in Multilingual Semantic Parsing over Wikidata, Ruixiang Cui and co-authors use MCD to show that models which appear "smart" on standard benchmarks fail almost completely when asked to handle novel logical structures. Similarly, Chengang Hu and Xiao Liu demonstrate in DiNeR that in high-shift scenarios, simply adding more training data can actually decrease performance—a phenomenon called "inverse-scaling"—because the model becomes more entrenched in the specific compounds it has already seen.
Geometric and Algorithmic Partitioning
Researchers use several sophisticated strategies to create these "hard" splits:
- Greedy Redistribution: Aishwarya Agrawal proposed algorithms that iteratively move samples between sets until the test set contains only novel QA combinations.
- Orthotopic Partitioning: In Scalable Evaluation and Neural Models for Compositional Generalization, Giacomo Camposampiero and Abbas Rahimi define training and test zones as "hyper-rectangles" in a multi-dimensional attribute space. By withholding an entire "volume" of attribute combinations, they can measure how well a model interpolates or extrapolates across the feature manifold.
- Functional Programs: The CLEVR dataset, introduced by Justin C. Johnson and Li Fei-Fei, represents questions as executable programs. This allows researchers to hold out specific sub-graphs of reasoning, testing if a model can handle a "long" reasoning chain if it has only seen "short" ones.
Why Models Struggle: Perception vs. Logic
One might assume that if a model is "disentangled"—meaning it has separate internal representations for color, shape, and size—it would generalize perfectly. However, Milton L. Montero and colleagues found in Lost in Latent Space that even perfectly disentangled Variational Autoencoders (VAEs) fail on novel combinations. The failure often starts in the encoder (perception) rather than the decoder (generation). If the model has never seen a "red square," its visual system may struggle to even "see" the square and the red color as independent, composable entities.
To combat this, some researchers suggest changing the model architecture itself. Amir Mohammad Karimi Mamaghan and Stefan Bauer show that Object-Centric Representations, which explicitly treat scenes as collections of discrete entities, are significantly more sample-efficient and robust when training data is scarce or biased.
Improving Generalization through Decomposition
If the problem is that models treat complex inputs as monolithic "blobs," the solution may be to force them to see the pieces. Mayank Kothyari and Sunita Sarawagi developed SCUD4ICL, which improves semantic parsing by decomposing complex examples into smaller, cleaner fragments. By reducing "interference" from irrelevant parts of a prompt, models can more effectively synthesize the specific components needed for a new, complex query.
By moving from random splits to these structured, "compositional" splits, the research community is shifting the goalpost from mere pattern matching to the kind of flexible, systematic reasoning that defines human intelligence.