Abstract
Self-consistency (SC), a widely used decoding strategy for chain-of-thought reasoning, shows significant gains across various multi-step reasoning tasks but comes with a high cost due to multiple sampling with the preset size. Its variants, Adaptive self-consistency (ASC) and Early-stopping self-consistency (ESC), dynamically adjust the number of samples based on the posterior distribution of a set of pre-samples, reducing the cost of SC with minimal impact on performance. Both methods, however, do not exploit the prior information about question difficulty. It often results in unnecessary repeated sampling for easy questions that could be accurately answered with just one attempt, wasting resources. To tackle this problem, we propose Difficulty-Adaptive Self-Consistency (DSC), which leverages the difficulty information of batch queries from both prior and posterior perspectives to adaptively allocate inference resources, further reducing the overall cost of SC. To demonstrate the effectiveness of DSC, we conduct extensive experiments on three popular categories of reasoning tasks: arithmetic, commonsense and symbolic reasoning on six benchmarks. The empirical results show that DSC consistently surpasses the strong baseline ASC and ESC in terms of costs by a significant margin, while attaining comparable performances.
Introduction
Large Language Models (LLMs) achieve superior performance on complex reasoning tasks through Self-Consistency (SC), a technique that aggregates multiple reasoning paths to find a consensus answer. However, SC is computationally expensive, often requiring dozens of samples per query. While optimized variants like Adaptive Self-Consistency (ASC) and Early-stopping (ESC) attempt to mitigate this by analyzing the posterior distribution of answers, they fail to utilize prior knowledge about question difficulty. This leads to significant resource waste on simple questions that could be solved with a single attempt.
Furthermore, existing methods often ignore the cost of input tokens. In few-shot reasoning, the long prompts and demonstrations can make input costs exceed output costs. This paper introduces Difficulty-Adaptive Self-Consistency (DSC), a framework designed to minimize both input and output costs by leveraging the LLM's ability to judge question difficulty.
Methodology
DSC shifts the focus toward prior difficulty information through a three-step workflow:
- Difficulty Ranking: The LLM ranks a batch of questions from easiest to hardest. To maintain accuracy within context limits, questions are ranked in small, shuffled batches and then aggregated into a global order.
- Problem Partition: Execution begins with the hardest questions. The system monitors result entropy; once it identifies a sequence of questions where the model is consistently confident (all samples match), it sets an "anchor point." Questions easier than this point are treated as "Easy" and receive only a single sample, bypassing expensive multi-sampling.
- Sample Size Pre-Allocation: For harder questions, DSC predicts the required sample size based on the average samples needed by the nearest, slightly easier neighbors. This minimizes the number of re-querying rounds, significantly reducing input token overhead.
Key Results and Insights
Experiments across six benchmarks (including MATH, GSM8K, and CSQA) demonstrate that DSC is highly effective:
- Significant Cost Reduction: On GPT-4, DSC reduced inference costs by an average of 65.29% compared to standard SC. It also outperformed the strong ESC baseline by 24.81% on GPT-4 and 21.86% on GPT-3.5-Turbo without compromising accuracy.
- LLMs as Difficulty Judges: A key insight is that LLMs, particularly GPT-4, are remarkably good at predicting task difficulty. The small upfront cost of ranking questions saves substantial resources during the inference phase.
- Addressing Input Costs: By pre-allocating sample sizes, DSC reduces the number of times expensive input prompts are sent to the API, addressing the "silent killer" of reasoning costs where input tokens often outweigh output tokens.
Conclusion
Difficulty-Adaptive Self-Consistency (DSC) provides a robust framework for cost-efficient LLM reasoning. By integrating prior difficulty assessments with posterior sampling dynamics, it achieves state-of-the-art accuracy at a fraction of the cost. While currently optimized for batch processing, future work will focus on adapting the method for streaming scenarios and improving ranking robustness across mixed task types.
Summary updated