Boosting code retrieval performance on Q&A sites with neural mutual attentions
Code retrieval aims to identify the most relevant code fragments in response to natural language queries and plays an important role in supporting software development on software Q&A platforms. However, effectively modeling the semantic relationship between queries and code remains challenging, particularly due to noisy and incomplete code snippets. To address this challenge, we propose NMAC, a Neural Mutual Attention approach for code retrieval from Q&A sites. The proposed model combines distributed word representations with a Bi-directional Long Short-Term Memory (Bi-LSTM) network and a mutual attention mechanism to explicitly capture fine-grained interactions between query titles and code fragments. NMAC analyzes key code elements, including variables, functions, documentation strings, and comments, to assess semantic relevance more accurately. The effectiveness of the proposed framework is evaluated on a benchmark dataset derived from a software Q&A platform. Experimental results demonstrate that NMAC outperforms existing baseline approaches in terms of retrieval accuracy.
Authors
- Sarah Kaleem (ORCID: https://orcid.org/0000-0001-7416-9675)
- Nazar Waheed
- Zahid Khan
- Basit Qureshi
- Muhammad Babar
- Nazia Bibi
Institutions
- Higher Colleges of Technology (AE)
- Prince Sultan University (SA)
- Iqra University (PK)
- National University of Sciences and Technology (PK)
Publication Details
- Journal
- Journal of King Saud University - Computer and Information Sciences
- Published
- 2026-05-27
- DOI
- https://doi.org/10.1007/s44443-026-00871-8
- Primary Topic
- Expert finding and Q&A systems
- Type
- article
- Field-Weighted Citation Impact
- 0.00