XCode : Towards Cross-Language Code Representation with Large-Scale Pre-Training

Author:

Lin Zehao1ORCID,Li Guodun1,Zhang Jingfeng1,Deng Yue1,Zeng Xiangji1,Zhang Yin1,Wan Yao2

Affiliation:

1. College of Computer Science and Technology, Zhejiang University, Hangzhou, Zhejiang, China

2. School of Computer Sci. and Tech., Huazhong University of Science and Technology, Wuhan, Hubei, China

Abstract

Source code representation learning is the basis of applying artificial intelligence to many software engineering tasks such as code clone detection, algorithm classification, and code summarization. Recently, many works have tried to improve the performance of source code representation from various perspectives, e.g., introducing the structural information of programs into latent representation. However, when dealing with rapidly expanded unlabeled cross-language source code datasets from the Internet, there are still two issues. Firstly, deep learning models for many code-specific tasks still suffer from the lack of high-quality labels. Secondly, the structural differences among programming languages make it more difficult to process multiple languages in a single neural architecture. To address these issues, in this article, we propose a novel Cross -language Code representation with a large-scale pre-training ( XCode ) method. Concretely, we propose to use several abstract syntax trees and ELMo-enhanced variational autoencoders to obtain multiple pre-trained source code language models trained on about 1.5 million code snippets. To fully utilize the knowledge across programming languages, we further propose a Shared Encoder-Decoder (SED) architecture which uses the multi-teacher single-student method to transfer knowledge from the aforementioned pre-trained models to the distilled SED. The pre-trained models and SED will cooperate to better represent the source code. For evaluation, we examine our approach on three typical downstream cross-language tasks, i.e., source code translation, code clone detection, and code-to-code search, on a real-world dataset composed of programming exercises with multiple solutions. Experimental results demonstrate the effectiveness of our proposed approach on cross-language code representations. Meanwhile, our approach performs significantly better than several code representation baselines on different downstream tasks in terms of multiple automatic evaluation metrics.

Funder

National Natural Science Foundation of China

MoE Engineering Research Center of Digital Library

Chinese Knowledge Center for Engineering Sciences and Technology

National Engineering Research Center for Big Data Technology and System

Fundamental Research Funds for the Central Universities

Publisher

Association for Computing Machinery (ACM)

Subject

Software

Reference110 articles.

1. Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek Gordon Murray, Benoit Steiner, Paul A. Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. 2016. TensorFlow: A system for large-scale machine learning. In Proceedings of the 12th USENIX Symposium on Operating Systems Design and Implementation, OSDI 2016, Savannah, GA, November 2-4, 2016, Kimberly Keeton and Timothy Roscoe (Eds.), USENIX Association, 265–283. Retrieved from https://www.usenix.org/conference/osdi16/technical-sessions/presentation/abadi.

2. A Survey of Machine Learning for Big Code and Naturalness

3. Uri Alon, Shaked Brody, Omer Levy, and Eran Yahav. 2019. code2seq: Generating sequences from structured representations of code. In Proceedings of the 7th International Conference on Learning Representations. OpenReview.net. Retrieved from https://openreview.net/forum?id=H1gKYo09tX.

4. A general path-based representation for predicting program properties

5. code2vec: learning distributed representations of code

Cited by 5 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. Transformers in source code generation: A comprehensive survey;Journal of Systems Architecture;2024-08

2. A Two-stage Coarsening Method for a Streaming Graph with Preserving Key Features;Proceedings of the 2024 International Conference on Generative Artificial Intelligence and Information Security;2024-05-10

3. PTM-APIRec: Leveraging Pre-trained Models of Source Code in API Recommendation;ACM Transactions on Software Engineering and Methodology;2023-11-14

4. Improving Cross-Language Code Clone Detection via Code Representation Learning and Graph Neural Networks;IEEE Transactions on Software Engineering;2023-11

5. IRC-CLVul: Cross-Programming-Language Vulnerability Detection with Intermediate Representations and Combined Features;Electronics;2023-07-13

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3