GNN-Coder: Boosting Semantic Code Retrieval with Combined GNNs and Transformer
Yufan Ye, Pu Pang, Ting Zhang, Hua Huang

TL;DR
GNN-Coder introduces a novel GNN-Transformer framework that leverages AST structures and a new graph pooling method to significantly improve semantic code retrieval accuracy, especially for complex code snippets.
Contribution
This paper pioneers the integration of GNNs with Transformers for code retrieval, proposing a new graph pooling technique and a metric for embedding uniformity to enhance performance.
Findings
Achieves 1-10% improvement in MRR on CSN dataset.
Attains 20% gain in zero-shot performance on CosQA.
Demonstrates superior ability to distinguish code snippets using new metrics.
Abstract
Code retrieval is a crucial component in modern software development, particularly in large-scale projects. However, existing approaches relying on sequence-based models often fail to fully exploit the structural dependencies inherent in code, leading to suboptimal retrieval performance, particularly with structurally complex code fragments. In this paper, we introduce GNN-Coder, a novel framework based on Graph Neural Network (GNN) to utilize Abstract Syntax Tree (AST). We make the first attempt to study how GNN-integrated Transformer can promote the development of semantic retrieval tasks by capturing the structural and semantic features of code. We further propose an innovative graph pooling method tailored for AST, utilizing the number of child nodes as a key feature to highlight the intrinsic topological relationships within the AST. This design effectively integrates both…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
MethodsAttention Is All You Need · Absolute Position Encodings · Linear Layer · Layer Normalization · Byte Pair Encoding · Dense Connections · Residual Connection · Label Smoothing · Multi-Head Attention · Position-Wise Feed-Forward Layer
