paperbot · PL 论文追踪

全部论文 待读 收藏

P2 ZC<sup>3</sup>: Zero-Shot Cross-Language Code Clone Detection

ZC^3:零样本跨语言代码克隆检测
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 3/10 · 该论文研究零样本跨语言代码克隆检测,属于机器学习与程序语言的交叉,但主要关注代码表示对齐与克隆检测,不涉及用户的静态分析、Agentic 程序、浮点程序分析、贝叶斯程序分析或 LLM/Agent 改进静态分析等核心方向。仅可作为代码表示学习方向的边缘参考。引用 13 inbox
Jia Li, Chongyang Tao, Zhi Jin, Fang Liu, Jia Li, Ge Li
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出零样本跨语言代码克隆检测方法 ZC^3,无需平行数据即可对齐多语言表示并检测克隆。

跨语言代码克隆检测可帮助平台迁移与项目翻译,但收集跨语言平行数据(尤其低资源语言)代价高昂。本文提出 ZC^3,一种零样本跨语言代码克隆检测方法。它通过对比片段预测在不同编程语言间构建同构表示空间,并引入领域感知学习与循环一致性学习,使表示既跨语言对齐又能区分不同类型克隆。在四个代表性跨语言克隆检测数据集上,ZC^3 的 MAP 分别比当前最优基线提升 67.12%、51.39%、14.85% 和 53.01%;作者还分析了不同语言的表示分布并讨论了方法的有效性。

问题
如何在不依赖任何跨语言平行数据的情况下,设计有效的跨语言代码克隆检测模型,以支持跨平台开发与项目翻译,尤其面对低资源语言时平行数据难以获取。
方法
提出 ZC^3,采用对比片段预测在不同语言间形成同构表示空间,并结合领域感知学习与循环一致性学习,约束跨语言表示对齐且对克隆类型具有判别性。
评估
在四个代表性跨语言克隆检测数据集上进行大量实验,MAP 较当前最优基线分别提升 67.12%、51.39%、14.85%、53.01%,并进一步分析不同语言的表示分布。
原文摘要(Abstract)

Developers introduce code clones to improve programming productivity. Many existing studies have achieved impressive performance in monolingual code clone detection. However, during software development, more and more developers write semantically equivalent programs with different languages to support different platforms and help developers translate projects from one language to another. Considering that collecting cross-language parallel data, especially for low-resource languages, is expensive and time-consuming, how designing an effective cross-language model that does not rely on any parallel data is a significant problem. In this paper, we propose a novel method named ZC3 for Z_ero-shot Cross-language Code Clone detection. ZC3 designs the contrastive snippet prediction to form an isomorphic representation space among different programming languages. Based on this, ZC3 exploits domain-aware learning and cycle consistency learning to further constrain the model to generate representations that are aligned among different languages meanwhile are diacritical for different types of clones. To evaluate our approach, we conduct extensive experiments on four representative cross-language clone detection datasets. Experimental results show that ZC3 outperforms the state-of-the-art baselines by 67.12%, 51.39%, 14.85%, and 53.01% on the MAP score, respectively. We further investigate the representational distribution of different languages and discuss the effectiveness of our method.

链接与引用

DOI 原文 · arXiv · DBLP

BibTeX
@inproceedings{abs-2308-13754,
  title = {ZC<sup>3</sup>: Zero-Shot Cross-Language Code Clone Detection},
  author = {Jia Li and Chongyang Tao and Zhi Jin and Fang Liu and Jia Li and Ge Li},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00210}
}