arrow
返回

Towards Learning Generalizable Code Embeddings Using Task-agnostic Graph Convolutional Networks

delete2023-03-30
delete4
PRE
AI
Z
Zishuo Ding *
H
Heng Li
W
Weiyi Shang
T
Tse-Hsun Chen
DOI:10.1145/3542944delete
delete原文链接
delete原文求助
delete分享
delete收藏
摘要

摘要

En 中文
Code embeddings have seen increasing applications in software engineering (SE) research and practice recently. Despite the advances in embedding techniques applied in SE research, one of the main challenges is their generalizability. A recent study finds that code embeddings may not be readily leveraged for the downstream tasks that the embeddings are not particularly trained for. Therefore, in this article, we propose GraphCodeVec, which represents the source code as graphs and leverages the Graph Convolutional Networks to learn more generalizable code embeddings in a task-agnostic manner. The edges in the graph representation are automatically constructed from the paths in the abstract syntax trees, and the nodes from the tokens in the source code. To evaluate the effectiveness of GraphCodeVec, we consider three downstream benchmark tasks (i.e., code comment generation, code authorship identification, and code clones detection) that are used in a prior benchmarking of code embeddings and add three new downstream tasks (i.e., source code classification, logging statements prediction, and software defect prediction), resulting in a total of six downstream tasks that are considered in our evaluation. For each downstream task, we apply the embeddings learned by GraphCodeVec and the embeddings learned from four baseline approaches and compare their respective performance. We find that GraphCodeVec outperforms all the baselines in five out of the six downstream tasks, and its performance is relatively stable across different tasks and datasets. In addition, we perform ablation experiments to understand the impacts of the training context (i.e., the graph context extracted from the abstract syntax trees) and the training model (i.e., the Graph Convolutional Networks) on the effectiveness of the generated embeddings. The results show that both the graph context and the Graph Convolutional Networks can benefit GraphCodeVec in producing high-quality embeddings for the downstream tasks, while the improvement by Graph Convolutional Networks is more robust across different downstream tasks and datasets. Our findings suggest that future research and practice may consider using graph-based deep learning methods to capture the structural information of the source code for SE tasks.
Keyword:
Machine learning
source code representation
code embeddings
neural network

期刊

A
ACM Transactions on Software Engineering and Methodology
IF:
6.2
论文数:
1.2K
被引数:
3.4K

机构

U
universite de montreal
学者数:
4.6W
论文数: 3.8W
被引数: 46
C
concordia university - canada
学者数:
8.0K
论文数: 8.9K
被引数: 4
引用论文

引用论文

err
IF0
err
err0
errOAAI
err
err分享
err收藏
Biopsy characteristics in men with a preoperative diagnosis of prostatic adenocarcinoma with high Gleason score (8-10) predict pathologic outcome in radical prostatectomy
err2014-10-01
err0
PREAI
errFadi Brimo; Bin Xu; Eleonora Scarlata; Louis R. Bégin; Alan Spatz; Laurent Salomon; Ahmed S. Zakaria; Guillaume Ploussard; Frank Bladou; Wassim Kassouf; Simon Tanguay; Simone Chevalier; Huihui Ye; Armen Aprikian
err分享
err收藏
“It's almost like they're trying to hide it”: How User-Provided Image Descriptions Have Failed to Make Twitter Accessible
err2019-05-13
err0
errOAAI
errCole Gleason; Patrick Carrington; Cameron Cassidy; Meredith Ringel Morris; Kris M. Kitani; Jeffrey P. Bigham
err分享
err收藏
Prognostic role of FUT8 expression in relation to p53 status in stage II and III colorectal cancer
err2018-07-05
err0
errOAAI
errMasaru Noda; Hirokazu Okayama; Yasuhide Kofunato; Shun Chida; Katsuharu Saito; Takeshi Tada; Mai Ashizawa; Takahiro Nakajima; Keita Aoto; Tomohiro Kikuchi; Wataru Sakamoto; Hisahito Endo; Shotaro Fujita; Motonobu Saito; Tomoyuki Momma; Shinji Ohki; Koji Kono
err分享
err收藏
学者 查看更多内容