一句话:提出面向代码的无监督与弱监督分布外检测方法,提升深度代码模型的可信度。
许多面向软件工程(SE)的机器学习模型都假设训练与测试数据同分布,但真实场景中训练集难以覆盖完整分布且测试分布会随时间漂移。当模型遇到与训练数据不同的分布外(OOD)样本时,可信模型应能检测它们,从而拒绝预测或将其转交给处理其他类别或任务的模型。本文提出两类面向代码的 SE 专用 OOD 检测方法:无监督方法仅用分布内样本训练;弱监督方法利用极少量 OOD 样本进一步提升多种 OOD 场景下的检测性能。大量实验表明,所提方法在四种 OOD 场景中同时显著优于基线,并对一个主流代码理解任务产生积极影响。
Numerous machine learning (ML) models have been developed, including those for software engineering (SE) tasks, under the assumption that training and testing data come from the same distribution. However, training and testing distributions often differ, as training datasets rarely encompass the entire distribution, while testing distribution tends to shift over time. Hence, when confronted with out-of-distribution (OOD) instances that differ from the training data, a reliable and trustworthy SE ML model must be capable of detecting them to either abstain from making predictions, or potentially forward these OODs to appropriate models handling other categories or tasks. In this paper, we develop two types of SE-specific OOD detection models, unsupervised and weakly-supervised OOD detection for code. The unsupervised OOD detection approach is trained solely on in-distribution samples while the weakly-supervised approach utilizes a tiny number of OOD samples to further enhance the detection performance in various OOD scenarios. Extensive experimental results demonstrate that our proposed methods significantly outperform the baselines in detecting OOD samples from four different scenarios simultaneously and also positively impact a main code understanding task.
DOI 原文 ·
@inproceedings{paperbot8847,
title = {Towards More Trustworthy Deep Code Models by Enabling Out-of-Distribution Detection},
author = {Yanfu Yan and Viet Duong and Huajie Shao and Denys Poshyvanyk},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00177}
}