Compositional Generalization in NLP: Can LLMs Truly Reason?

Compositional Generalization in NLP: Can LLMs Truly Reason? Nov, 23 2026

Imagine teaching a child the word "jump" and the concept of "twice." They can instantly understand "jump twice," even if they've never heard that exact phrase before. This is compositional generalization: the ability to understand and generate meanings for novel sentences by systematically recombining known components according to learned rules. For decades, this human-like capacity was the holy grail of natural language processing (NLP). We wanted machines to do more than just predict the next likely word based on statistical patterns; we wanted them to reason systematically.

But here’s the twist: as Large Language Models (LLMs) like GPT-4 and Llama scaled to billions of parameters, many researchers assumed compositional generalization would emerge automatically from sheer size. It didn’t. While modern LLMs ace standard tests, they often collapse when faced with slightly new combinations of familiar words. The question isn't whether they are smart-it's whether they actually *understand* structure or just memorize patterns really well. Let's look at what the data says about their systematic reasoning capabilities.

The Systematicity Gap in Neural Models

In the early days of deep learning, sequence-to-sequence models showed a troubling trend. On random splits of datasets where test examples looked similar to training examples, these models achieved near-perfect accuracy-often 96-99%. But when researchers held out specific combinations to test true generalization, performance plummeted to 16-35%. This drop is known as the systematicity gap. It reveals that standard architectures like LSTMs and Transformers lack inherent structural biases for strict compositionality. They approximate systematic behavior through scale and data diversity, but they don't inherently "know" grammar rules the way a symbolic logic system does.

This gap matters because real-world language is infinite. You cannot memorize every possible sentence. If your model fails when you swap two nouns or add a modifier it has seen before but not in that order, it’s brittle. That brittleness is dangerous in applications like legal analysis or medical diagnosis, where precise interpretation of novel phrasing is critical.

Benchmarks That Expose the Flaws

To measure this ability, researchers created synthetic benchmarks designed to break models. The most famous is SCAN, a simplified navigation-domain dataset introduced in 2018 where natural language commands are mapped to action sequences. In SCAN, models learn commands like "jump left" and then must generalize to "jump left twice." Early models failed miserably on these held-out splits.

As models got better, benchmarks got harder. CFQ (Compositional Freebase Questions), released by Google Research in 2020, measures compositional generalization in semantic parsing over the Freebase knowledge base. CFQ uses a metric called "compound divergence" to quantify how different the training and testing distributions are. High divergence means the test set contains combinations of predicates and arguments that were never seen together during training. Baseline models show steep accuracy declines as compound divergence grows, proving they struggle to recombine primitives systematically.

Comparison of Key Compositional Generalization Benchmarks
Benchmark Release Year Primary Focus Key Challenge Metric Typical Failure Mode
SCAN 2018 Instruction following / Action mapping Length & Add-primitive splits Fails on longer sequences or new verbs
CFQ 2020 Semantic parsing (SPARQL) Compound Divergence (MCD) Fails on novel predicate-argument pairs
COGS 2020 Syntactic/Semantic interpretation Structural gaps (e.g., dative shift) Low accuracy (16-35%) on generalization sets
gSCAN 2020 Grounded visual language Visual property conjunctions Fails to combine visual attributes correctly
A glowing neural network casting shadows over a fragmented maze of lost puzzle pieces.

Can Prompting Solve the Problem?

By 2022-2025, the narrative shifted. Researchers discovered that while fine-tuning small models on these tasks yielded poor results, prompting massive foundation models worked surprisingly well. Techniques like "least-to-most" prompting-where the model breaks a complex problem into subproblems-allowed LLMs to achieve 95-99.7% accuracy on benchmarks like SCAN and CFQ. This was done using less than 1% of the original training data.

Does this mean LLMs now reason systematically? Not exactly. It suggests that in-context learning allows models to simulate systematic reasoning by leveraging pre-trained knowledge and careful instruction decomposition. When you give an LLM a clear rule and ask it to apply it step-by-step, it behaves systematically. However, this success is fragile. Newer benchmarks like STaR (Systematic Relational Reasoning), introduced in 2025 to evaluate abstract rule-based reasoning, show that models still struggle with relational complexity. They might get the syntax right but fail the underlying logical structure when the relationships become non-linear or deeply nested.

The Role of Architecture and Decoding

It’s not just about the prompt. Small changes in how a model generates text can significantly impact its measured systematicity. A 2023 study found that using top-p sampling (nucleus sampling) instead of greedy decoding improved average accuracy on compositional datasets by 4 percentage points. On COGS specifically, this decoding tweak boosted performance by 12.6 percentage points over previous state-of-the-art supervised methods.

This highlights a critical pitfall in AI evaluation: decoding strategy confounds generalization claims. If you tune your temperature and top-p settings to maximize score on a leaderboard, you might be measuring luck rather than true reasoning capability. To truly assess if an LLM reasons systematically, you must control for hyperparameters, random seeds, and prompt templates. Otherwise, you’re just optimizing for noise.

An AI character untangling complex lines into neat gears using structured steps.

Relational Reasoning and Thematic Generalization

Recent work has moved beyond simple syntactic composition to more cognitive styles of reasoning. The Thematic Generalization Benchmark V2, released in 2025, tests whether models can infer narrow latent themes from few examples, reveals a different kind of failure. Models often commit "over-generalization" errors. Faced with a subtle rule, they opt for broader categories that cover more surface features. This is distinct from the syntactic extrapolation issues seen in SCAN. It suggests that while LLMs are great at pattern matching, they lack the human ability to hypothesize and test narrow causal or thematic rules without explicit guidance.

Furthermore, the concept of "critical complexity" is emerging. Studies suggest there is a threshold of reasoning depth beyond which a model transitions from generalizing to memorizing. Smaller or older models hit this ceiling quickly. Frontier models maintain robustness longer, but no model is immune. As chains of reasoning deepen, the probability of hallucination or logical drift increases.

Practical Implications for Developers

If you are building an application relying on LLMs for structured tasks, assume your model will fail on novel combinations until proven otherwise. Don't rely solely on high-level accuracy metrics. Instead:

  • Create custom hold-out sets: Generate synthetic data with high compound divergence to stress-test your specific use case.
  • Use Chain-of-Thought (CoT): Force the model to decompose problems. Least-to-most prompting is highly effective for compositional tasks.
  • Monitor distribution shifts: Watch for inputs that are longer than typical training examples or contain unusual entity compositions.
  • Validate with formal semantics: Where possible, map outputs to a formal representation (like SPARQL or SQL) to check for structural validity, not just string similarity.

Compositional generalization remains an active research frontier. LLMs have made huge strides, moving from failing 65% of the time to succeeding 95%+ on classic benchmarks. But this success is contingent on careful engineering. The models don't "reason" in the human sense; they simulate reasoning through statistical approximation. Until we integrate stronger structural biases-like explicit syntax trees or typed semantics-we must treat systematicity as a feature to be engineered, not a given.

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 (words, phrases) according to learned rules. It allows a system to handle expressions it has never encountered before, provided the parts and the combination rules are known.

Why do Large Language Models struggle with systematic reasoning?

Standard neural architectures like Transformers lack inherent structural biases for strict compositionality. They tend to memorize surface patterns rather than abstract rules. While scaling helps, it doesn't guarantee systematicity. Models often fail when tested on combinations of primitives that appeared in training but not together, revealing a reliance on statistical correlation over logical rule application.

How does the CFQ benchmark test compositional generalization?

CFQ (Compositional Freebase Questions) measures generalization by splitting data based on "compound divergence." It creates training and test sets where the distribution of primitive combinations differs significantly. High compound divergence indicates that the test set requires combining predicates and arguments in ways unseen during training, forcing the model to demonstrate true systematic recombination rather than memorization.

Can prompting improve LLM systematicity?

Yes. Techniques like least-to-most prompting and chain-of-thought reasoning allow LLMs to decompose complex compositional tasks into simpler steps. This approach has enabled models to achieve near-perfect accuracy on benchmarks like SCAN and CFQ using minimal training data, effectively simulating systematic reasoning through guided inference.

What is the difference between SCAN and COGS benchmarks?

SCAN focuses on instruction following in a synthetic navigation domain, testing if models can execute actions based on command structures. COGS (Compositional Generalization Challenge Based on Semantic Interpretation) focuses on syntactic and semantic interpretation of English sentences, testing if models can parse novel syntactic structures (like dative shifts) into correct logical forms. Both reveal systematicity gaps but target different linguistic layers.