[Paper Review] Graph Neural Network to Dilute Outliers for Refactoring Monolith Application
This paper proposes CO-GCN, a novel graph neural network framework that integrates node clustering, outlier detection, and outlier dilution to refactor monolith applications into microservices. By modeling code as an attributed graph and leveraging multi-objective learning, CO-GCN improves clustering quality and identifies high-impact refactor candidates with 60% average overlap in human evaluation, outperforming state-of-the-art methods in both quantitative metrics and qualitative relevance.
Microservices are becoming the defacto design choice for software architecture. It involves partitioning the software components into finer modules such that the development can happen independently. It also provides natural benefits when deployed on the cloud since resources can be allocated dynamically to necessary components based on demand. Therefore, enterprises as part of their journey to cloud, are increasingly looking to refactor their monolith application into one or more candidate microservices; wherein each service contains a group of software entities (e.g., classes) that are responsible for a common functionality. Graphs are a natural choice to represent a software system. Each software entity can be represented as nodes and its dependencies with other entities as links. Therefore, this problem of refactoring can be viewed as a graph based clustering task. In this work, we propose a novel method to adapt the recent advancements in graph neural networks in the context of code to better understand the software and apply them in the clustering task. In that process, we also identify the outliers in the graph which can be directly mapped to top refactor candidates in the software. Our solution is able to improve state-of-the-art performance compared to works from both software engineering and existing graph representation based techniques.
Motivation & Objective
- To address the challenge of decomposing monolith applications into microservices by modeling software structure as a graph.
- To identify and prioritize outlier classes—those with excessive cross-functional dependencies—that are prime candidates for refactoring.
- To unify clustering, outlier detection, and outlier dilution into a single end-to-end GNN framework for improved microservice decomposition.
- To outperform existing graph-based and software engineering techniques in clustering quality and relevance of detected refactor candidates.
Proposed method
- The method translates monolith code into an attributed graph using static program analysis, where nodes represent classes and edges represent dependencies.
- It introduces two types of outliers: structural outliers (highly connected across functional boundaries) and attribute outliers (with anomalous invocation patterns).
- CO-GCN employs a multi-objective loss function combining graph reconstruction, clustering, and outlier-aware objectives to jointly optimize node representations, cluster assignments, and outlier scores.
- The framework uses a graph convolutional network (GCN) to learn node embeddings, with a clustering head for assigning nodes to microservice candidates.
- Outlier scores are used to dilute the influence of anomalous nodes during message passing, reducing their disruptive effect on cluster formation.
- The model is trained end-to-end with a total loss that balances structural reconstruction, attribute reconstruction, clustering, and outlier awareness.
Experimental results
Research questions
- RQ1Can a graph neural network be effectively adapted to simultaneously perform clustering and outlier detection for monolith refactoring?
- RQ2How does incorporating outlier awareness and dilution improve the quality of microservice clusterings compared to standard GNNs?
- RQ3To what extent do the detected outliers align with human expert judgments on high-priority refactor candidates?
- RQ4How sensitive is the performance of the proposed framework to hyperparameters such as node embedding size and loss weighting?
Key findings
- CO-GCN achieved state-of-the-art performance on four public monolith applications, outperforming existing graph-based and software engineering techniques in modularity and structural modularity.
- The framework detected outliers with 60% average overlap against expert-identified top five refactor candidates, significantly outperforming GCN (45%) and DGI (55%) in human evaluation.
- Abllation studies showed that both the clustering objective and outlier-aware training components contribute meaningfully to cluster quality, though their impact varied by application and metric.
- Sensitivity analysis revealed that higher node embedding sizes (e.g., 64) generally improved structural modularity, though modularity scores remained relatively stable across embedding sizes.
- Removing outlier information led to improved modularity in one application (PBW), but this was offset by a drop in structural modularity, indicating the trade-off between cluster cohesion and structural fidelity.
- The integration of outlier detection and dilution into the training objective led to more coherent and functionally coherent clusters, as validated by qualitative expert feedback.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.