Skip to main content
QUICK REVIEW

[Paper Review] Program Classification Using Gated Graph Attention Neural Network for Online Programming Service

Mingming Lu, Dingwu Tan|arXiv (Cornell University)|Mar 9, 2019
Online Learning and AnalyticsComputer Science24 references5 citations
TL;DR

This paper proposes a Gated Graph Attention Neural Network (GGANN) that enhances program classification by integrating data flow and function call information into Abstract Syntax Trees (ASTs), forming a unified program graph. The model achieves a state-of-the-art classification accuracy of 97.8% by leveraging attention mechanisms to capture semantic and structural program features.

ABSTRACT

The online programing services, such as Github,TopCoder, and EduCoder, have promoted a lot of social interactions among the service users. However, the existing social interactions is rather limited and inefficient due to the rapid increasing of source-code repositories, which is difficult to explore manually. The emergence of source-code mining provides a promising way to analyze those source codes, so that those source codes can be relatively easy to understand and share among those service users. Among all the source-code mining attempts,program classification lays a foundation for various tasks related to source-code understanding, because it is impossible for a machine to understand a computer program if it cannot classify the program correctly. Although numerous machine learning models, such as the Natural Language Processing (NLP) based models and the Abstract Syntax Tree (AST) based models, have been proposed to classify computer programs based on their corresponding source codes, the existing works cannot fully characterize the source codes from the perspective of both the syntax and semantic information. To address this problem, we proposed a Graph Neural Network (GNN) based model, which integrates data flow and function call information to the AST,and applies an improved GNN model to the integrated graph, so as to achieve the state-of-art program classification accuracy. The experiment results have shown that the proposed work can classify programs with accuracy over 97%.

Motivation & Objective

  • To address the limitations of existing program classification models that fail to capture both syntactic and semantic information effectively.
  • To improve social interaction efficiency in online programming services like GitHub, TopCoder, and EduCoder by enabling accurate program understanding and recommendation.
  • To develop a unified graph representation that captures both fine-grained data flow and coarse-grained function-call relationships in source code.
  • To design a graph neural network model capable of learning meaningful, semantically rich node representations for program classification.

Proposed method

  • Construct a program graph by extending the Abstract Syntax Tree (AST) with data flow edges and function call edges to capture both syntactic and semantic information.
  • Propose a Gated Graph Attention Neural Network (GGANN) that integrates an attention mechanism into the Gated Graph Neural Network (GGNN) to dynamically weight node importance during message passing.
  • Use a graph-level aggregation function based on attention scores to compute the final graph representation for classification.
  • Apply the GGANN model to a program graph representation derived from source code, enabling end-to-end learning of structural and semantic features.
  • Utilize t-SNE visualization and K-means clustering on learned node embeddings to validate semantic clustering behavior.
  • Conduct ablation studies and comparisons with state-of-the-art models like TBCNN to evaluate performance and generalization.

Experimental results

Research questions

  • RQ1Can a graph neural network model effectively learn both syntactic and semantic features of source code by integrating data flow and function call information into the AST?
  • RQ2Does the attention mechanism in GGANN successfully identify and prioritize semantically important nodes in the program graph?
  • RQ3Can the learned node representations reflect meaningful semantic clustering, such as grouping control flow statements or operators?
  • RQ4How does the proposed GGANN model compare to existing models like TBCNN in terms of classification accuracy and generalization on unseen code?

Key findings

  • The proposed GGANN model achieves a program classification accuracy of 97.8% on the benchmark dataset, outperforming state-of-the-art methods.
  • t-SNE visualization of learned node representations reveals clear clustering patterns, indicating that the model captures semantic similarity between nodes.
  • K-means clustering of node embeddings shows that semantically related nodes—such as control flow statements (e.g., ForStmt, BreakStmt) and operators (e.g., BinaryOperator, IntegerLiteral)—are grouped together.
  • Attention scores in GGANN highlight key structural nodes like IfStmt, CallExpr, and CompoundStmt as highly important, confirming the model's ability to focus on semantically rich components.
  • The model generalizes well to unseen test data, demonstrating robustness and effective feature learning across diverse programming tasks.
  • The integration of data flow and function call edges into the AST significantly improves representation quality compared to AST-only models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.