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

Institutions

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
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Boosting code retrieval performance on Q&A sites with neural mutual attentions

Sarah Kaleem, Nazar Waheed, Zahid Khan, Basit Qureshi et al.
Journal of King Saud University - Computer and Information Sciences
Expert finding and Q&A systems
article

Boosting code retrieval performance on Q&A sites with neural mutual attentions

Sarah Kaleem, Nazar Waheed, Zahid Khan, Basit Qureshi, Muhammad Babar, Nazia Bibi
article en

Abstract

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.

Journal of King Saud University - Computer and Information Sciences
Higher Colleges of Technology (AE), Prince Sultan University (SA), Iqra University (PK), National University of Sciences and Technology (PK)
Openalex Percentile: Top 2%
Expert finding and Q&A systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.