为大模型代码生成设计了能保证高置信度的不确定性量化方法
Uncertainty Quantification for LLM-based Code Generation
- 基于多重假设检验构建风险可控的预测集
- 在相同风险水平下代码剔除率降低24.5%
- 适合需要可靠生成结果的编程场景
预测集为机器学习模型的不确定性提供了理论基础框架。将其应用于结构化生成任务,特别是大语言模型(LLM)驱动的代码生成,仍具挑战性。现有方法提出PAC预测集,但受限于对风险的强单调性假设和单标签分类框架,严重压缩候选程序空间,无法容纳代码生成中固有的多有效输出特性。为此,我们提出RisCoSet方法,利用多重假设检验为LLM代码生成构建风险控制的预测集。给定训练好的代码生成模型,生成一个部分程序表示的预测集,该集合以高置信度包含正确解。在三个LLM上的大量实验表明该方法有效:例如,在同等风险水平下,相比最先进方法,代码移除率最高可降低24.5%。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。