paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Can Neural Clone Detection Generalize to Unseen Functionalitiesƒ

神经克隆检测能否泛化到未见功能?
ASE 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE)2021匹配度 3/10 · 论文主题是神经代码克隆检测的跨功能泛化与评估,属于机器学习与程序语言/代码分析的交叉,但与画像核心关注的 LLM/Agent 静态分析、浮点程序分析、贝叶斯程序分析均无直接交叉;仅其“指出现有方法在特定场景失效并设计评估方法”的问题驱动风格有一定参考价值。引用 13 inbox
Chenyao Liu, Zeqi Lin, Jian-Guang Lou, Lijie Wen, Dongmei Zhang
crossref: 2026-09-12

AI 速览

一句话:揭示神经代码克隆检测缺乏跨功能泛化能力,并给出评估方法、影响因素分析与人在环适配机制。

论文指出当前神经代码克隆检测评估方法存在一个关键疏漏:未考察跨功能泛化,即检测训练中从未出现过的功能所对应的语义克隆。作者首先提出一套能系统度量跨功能泛化性的评估方法,并据此开展实证研究,发现现有神经克隆检测器在新功能上的泛化能力远低于预期。随后论文分析影响泛化性的三个关键因素:训练数据多样性、词表(out-of-vocabulary)问题与局部性,结果表明缓解未登录词问题、提升训练数据多样性可显著降低未见功能上的性能损失。最后作者提出一种人在环机制,将迁移学习与主动学习结合,帮助检测器适配包含大量未见功能的新代码仓库,实验显示该机制可减少约 88% 的人工标注量。代码与数据已公开。

问题
现有神经克隆检测器的评估只看同功能分布内的表现,忽略跨功能泛化,因此无法判断它们是否真正学到了语义克隆检测能力,而非仅仅拟合训练数据中的特定功能。
方法
提出系统度量跨功能泛化性的评估方法;通过实证研究分析训练数据多样性、词表与局部性三个影响因素;并提出结合迁移学习与主动学习的人在环机制,使检测器适配含大量未见功能的新仓库。
评估
基于所提评估方法开展实证研究,发现现有检测器在未见功能上泛化不佳;因素分析与人在环适配实验表明,缓解未登录词问题、增加数据多样性可减少性能损失,且该机制将标注量降低约 88%。
原文摘要(Abstract)

Many recently proposed code clone detectors exploit neural networks to capture latent semantics of source code, thus achieving impressive results for detecting semantic clones. These neural clone detectors rely on the availability of large amounts of labeled training data. We identify a key oversight in the current evaluation methodology for neural clone detection: cross-functionality generalization (i.e., detecting semantic clones of which the functionalities are unseen in training). Specifically, we focus on this question: do neural clone detectors truly learn the ability to detect semantic clones, or they just learn how to model specific functionalities in training data while cannot generalize to realistic unseen functionalitiesƒ This paper investigates how the generalizability can be evaluated and improved.Our contributions are 3-folds: (1) We propose an evaluation methodology that can systematically measure the cross-functionality generalizability of neural clone detection. Based on this evaluation methodology, an empirical study is conducted and the results indicate that current neural clone detectors cannot generalize well as expected. (2) We conduct empirical analysis to understand key factors that can impact the generalizability. We investigate 3 factors: training data diversity, vocabulary, and locality. Results show that the performance loss on unseen functionalities can be reduced through addressing the out-of-vocabulary problem and increasing training data diversity. (3) We propose a human-in-the-loop mechanism that help adapt neural clone detectors to new code repositories containing lots of unseen functionalities. It improves annotation efficiency with the combination of transfer learning and active learning. Experimental results show that it reduces the amount of annotations by about 88%. Our code and data are publicly available1.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot6509,
  title = {Can Neural Clone Detection Generalize to Unseen Functionalitiesƒ},
  author = {Chenyao Liu and Zeqi Lin and Jian-Guang Lou and Lijie Wen and Dongmei Zhang},
  booktitle = {ASE},
  year = {2021},
  doi = {10.1109/ase51524.2021.9678907}
}