paperbot · PL 论文追踪

全部论文 待读 收藏

P2 NIL: large-scale detection of large-variance clones

NIL:大规模检测大差异克隆
FSE Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2021匹配度 2/10 · 论文研究传统的基于 token N-gram 与倒排索引的大规模代码克隆检测,属于静态分析与软件工程工具,但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,也未与 AI+PL 交叉。它仅在广义程序分析/工具可扩展性层面有间接参考价值,与用户当前核心方向匹配度低。引用 39 inbox
Tasuku Nakagawa, Yoshiki Higo, Shinji Kusumoto
crossref: 2026-09-12

AI 速览

一句话:提出基于 token N-gram 与倒排索引的可扩展克隆检测工具 NIL,能高效检测大规模代码库中的大差异克隆。

代码克隆检测中,大差异克隆(修改分散)和大间隔克隆(修改集中)难以被通用技术发现,且现有方法无法在大规模代码库上快速检测。本文提出可扩展的克隆检测技术 NIL,其核心是基于 token 的检测器:先用 token 序列的 N-gram 表示和倒排索引高效筛选候选克隆,再通过最长公共子序列(LCS)度量相似度来验证候选。作者在 1–250 MLOC 的不同规模输入上评估 NIL 的大差异克隆检测精度、通用 Type-1/2/3 克隆检测精度和可扩展性。实验表明,与现有最优工具相比,NIL 在大差异克隆检测上精度更高,在通用克隆检测上精度相当,并在各种输入规模下执行时间最短。

问题
通用克隆检测技术难以发现大差异或大间隔克隆,且缺乏能在大规模代码库中快速检测此类克隆的可扩展方法。
方法
NIL 是基于 token 的克隆检测器,利用 token 序列的 N-gram 表示和倒排索引高效筛选候选,再基于最长公共子序列(LCS)计算相似度来验证候选。
评估
在 1–250 MLOC 的不同规模输入上,评估大差异克隆检测精度、通用 Type-1/2/3 克隆检测精度和可扩展性,并与现有最优工具对比;结果显示 NIL 在大差异克隆上精度更高、通用精度相当、执行时间最短。
原文摘要(Abstract)

A code clone (in short, clone) is a code fragment that is identical or similar to other code fragments in source code. Clones generated by a large number of changes to copy-and-pasted code fragments are called large-variance (modifications are scattered) or large-gap (modifications are in one place) clones. It is difficult for general clone detection techniques to detect such clones and thus specialized techniques are necessary. In addition, with the rapid growth of software development, scalable clone detectors that can detect clones in large codebases are required. However, there are no existing techniques for quickly detecting large-variance or large-gap clones in large codebases. In this paper, we propose a scalable clone detection technique that can detect large-variance clones from large codebases and describe its implementation, called NIL. NIL is a token-based clone detector that efficiently identifies clone candidates using an N-gram representation of token sequences and an inverted index. Then, NIL verifies the clone candidates by measuring their similarity based on the longest common subsequence between their token sequences. We evaluate NIL in terms of large- variance clone detection accuracy, general Type-1, Type-2, and Type- 3 clone detection accuracy, and scalability. Our experimental results show that NIL has higher accuracy in terms of large-variance clone detection, equivalent accuracy in terms of general clone detection, and the shortest execution time for inputs of various sizes (1–250 MLOC) compared to existing state-of-the-art tools.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot6375,
  title = {NIL: large-scale detection of large-variance clones},
  author = {Tasuku Nakagawa and Yoshiki Higo and Shinji Kusumoto},
  booktitle = {FSE},
  year = {2021},
  doi = {10.1145/3468264.3468564}
}