ZC3: Zero-Shot Cross-Language Code Clone Detection

  • 2023-09-07 12:22:59
  • Jia Li, Chongyang Tao, Zhi Jin, Fang Liu, Jia Li, Ge Li
  • 0


Developers introduce code clones to improve programming productivity. Manyexisting studies have achieved impressive performance in monolingual code clonedetection. However, during software development, more and more developers writesemantically equivalent programs with different languages to support differentplatforms and help developers translate projects from one language to another.Considering that collecting cross-language parallel data, especially forlow-resource languages, is expensive and time-consuming, how designing aneffective cross-language model that does not rely on any parallel data is asignificant problem. In this paper, we propose a novel method named ZC3 forZero-shot Cross-language Code Clone detection. ZC3 designs the contrastivesnippet prediction to form an isomorphic representation space among differentprogramming languages. Based on this, ZC3 exploits domain-aware learning andcycle consistency learning to further constrain the model to generaterepresentations that are aligned among different languages meanwhile arediacritical for different types of clones. To evaluate our approach, we conductextensive experiments on four representative cross-language clone detectiondatasets. Experimental results show that ZC3 outperforms the state-of-the-artbaselines by 67.12%, 51.39%, 14.85%, and 53.01% on the MAP score, respectively.We further investigate the representational distribution of different languagesand discuss the effectiveness of our method.


Quick Read (beta)

loading the full paper ...