Characterizing Overconfident Failure in LLM-Based Code Generation
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) are increasingly used for automated code generation, but generated programs can appear syntactically plausible while still failing execution-based correctness checks. Existing validation methods, such as testing and program analysis, remain essential but are often incomplete, costly, or applied only after generation. Model-derived uncertainty is therefore a natural early reliability signal. This paper studies the dilemma of overconfidence in code LLMs where incorrect programs are often generated with token-level confidence comparable to correct programs. We study this dilemma across four open-source code models and three execution-based benchmarks. Our analysis begins by investigating whether existing uncertainty metrics provide reliable proxies for execution correctness in code generation. We then characterize overconfidence at both global and local token levels, asking whether incorrect programs remain indistinguishable from correct ones under confidence and entropy summaries, including selective generation and the limits of instruction tuning. Finally, we evaluate whether common mitigation strategies reduce this failure mode. Our study yields four findings. First, existing uncertainty signals provide only partial and model-dependent evidence of execution failure. Second, overconfidence persists at both program and token levels, and uncertainty-based selection does not consistently improve accepted-set accuracy. Third, instruction tuning can increase certainty on failing generations without consistently improving correctness discrimination. Fourth, common mitigation techniques improve specific aspects of reliability but do not reliably resolve overconfident failure. Our exploratory latent analysis suggests that hidden representations may encode correctness-related signals that output confidence does not expose.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 29 of its 73 references that are in the map. First posted on arXiv 8 Oct 2026.
Builds on
29 of 73 references.
References · 29
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2023Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generationcited by 795
- 2023Generating with Confidence: Uncertainty Quantification for Black-box Large Language Modelscited by 286
- 2024OpenCodeInterpreter: Integrating Code Generation with Execution and Refinementcited by 242
- 2025Why Language Models Hallucinatecited by 205
- 2024Fact-Checking the Output of Large Language Models via Token-Level Uncertainty Quantificationcited by 159
- 2023Shifting Attention to Relevance: Towards the Predictive Uncertainty Quantification of Free-Form Large Language Modelscited by 147
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024Benchmarking Uncertainty Quantification Methods for Large Language Models with LM-Polygraphcited by 105
- 2022Mutual Information Alleviates Hallucinations in Abstractive Summarizationcited by 67
- 2023Uncertainty in Natural Language Generation: From Theory to Applicationscited by 61
17 more
- 2025A Survey of Uncertainty Estimation Methods on Large Language Modelscited by 57
- 2024Calibration and Correctness of Language Models for Codecited by 49
- 2023Uncertainty in Natural Language Processing: Sources, Quantification, and Applicationscited by 44
- 2024TESTEVAL: Benchmarking Large Language Models for Test Case Generationcited by 38
- 2022Rainproof: An Umbrella To Shield Text Generators From Out-Of-Distribution Datacited by 21
- 2025From Calibration to Collaboration: LLM Uncertainty Quantification Should Be More Human-Centeredcited by 21
- 2025An Empirical Analysis of Uncertainty in Large Language Model Evaluationscited by 20
- 2025Latent Thinking Optimization: Your Latent Reasoning Language Model Secretly Encodes Reward Signals in Its Latent Thoughtscited by 18
- 2025Reconsidering LLM Uncertainty Estimation Methods in the Wildcited by 17
- 2025Assessing Correctness in LLM-Based Code Generation via Uncertainty Estimationcited by 14
- 2024Investigating Context-Faithfulness in Large Language Models: The Roles of Memory Strength and Evidence Stylecited by 11
- 2025Training Language Models to Generate Quality Code with Program Analysis Feedbackcited by 11
- 2023R-U-SURE? Uncertainty-Aware Code Suggestions By Maximizing Utility Across Random User Intentscited by 10
- 2024AmbigNLG: Addressing Task Ambiguity in Instruction for NLGcited by 10
- 2021Estimating Predictive Uncertainty Under Program Data Distribution Shiftcited by 5
- 2024DOCE: Finding the Sweet Spot for Execution-Based Code Generationcited by 4
- 2026Code Is More Than Text: Uncertainty Estimation for Code Generationcited by 4
Built on by
Not cited yet.