arrow
Return

GNNContext: GNN-based Code Context Prediction for Programming Tasks

delete2025-08-01
delete0
PRE
AI
X
Xiaoye Zheng
Z
Zhiyuan Wan
S
Shun Liu
K
Kaiwen Yang
D
David Lo
X
Xiaohu Yang
DOI:10.1109/TSE.2025.3578390delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
A code context model comprises source code elements and their relations relevant to a programming task. The capture and use of code context models in software tools can benefit software development practices, such as code navigation and search. Prior research has explored approaches that leverage either the structural information of code or interaction histories of developers with integrated development environments to automate the construction of code context models. However, these approaches primarily capture shallow syntactic and lexical features of code elements, with limited ability to capture contextual and structural dependencies among neighboring code elements. In this paper, we propose GNNContext, a novel approach for predicting code context models based on Graph Neural Networks. Our approach leverages code representation learning models to capture both the syntactic and semantic features of code elements, while employing Graph Neural Networks to learn the structural and contextual information among neighboring code elements in the code context models. To evaluate the effectiveness of our approach, we apply it to a dataset comprising 3,879 code context models that we derive from three Eclipse open-source projects. The evaluation results demonstrate that our proposed approach GNNContext can significantly outperform the state-of-the-art baseline for code context prediction, achieving average improvements of 62.79%, 56.60%, 73.50% and 81.89% in mean reciprocal rank, top- 1, top-3, and top-5 recall rates, respectively, across predictions of varying steps. Moreover, our approach demonstrates robust performance in a cross-project evaluation setting.
Keywords:
Code context models
programming tasks
developers
context prediction
graph neural networks

Journal

IEEE Transactions on Software Engineering cover
IEEE Transactions on Software Engineering
IF:
5.6
Papers:
2.9K
Citations:
1.1W

Organization

S
Singapore Management University
Scholars:
1.5K
Papers: 2.5K
Citations: 3.5K
Z
zhejiang university
Scholars:
17.7W
Papers: 12.1W
Citations: 152
Cited Papers

Cited Papers

The Impact of View Histories on Edit Recommendations
err2015-03-01
err16
PREAI
errLee, Seonah; Kang, Sungwon; Kim, Sunghun; Staats, Matt
errShare
errSave
KNN Model-Based Approach in Classification
err2003-01-01
err0
PREAI
errGongde Guo; Hui Wang; David Bell; Yaxin Bi; Kieran Greer
errShare
errSave
Mining version histories to guide software changes
err2005-06-01
err469
PREAI
errZimmermann, T; Weissgerber, P; Diehl, S; Zeller, A
errShare
errSave
Latent Patterns in Activities: A Field Study of How Developers Manage Context
err2019-05-01
err0
PREAI
errSouti Chattopadhyay; Nicholas Nelson; Yenifer Ramirez Gonzalez; Annel Amelia Leon; Rahul Pandita; Anita Sarma
errShare
errSave
On the Impact of Sample Duplication in Machine-Learning-Based Android Malware Detection
err2021-05-08
err54
errOAAI
errZhao, Yanjie; Li, Li; Wang, Haoyu; Cai, Haipeng; Bissyande, Tegawende F.; Klein, Jacques; Grundy, John
errShare
errSave
errShare
errSave
LineVD
err2022-10-17
err0
errOAAI
errDavid Hin; Andrey Kan; Huaming Chen; M. Ali Babar
errShare
errSave
researcher View more