GraphCode2Vec: Generic Code Embedding via Lexical and Program Dependence Analyses.

2021 
Code embedding is a keystone in the application of machine learning on several Software Engineering (SE) tasks, e.g., method name prediction and code clone detection. To be effective, the embedding needs to capture program semantics in a way that is effective and generic, in a sense being able to effectively support a plethora of SE tasks. To this end, we propose an approach (called GraphCode2Vec) thatcaptures program semantics through lexical and program dependence features via an effective combination of code analysis and Graph Neural Networks. GraphCode2Vec is generic, i.e., it allows pre-training, and it is effectively applicable to several SE downstream tasks. We evaluate the effectiveness of GraphCode2Vec on three (3) tasks (method name prediction, solution classification and code clone detection), and compare it with four (4) similarly generic code embedding baselines (Code2Seq, Code2Vec, CodeBERT, GraphCodeBERT) and seven (7) task-specific, learning-based methods. In particular, GraphCode2Vec is more effective than both generic and task-specific learning-based baselines for all three tasks, with the exception of one task where it is slightly less effective than GraphCodeBERT. We also demonstrate through a purposely designed probing and ablation study that GraphCode2Vec effectively learns lexical and program dependence features and that pre-training improves its effectiveness.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    58
    References
    0
    Citations
    NaN
    KQI
    []