论文笔记 | code pretraining(代码预训练系列)

Pre-trained contextual embedding of source code

ICLR 2020 reject,后改为Learning and Evaluating Contextual Embedding of Source Code,发表在ICML 2020
Google Brain
CuBERT:开源代码和数据链接
和Bert无区别,只是替换了语料和微调的任务。

本文做的是代码预训练,提出了CuBERT(Code Understanding BERT)。在6.6M python files的语料上做训练。数据是public Github repository hosted on Google’s BigQuery platform。

预训练任务

  1. Masked language modeling (MLM)
    预测mask的token是什么

  2. Next Sentence Prediction(NSP)
    预测两个代码逻辑行是否为上下句的关系

微调任务
5个分类任务和一个其他任务

  1. Variable Misuse Classification
  2. Wrong Binary Operator
  3. Swapped Operand
  4. Function-Docstring Mismatch
  5. Exception type
  6. Variable Misuse localization and repair
    微调的数据集为:
    在这里插入图片描述

CodeBERT: A Pre-trained model for programming and natural languages

EMNLP findings, 2020
Zhangyin Feng, Daya Guo, Duyu Tang …
哈工大,中山大学,微软亚洲研究院
开源代码和数据
可用:预训练模型;在每种语言上进行微调比在6种语言上一起微调效果更优;

本文做的是代码预训练,提出了CodeBERT(a first large bimodal pre-trained model for natural language and programming language)。

模型架构
Follow Bert,RoBERTa,使用多层双向Transformer作为CodeBERT的模型架构,和RoBERTa-Base中的架构一样,其中的模型参数有125 Million(1.25亿参数)


input: [ C L S ] , w 1 , w 2 , ⋯   , w n , [ S E P ] , c 1 , c 2 , ⋯   , c m , [ E O S ] [CLS], w_1, w_2, \cdots, w_n, [SEP], c_1, c_2, \cdots, c_m, [EOS] [CLS],w1,w2,,wn,[SEP],c1,c2,,cm,[EOS]
其中的 w i w_i wi表示句子的token, c i c_i ci表示代码的token
output: 每一个token基于上下文的表示;[CLS]的表示,代表聚合的序列表示


预训练数据
在这里插入图片描述

数据集来自CodeSearchNet,其中的2.4M bimodal data的形式为<individual funciton, documentation>,其中的6.4M unimodal codes表示单独的代码数据。

预训练的任务

  1. Masked Language Modeling (MLM)
    输入是NL-PL pair,在其中随机选择一些位置mask掉。M

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值