Maximizing Prefix-Confidence at Test-Time Efficiently Improves Mathematical Reasoning

Matthias Otth, Jonas Hübotter, Ido Hakimi, Andreas KrausearXiv 2025 · DOI

Abstract

Improving the mathematical reasoning capabilities of Large Language Models (LLMs) at test-time typically involves generating numerous full solutions and selecting the best one via majority voting or verifiers. However, these methods are either computationally prohibitive or suffer from "length bias," where shorter, potentially incorrect answers are favored due to higher cumulative probabilities. This paper proposes Test-Time Prefix-Confidence Scaling, a method that generates only the initial tokens (prefixes) of multiple reasoning paths and proceeds with the most promising one. Experiments on competition-level benchmarks like AIME demonstrate that this approach achieves better accuracy-compute trade-offs than traditional majority voting and effectively bypasses length bias.

Introduction

Multi-step reasoning remains a significant challenge for LLMs. Current strategies to enhance performance at inference time include Majority Voting (Self-Consistency), which picks the most frequent answer among many full generations, and Best-of-N (BoN) Sampling, which uses a verifier or internal model confidence to select a single answer. While effective, Majority Voting is compute-intensive. Conversely, BoN sampling often fails because LLM confidence scores are multiplicative; longer, more detailed reasoning chains naturally accumulate lower total probabilities than shorter ones, leading to a detrimental "length bias."

Researchers from ETH Zürich address these issues by introducing a "fail fast" mechanism. By evaluating the model's confidence early in the generation process—specifically after just 32 tokens—they can identify high-quality reasoning paths without the overhead of full generation.

Methods: Prefix-Confidence Scaling

The core innovation is evaluating confidence on fixed-length prefixes rather than full sequences.

Prefix-Confidence Voting

Instead of generating $N$ complete solutions, the model generates $N$ short prefixes (e.g., the first 32 tokens). The model then ranks these prefixes based on two metrics:

  1. Self-confidence: The raw log-likelihood of the generated sequence.
  2. Self-certainty: A measure of how much the model's token distribution deviates from a random uniform distribution.

The model selects the prefix with the highest score and completes only that single reasoning chain. Because all candidates are of the same length, the multiplicative probability penalty is equalized, effectively eliminating length bias.

Conceptual diagram of Test-Time Prefix-Confidence Scaling.

Prefix-Confidence Training

The authors also explored Test-Time Training (TTT). In this variant, the model is briefly fine-tuned on its own high-confidence prefixes before generating the final answer. While this method showed promise, the inference-only voting approach generally provided a better balance of speed and accuracy.

Experimental Setup

The researchers utilized the Qwen2.5-Math-1.5B-Instruct model. Performance was evaluated across a spectrum of mathematical difficulty:

  • School-level: GSM8K and MATH500.
  • Competition-level: AMC23, AIME24, and AIME25.

Results and Analysis

The experimental results highlight significant efficiency gains and robustness across tasks.

Efficiency and Accuracy Trade-offs

Prefix-confidence scaling with 16 samples (PC@16) consistently outperformed or matched Majority Voting while requiring significantly less compute. For instance, on the AIME24 benchmark, PC@16 achieved 16.7% accuracy, rivaling Majority Voting at a fraction of the inference time.

Accuracy vs. Inference Time across various mathematical benchmarks.

Overcoming Length Bias

The study confirmed that standard BoN sampling on full attempts often degrades performance compared to the base model due to length bias. On MATH500, the base model's 73.6% accuracy dropped to 71.3% when using full-attempt confidence selection. By contrast, prefix-based selection maintained or improved upon the base model's performance by comparing sequences of identical length.

Key Insights

  • The 32-Token Threshold: Analysis suggests that approximately 32 tokens—roughly two sentences of "scratchpad" reasoning—are sufficient for the model to signal the likely success of a reasoning path.
  • Metric Performance: "Self-confidence" (likelihood) emerged as a more robust signal than "self-certainty" for complex competition-level tasks, whereas self-certainty was competitive on simpler tasks like GSM8K.

Discussion and Future Work

While highly effective for mathematics, the generalizability of prefix-confidence scaling to more subjective domains like creative writing or coding remains an open question. Additionally, the use of a fixed prefix length (32 tokens) might be suboptimal; future iterations could employ dynamic lengths that adjust based on problem difficulty. Finally, implementing semantic grouping to avoid redundant prefix sampling could further optimize the search space and improve diversity in reasoning paths.

Conclusion

Test-Time Prefix-Confidence Scaling offers a compute-efficient alternative to traditional test-time scaling methods. By identifying promising reasoning paths early and avoiding the pitfalls of length bias, it enables smaller models to achieve performance levels previously reserved for much more expensive sampling strategies.

Summary updated

BibTeX
@misc{otth2025maximizing,
  author = {Matthias Otth and Jonas Hübotter and Ido Hakimi and Andreas Krause},
  title = {{Maximizing Prefix-Confidence at Test-Time Efficiently Improves Mathematical Reasoning}},
  year = {2025},
  eprint = {2507.18122},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.18122},
}
Figure