论文精选

一种通过分层无对比表示学习实现 IV 型代码克隆检测的方法

Type-IV Code Clone Detection via Layer-Wise Non-Contrastive Representation Learning

精选理由

这篇论文介绍了一种叫 LWVIC4Code 的方法,专门用来检测 IV 型代码克隆,比传统方法更有效。

本文提出 LWVIC4Code 方法,通过无对比学习解决 IV 型代码克隆检测难题。在 Kamino 和 GPTCloneBench 数据集上,该方法在无负样本的情况下实现了与对比学习基线相当或更好的性能,并有效推广到 Java 和 C# 语言。

原文 · arXiv cs.LG

Type-IV Code Clone Detection via Layer-Wise Non-Contrastive Representation Learning

Software clones are fragments of code that are similar or functionally equivalent to each other. They pose significant challenges for maintenance, refactoring, and bug detection. Detecting Type-IV clones, which are semantically equivalent but may differ syntactically, is particularly difficult for traditional token- or syntax-based methods. Recent machine learning approaches rely on contrastive learning, which requires careful negative sampling and can introduce bias. In this paper, we propose LWVIC4Code, a non-contrastive representation learning approach specifically designed for Type-IV clone detection. Building on the Variance-Invariance-Covariance Regularization (VICReg) framework and prior layer-wise VICReg training, LWVIC4Code introduces cross-layer consistency regularization and depth-dependent layer weighting to progressively refine semantic information across transformer layers, producing robust and discriminative code representations. We conduct an empirical study comparing LWVIC4Code against a contrastive learning baseline and zero-shot large language models on Python (Kamino) and multi-language (GPTCloneBench) datasets. Results show that LWVIC4Code achieves competitive or superior performance without negative samples, benefits from layer-wise supervision, and generalizes effectively from Python to other languages, particularly Java and C#. These results demonstrate that non-contrastive, layer-wise representation learning is a promising direction for robust semantic code clone detection.