Empirical Study on Transformer-based Techniques for Software Engineering

Yan Xiao, Xinyue Zuo, Lei Xue, Kailong Wang, Jin Song Dong, Ivan BeschastnikharXiv 2023 · DOI

Introduction

Since the introduction of the Transformer architecture in 2017, the Software Engineering (SE) community has rapidly integrated models like BERT and GPT into various coding tasks. However, this rapid adoption has often lacked a cohesive evaluation framework. This study provides a comprehensive "reality check" on Transformer-based models in SE, reviewing 282 papers and benchmarking three major architectures—CodeBERT, CodeGPT, and CodeT5—to debunk common myths and identify critical gaps in current research.

The Three Pillars of the "Reality Check"

The authors identify three primary issues currently facing the application of Transformers in SE:

  1. Architecture Dogma: A prevailing belief that encoder-decoder models (e.g., T5) are the universal "gold standard," while encoder-only or decoder-only models are inherently limited.
  2. The Benchmark Bubble: Models often demonstrate exceptional performance on standard benchmarks like CodeXGLUE but fail to generalize to other real-world datasets for the same tasks.
  3. The Utility Gap: Research focus is heavily skewed toward popular tasks like code summarization, while neglecting high-pain developer areas such as merge conflict resolution.

Methodology and Model Architectures

The study employs a dual-track approach: a systematic literature review of 282 papers from top-tier SE venues (2017–2022) and an empirical benchmarking of three representative architectures.

Overview of Input, Embedding, and Model Architectures for CodeBERT, CodeT5, and CodeGPT.

As shown in Figure 1, the models represent three distinct structural approaches:

  • CodeBERT (Encoder-only): Optimized for understanding the semantic relationship between code and natural language.
  • CodeGPT (Decoder-only): Specifically designed for generative tasks.
  • CodeT5 (Encoder-decoder): A unified model intended to bridge understanding and generation.

These models were evaluated across four core SE tasks: Code Summarization, Bug Fixing, Bug Detection, and Code Search. To facilitate these tasks, models often utilize specific pre-training objectives such as identifier tagging or masked prediction.

Examples of Software Engineering tasks including Identifier Tagging and Masked Identifier Prediction.

Key Insights and Empirical Findings

Debunking Architecture Myths

Contrary to popular belief, decoder-only models like CodeGPT can achieve state-of-the-art performance in generation tasks when evaluated with modern metrics like METEOR. Furthermore, encoder-only models like CodeBERT remain the most efficient for "understanding" tasks, providing the best performance-to-resource ratio.

The Generalization Peril

A significant "generalization gap" exists. Models trained on specific benchmarks perform significantly worse on different datasets for the same task. For instance, CodeBERT’s BLEU-4 score dropped from 32.20 to 17.61 when moved between datasets. The study suggests that simply increasing data volume does not solve this; in some cases, it even degrades performance.

Resource Efficiency vs. Performance

While CodeT5 is powerful, its high resource consumption does not always yield proportional gains. CodeBERT remains the "MVP" for efficiency in understanding-based tasks, outperforming others in Code Search (MRR of 28.45) and Bug Detection (Accuracy of 63.54%) while requiring significantly less memory and time.

Conclusion and Future Directions

The study highlights that the SE community often lags behind the broader NLP field, sometimes comparing modern results against outdated 2017 baselines. To move forward, the authors recommend:

  • Prioritizing Developer Needs: Shifting focus to under-studied tasks like module dependency and conflict resolution.
  • Dataset Pruning: Focusing on better data selection rather than just larger datasets to improve generalization.
  • Efficiency over Size: Investigating whether smaller, specialized models can match the performance of resource-heavy large language models for specific SE applications.

Summary updated

BibTeX
@misc{xiao2023empirical,
  author = {Yan Xiao and Xinyue Zuo and Lei Xue and Kailong Wang and Jin Song Dong and Ivan Beschastnikh},
  title = {{Empirical Study on Transformer-based Techniques for Software Engineering}},
  year = {2023},
  eprint = {2310.00399},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.00399},
}
Figure