paperbot · PL 论文追踪

全部论文 待读 收藏

Harnessing Uncertainty in Code Language Models: Lessons from Vulnerability Detection

利用代码语言模型中的不确定性:来自漏洞检测的经验教训
ASE Proceedings of the 41st IEEE/ACM International Conference on Automated Software Engineering2026引用 0 inbox
Haodong Li, Xiao Cheng, Xudong Wang, Zhihao Guo, Haoyu Wang
crossref: 2026-10-09

AI 速览

一句话:系统实证研究代码语言模型漏洞检测中的不确定性估计,揭示校准与不确定性增强方法的有效性依赖模型规模与标签条件建模。

代码语言模型(CLM)正被广泛用于漏洞检测,但其预测何时可信仍缺乏依据。本文是一篇经验论文,对基于 CLM 的漏洞检测中的不确定性估计进行了系统性实证研究:在 1,050 个真实项目上,覆盖 8 个 2B–16B 参数规模的模型,评估 4 种校准方法与 2 类不确定性驱动的增强框架,并分别在分布内与分布外设置下考察。研究发现:(1) 校准效果依赖模型规模——温度缩放与集成方法稳定有效,而 Monte Carlo Dropout 与贝叶斯低秩适配反向传播仅对约 6B–7B 的中等规模模型有益;(2) 基于不确定性的纠错必须采用标签条件建模才有效,在分布外数据上最多提升 12% Macro-F1,而全局策略效果可忽略;(3) 课程学习未能超越标准微调,因为基于不确定性的难度排序与模型学到的决策边界不一致,导致训练不稳定或收益甚微。这些结果挑战了不确定性方法可普遍迁移的假设,并为部署不确定性感知的漏洞检测提供了实践指南。

问题
研究不确定性估计方法在生成式代码语言模型漏洞检测中是否仍然有效,以及其效果受哪些因素影响。
方法
在 1,050 个真实项目上,对 8 个 2B–16B 参数的代码语言模型,评估 4 种校准方法与 2 类不确定性驱动增强框架,覆盖分布内与分布外设置。
评估
通过 Macro-F1 等指标比较不同校准与增强策略在分布内、分布外检测任务上的表现,并分析模型规模、标签条件建模与课程学习的影响。
原文摘要(Abstract)

Code Language Models (CLMs) are increasingly adopted for vulnerability detection, yet knowing when to trust their predictions remains an open challenge. Uncertainty estimation has improved reliability in traditional discriminative models, but whether these benefits transfer to the generative paradigm of CLMs is unclear. This experience paper presents a systematic empirical study of uncertainty estimation in CLM-based vulnerability detection, evaluating four calibration methods and two uncertainty-driven enhancement frameworks across eight models (2B--16B parameters) under both in-distribution and out-of-distribution settings on 1,050 real-world projects. Our study reveals that: (1) calibration effectiveness is model-scale dependent: temperature scaling and ensembles deliver consistent gains, while Monte Carlo Dropout and Bayesian Low-Rank Adaptation by Backpropagation only benefit medium-scale models (approximately 6B--7B parameters); (2) uncertainty-based correction requires label-conditional modeling to be effective (up to 12% Macro-F1 improvement on out-of-distribution data), as global strategies show negligible effects; (3) curriculum learning fails to improve upon standard fine-tuning, as uncertainty-based difficulty ordering does not align with the learned decision boundary, causing training instability or negligible gains. These findings challenge assumptions about the universal transferability of uncertainty methods and provide practical guidelines for deploying uncertainty-aware vulnerability detection.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot12198,
  title = {Harnessing Uncertainty in Code Language Models: Lessons from Vulnerability Detection},
  author = {Haodong Li and Xiao Cheng and Xudong Wang and Zhihao Guo and Haoyu Wang},
  booktitle = {ASE},
  year = {2026},
  doi = {10.1145/3832783.3837465}
}