Enhancing Chain of Thought Prompting in Large Language Models via Reasoning Patterns

Yufeng Zhang, Xuepeng Wang, Lingxiang Wu, Jinqiao Wang · DOI

TL;DR

Current unsupervised Chain-of-Thought (CoT) prompting methods select few-shot examples based on surface-level question semantics, which often introduces irrelevant noise. This paper introduces Pattern-CoT, a novel approach that selects demonstrations based on underlying reasoning patterns (the sequence of logical operations) rather than text similarity. This method consistently improves LLM performance across diverse reasoning tasks while providing explicit interpretability into how prompts guide model outputs.

What Problem Does This Paper Address?

Chain-of-Thought (CoT) prompting has revolutionized how we elicit multi-step reasoning from Large Language Models (LLMs). However, finding the best "demonstrations" (few-shot examples) to prime the model remains a challenge.

Existing unsupervised selection methods, like Auto-CoT, cluster examples based on the semantic features of the questions. For instance, two questions about "buying apples" might be grouped together even if one requires simple addition and the other requires complex algebraic division. This semantic-matching approach introduces global noise, obscures the core logic needed for the task, and lacks interpretability.

Recent literature suggests that LLMs are influenced far more by the structural templates and logical patterns in a prompt than by surface-level text similarity. This paper addresses the gap between demonstration selection and the actual target reasoning paths.

Methods

The authors propose Pattern-CoT, a framework designed to capture and cluster fine-grained logical operations. The pipeline consists of three main phases:

Figure 2: Illustration of our proposed framework. We first extract different patterns from the original rationales. Then clustering is used to produce a group of demonstrations. This enables LLMs to perceive diverse reasoning patterns and to select a proper solution path. It avoids LLMs being biased by monotonous reasoning mode.
  1. Seed Demonstration Collection: A pool of rationales and answers is generated from the dataset using standard zero-shot CoT ("Let's think step by step").
  2. Pattern Discovery: The authors define a set of task-specific "operation tokens" (e.g., +, -, *, /, twice, half for math; yesterday, tomorrow for date understanding). These tokens are extracted from the zero-shot rationales to form a condensed "reasoning pattern" sequence for each question.
  3. Pattern-Wise Demonstration Selection: These abstracted pattern sequences are encoded using a language model (Sentence-BERT) and clustered via $k$-means. By sampling a representative example from each cluster, the final prompt contains a highly diverse set of logical solving strategies.

Additionally, the authors introduce an Adaptive $k$ formula to automatically determine the optimal number of demonstration examples ($k$) based on the number of unique operation types ($n$) and the dataset size ($N$): $$k = \lceil \frac{1}{2} \times n \times (1 + \log(N)) \rceil$$

Datasets

The method was evaluated across eight representative reasoning benchmarks:

  • Arithmetic/Math: MultiArith, GSM8K, AddSub, AQuA-RAT, SingleEq, and SVAMP.
  • Symbolic/Logical Reasoning: Coin-Flip and BIG-bench Date Understanding.

Key Insights and Ideas

  • Logic Trumps Semantics: For datasets like Coin-Flip and Date Understanding, where questions are semantically almost identical, traditional semantic clustering fails. Pattern-CoT excels here because it differentiates examples based on the underlying state-transitions or temporal shifts rather than the words used.
  • The "Pattern" Matters More Than Correctness: In a striking finding, the authors noted that even when the selected demonstrations contained high error rates (including the AQuA dataset, which had a 100% error rate in its selected few-shot examples), Pattern-CoT still yielded significant downstream accuracy gains. The LLM learns how to approach the problem structurally, ignoring the incorrect arithmetic labels.
  • Mitigating Model Bias: Using perturbation-based feature attribution, the authors visualized how repetitive patterns in standard Auto-CoT bias the model toward specific operations. Introducing diverse reasoning patterns effectively reduces this bias, allowing the model to activate the correct reasoning pathways.
Figure 4: Visualization of token attribution for the case study. The left part stands for the score matrix of patterns from Auto- CoT, and the right part stands for the score matrix from our method. The upper column denotes each individual prompt, and the row denotes the generated token sequence. Higher scores (positive) indicate that the input has a greater impact on the output.

Key Results

Pattern-CoT was validated using LLaMA-2 (7B and 13B), GPT-3.5-turbo, and Qwen-7B.

  • Consistent Outperformance: Pattern-CoT consistently beat Zero-Shot-CoT, Random-CoT, and Auto-CoT. For example, on the SVAMP dataset using LLaMA-2-13B, Pattern-CoT achieved an accuracy of 56.39%, outperforming Auto-CoT's 55.50%.
  • Adaptive $k$ Gains: Implementing the adaptive cluster sizing yielded further improvements. On the AQuA dataset with LLaMA-2-13B, using adaptive $k$ boosted accuracy from 26.37% to 31.49%.
  • Completeness of Operations: The authors showed that dropping specialized operation tokens (using only basic +, -, *, /) degrades performance, proving that capturing the full logical scope of the task is vital (see Figure 3 in the paper).

Limitations and Future Work

While powerful, Pattern-CoT relies on defining a discrete action space (the operation tokens). For straightforward math or symbolic tasks, this is easy. However, for highly abstract or open-ended reasoning tasks (like creative writing or complex legal reasoning), defining or automatically discovering these operation tokens remains an open challenge. Additionally, due to hardware constraints, the authors primarily evaluated open-source models up to 13B parameters, leaving the impact on ultra-large frontier models as a direction for future study.

Summary updated

BibTeX
@inproceedings{zhang2025enhancing,
  author = {Yufeng Zhang and Xuepeng Wang and Lingxiang Wu and Jinqiao Wang},
  title = {{Enhancing Chain of Thought Prompting in Large Language Models via Reasoning Patterns}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i24.34793},
}
Figure