Let's Sample Step by Step: Adaptive-Consistency for Efficient Reasoning and Coding with LLMs

Pranjal Aggarwal, Aman Madaan, Yiming Yang, Mausam

Introduction

Self-Consistency (SC) has emerged as a robust technique for enhancing the reasoning capabilities of Large Language Models (LLMs). By sampling multiple outputs for a single query and selecting the majority answer, SC significantly reduces logical errors and hallucinations. However, SC is computationally expensive, typically requiring a fixed budget of samples (e.g., 40 or 100) regardless of the problem's difficulty. This "fixed-budget" approach leads to significant waste when a model reaches a clear consensus early in the sampling process.

Methodology: Adaptive-Consistency

To address this inefficiency, we introduce Adaptive-Consistency (AC), an inference-time technique that dynamically adjusts the number of samples for each query. AC introduces a lightweight Stopping Criterion that halts generation as soon as a stable majority is identified.

Figure 1: Comparison between Self-Consistency and Adaptive-Consistency. AC achieves the same result with significantly fewer samples by using a stopping criterion.

The core of AC is a Bayesian framework that estimates the probability that the current majority answer will remain the leader if sampling were to continue. The researchers proposed three variations of this criterion:

  1. Dirichlet Stopping Criteria: Models the distribution of unique answers to calculate the confidence in the majority stability.
  2. Beta Stopping Criteria: A highly efficient approximation focusing on the gap between the top two answers. It is four orders of magnitude faster to compute than the Dirichlet version with negligible performance loss.
  3. Geometric Mean for Code: Tailored for code generation, this applies stopping criteria across multiple test cases independently.

Because AC operates entirely during inference, it requires no retraining or fine-tuning of the underlying LLM.

Experimental Setup

The method was evaluated across 17 diverse datasets, including mathematical reasoning (GSM-8K, SVAMP), commonsense reasoning (StrategyQA), symbolic reasoning (Logical Deduction), and code generation (HumanEval, MBPP). Testing involved three prominent models: Vicuna-13B, Code-Davinci-002, and GPT-3.5-Turbo.

Key Insights and Results

The Accuracy Plateau

A critical observation in this research is the "accuracy-confidence trade-off." While standard Self-Consistency continues to consume compute linearly, accuracy typically plateaus early. AC identifies the "knee" of this curve, stopping sampling just as diminishing returns begin.

Figure 3: Accuracy vs. Sample Budget. Adaptive-Consistency reaches peak accuracy much faster than standard Self-Consistency, identifying the optimal stopping point.

Performance Gains

  • Efficiency: On average, AC requires 3.3x fewer samples than standard SC. In specific symbolic reasoning tasks, efficiency gains reached up to 7.9x.
  • Accuracy Preservation: Across all 17 datasets, the average drop in accuracy was less than 0.1%.
  • Code Generation Improvement: Interestingly, on the Code-Davinci-002 model, AC improved accuracy by 0.4% while using 2.4x fewer samples, likely by avoiding the "noise" introduced by excessive sampling in large sets.

Limitations and Future Work

While highly effective, AC is subject to Majority Bias; if a model is consistently and confidently wrong, AC will stop early on that incorrect answer. Furthermore, the current implementation relies on exact string matching for voting, which may struggle with semantically identical but syntactically different long-form responses. Future work will explore semantic similarity and more robust criteria to mitigate model-specific biases.

Conclusion

Adaptive-Consistency provides a simple, model-agnostic way to make LLM reasoning significantly more efficient. By treating the sampling budget as a dynamic resource rather than a fixed cost, AC enables high-performance reasoning at a fraction of the traditional computational price.

Summary updated

BibTeX
@inproceedings{aggarwal2023let,
  author = {Pranjal Aggarwal and Aman Madaan and Yiming Yang and Mausam},
  title = {{Let's Sample Step by Step: Adaptive-Consistency for Efficient Reasoning and Coding with LLMs}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.761},
}
Figure