mlsanityData to 14 Oct 2026

Characterizing Pattern Matching and Its Limits on Compositional Task Structures

arXiv 2505.20278 ↗First posted 26 May 2025cs.LG cs.AI cs.CLcited by 4

Not on the map. Why?

Abstract (arXiv)

Despite impressive capabilities, LLMs' successes often rely on pattern-matching behaviors, yet these are also linked to OOD generalization failures in compositional tasks. However, behavioral studies commonly employ task setups that allow multiple generalization sources (e.g., algebraic invariances, structural repetition), obscuring a precise and testable account of how well LLMs perform generalization through pattern matching and their limitations. To address this ambiguity, we first formalize pattern matching as functional equivalence, i.e., identifying pairs of subsequences of inputs that consistently lead to identical results when the rest of the input is held constant. Then, we systematically study how decoder-only Transformer and Mamba behave in controlled tasks with compositional structures that isolate this mechanism. Our formalism yields predictive and quantitative insights: (1) Instance-wise success of pattern matching is well predicted by the number of contexts witnessing the relevant functional equivalence. (2) We prove a tight sample complexity bound of learning a two-hop structure by identifying the exponent of the data scaling law for perfect in-domain generalization. Our empirical results align with the theoretical prediction, under 20x parameter scaling and across architectures. (3) Path ambiguity is a structural barrier: when a variable influences the output via multiple paths, models fail to form unified intermediate state representations, impairing accuracy and interpretability. (4) Chain-of-Thought reduces data requirements yet does not resolve path ambiguity. Hence, we provide a predictive, falsifiable boundary for pattern matching and a foundational diagnostic for disentangling mixed generalization mechanisms.

Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). First posted on arXiv 26 May 2025.

Builds on

0 of 0 references.

No references here yet.

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 4.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Task Generalization With AutoRegressive Compositional Structure: Can Learning From D Tasks Generalize to DT Tasks?
  2. 2025Born a Transformer -- Always a Transformer? On the Effect of Pretraining on Architectural Abilities
  3. 2024Swing-by Dynamics in Concept Learning and Compositional Generalization
  4. 2023Discovering modular solutions that generalize compositionally
  5. 2024Benchmarking and Understanding Compositional Relational Reasoning of LLMs
  6. 2023Compositional Abilities Emerge Multiplicatively: Exploring Diffusion Models on a Synthetic Task
  7. 2024Do Large Language Models Have Compositional Ability? An Investigation into Limitations and Scalability
  8. 2026Operationalising the Superficial Alignment Hypothesis via Task Complexity