Recent learning techniques for the representation of code depend mostly on human-annotated (labeled) data. In this work, we are proposing Corder, a self-supervised learning system that can learn to represent code without having to label data. 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 paradigm. We use a set of semantic-preserving transformation operators to generate snippets that are syntactically diverse but semantically equivalent. The contrastive learning objective, at the same time, maximizes agreement between different views of the same snippets and minimizes agreement between transformed views of different snippets. We train different instances of Corder on 3 neural network encoders, which are Tree-based CNN, ASTNN, and Code2vec over 2.5 million unannotated Java methods mined from GitHub. Our result shows that the Corder pre-training improves code classification and method name prediction with large margins. Furthermore, the code vectors generated by Corder are adapted to code clustering which has been shown to significantly beat the other baselines.


翻译:在这项工作中,我们提出Corder,这是一个自我监督的学习系统,可以学习在无需标签数据的情况下代表代码。关键的创新是,我们通过要求源代码模型通过对比性学习模式承认相似和不同的代码片段来培训源代码模型。我们使用一套语义保存转换操作器生成片段,这些片段在实际操作上是多种多样的,但在语义上是等同的。同时,对比性学习目标将同一片段的不同观点之间达成最大程度的一致,并将不同片段不同转变观点之间的协议最小化。我们培训了3个神经网络编码模型的不同案例,即基于树木的CNN、ASTNNN和从GitHub开采的250多万无注释 Java方法。我们的结果显示,Corder-训练前改进了代码分类和大边距的方法名称预测。此外,Corder生成的代码矢量器被调整为代码组合,大大地打破了其他基线。

0
下载
关闭预览

相关内容

100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
161+阅读 · 2020年3月18日
已删除
将门创投
3+阅读 · 2019年9月4日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Arxiv
0+阅读 · 2020年11月20日
VIP会员
相关VIP内容
100+篇《自监督学习(Self-Supervised Learning)》论文最新合集
专知会员服务
161+阅读 · 2020年3月18日
相关资讯
已删除
将门创投
3+阅读 · 2019年9月4日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
disentangled-representation-papers
CreateAMind
26+阅读 · 2018年9月12日
Hierarchical Disentangled Representations
CreateAMind
4+阅读 · 2018年4月15日
Auto-Encoding GAN
CreateAMind
7+阅读 · 2017年8月4日
Top
微信扫码咨询专知VIP会员