SELGAug 25, 2021

What do pre-trained code models know about code?

arXiv:2108.11308v1119 citations
Originality Incremental advance
AI Analysis

This work addresses the need to evaluate pre-trained code models for software engineering tasks, though it is incremental in probing existing models.

The paper investigates whether pre-trained code models comprehensively encode source code characteristics by constructing four probing tasks (surface-level, syntactic, structural, and semantic) to assess their knowledge. Results show that GraphCodeBERT performs most consistently, but BERT surprisingly excels on some tasks, indicating gaps in understanding.

Pre-trained models of code built on the transformer architecture have performed well on software engineering (SE) tasks such as predictive code generation, code summarization, among others. However, whether the vector representations from these pre-trained models comprehensively encode characteristics of source code well enough to be applicable to a broad spectrum of downstream tasks remains an open question. One way to investigate this is with diagnostic tasks called probes. In this paper, we construct four probing tasks (probing for surface-level, syntactic, structural, and semantic information) for pre-trained code models. We show how probes can be used to identify whether models are deficient in (understanding) certain code properties, characterize different model layers, and get insight into the model sample-efficiency. We probe four models that vary in their expected knowledge of code properties: BERT (pre-trained on English), CodeBERT and CodeBERTa (pre-trained on source code, and natural language documentation), and GraphCodeBERT (pre-trained on source code with dataflow). While GraphCodeBERT performs more consistently overall, we find that BERT performs surprisingly well on some code tasks, which calls for further investigation.

Code Implementations1 repo
Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes