The Dichotomy Between Pattern Recognition and Step-by-Step Reasoning

Amrut Nadgir, Pratik Chaudhari, Vijay BalasubramanianarXiv 2026

This paper from researchers at the University of Pennsylvania offers a compelling theoretical and empirical bridge between two seemingly distinct behaviors in Large Language Models (LLMs): statistical pattern recognition and logical, step-by-step reasoning.

TL;DR

The authors argue that reasoning and pattern recognition are two ends of a spectrum defined by context length. By modeling reasoning traces as paths on a De Bruijn graph, they prove that reasoning is highly sample-efficient because a model only needs to learn local transitions (edges) to generalize to an exponential number of global paths.

What Problem Does This Paper Address?

We know LLMs are trained to predict the next token by imitating statistical patterns. Yet, when prompted to "think step-by-step," they solve complex problems they couldn't handle directly. This creates a conceptual tension: is reasoning a fundamentally different paradigm, or just a specific type of pattern recognition?

The authors tackle the "sample efficiency" mystery: how can LLMs learn to solve complex, long-horizon reasoning tasks from a relatively small amount of relevant training data? They hypothesize that the secret lies in De Bruijn structure—a property where the next step in a reasoning chain depends only on a small window of the immediate past.

Methods

The researchers formalize reasoning traces as paths on a De Bruijn Directed Acyclic Graph (DAG). In this framework:

  • Nodes represent a short context of length $c$.
  • Edges represent valid transitions to the next token.

They provide theoretical proofs showing that the number of edges required to define a reasoning space is "vanishingly small" compared to the total number of possible reasoning paths.

To test this, they:

  1. Synthetic Experiments: Trained small transformers on synthetic De Bruijn DAGs to measure how sample complexity scales with graph size.
  2. Controlled Fine-tuning: Fine-tuned Qwen2.5-1.5B-Instruct on equation-solving and story-tracking tasks, varying the frequency of "state emissions" (explicitly writing out the current state of the problem) to control the context window $c$.
  3. Attention Masking: Applied sliding-window attention to Qwen3 models on real-world benchmarks to see how much "past" is actually needed for reasoning.

Datasets

  • Synthetic De Bruijn DAGs: Custom-generated graphs with varying vocabulary sizes ($V$) and context lengths ($c$).
  • Equation-Solving: A custom dataset of linear, quadratic, cubic, and product equations.
  • Story Task: Algorithmically generated stories requiring "Theory of Mind" to track character beliefs and object locations.
  • Standard Benchmarks: GSM8K (grade school math), MATH-500 (harder math), and GPQA-Diamond (graduate-level science).

Key Insights and Ideas

  • Reasoning as Graph Compression: If a task has De Bruijn structure, an LLM doesn't need to see every possible reasoning trace. It only needs to see enough samples to cover the edges of the graph. Once it learns the edges, it can compose them to traverse paths it has never seen before, including paths much longer than those in the training set.
  • The Locality of Reasoning: Reasoning is "local." In a well-structured chain-of-thought, the next token should ideally only depend on the current "state" of the problem, not the entire history.
  • The Accuracy-Robustness Trade-off:
    • Small $c$ (Frequent States): Leads to high accuracy and high sample efficiency but makes the model "brittle." If the model makes one small error in a state, that error propagates because the model only looks at the immediate (now corrupted) past.
  • Large $c$ (Infrequent States): The model falls back on global pattern recognition. It is more robust to local perturbations but requires significantly more data to achieve high accuracy.
  • Implicit vs. Explicit Structure: The authors found that for the sample efficiency gains to occur, the De Bruijn structure must be explicit in the tokens. If the structure is hidden (e.g., via permutations), the transformer fails to exploit it.
A De Bruijn graph where nodes are 4-grams and edges are next-token transitions.

Key Results

  • Power Law Scaling: The number of training samples a transformer needs to learn a reasoning task follows a power law relative to the number of edges in its De Bruijn DAG (roughly $\text{Samples} \propto \text{Edges}^{0.6}$ to $0.9$).
  • Generalization to Length: Models trained on short reasoning traces can generalize to much longer ones, provided the underlying graph structure is learned.
  • Real-World Evidence: On benchmarks like GSM8K and MATH-500, Qwen3 models retained over 75% of their accuracy even when their attention was restricted to a sliding window less than 15% of the total reasoning trace length. This suggests that real-world reasoning tasks already exhibit significant De Bruijn structure.
The minimum number of paths to cover a DAG (Pmin) is a tiny fraction of total paths (Ptot) as the graph grows.

Limitations and Future Work

  • Explicit States: The study relies heavily on tasks where "states" can be explicitly written out (like an equation). Natural language reasoning is often fuzzier, and identifying the "implicit" De Bruijn structure in prose remains a challenge.
  • Vocabulary Trade-offs: While larger vocabularies theoretically improve graph compression, they also increase the difficulty of the next-token classification task at each step. Finding the "optimal" vocabulary size for reasoning is an open question.
  • Error Correction: Future work could explore training models to explicitly "recover" from the drift observed in low-$c$ reasoning models, perhaps by mixing different context lengths during training.

Summary updated

BibTeX
@misc{nadgir2026dichotomy,
  author = {Amrut Nadgir and Pratik Chaudhari and Vijay Balasubramanian},
  title = {{The Dichotomy Between Pattern Recognition and Step-by-Step Reasoning}},
  year = {2026},
  eprint = {2610.09186},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.09186},
}
Figure