AbstractPaper



Contrastive Code Representation Learning


ARXIV  ·  2020  ·  Impact 4

Paras Jain; Ajay Jain; Tianjun Zhang; Pieter Abbeel; Joseph E. Gonzalez; Ion Stoica;


HIGHLIGHT
We propose ContraCode: a contrastive pre-training task that learns code functionality, not form.
RELATED
Papers      Patents     Grants     Venues     Experts     Code    Cite    Share    Save


ABSTRACT
Recent work learns contextual representations of source code by reconstructing tokens from their context. For downstream semantic understanding tasks like summarizing code in English, these representations should ideally capture program functionality. However, we show that the popular reconstruction-based BERT model is sensitive to source code edits, even when the edits preserve semantics. We propose ContraCode: a contrastive pre-training task that learns code functionality, not form. ContraCode pre-trains a neural network to identify functionally similar variants of a program among many non-equivalent distractors. We scalably generate these variants using an automated source-to-source compiler as a form of data augmentation. Contrastive pre-training improves JavaScript summarization and TypeScript type inference accuracy by 2% to 13%. We also propose a new zero-shot JavaScript code clone detection dataset, showing that ContraCode is both more robust and semantically meaningful. On it, we outperform RoBERTa by 39% AUROC in an adversarial setting and up to 5% on natural code.

 Paraphrase     Questionfy     Wikify     Simplify     Summarize


FULL PAPER
Download

impact factor4
year_of_publication2020
sourceARXIV
commentIn Proceedings of EMNLP 2021. 19 pages, 16 figures, 9 tables. Code available at https://github.com/parasj/contracode

AI Reader
upload a document and start your AI-powered reading
AI Writer
you focus on what matters the most, we handle the rest
Daily Digest
get customized highlights of the latest research & news