Lune

FSE2021Top-tier venue

Empirical study of transformers for source code

Nadezhda Chirkova, Sergey Troshin

Abstract

Initially developed for natural language processing (NLP), Transformers are now widely used for source code processing, due to the format similarity between source code and text. In contrast to natural language, source code is strictly structured, i.e., it follows the syntax of the programming language. Several recent works develop Transformer modifications for capturing syntactic information in source code. The drawback of these works is that they do not compare to each other and consider different tasks. In this work, we conduct a thorough empirical study of the capabilities of Transformers to utilize syntactic information in different tasks. We consider three tasks (code completion, function naming and bug fixing) and re-implement different syntax-capturing modifications in a unified framework. We show that Transformers are able to make meaningful predictions based purely on syntactic information and underline the best practices of taking the syntactic information into account for improving the performance of the model.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

7 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Two Sides of the Same Coin: Exploiting the Impact of Identifiers in Neural Code Comprehension cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Two Sides of the Same Coin: Exploiting the Impact of Identifiers in Neural Code Comprehension cites GraphCodeBERT: Pre-training Code Representations with Data Flow
  • CodeBERT: A Pre-Trained Model for Programming and Natural Languages cites Learning and Evaluating Contextual Embedding of Source Code
  • Learning and Evaluating Contextual Embedding of Source Code cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • CrossCodeBench: Benchmarking Cross-Task Generalization of Source Code Models cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • CrossCodeBench: Benchmarking Cross-Task Generalization of Source Code Models cites GraphCodeBERT: Pre-training Code Representations with Data Flow
  • What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source Code cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source Code cites GraphCodeBERT: Pre-training Code Representations with Data Flow
  • What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source Code cites Learning and Evaluating Contextual Embedding of Source Code
  • An interpretable error correction method for enhancing code-to-code translation cites Unsupervised Translation of Programming Languages
  • An interpretable error correction method for enhancing code-to-code translation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers7

  1. What Do They Capture? - A Structural Analysis of Pre-Trained Language Models for Source CodeYao Wan, Wei Zhao, Hongyu Zhang, Yulei Sui et al.ICSE 2022 · 66 citations
  2. Two Sides of the Same Coin: Exploiting the Impact of Identifiers in Neural Code ComprehensionShuzheng Gao, Cuiyun Gao, Chaozheng Wang, Jun Sun et al.ICSE 2023 · 17 citations
  3. Rethinking Positional Encoding in Tree Transformer for Code RepresentationHan Peng, Ge Li, Yunfei Zhao, Zhi JinEMNLP 2022 · 10 citations
  4. An interpretable error correction method for enhancing code-to-code translationMin Xue, Artur Andrzejak, Marla LeutherICLR 2024 · 10 citations
  5. CrossCodeBench: Benchmarking Cross-Task Generalization of Source Code ModelsChangan Niu, Chuanyi Li, Vincent Ng, Bin LuoICSE 2023 · 9 citations

Builds on9

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  2. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
  3. Unsupervised Translation of Programming LanguagesBaptiste Rozière, Marie-Anne Lachaux, Lowik Chanussot, Guillaume LampleNeurIPS 2020 · 606 citations
  4. Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 citations
  5. Pitfalls of In-Domain Uncertainty Estimation and Ensembling in Deep LearningArsenii Ashukha, Alexander Lyzhov, Dmitry Molchanov, Dmitry P. VetrovICLR 2020 · 354 citations

Related papers

  1. On the Applicability of Language Models to Block-Based ProgramsElisabeth Griebl, Benedikt Fein, Florian Obermüller, Gordon Fraser et al.ICSE 2023 · 5 citations
  2. Code Prediction by Feeding Trees to TransformersSeohyun Kim, Jinman Zhao, Yuchi Tian, Satish ChandraICSE 2021 · 179 citations
  3. Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax HierarchyColin B. Clement, Shuai Lu, Xiaoyu Liu, Michele Tufano et al.EMNLP 2021 · 11 citations
  4. GrammarT5: Grammar-Integrated Pretrained Encoder-Decoder Neural Model for CodeQihao Zhu, Qingyuan Liang, Zeyu Sun, Yingfei Xiong et al.ICSE 2024 · 10 citations
  5. Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related TasksAntonio Mastropaolo, Simone Scalabrino, Nathan Cooper, David Nader-Palacio et al.ICSE 2021 · 9 citations
Dusk over the sea between two cliffs drawn in fine vertical lines