Uncertainty Quantification for LLM-based Code Generation
Not on the map. Why?
Abstract (arXiv)
Prediction sets provide a theoretically grounded framework for quantifying uncertainty in machine learning models. Adapting them to structured generation tasks, in particular, large language model (LLM) based code generation, remains a challenging problem. An existing attempt proposes PAC prediction sets but is limited by its strong monotonicity assumption on risk and single-label classification framework, which severely limits the space of candidate programs and cannot accommodate the multiple valid outputs inherent to code generation. To address these limitations, we propose an approach RisCoSet that leverages multiple hypothesis testing to construct risk-controlling predictions for LLM-based code generation. Given a trained code generation model, we produce a prediction set represented by a partial program, which is guaranteed to contain a correct solution with high confidence. Extensive experiments on three LLMs demonstrate the effectiveness of the proposed method. For instance, compared with the state-of-the-art, our method can significantly reduce the code removal by up to 24.5%, at the same level of risk.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 25 of its 41 references that are in the map. First posted on arXiv 12 May 2026.
Builds on
25 of 41 references.
References · 25
- 2023GPT-4 Technical Reportcited by 18,132
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2017On Calibration of Modern Neural Networkscited by 4,860
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2024Qwen2.5-Coder Technical Reportcited by 1,151
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2022Teaching Models to Express Their Uncertainty in Wordscited by 731
- 2022CodeT: Code Generation with Generated Testscited by 369
- 2022Conformal Risk Controlcited by 290
- 2021Distribution-Free, Risk-Controlling Prediction Setscited by 278
13 more
- 2016Least Ambiguous Set-Valued Classifiers with Bounded Error Levelscited by 270
- 2021Learn then Test: Calibrating Predictive Algorithms to Achieve Risk Controlcited by 256
- 2024Large Legal Fictions: Profiling Legal Hallucinations in Large Language Modelscited by 144
- 2023Conformal Prediction with Large Language Models for Multi-Choice Question Answeringcited by 131
- 2024Benchmarking LLMs via Uncertainty Quantificationcited by 124
- 2019PAC Confidence Sets for Deep Neural Networks via Calibrated Predictioncited by 59
- 2022Predictive Inference with Feature Conformal Predictioncited by 33
- 2021Learning to Complete Code with Sketchescited by 23
- 2018Studying the Difference Between Natural and Programming Language Corporacited by 13
- 2025A Theoretical Study on Bridging Internal Probability and Self-Consistency for LLM Reasoningcited by 13
- 2024Benchmarking Llama2, Mistral, Gemma and GPT for Factuality, Toxicity, Bias and Propensity for Hallucinationscited by 8
- 2025Probably Approximately Correct Labelscited by 7
- 2023PAC Prediction Sets for Large Language Models of Codecited by 5
Built on by
Not cited yet.