Researchers evaluated five LLMs on 30 open-source Java projects, measuring whether refactored code passed original unit tests.
An empirical study tested how well five large language models handle code refactoring on real projects. Researchers evaluated StarCoder2, GPT-4o Mini, GPT-4o, LLaMA 3, and DeepSeek-v3 on 30 open-source Java projects, measuring success by whether refactored code passed the original unit tests.
The results
GPT-4o and DeepSeek-v3 achieved over 90% success rates on multi-file refactorings. LLaMA 3 led in reducing code smells by 15.1%.
Model variation
Not all LLMs handle refactoring equally. GPT-4o and DeepSeek-v3 showed strong performance on unit test preservation, while LLaMA 3 differentiated itself on code smell reduction. StarCoder2 and GPT-4o Mini were also evaluated in the study.
For developers evaluating tools
If you are selecting an LLM for automated refactoring, legacy code cleanup, or code quality improvement tasks, this study provides measurable data. The 90% success rate on multi-file refactorings and the 15.1% code smell reduction from LLaMA 3 offer concrete reference points for comparison. The choice of model depends on whether your priority is preserving existing test coverage or improving code quality metrics on your specific codebase.
Go deeper
Get the latest AI updates in the Tech AI Magazine app
iPhone · Android