arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2402.01935cs.CL
收藏

大规模代码表示学习

Code Representation Learning At Scale

AWS AI Labs(亚马逊云科技AI实验室)

Dejiao Zhang, Wasi Ahmad, Ming Tan, Hantian Ding, Ramesh Nallapati, Dan Roth, Xiaofei Ma, Bing Xiang

AI总结:

本研究提出两阶段预训练方案,利用海量代码数据训练编码器,通过混合去噪和双模态对比学习,显著提升多种下游任务性能,并揭示关键因素。

摘要:

近期研究表明,大规模代码语言模型在下游任务(如代码生成)上展现出显著的性能提升。然而,现有的大多数代码表示学习工作仅使用非常有限的预训练语料库,在亿级参数规模上训练模型。在本工作中,我们通过一种两阶段预训练方案,利用海量代码数据来推动代码表示学习。我们首先通过一种混合方法训练编码器,该方法同时利用了掩码语言建模中的随机性和编程语言的结构特性。然后,我们通过对比学习,使用以无监督方式构建的困难负样本和困难正样本来增强表示。我们建立了一个现成的编码器模型,该模型在多种下游任务上持续大幅超越现有模型。为了理解促成成功代码表示学习的因素,我们进行了详细的消融实验,并分享了关于以下方面的发现:(i)一种针对源代码的定制且有效的词元级去噪方案;(ii)困难负样本和困难正样本的重要性;(iii)所提出的双模态对比学习如何提升跨语言语义搜索性能;(iv)预训练方案如何决定下游任务性能随模型规模的变化。

英文摘要:

Recent studies have shown that code language models at scale demonstrate significant performance gains on downstream tasks, i.e., code generation. However, most of the existing works on code representation learning train models at a hundred million parameter scale using very limited pretraining corpora. In this work, we fuel code representation learning with a vast amount of code data via a two-stage pretraining scheme. We first train the encoders via a mix that leverages both randomness in masking language modeling and the structure aspect of programming language. We then enhance the representations via contrastive learning with hard negative and hard positive constructed in an unsupervised manner. We establish an off-the-shelf encoder model that persistently outperforms the existing models on a wide variety of downstream tasks by large margins. To comprehend the factors contributing to successful code representation learning, we conduct detailed ablations and share our findings on (i) a customized and effective token-level denoising scheme for source code; (ii) the importance of hard negatives and hard positives; (iii) how the proposed bimodal contrastive learning boost the cross-lingual semantic search performance; and (iv) how the pretraining schemes decide the downstream task performance scales with the model size.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑