NS3: Neuro-Symbolic Semantic Code Search

Shushan Arakelyan, Anna Hakhverdyan, Miltiadis Allamanis, Luis Garcia, Christophe Hauser +1 more
5/21/2022
cs.LG

Official code: ShushanArakelyan/modular_code_search (9 stars, Python, last commit 2022-09-15).

Abstract

Semantic code search is the task of retrieving a code snippet given a textual description of its functionality. Recent work has been focused on using similarity metrics between neural embeddings of text and code.

Show full abstract

However, current language models are known to struggle with longer, compositional text, and multi-step reasoning. To overcome this limitation, we propose supplementing the query sentence with a layout of its semantic structure. The semantic layout is used to break down the final reasoning decision into a series of lower-level decisions. We use a Neural Module Network architecture to implement this idea. We compare our model - NS3 (Neuro-Symbolic Semantic Search) - to a number of baselines, including state-of-the-art semantic code retrieval methods, and evaluate on two datasets - CodeSearchNet and Code Search and Question Answering. We demonstrate that our approach results in more precise code retrieval, and we study the effectiveness of our modular design when handling compositional queries.

View on arXivView PDF

Code Implementations(1)

Code for NS3: Neuro-Symbolic Semantic Code Search

90Python, ShellJul 19, 20214 years ago

Similar Papers

Cite this paper

@article{arakelyan2022ns,
  title  = {NS3: Neuro-Symbolic Semantic Code Search},
  author = {Shushan Arakelyan and Anna Hakhverdyan and Miltiadis Allamanis and Luis Garcia and Christophe Hauser and Xiang Ren},
  year   = {2022},
  eprint = {2205.10674},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2205.10674}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2205.10674.svg)](https://codeofpaper.com/paper/2205.10674)

Discussion