Compositional Generalization in NLP: Can LLMs Reason Systematically?

Compositional Generalization in NLP: Can LLMs Reason Systematically?
by Vicki Powell Jul, 12 2026

Imagine teaching a child that "red" describes an apple and "big" describes a truck. If you then ask them to find the "big red apple," they don't panic. They combine two known concepts into a new, specific instruction. Humans do this effortlessly every day. But can Large Language Models artificial intelligence systems trained on massive text datasets to generate human-like responses actually do the same? Or are they just incredibly good at remembering patterns they've seen before?

This question sits at the heart of Compositional Generalization the ability of a model to understand novel combinations of familiar elements based on learned rules rather than memorized examples. For years, researchers have watched LLMs ace standard tests, only to fail spectacularly when faced with a simple twist in sentence structure or word order. It turns out that passing a test isn't the same as understanding the logic behind it.

The Core Problem: Memorization vs. Logic

To understand why this matters, we need to look at how these models learn. Most current AI systems rely on statistical probability. They predict the next word based on what usually follows previous words in their training data. This works great for common phrases. But it falls apart when you present a combination that never existed in the training set.

Think of it like learning to cook by watching videos. You might memorize exactly how to make a specific pasta dish because you saw it ten times. But if someone asks you to use those same ingredients to make a soup-a structure you've never seen-you might freeze. That is the systematicity gap. The model knows the parts (ingredients/words) but doesn't grasp the underlying grammar (recipe/syntax) well enough to recombine them freely.

Between 2018 and 2025, studies showed a stark contrast. Standard neural networks often hit 96-99% accuracy on normal tasks. But when tested on held-out combinations requiring true composition, their performance collapsed to 16-35%. That drop reveals a fundamental weakness: without explicit structural biases, scale alone doesn't guarantee logical reasoning.

Benchmarks That Break the Model

You can't measure what you can't define. To test compositional generalization, researchers created specific benchmarks designed to trick pattern-matching algorithms. These aren't just harder versions of regular tests; they are structured to force the model to apply rules to new situations.

Key Benchmarks for Testing Compositional Generalization
Benchmark Name Focus Area Key Challenge
SCAN Synthetic Navigation Commands Mapping commands like "jump twice" to actions where primitives appear only in held-out combos.
CFQ Semantic Parsing over Freebase High compound divergence; tests natural language questions against complex SPARQL queries.
COGS Syntactic Structure & Semantics Intentionally excludes certain argument structures in training to force recombination at test time.
gSCAN Grounded Visual Understanding Combines visual properties (color, size) with relational descriptors in a grid world.

SCAN A synthetic dataset introduced in 2018 by Lake and Baroni to test systematic generalization using simplified navigation commands was the pioneer here. It uses simple instructions like "go right and jump." The catch? The training data might show "jump" with "run," but the test data asks for "jump" with "skip." If the model has merely memorized pairs, it fails. Early sequence-to-sequence models failed hard here, proving that high accuracy on random splits meant nothing regarding true understanding.

Then came CFQ Compositional Freebase Questions, a dataset released by Google Research in 2020 containing ~240k question-query pairs to test semantic parsing generalization. Released by Google Research in March 2020, CFQ scales up the challenge using real-world knowledge bases. It introduces "compound divergence"-a metric measuring how different the training and testing distributions are. High divergence means the model must generalize across very different combinations of predicates and arguments. Baseline models saw steep accuracy declines as this divergence grew, highlighting their limited systematicity.

COGS Compositional Generalization Challenge Based on Semantic Interpretation, introduced in 2020 to test models on systematically novel syntactic and lexical combinations takes it further by manipulating English syntax. It trains models on sentences but deliberately leaves out certain grammatical structures, like transitive verbs used in intransitive positions. Success requires the model to recombine known elements, not just recall templates. In 2020 experiments, Transformers achieved near-perfect scores on in-distribution tests but plummeted to 16-35% on the generalization set. The variance was also high (±6-8%), showing instability even when results were decent.

Chef memorizing pasta recipe but failing to create new soup dish

Can Prompting Fix the Gap?

If raw architecture struggles, maybe better instructions help. From 2022 to 2025, the focus shifted toward Prompt Engineering The practice of designing input text to guide Large Language Models toward desired outputs without fine-tuning. Specifically, techniques like "least-to-most" prompting broke complex problems into smaller steps.

The results were surprising. A 2023 study showed that dynamic least-to-most prompting could achieve 99.7% accuracy on SCAN and 95% on CFQ splits. Even more impressive? It did this using only 0.4% to 1% of the original supervised training data. On COGS, the same approach hit 99.2% accuracy on the generalization split. This suggests that LLMs *do* possess latent systematic capabilities, but they need the right scaffolding to access them. The pretraining phase builds a vast web of associations; clever prompting acts as the key to unlock logical pathways within that web.

However, decoding strategies matter too. A 2023 project found that simply changing from greedy decoding to top-p sampling (nucleus sampling) improved average accuracy on compositional datasets from 22.4% to 26.4%, with significant gains on COGS. This proves that evaluation is fragile. Small changes in hyperparameters or prompt format can drastically alter whether a model appears "smart" or "broken."

New Frontiers: Relational and Abstract Reasoning

While older benchmarks focused on syntax, newer tests probe deeper cognitive skills. By early 2025, researchers introduced STaR Benchmark Systematic Relational Reasoning benchmark introduced in 2025 to evaluate models on inferring and applying relational rules (Systematic Relational Reasoning). This evaluates whether models can infer abstract rules and apply them consistently. Many popular systems performed above random chance but still struggled to reach high accuracy, indicating partial-but incomplete-systematic reasoning.

Another 2025 framework called Scylla measures "critical complexity"-the point where a model stops generalizing and starts memorizing. Testing 28 LLM families, including LLaMA and Qwen variants, the study found that models differ wildly in how much reasoning depth they can handle before overfitting. Frontier models maintain robustness on deeper chains, while smaller models hit their limit quickly. This underscores that systematicity is a graded capacity linked to scale and architecture.

The Thematic Generalization Benchmark V2 (updated August 2025) targets rule induction. Models must infer a narrow "theme" from positive and negative examples. Preliminary results show that LLMs often commit "over-generalization errors," picking broader categories that fit surface features but miss the fine-grained rule. This is a distinct failure mode from the syntactic issues seen in SCAN, revealing that abstract rule-following remains a weak spot.

Key unlocking a puzzle box to release organized geometric logic shapes

Why This Matters for Real-World Applications

You might wonder why synthetic benchmarks matter if chatbots seem helpful daily. The answer lies in reliability. When you deploy an LLM in healthcare, law, or coding, you cannot afford for it to hallucinate logic when facing a novel case. Distribution shifts-like longer inputs or unusual entity combinations-are common in production. If a model relies on superficial patterns, it will fail unpredictably.

Practitioners report that reproducing accuracies on CFQ and COGS requires careful tuning of seeds and decoding parameters. There is a risk of overestimating reasoning abilities based on qualitative inspection. A model might give a coherent-sounding explanation while failing basic rule-induction tests. This "illusion of competence" is dangerous for enterprise adoption.

Economically, these benchmarks are free open-source assets. The cost comes from compute. Running full evaluations with multiple LLM variants can process millions of tokens, leading to significant API or GPU expenses. As of July 2026, this remains a niche methodological subfield rather than a standalone commercial market, subsumed under broader LLM safety and evaluation efforts.

Conclusion: Brittle Brilliance

So, can LLMs reason systematically? The evidence up to mid-2026 supports a nuanced answer. Yes, they can exhibit near-perfect systematicity on controlled benchmarks, especially when aided by advanced prompting strategies. They can match human-like compositionality in constrained settings. However, their generalization remains brittle. Under distribution shifts, complex relational demands, or adversarial rule sets, they falter.

Future progress likely depends on integrating stronger inductive biases-explicit syntax, typed semantics, or modular reasoning components-into architectures. We also need more robust, less gameable benchmarks. Until then, compositional generalization remains an active research frontier, not a solved problem. It reminds us that while scale brings power, it does not automatically bring wisdom.

What is compositional generalization in NLP?

Compositional generalization is the ability of a model to understand and generate meanings for novel sentences by systematically recombining known components according to learned rules, rather than memorizing whole expressions or surface patterns. It tests whether a system can apply grammatical and semantic rules to new combinations of words that never appeared in its training data.

Why do Large Language Models struggle with systematic reasoning?

LLMs primarily rely on statistical probability to predict the next word based on training data patterns. While effective for common phrases, this approach lacks inherent structural biases for strict compositionality. When faced with novel combinations or structural shifts not present in training, models often default to memorized patterns, leading to significant drops in accuracy on compositional benchmarks.

What are SCAN, CFQ, and COGS?

These are key benchmarks for testing compositional generalization. SCAN (2018) uses synthetic navigation commands to test primitive recombination. CFQ (2020) focuses on semantic parsing over Freebase with high compound divergence. COGS (2020) tests syntactic and semantic interpretation by intentionally excluding certain argument structures in training to force generalization at test time.

How does least-to-most prompting improve systematicity?

Least-to-most prompting breaks complex tasks into smaller, manageable subproblems. By providing in-context exemplars and guiding the model through step-by-step decomposition, this technique allows LLMs to access latent systematic capabilities. Studies show it can achieve 95-99.7% accuracy on benchmarks like SCAN and CFQ using less than 1% of traditional training data.

Is compositional generalization a solved problem for AI?

No, it is not fully solved. While LLMs perform well on classical benchmarks with advanced prompting, they still struggle with abstract relational reasoning, longer reasoning chains, and adversarial rule sets. New benchmarks like STaR and Scylla reveal that systematicity is a graded capacity that remains brittle under distribution shifts and complex novel structures.