Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
102 tokens/sec
GPT-4o
59 tokens/sec
Gemini 2.5 Pro Pro
43 tokens/sec
o3 Pro
6 tokens/sec
GPT-4.1 Pro
50 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

CODE-MVP: Learning to Represent Source Code from Multiple Views with Contrastive Pre-Training (2205.02029v1)

Published 4 May 2022 in cs.PL, cs.AI, and cs.CL

Abstract: Recent years have witnessed increasing interest in code representation learning, which aims to represent the semantics of source code into distributed vectors. Currently, various works have been proposed to represent the complex semantics of source code from different views, including plain text, Abstract Syntax Tree (AST), and several kinds of code graphs (e.g., Control/Data Flow Graph). However, most of them only consider a single view of source code independently, ignoring the correspondences among different views. In this paper, we propose to integrate different views with the natural-language description of source code into a unified framework with Multi-View contrastive Pre-training, and name our model as CODE-MVP. Specifically, we first extract multiple code views using compiler tools, and learn the complementary information among them under a contrastive learning framework. Inspired by the type checking in compilation, we also design a fine-grained type inference objective in the pre-training. Experiments on three downstream tasks over five datasets demonstrate the superiority of CODE-MVP when compared with several state-of-the-art baselines. For example, we achieve 2.4/2.3/1.1 gain in terms of MRR/MAP/Accuracy metrics on natural language code retrieval, code similarity, and code defect detection tasks, respectively.

User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (8)
  1. Xin Wang (1307 papers)
  2. Yasheng Wang (91 papers)
  3. Yao Wan (70 papers)
  4. Jiawei Wang (128 papers)
  5. Pingyi Zhou (9 papers)
  6. Li Li (657 papers)
  7. Hao Wu (623 papers)
  8. Jin Liu (151 papers)
Citations (32)