NS3: Neuro-Symbolic Semantic Code Search

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. However, current language models are known to struggle with longer, compositional sentences, 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 - $NS^3$ (Neuro-Symbolic Semantic Search) - to a number of baselines, including state-of-the-art semantic code retrieval methods, such as CodeBERT, CuBERT and GraphCodeBERT, and evaluate on two datasets - Code Search Net (CSN) and Code Search and Question Answering (CoSQA). On these datasets, we demonstrate that our approach results in higher performance. We also perform additional studies to show the effectiveness of our modular design when handling compositional queries.

Cite

Text

Arakelyan et al. "NS3: Neuro-Symbolic Semantic Code Search." ICLR 2022 Workshops: DL4C, 2022.

Markdown

[Arakelyan et al. "NS3: Neuro-Symbolic Semantic Code Search." ICLR 2022 Workshops: DL4C, 2022.](https://mlanthology.org/iclrw/2022/arakelyan2022iclrw-ns3/)

BibTeX

@inproceedings{arakelyan2022iclrw-ns3,
  title     = {{NS3: Neuro-Symbolic Semantic Code Search}},
  author    = {Arakelyan, Shushan and Hakhverdyan, Anna and Allamanis, Miltiadis and Hauser, Christophe and Garcia, Luis Antonio and Ren, Xiang},
  booktitle = {ICLR 2022 Workshops: DL4C},
  year      = {2022},
  url       = {https://mlanthology.org/iclrw/2022/arakelyan2022iclrw-ns3/}
}