Think Twice Before You Write -- an Entropy-based Decoding Strategy to Enhance LLM Reasoning

Jiashu He, Meizhu Liu, Olaitan P Olaleye, Amit Agarwal, M. Avendi, Yassi Abbasi, Matthew Rowe, Hitesh Laxmichand Patel, Paul Li, Tao Sheng, Sujith Ravi, Dan RotharXiv 2026

TL;DR

The paper introduces HN-decode, an adaptive, entropy-guided decoding framework that identifies high-uncertainty tokens during LLM generation and selectively branches at these critical decision points. By focusing computational budget only where the model is unsure and utilizing a novel "Entropy After </Think>" (EAT) stopping criterion, HN-decode enables smaller models like LLaMA-3.1-8B to match or exceed the reasoning performance of frontier models at a fraction of the cost.

What Problem Does This Paper Address?

When large language models (LLMs) tackle complex, multi-step reasoning tasks (like mathematics or logic), they are highly susceptible to error propagation. Standard decoding strategies like greedy search or top-$k$ sampling treat every token uniformly. If a model makes a single misstep early in a reasoning chain, that error cascades, leading to a final answer that may look convincing but is fundamentally flawed.

While techniques like self-consistency mitigate this by sampling multiple full reasoning paths and taking a majority vote, they are computationally extravagant—wasting resources regenerating parts of the prompt where the model was already highly confident.

Figure 2: Different kinds of reasoning errors made by LLMs in complex tasks are due to one or a few wrong tokens which mislead the problem-solving direction.

The authors address this inefficiency by asking: Can we dynamically allocate our search budget to focus purely on the "decision-critical moments" where the model is most uncertain?

Methods

The authors propose HN-decode (High-Entropy-Token-Guided Decoding), which operates in two main phases:

  1. Entropy-Based Token Selection & Branching: The model generates an initial solution. At each step, it calculates the Shannon entropy of the next-token probability distribution. High entropy signifies a uniform distribution where the model is uncertain. The algorithm identifies these "vulnerable tokens," truncates the rollout just before them, and forks alternative tokens to create a pool of partial rollouts.
  2. Parallel Thinking via Partial Rollouts: Instead of sampling entirely new trajectories, generation resumes from these partial paths in the job pool, greedily exploring alternative branches while reusing the confident, low-entropy prefixes.
Figure 3: An example of parallel thinking on vulnerable tokens. Here, "equilateral" is the vulnerable token.

To determine when to stop exploring, the paper introduces a rollout-level Entropy After </Think> (EAT) stopping criterion. Instead of checking step-by-step, the framework replays the completed reasoning trace, measures the mean ($\mu$) and variance ($\sigma$) of the next-token entropies at the </think> boundaries, and accepts the solution only if it meets a strict stability threshold.

Datasets

The framework was evaluated on two primary mathematical benchmarks:

  • GSM8K: Grade-school math word problems.
  • AMC2023: American Mathematics Competition problems (substantially more challenging).

To rigorously test robustness, the authors also generated perturbed variants of these datasets (2,242 for GSM8K and 320 for AMC2023) using a method that swaps out input-output values while strictly preserving the underlying programmatic reasoning structure.

Key Insights and Ideas

  • Uncertainty is Localized: LLM reasoning errors are rarely distributed evenly. They cluster around specific pivot points. Token-wise Shannon entropy serves as an excellent proxy for identifying these exact bottleneck moments.
  • Prefix Reuse Saves Compute: Indiscriminate sampling wastes compute on trivial tokens (e.g., syntax, obvious arithmetic). Branching from partial rollouts ensures that the model only spends FLOPs on meaningful logical divergences.
  • Holistic Thought Stability: The EAT stopping criterion relies on the philosophy that a correct and stable reasoning path will naturally conclude with low-entropy, highly confident token distributions.

Key Results

HN-decode yields massive accuracy boosts across both small and large models:

  • LLaMA-3.1-8B: On GSM8K, accuracy shot up from a base of 84.2% to 99.6%. On the difficult AMC2023 benchmark, it surged from 45.0% to 97.5%.
  • GPT-4o: Achieved 100% on GSM8K (up from 96.3%) and 98.25% on AMC2023 (up from 75.0%).
Figure 1: Performance on GSM8K, our Entropy Decod- ing approach enables the 8B Llama model to outperform the base GPT models with ∼33x less compute.

When tested against a frontier model (referred to as GPT-5 in the text) on the perturbed datasets, LLaMA-3.1-8B equipped with HN-decode achieved comparable accuracy (99.2% vs 96.6% on GSM8K_p) while operating at more than an order of magnitude lower API cost ($0.05¢ vs $0.52¢ per question).

Quantitative results across datasets and models.

Limitations and Future Work

Despite its strong performance, the authors note several limitations:

  • Confidently Wrong Errors: If a model suffers from a deep systematic misconception, it might output an incorrect token with very low entropy, causing HN-decode to miss the error entirely.
  • Combinatorial Explosion: In highly adversarial or complex settings with many consecutive high-entropy tokens, the pool of partial rollouts could grow rapidly, driving up computational costs.
  • Inference Constraints: The method requires access to token-level log probabilities/entropy signals, which are often restricted or inefficient to compute through commercial, closed-source APIs.

Future work includes extending this framework beyond mathematics into code generation, scientific discovery, and multimodal reasoning tasks.

Summary updated

BibTeX
@misc{he2026think,
  author = {Jiashu He and Meizhu Liu and Olaitan P Olaleye and Amit Agarwal and M. Avendi and Yassi Abbasi and Matthew Rowe and Hitesh Laxmichand Patel and Paul Li and Tao Sheng and Sujith Ravi and Dan Roth},
  title = {{Think Twice Before You Write -- an Entropy-based Decoding Strategy to Enhance LLM Reasoning}},
  year = {2026},
  eprint = {2604.00018},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.00018},
}
Figure