Learning and Evaluating Contextual Embedding of Source Code
Not on the map. Why?
Abstract (arXiv)
Recent research has achieved impressive results on understanding and improving source code by building up on machine-learning techniques developed for natural languages. A significant advancement in natural-language understanding has come with the development of pre-trained contextual embeddings, such as BERT, which can be fine-tuned for downstream tasks with less labeled data and training budget, while achieving better accuracies. However, there is no attempt yet to obtain a high-quality contextual embedding of source code, and to evaluate it on multiple program-understanding tasks simultaneously; that is the gap that this paper aims to mitigate. Specifically, first, we curate a massive, deduplicated corpus of 7.4M Python files from GitHub, which we use to pre-train CuBERT, an open-sourced code-understanding BERT model; and, second, we create an open-sourced benchmark that comprises five classification tasks and one program-repair task, akin to code-understanding tasks proposed in the literature before. We fine-tune CuBERT on our benchmark tasks, and compare the resulting models to different variants of Word2Vec token embeddings, BiLSTM and Transformer models, as well as published state-of-the-art models, showing that CuBERT outperforms them all, even with shorter training, and with fewer labeled examples. Future work on source-code embedding can benefit from reusing our benchmark, and from comparing against CuBERT models as a strong baseline.
Key facts. Cited by 33 papers in the map (data through 7 Oct 2026). First posted on arXiv 21 Dec 2019.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2021: 9; 2022: 14; 2023: 5; 2024: 3; 2025: 2.
33 papers.
Sort:
By area:
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2022PanGu-Coder: Program Synthesis with Function-Level Language Modelingcited by 47
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 40
- 2021What do pre-trained code models know about code?cited by 36
- 2022On the Transferability of Pre-trained Language Models for Low-Resource Programming Languagescited by 30
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugscited by 28
- 2021On Multi-Modal Learning of Editing Source Codecited by 25
- 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
- 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 20
- 2023Multi-target Backdoor Attacks for Code Pre-trained Modelscited by 19
- 2021Generating Bug-Fixes Using Pretrained Transformerscited by 18
- 2021DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletonscited by 17
21 more
- 2023One Adapter for All Programming Languages? Adapter Tuning for Code Search and Summarizationcited by 16
- 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacitiescited by 9
- 2021ProtoTransformer: A Meta-Learning Approach to Providing Student Feedbackcited by 8
- 2022A Simple, Yet Effective Approach to Finding Biases in Code Generationcited by 8
- 2021Recommending Metamodel Concepts during Modeling Activities with Pre-Trained Language Modelscited by 7
- 2022Soft-Labeled Contrastive Pre-training for Function-level Code Representationcited by 7
- 2022CommitBART: A Large Pre-trained Model for GitHub Commitscited by 6
- 2024Is Next Token Prediction Sufficient for GPT? Exploration on Code Logic Comprehensioncited by 6
- 2022Can we learn from developer mistakes? Learning to localize and repair real bugs from real bug fixescited by 4
- 2023Automatic Unit Test Data Generation and Actor-Critic Reinforcement Learning for Code Synthesiscited by 4
- 2021Unsupervised Learning of General-Purpose Embeddings for Code Changescited by 3
- 2025CoRet: Improved Retriever for Code Editingcited by 3
- 2022Semantic-Preserving Adversarial Code Comprehensioncited by 2
- 2023INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformerscited by 2
- 2025An Empirical Study of Knowledge Distillation for Code Understanding Taskscited by 2
- 2022AstBERT: Enabling Language Model for Financial Code Understanding with Abstract Syntax Treescited by 1
- 2022Exploring Representation of Horn Clauses using GNNs (Extended Technical Report)cited by 1
- 2024Text-to-Code Generation with Modality-relative Pre-trainingcited by 1
- 2022MQDD: Pre-training of Multimodal Question Duplicity Detection for Software Engineering Domaincited by 0
- 2022Understanding Long Programming Languages with Structure-Aware Sparse Attentioncited by 0
- 2024Analysing the Behaviour of Tree-Based Neural Networks in Regression Taskscited by 0
- 2025An Empirical Study of Knowledge Distillation for Code Understanding Tasks21 Aug 2025
- 2025CoRet: Improved Retriever for Code Editing30 May 2025
- 2024Analysing the Behaviour of Tree-Based Neural Networks in Regression Tasks17 Jun 2024
- 2024Is Next Token Prediction Sufficient for GPT? Exploration on Code Logic Comprehension13 Apr 2024
- 2024Text-to-Code Generation with Modality-relative Pre-training8 Feb 2024
- 2023INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformers8 Dec 2023
- 2023Automatic Unit Test Data Generation and Actor-Critic Reinforcement Learning for Code Synthesis20 Oct 2023
- 2023Multi-target Backdoor Attacks for Code Pre-trained Models14 Jun 2023
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugs6 Jun 2023
- 2023One Adapter for All Programming Languages? Adapter Tuning for Code Search and Summarization28 Mar 2023
- 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacities20 Dec 2022
- 2022A Simple, Yet Effective Approach to Finding Biases in Code Generation31 Oct 2022
21 more
- 2022Soft-Labeled Contrastive Pre-training for Function-level Code Representation18 Oct 2022
- 2022Semantic-Preserving Adversarial Code Comprehension12 Sep 2022
- 2022CommitBART: A Large Pre-trained Model for GitHub Commits17 Aug 2022
- 2022PanGu-Coder: Program Synthesis with Function-Level Language Modeling22 Jul 2022
- 2022Can we learn from developer mistakes? Learning to localize and repair real bugs from real bug fixes1 Jul 2022
- 2022Exploring Representation of Horn Clauses using GNNs (Extended Technical Report)14 Jun 2022
- 2022Understanding Long Programming Languages with Structure-Aware Sparse Attention27 May 2022
- 2022On the Transferability of Pre-trained Language Models for Low-Resource Programming Languages5 Apr 2022
- 2022MQDD: Pre-training of Multimodal Question Duplicity Detection for Software Engineering Domain26 Mar 2022
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representation8 Mar 2022
- 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Search26 Jan 2022
- 2022AstBERT: Enabling Language Model for Financial Code Understanding with Abstract Syntax Trees20 Jan 2022
- 2021What do pre-trained code models know about code?25 Aug 2021
- 2021On Multi-Modal Learning of Editing Source Code15 Aug 2021
- 2021ProtoTransformer: A Meta-Learning Approach to Providing Student Feedback23 Jul 2021
- 2021Understanding Neural Code Intelligence Through Program Simplification7 Jun 2021
- 2021Unsupervised Learning of General-Purpose Embeddings for Code Changes3 Jun 2021
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Language26 May 2021
- 2021DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletons19 May 2021
- 2021Generating Bug-Fixes Using Pretrained Transformers16 Apr 2021
- 2021Recommending Metamodel Concepts during Modeling Activities with Pre-Trained Language Models4 Apr 2021
- 2023Multi-target Backdoor Attacks for Code Pre-trained Modelscited by 19
- 2023Multi-target Backdoor Attacks for Code Pre-trained Models14 Jun 2023
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2022PanGu-Coder: Program Synthesis with Function-Level Language Modelingcited by 47
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 40
- 2021What do pre-trained code models know about code?cited by 36
- 2022On the Transferability of Pre-trained Language Models for Low-Resource Programming Languagescited by 30
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugscited by 28
- 2021On Multi-Modal Learning of Editing Source Codecited by 25
- 2022CodeRetriever: Unimodal and Bimodal Contrastive Learning for Code Searchcited by 21
- 2021Understanding Neural Code Intelligence Through Program Simplificationcited by 20
- 2021Generating Bug-Fixes Using Pretrained Transformerscited by 18
- 2021DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletonscited by 17
- 2023One Adapter for All Programming Languages? Adapter Tuning for Code Search and Summarizationcited by 16
12 most cited of 32 All 32 (JSON)
- 2025An Empirical Study of Knowledge Distillation for Code Understanding Tasks21 Aug 2025
- 2025CoRet: Improved Retriever for Code Editing30 May 2025
- 2024Analysing the Behaviour of Tree-Based Neural Networks in Regression Tasks17 Jun 2024
- 2024Is Next Token Prediction Sufficient for GPT? Exploration on Code Logic Comprehension13 Apr 2024
- 2024Text-to-Code Generation with Modality-relative Pre-training8 Feb 2024
- 2023INSPECT: Intrinsic and Systematic Probing Evaluation for Code Transformers8 Dec 2023
- 2023Automatic Unit Test Data Generation and Actor-Critic Reinforcement Learning for Code Synthesis20 Oct 2023
- 2023Large Language Models of Code Fail at Completing Code with Potential Bugs6 Jun 2023
- 2023One Adapter for All Programming Languages? Adapter Tuning for Code Search and Summarization28 Mar 2023
- 2022Unveiling Code Pre-Trained Models: Investigating Syntax and Semantics Capacities20 Dec 2022
- 2022A Simple, Yet Effective Approach to Finding Biases in Code Generation31 Oct 2022
- 2022Soft-Labeled Contrastive Pre-training for Function-level Code Representation18 Oct 2022
12 newest of 32 All 32 (JSON)