# AI-Driven Code Refactoring: Using Graph Neural Networks to Enhance Software Maintainability

arXiv: https://arxiv.org/abs/2504.10412 · HTML: https://mlsanity.com/paper/2504.10412/

## Key facts

- Cited by 4 papers in the map (data through 14 Oct 2026).
- Builds on 4 of its 22 references that are in the map.
- First posted on arXiv 14 Apr 2025.

## Builds on (most cited first, 4 of 4)

- [Semi-Supervised Classification with Graph Convolutional Networks](https://mlsanity.com/paper/1609.02907/) (2016)
- [Inductive Representation Learning on Large Graphs](https://mlsanity.com/paper/1706.02216/) (2017)
- [Neural Message Passing for Quantum Chemistry](https://mlsanity.com/paper/1704.01212/) (2017)
- [CodeSearchNet Challenge: Evaluating the State of Semantic Code Search](https://mlsanity.com/paper/1909.09436/) (2019)

## Built on by (most cited first, 4 of 4)

- [Code Reborn AI-Driven Legacy Systems Modernization from COBOL to Java](https://mlsanity.com/paper/2504.11335/) (2025)
- [Neuromorphic Mimicry Attacks Exploiting Brain-Inspired Computing for Covert Cyber Intrusions](https://mlsanity.com/paper/2505.17094/) (2025)
- [The Impact of Software Testing with Quantum Optimization Meets Machine Learning](https://mlsanity.com/paper/2506.02090/) (2025)
- [Reinforcement Learning for Autonomous Warehouse Orchestration in SAP Logistics Execution: Redefining Supply Chain Agility](https://mlsanity.com/paper/2506.06523/) (2025)

## Abstract (arXiv)

This study explores Graph Neural Networks (GNNs) as a transformative tool for code refactoring, using abstract syntax trees (ASTs) to boost software maintainability. It analyzes a dataset of 2 million snippets from CodeSearchNet and a custom 75000-file GitHub Python corpus, comparing GNNs against rule-based SonarQube and decision trees. Metrics include cyclomatic complexity (target below 10), coupling (target below 5), and refactoring precision. GNNs achieve 92% accuracy, reducing complexity by 35% and coupling by 33%, outperforming SonarQube (78%, 16%) and decision trees (85%, 25%). Preprocessing fixed 60% of syntax errors. Bar graphs, tables, and AST visuals clarify results. This offers a scalable AI-driven path to cleaner codebases, which is crucial for software engineering.
