GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search

Code search aims to retrieve accurate code snippets based on a natural language query to improve software productivity and quality. With the massive amount of available programs such as (on GitHub or Stack Overflow), identifying and localizing the precise code is critical for the software developers...

Full description

Saved in:
Bibliographic Details
Main Authors: LIU, Shangqing, XIE, Xiaofei, SIOW, Jjingkai, MA, Lei, MENG, Guozhu, LIU, Yang
Format: text
Language:English
Published: Institutional Knowledge at Singapore Management University 2023
Subjects:
Online Access:https://ink.library.smu.edu.sg/sis_research/7767
https://ink.library.smu.edu.sg/context/sis_research/article/8770/viewcontent/GraphSearchNet_av.pdf
Tags: Add Tag
No Tags, Be the first to tag this record!
Institution: Singapore Management University
Language: English
id sg-smu-ink.sis_research-8770
record_format dspace
spelling sg-smu-ink.sis_research-87702023-02-23T08:06:43Z GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search LIU, Shangqing XIE, Xiaofei SIOW, Jjingkai MA, Lei MENG, Guozhu LIU, Yang Code search aims to retrieve accurate code snippets based on a natural language query to improve software productivity and quality. With the massive amount of available programs such as (on GitHub or Stack Overflow), identifying and localizing the precise code is critical for the software developers. In addition, Deep learning has recently been widely applied to different code-related scenarios, ., vulnerability detection, source code summarization. However, automated deep code search is still challenging since it requires a high-level semantic mapping between code and natural language queries. Most existing deep learning-based approaches for code search rely on the sequential text ., feeding the program and the query as a flat sequence of tokens to learn the program semantics while the structural information is not fully considered. Furthermore, the widely adopted Graph Neural Networks (GNNs) have proved their effectiveness in learning program semantics, however, they also suffer the problem of capturing the global dependencies in the constructed graph, which limits the model learning capacity. To address these challenges, in this paper, we design a novel neural network framework, named GraphSearchNet, to enable an effective and accurate source code search by jointly learning the rich semantics of both source code and natural language queries. Specifically, we propose to construct graphs for the source code and queries with bidirectional GGNN (BiGGNN) to capture the local structural information of the source code and queries. Furthermore, we enhance BiGGNN by utilizing the multi-head attention module to supplement the global dependencies that BiGGNN missed to improve the model learning capacity. The extensive experiments on Java and Python programming language from the public benchmark CodeSearchNet confirm that GraphSearchNet outperforms current state-of-the-art works by a significant margin. 2023-01-01T08:00:00Z text application/pdf https://ink.library.smu.edu.sg/sis_research/7767 info:doi/10.1109/TSE.2022.3233901 https://ink.library.smu.edu.sg/context/sis_research/article/8770/viewcontent/GraphSearchNet_av.pdf http://creativecommons.org/licenses/by-nc-nd/4.0/ Research Collection School Of Computing and Information Systems eng Institutional Knowledge at Singapore Management University Code Search Codes Graph Neural Networks Message passing Multi-Head Attention Natural languages Semantics Software Source coding Task analysis Databases and Information Systems Numerical Analysis and Computation Software Engineering
institution Singapore Management University
building SMU Libraries
continent Asia
country Singapore
Singapore
content_provider SMU Libraries
collection InK@SMU
language English
topic Code Search
Codes
Graph Neural Networks
Message passing
Multi-Head Attention
Natural languages
Semantics
Software
Source coding
Task analysis
Databases and Information Systems
Numerical Analysis and Computation
Software Engineering
spellingShingle Code Search
Codes
Graph Neural Networks
Message passing
Multi-Head Attention
Natural languages
Semantics
Software
Source coding
Task analysis
Databases and Information Systems
Numerical Analysis and Computation
Software Engineering
LIU, Shangqing
XIE, Xiaofei
SIOW, Jjingkai
MA, Lei
MENG, Guozhu
LIU, Yang
GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search
description Code search aims to retrieve accurate code snippets based on a natural language query to improve software productivity and quality. With the massive amount of available programs such as (on GitHub or Stack Overflow), identifying and localizing the precise code is critical for the software developers. In addition, Deep learning has recently been widely applied to different code-related scenarios, ., vulnerability detection, source code summarization. However, automated deep code search is still challenging since it requires a high-level semantic mapping between code and natural language queries. Most existing deep learning-based approaches for code search rely on the sequential text ., feeding the program and the query as a flat sequence of tokens to learn the program semantics while the structural information is not fully considered. Furthermore, the widely adopted Graph Neural Networks (GNNs) have proved their effectiveness in learning program semantics, however, they also suffer the problem of capturing the global dependencies in the constructed graph, which limits the model learning capacity. To address these challenges, in this paper, we design a novel neural network framework, named GraphSearchNet, to enable an effective and accurate source code search by jointly learning the rich semantics of both source code and natural language queries. Specifically, we propose to construct graphs for the source code and queries with bidirectional GGNN (BiGGNN) to capture the local structural information of the source code and queries. Furthermore, we enhance BiGGNN by utilizing the multi-head attention module to supplement the global dependencies that BiGGNN missed to improve the model learning capacity. The extensive experiments on Java and Python programming language from the public benchmark CodeSearchNet confirm that GraphSearchNet outperforms current state-of-the-art works by a significant margin.
format text
author LIU, Shangqing
XIE, Xiaofei
SIOW, Jjingkai
MA, Lei
MENG, Guozhu
LIU, Yang
author_facet LIU, Shangqing
XIE, Xiaofei
SIOW, Jjingkai
MA, Lei
MENG, Guozhu
LIU, Yang
author_sort LIU, Shangqing
title GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search
title_short GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search
title_full GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search
title_fullStr GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search
title_full_unstemmed GraphSearchNet: Enhancing GNNs via capturing global dependencies for semantic code search
title_sort graphsearchnet: enhancing gnns via capturing global dependencies for semantic code search
publisher Institutional Knowledge at Singapore Management University
publishDate 2023
url https://ink.library.smu.edu.sg/sis_research/7767
https://ink.library.smu.edu.sg/context/sis_research/article/8770/viewcontent/GraphSearchNet_av.pdf
_version_ 1770576470236725248