Towards More Trustworthy Deep Code Models by Enabling Out-of-Distribution Detection

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Yan, Yanfu, Duong, Viet, Shao, Huajie, Poshyvanyk, Denys
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866916638078533632
author Yan, Yanfu
Duong, Viet
Shao, Huajie
Poshyvanyk, Denys
author_facet Yan, Yanfu
Duong, Viet
Shao, Huajie
Poshyvanyk, Denys
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2502_18883
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Towards More Trustworthy Deep Code Models by Enabling Out-of-Distribution Detection
Yan, Yanfu
Duong, Viet
Shao, Huajie
Poshyvanyk, Denys
Software Engineering
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.
title Towards More Trustworthy Deep Code Models by Enabling Out-of-Distribution Detection
topic Software Engineering
url https://arxiv.org/abs/2502.18883