Boosting Source Code Learning with Text-Oriented Data Augmentation: An Empirical Study

Zeming Dong, Qiang Hu, Yuejun Guo, Zhenya Zhang, Maxime Cordy +3 more
3/13/2023
cs.SEcs.AI

No official code found. Best implementation: zemingd/PT4Code (1 star, last commit 2025-02-21).

Abstract

Recent studies have demonstrated remarkable advancements in source code learning, which applies deep neural networks (DNNs) to tackle various software engineering tasks. Similar to other DNN-based domains, source code learning also requires massive high-quality training data to achieve the success of these applications. Data augmentation, a technique used to produce additional training data, is widely adopted in other domains (e.g. computer vision). However, the existing practice of data augmentation in source code learning is limited to simple syntax-preserved methods, such as code refactoring. In this paper, considering that source code can also be represented as text data, we take an early step to investigate the effectiveness of data augmentation methods originally designed for natural language texts in the context of source code learning. To this end, we focus on code classification tasks and conduct a comprehensive empirical study across four critical code problems and four DNN architectures to assess the effectiveness of 25 data augmentation methods. Our results reveal specific data augmentation methods that yield more accurate and robust models for source code learning. Additionally, we discover that the data augmentation methods remain beneficial even when they slightly break source code syntax.

View on arXivView PDF

Code Implementations(1)

zemingd/PT4CodeCommunity66%

[EMSE 2025] Boosting Source Code Learning with Text-Oriented Data Augmentation: An Empirical Study

10Shell, Python1 years ago

Similar Papers

Cite this paper

@article{dong2023boosting,
  title  = {Boosting Source Code Learning with Text-Oriented Data Augmentation: An Empirical Study},
  author = {Zeming Dong and Qiang Hu and Yuejun Guo and Zhenya Zhang and Maxime Cordy and Mike Papadakis and Yves Le Traon and Jianjun Zhao},
  year   = {2023},
  eprint = {2303.06808},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2303.06808v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2303.06808.svg)](https://codeofpaper.com/paper/2303.06808)

Discussion