Pith. sign in

REVIEW 5 cited by

Uncertainty-Guided Chain-of-Thought for Code Generation with LLMs

Not yet reviewed by Pith; the record is open.

This paper has not been read by Pith yet. Machine review is queued; the pith claim, tier, and objections will appear here once it completes.

SPECIMEN: schema-true, not a live event

T0 review · schema-true

One-sentence machine reading of the paper's core claim.

pith:XXXXXXXX · record.json · timestamp

arxiv 2503.15341 v1 pith:4VK7VCRB submitted 2025-03-19 cs.SE

classification cs.SE
keywords codellmsgenerationreasoninguncertaintyaccuracychain-of-thoughtuncert-cot
verification ladder T0 review T1 audit T2 compute T3 formal
0 comments
read the original abstract

Chain-of-Thought (CoT) reasoning has been demonstrated as an effective technique for improving the problem-solving capabilities of large language models (LLMs) in the context of code generation. However, existing CoT methods often exhibit a tendency toward "overthinking", where the LLM consistently applies reasoning strategies without adequately considering the task's underlying complexity. This results in the LLMs allocating excessive computational resources, in terms of tokens, to relatively simple tasks or problems where the correct answer is already evident. Additionally, this overthinking may lead LLMs down incorrect reasoning paths, resulting in incorrect code generation. In this paper, we introduce UnCertainty-Aware Chain-of-Thought (UnCert-CoT), an LLM-based approach designed to enhance code generation by incorporating an uncertainty-aware CoT reasoning mechanism, which focuses computational resources on targeting points where LLMs are more prone to error. We propose two confidence-based uncertainty measures: Entropy-based and Probability Differential-based methods. When uncertainty is high, UnCert-CoT activates CoT-decoding to generate multiple reasoning paths and selects the final code that exhibits the highest likelihood of correctness. In contrast, LLM directly generates the code when uncertainty is low. This uncertainty judgment mechanism allows LLMs to prioritize complex tasks and avoid unnecessary steps in simpler cases, thereby improving overall efficiency and accuracy in code generation. Our experimental results demonstrate that UnCert-CoT significantly enhances code generation accuracy on challenging benchmark MHPP(Mostly Hard Python Problems), it achieves improvements up to 6.1% on PassRate accuracy, particularly in situations where traditional LLMs are prone to errors.

Discussion (0). Sign in to comment.

Forward citations

Cited by 5 Pith papers

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score. Full citation record

  1. Code-MUE: Measuring Code LLMs' Uncertainty through Execution-based Semantic Interaction Graphs

    cs.SE 2026-07 conditional novelty 6.0 of 10

    Code-MUE measures Code LLM uncertainty via execution-based Semantic Interaction Graphs and Von Neumann entropy, correlating strongly with functional correctness on eight models.

  2. Lil: Less is Less When Applying Post-Training Sparse-Attention Algorithms in Long-Decode Stage

    cs.CL 2026-01 unverdicted novelty 5.0 of 10

    Sparse attention in LLM decode stages increases end-to-end complexity via information loss that lengthens outputs; early-stopping reduces tokens by 90 percent with under 2 percent accuracy drop.

  3. Self-Reflective Generation at Test Time

    cs.CL 2025-10 conditional novelty 5.0 of 10

    SRGen improves LLM math reasoning by detecting high-entropy tokens and injecting a small corrected vector into the hidden state at those points during decoding, without training.

  4. Temporalizing Confidence: Evaluation of Chain-of-Thought Reasoning with Signal Temporal Logic

    cs.LG 2025-06 conditional novelty 4.0 of 10

    Stepwise CoT confidence is reshaped and scored with signal temporal logic robustness to produce better calibrated confidence estimates on Gaokao math questions.

  5. Chain-of-Code Collapse: Reasoning Failures in LLMs via Adversarial Prompting in Code Generation

    cs.CL 2025-06 reject novelty 4.0 of 10

    Prompt rewrites of LeetCode problems cause large accuracy swings in nine LLMs, but invalid negation test cases and inconsistent tables make the headline numbers unreliable.

Pith tools