Lune

NeurIPS2022Top-tier venue

NS3: Neuro-symbolic Semantic Code Search

Shushan Arakelyan, Anna Hakhverdyan, Miltiadis Allamanis, Luis Garcia, Christophe Hauser, Xiang Ren

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 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 -NS 3 (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 1 .

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

1 top-tier paper has cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • CodeBERT: A Pre-Trained Model for Programming and Natural Languages cites Learning and Evaluating Contextual Embedding of Source Code
  • Learning and Evaluating Contextual Embedding of Source Code cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • ReACC: A Retrieval-Augmented Code Completion Framework cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • ReACC: A Retrieval-Augmented Code Completion Framework cites GraphCodeBERT: Pre-training Code Representations with Data Flow
  • Language-Agnostic Representation Learning of Source Code from Structure and Context cites Learning and Evaluating Contextual Embedding of Source Code
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers1

  1. Dataflow-Guided Neuro-Symbolic Language Models for Type InferenceGe Li, Yao Wan, Hongyu Zhang, Zhou Zhao et al.ICML 2025

Builds on13

  1. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  2. GraphCodeBERT: Pre-training Code Representations with Data FlowDaya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng et al.ICLR 2021 · 1,644 citations
  3. Learning and Evaluating Contextual Embedding of Source CodeAditya Kanade, Petros Maniatis, Gogul Balakrishnan, Kensen ShiICML 2020 · 438 citations
  4. ReACC: A Retrieval-Augmented Code Completion FrameworkShuai Lu, Nan Duan, Hojae Han, Daya Guo et al.ACL 2022 · 208 citations
  5. Language-Agnostic Representation Learning of Source Code from Structure and ContextDaniel Zügner, Tobias Kirschstein, Michele Catasta, Jure Leskovec et al.ICLR 2021 · 131 citations

Related papers

  1. XSearch: Explainable Code Search via Concept-to-Code AlignmentYiming Liu, Ruofan Liu, Yun Lin, Zicong Zhang et al.ISSTA 2026 · 1 citation
  2. Efficient Text-to-Code Retrieval with Cascaded Fast and Slow Transformer ModelsAkhilesh Deepak Gotmare, Junnan Li, Shafiq Joty, Steven C. H. HoiFSE 2023 · 5 citations
  3. How to better utilize code graphs in semantic code search?Yucen Shi, Ying Yin, Zhengkui Wang, David Lo et al.FSE 2022 · 25 citations
  4. MGS3: A Multi-Granularity Self-Supervised Code Search FrameworkRui Li, Junfeng Kang, Qi Liu, Liyang He et al.KDD 2025
  5. Structure-Aware Language Model Pretraining Improves Dense Retrieval on Structured DataXinze Li, Zhenghao Liu, Chenyan Xiong, Shi Yu et al.ACL Findings 2023 · 10 citations
Dusk over the sea between two cliffs drawn in fine vertical lines