mlsanityData to 7 Oct 2026

Task Abstention for Large Language Models in Code Generation

arXiv 2605.17029 ↗First posted 16 May 2026cs.SE cs.AIcited by 0

Not on the map. Why?

Abstract (arXiv)

Large language models (LLMs) have revolutionized automated code generation. One serious concern, however, is the so-called ``hallucination'', i.e., LLMs may generate seemingly plausible but functionally incorrect code. In this paper, we study the task abstention problem, i.e., determining whether a given LLM should abstain from performing a specific code generation task to avoid likely hallucination. Our approach features a calibrated abstention rule, grounded in the principles of multiple hypothesis testing. The rule assesses generation consistency through code execution outcomes, allowing it to handle syntactic diversity of semantically equivalent code without reliance on oracle test cases or external databases. We prove that our approach provides a rigorous, distribution-free theoretical guarantee on its abstention decisions. We evaluate our method on benchmark datasets using several open-source code LLMs. Results show that our method allows generative models to more accurately and efficiently identify and abstain from tasks that induce hallucination compared to existing techniques, providing a reliable mechanism for safer and more robust code generation.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 50 of its 59 references that are in the map. First posted on arXiv 16 May 2026.

Builds on

50 of 59 references.

References · 50

  1. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  2. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
  3. 2021Program Synthesis with Large Language Modelscited by 3,509
  4. 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
  5. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  6. 2022Language Models (Mostly) Know What They Knowcited by 1,783
  7. 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,582
  8. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  9. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  10. 2024Qwen2.5-Coder Technical Reportcited by 1,151
  11. 2023Can LLMs Express Their Uncertainty? An Empirical Evaluation of Confidence Elicitation in LLMscited by 946
  12. 2023Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generationcited by 795
38 more
  1. 2023Just Ask for Calibration: Strategies for Eliciting Calibrated Confidence Scores from Language Models Fine-Tuned with Human Feedbackcited by 788
  2. 2023SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Modelscited by 787
  3. 2022Teaching Models to Express Their Uncertainty in Wordscited by 731
  4. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
  5. 2019Conformal Prediction Under Covariate Shiftcited by 511
  6. 2023Large Language Models Are Not Robust Multiple Choice Selectorscited by 454
  7. 2021Adaptive Conformal Inference Under Distribution Shiftcited by 360
  8. 2022Conformal prediction beyond exchangeabilitycited by 348
  9. 2022Conformal Risk Controlcited by 290
  10. 2021Learn then Test: Calibrating Predictive Algorithms to Achieve Risk Controlcited by 256
  11. 2023A Survey of Confidence Estimation and Calibration in Large Language Modelscited by 253
  12. 2023Large Language Models for Software Engineering: Survey and Open Problemscited by 178
  13. 2024Don't Hallucinate, Abstain: Identifying LLM Knowledge Gaps via Multi-LLM Collaborationcited by 176
  14. 2023Conformal Language Modelingcited by 163
  15. 2023Shifting Attention to Relevance: Towards the Predictive Uncertainty Quantification of Free-Form Large Language Modelscited by 147
  16. 2024To Believe or Not to Believe Your LLMcited by 120
  17. 2024Know Your Limits: A Survey of Abstention in Large Language Modelscited by 116
  18. 2023R-Tuning: Instructing Large Language Models to Say `I Don't Know'cited by 106
  19. 2022DisentQA: Disentangling Parametric and Contextual Knowledge with Counterfactual Question Answeringcited by 93
  20. 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigationcited by 92
  21. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 78
  22. 2023Alignment for Honestycited by 72
  23. 2022Automated Repair of Programs from Large Language Modelscited by 71
  24. 2024SynCode: LLM Generation with Grammar Augmentationcited by 66
  25. 2023The Art of Defending: A Systematic Evaluation and Analysis of LLM Defense Strategies on Safety and Over-Defensivenesscited by 63
  26. 2024EffiBench: Benchmarking the Efficiency of Automatically Generated Codecited by 62
  27. 2024Distinguishing the Knowable from the Unknowable with Language Modelscited by 45
  28. 2023Look Before You Leap: An Exploratory Study of Uncertainty Measurement for Large Language Modelscited by 40
  29. 2023Learn to Refuse: Making Large Language Models More Controllable and Reliable through Knowledge Scope Limitation and Refusal Mechanismcited by 33
  30. 2024CodeHalu: Investigating Code Hallucinations in LLMs via Execution-based Verificationcited by 32
  31. 2024Towards Understanding the Characteristics of Code Generation Errors Made by Large Language Modelscited by 28
  32. 2024Cycles of Thought: Measuring LLM Confidence through Stable Explanationscited by 27
  33. 2023RELIC: Investigating Large Language Model Responses using Self-Consistencycited by 23
  34. 2024CodeMirage: Hallucinations in Code Generated by Large Language Modelscited by 23
  35. 2023Jailbreaker in Jail: Moving Target Defense for Large Language Modelscited by 14
  36. 2024De-Hallucinator: Mitigating LLM Hallucinations in Code Generation Tasks via Iterative Groundingcited by 14
  37. 2024Epistemology of Language Models: Do Language Models Have Holistic Knowledge?cited by 9
  38. 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 9

Built on by

Not cited yet.