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

基于语义保持变换的自监督对比学习代码检索与摘要

Self-Supervised Contrastive Learning for Code Retrieval and Summarization via Semantic-Preserving Transformations

Huawei Ireland Research Center(华为爱尔兰研究中心);The Open University(开放大学);Singapore Management University(新加坡管理大学)

Nghi D. Q. Bui, Yijun Yu, Lingxiao Jiang

摘要:

我们提出了Corder,一个自监督的对比学习框架的源代码模型。Corder旨在减轻代码检索和代码摘要任务对标记数据的需求。Corder的预训练模型可以以两种方式使用:(1)它可以产生代码的矢量表示,可以应用于没有标记数据的代码检索任务;(2)它可以用于可能仍然需要标记数据的任务的微调过程,例如代码摘要。关键的创新是我们通过对比学习目标要求源代码模型识别相似和不相似的代码片段来训练源代码模型。为此,我们使用一组语义保持转换操作符来生成语法上不同但语义上等效的代码片段。通过大量的实验,我们已经证明,Corder预训练的代码模型在代码到代码检索、文本到代码检索和代码到文本摘要任务中的表现大大优于其他基线。

英文摘要:

We propose Corder, a self-supervised contrastive learning framework for source code model. Corder is designed to alleviate the need of labeled data for code retrieval and code summarization tasks. The pre-trained model of Corder can be used in two ways: (1) it can produce vector representation of code which can be applied to code retrieval tasks that do not have labeled data; (2) it can be used in a fine-tuning process for tasks that might still require label data such as code summarization. The key innovation is that we train the source code model by asking it to recognize similar and dissimilar code snippets through a contrastive learning objective. To do so, we use a set of semantic-preserving transformation operators to generate code snippets that are syntactically diverse but semantically equivalent. Through extensive experiments, we have shown that the code models pretrained by Corder substantially outperform the other baselines for code-to-code retrieval, text-to-code retrieval, and code-to-text summarization tasks.

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

↑