Characterizing Pattern Matching and Its Limits on Compositional Task Structures

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Chang, Hoyeon, Park, Jinho, Cho, Hanseul, Yang, Sohee, Ko, Miyoung, Hwang, Hyeonbin, Won, Seungpil, Lee, Dohaeng, Ahn, Youbin, Seo, Minjoon
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918364784361472
author Chang, Hoyeon
Park, Jinho
Cho, Hanseul
Yang, Sohee
Ko, Miyoung
Hwang, Hyeonbin
Won, Seungpil
Lee, Dohaeng
Ahn, Youbin
Seo, Minjoon
author_facet Chang, Hoyeon
Park, Jinho
Cho, Hanseul
Yang, Sohee
Ko, Miyoung
Hwang, Hyeonbin
Won, Seungpil
Lee, Dohaeng
Ahn, Youbin
Seo, Minjoon
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2505_20278
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Characterizing Pattern Matching and Its Limits on Compositional Task Structures
Chang, Hoyeon
Park, Jinho
Cho, Hanseul
Yang, Sohee
Ko, Miyoung
Hwang, Hyeonbin
Won, Seungpil
Lee, Dohaeng
Ahn, Youbin
Seo, Minjoon
Machine Learning
Artificial Intelligence
Computation and Language
I.2.6
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.
title Characterizing Pattern Matching and Its Limits on Compositional Task Structures
topic Machine Learning
Artificial Intelligence
Computation and Language
I.2.6
url https://arxiv.org/abs/2505.20278