paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Calibration and Correctness of Language Models for Code

代码语言模型的校准与正确性
ICSE 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE)2025匹配度 3/10 · 论文聚焦代码生成语言模型的校准性与正确性评估,属于对LLM自身可信度的研究,而非将静态分析用于Agent/ML系统,也未用LLM改进静态分析、形式化验证或涉及浮点/贝叶斯程序分析;虽与Coding Agent中“是否信任生成代码”的决策有弱关联,但不在画像核心方向内。引用 25 inbox
Claudio Spiess, David Gros, Kunal Suresh Pai, Michael Pradel, Md Rafiqul Islam Rabin, Amin Alipour, Susmit Jha, Prem Devanbu, Toufique Ahmed
crossref: 2026-09-12

AI 速览

一句话:构建代码生成模型校准性评估框架,发现模型开箱即用校准不佳,并评估 Platt scaling 的改进效果与适用边界。

机器学习模型常会出错,用户需要可靠的置信度指示来判断是否该信任某个输出。校准研究此前多集中于非生成式分类场景。本文针对生成式代码模型,提出一个评估校准性的框架,涵盖多种任务、正确性判据、数据集与置信度估计方法。实验发现,所测试的生成式代码模型总体上开箱即用校准不佳,即置信度与正确性关联不强。作者进一步表明,使用 Platt scaling 等标准方法可以改善校准,但由于 Platt scaling 依赖预先获得正确性数据,本文评估了其在软件工程中的适用性与泛化性,讨论了它真正具有实用潜力的情形以及受限的情形,为后续研究提供了框架,并有助于开发者更理性地决定如何使用模型生成的代码。

问题
生成式代码模型常产生错误输出,开发者需要可靠的置信度来判断应直接使用、仔细审查还是丢弃,但现有校准研究多集中于非生成式分类场景。
方法
提出一个评估代码生成模型校准性的框架,覆盖多种任务、正确性判据、数据集与置信度估计方法,并考察 Platt scaling 等标准校准方法的改进效果与泛化性。
评估
在多个任务、数据集与正确性标准上测量模型的校准性,发现多数生成式代码模型开箱即用校准不佳;进一步评估 Platt scaling 在软件工程场景中的适用性,指出其有效与受限的情形。
原文摘要(Abstract)

Machine learning models are widely used, but can also often be wrong. Users would benefit from a reliable indication of whether a given output from a given model should be trusted, so a rational decision can be made whether to use the output or not. For example, outputs can be associated with a confidence measure; if this confidence measure is strongly associated with likelihood of correctness, then the model is said to be well-calibrated. A well-calibrated confidence measure can serve as a basis for rational, graduated decision-making on how much review and care is needed when using generated code. Calibration has so far been studied in mostly non-generative (e.g., classification) settings, especially in software engineering. However, generated code can quite often be wrong: Given generated code, developers must decide whether to use directly, use after varying intensity of careful review, or discard model-generated code. Thus, calibration is vital in generative settings. We make several contributions. We develop a framework for evaluating the calibration of code-generating models. We consider several tasks, correctness criteria, datasets, and approaches, and find that, by and large, generative code models we test are not well-calibrated out of the box. We then show how calibration can be improved using standard methods, such as Platt scaling. Since Platt scaling relies on the prior availability of correctness data, we evaluate the applicability and generalizability of Platt scaling in software engineering, discuss settings where it has good potential for practical use, and settings where it does not. Our contributions will lead to better-calibrated decision-making in the current use of code generated by language models, and offers a framework for future research to further improve calibration methods for generative models in software engineering.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8816,
  title = {Calibration and Correctness of Language Models for Code},
  author = {Claudio Spiess and David Gros and Kunal Suresh Pai and Michael Pradel and Md Rafiqul Islam Rabin and Amin Alipour and Susmit Jha and Prem Devanbu and Toufique Ahmed},
  booktitle = {ICSE},
  year = {2025},
  doi = {10.1109/icse55347.2025.00040}
}