一句话:系统评估五种预训练代码模型在四项代码理解任务中的校准表现,揭示其过自信问题及现有校准方法的局限。
本文关注预训练代码模型在软件工程中的预测不确定性校准问题。现有研究多聚焦性能提升,忽视模型校准。作者选取五种预训练代码模型和四项代码理解任务,在分布内与多种分布外设置下系统评估校准性能,并考察温度缩放与标签平滑等校准方法。结果发现:模型常表现出过自信;温度缩放和标签平滑在分布内数据上有效;在分布外设置中过自信加剧,且这两种方法的校准效果下降。实验材料已开源。
Pre-trained code models have achieved notable success in the field of Software Engineering (SE). However, existing studies have predominantly focused on improving model performance, with limited attention given to other critical aspects such as model calibration. Model calibration, which refers to the accurate estimation of predictive uncertainty, is a vital consideration in practical applications. Therefore, in order to advance the understanding of model calibration in SE, we conduct a comprehensive investigation into the calibration of pre-trained code models in this paper. Our investigation focuses on five pre-trained code models and four code understanding tasks, including analyses of calibration in both in-distribution and out-of-distribution settings. Several key insights are uncovered: (1) pre-trained code models may suffer from the issue of over-confidence; (2) temperature scaling and label smoothing are effective in calibrating code models in in-distribution data; (3) the issue of over-confidence in pre-trained code models worsens in different out-of-distribution settings, and the effectiveness of temperature scaling and label smoothing diminishes. All materials used in our experiments are available at https://github.com/queserasera22/Calibration-of-Pretrained-Code-Models.