Logo image
GraphCode2Vec: generic code embedding via lexical and program dependence analyses
Conference proceeding   Open access

GraphCode2Vec: generic code embedding via lexical and program dependence analyses

Wei Ma, Mengjie Zhao, Ezekiel Soremekun, Qiang Hu, Jie M. Zhang, Mike Papadakis, Maxime Cordy, Xiaofei Xie and Yves Le Traon
Proceedings of the 19th International Conference on Mining Software Repositories, pp.524-536
ACM Conferences
MSR '22: 19th International Conference on Mining Software Repositories
23/05/2022

Abstract

Computing methodologies Computing methodologies -- Machine learning Computing methodologies -- Machine learning -- Machine learning approaches Computing methodologies -- Machine learning -- Machine learning approaches -- Neural networks
Code embedding is a keystone in the application of machine learning on several Software Engineering (SE) tasks. To effectively support a plethora of SE tasks, the embedding needs to capture program syntax and semantics in a way that is generic. To this end, we propose the first self-supervised pre-training approach (called GraphCode2Vec) which produces task-agnostic embedding of lexical and program dependence features. GraphCode2Vec achieves this via a synergistic combination of code analysis and Graph Neural Networks. GraphCode2Vec is generic, it allows pre-training, and it is applicable to several SE downstream tasks. We evaluate the effectiveness of GraphCode2Vec on four (4) tasks (method name prediction, solution classification, mutation testing and overfitted patch classification), and compare it with four (4) similarly generic code embedding baselines (Code2Seq, Code2Vec, CodeBERT, Graph-CodeBERT) and seven (7) task-specific, learning-based methods. In particular, GraphCode2Vec is more effective than both generic and task-specific learning-based baselines. It is also complementary and comparable to GraphCodeBERT (a larger and more complex model). We also demonstrate through a probing and ablation study that GraphCode2Vec learns lexical and program dependence features and that self-supervised pre-training improves effectiveness.
url
https://doi.org/10.1145/3524842.3528456View
Published (Version of record) Open

Metrics

1 Record Views

Details

Logo image