An Empirical Study on the Code Refactoring Capability of Large Language Models
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) have shown potential to enhance software development through automated code generation and refactoring, reducing development time and improving code quality. This study empirically evaluates StarCoder2, an LLM optimized for code generation, in refactoring code across 30 open-source Java projects. We compare StarCoder2's performance against human developers, focusing on (1) code quality improvements, (2) types and effectiveness of refactorings, and (3) enhancements through one-shot and chain-of-thought prompting. Our results indicate that StarCoder2 reduces code smells by 20.1% more than developers, excelling in systematic issues like Long Statement and Magic Number, while developers handle complex, context-dependent issues better. One-shot prompting increases the unit test pass rate by 6.15% and improves code smell reduction by 3.52%. Generating five refactorings per input further increases the pass rate by 28.8%, suggesting that combining one-shot prompting with multiple refactorings optimizes performance. These findings provide insights into StarCoder2's potential and best practices for integrating LLMs into software refactoring, supporting more efficient and effective code improvement in real-world applications.
Key facts. Cited by 19 papers in the map (data through 14 Oct 2026). First posted on arXiv 4 Nov 2024.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 10; 2026: 9.
19 papers.
Sort:
By area:
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasetscited by 16
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
- 2025RefAgent: A Multi-agent LLM-based Framework for Automatic Software Refactoringcited by 8
- 2026CodeTaste: Can LLMs Generate Human-Level Code Refactorings?cited by 8
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoringcited by 6
- 2025Trust Me, I Know This Function: Hijacking LLM Static Analysis using Biascited by 3
- 2026SmellBench: Evaluating LLM Agents on Architectural Code Smell Repaircited by 3
- 2025Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiencycited by 2
- 2025Taxonomy of migration scenarios for Qiskit refactoring using LLMscited by 2
- 2025Can LLMs Replace Humans During Code Chunking?cited by 2
- 2025Refactoring with LLMs: Bridging Human Expertise and Machine Understandingcited by 2
- 2025A Blueprint for AI-Driven Software Quality: Integrating LLMs with Established Standardscited by 1
7 more
- 2025Automatic Qiskit Code Refactoring Using Large Language Modelscited by 1
- 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenancecited by 0
- 2026AI-Assisted Unit Test Writing and Test-Driven Code Refactoring: A Case Studycited by 0
- 2026Structural Anchors and Reasoning Fragility:Understanding CoT Robustness in LLM4Codecited by 0
- 2026An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Gamecited by 0
- 2026SDAD: Spec-Driven Agentic Development for the AI-Native SDLCcited by 0
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoringcited by 0
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoring21 Aug 2026
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoring10 Aug 2026
- 2026An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Game19 Jun 2026
- 2026SmellBench: Evaluating LLM Agents on Architectural Code Smell Repair7 May 2026
- 2026SDAD: Spec-Driven Agentic Development for the AI-Native SDLC5 May 2026
- 2026Structural Anchors and Reasoning Fragility:Understanding CoT Robustness in LLM4Code14 Apr 2026
- 2026AI-Assisted Unit Test Writing and Test-Driven Code Refactoring: A Case Study3 Apr 2026
- 2026CodeTaste: Can LLMs Generate Human-Level Code Refactorings?4 Mar 2026
- 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenance26 Jan 2026
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025RefAgent: A Multi-agent LLM-based Framework for Automatic Software Refactoring5 Nov 2025
- 2025Refactoring with LLMs: Bridging Human Expertise and Machine Understanding4 Oct 2025
7 more
- 2025Trust Me, I Know This Function: Hijacking LLM Static Analysis using Bias24 Aug 2025
- 2025Can LLMs Replace Humans During Code Chunking?24 Jun 2025
- 2025Automatic Qiskit Code Refactoring Using Large Language Models17 Jun 2025
- 2025Taxonomy of migration scenarios for Qiskit refactoring using LLMs8 Jun 2025
- 2025A Blueprint for AI-Driven Software Quality: Integrating LLMs with Established Standards19 May 2025
- 2025Optimizing Token Consumption in LLMs: A Nano Surge Approach for Code Reasoning Efficiency22 Apr 2025
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasets21 Mar 2025
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
- 2025RefAgent: A Multi-agent LLM-based Framework for Automatic Software Refactoringcited by 8
- 2026CodeTaste: Can LLMs Generate Human-Level Code Refactorings?cited by 8
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoringcited by 6
- 2026SmellBench: Evaluating LLM Agents on Architectural Code Smell Repaircited by 3
- 2026SDAD: Spec-Driven Agentic Development for the AI-Native SDLCcited by 0
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoringcited by 0
- 2026REFINE: A Multi-Agent LLM Approach for Evidence-Guided Code Refactoring21 Aug 2026
- 2026SWE-Bench ProMax: Benchmarking Agents on Large-Scale Multilingual Code Refactoring10 Aug 2026
- 2026SmellBench: Evaluating LLM Agents on Architectural Code Smell Repair7 May 2026
- 2026SDAD: Spec-Driven Agentic Development for the AI-Native SDLC5 May 2026
- 2026CodeTaste: Can LLMs Generate Human-Level Code Refactorings?4 Mar 2026
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025RefAgent: A Multi-agent LLM-based Framework for Automatic Software Refactoring5 Nov 2025
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasetscited by 16
- 2025Trust Me, I Know This Function: Hijacking LLM Static Analysis using Biascited by 3
- 2025Taxonomy of migration scenarios for Qiskit refactoring using LLMscited by 2
- 2025Can LLMs Replace Humans During Code Chunking?cited by 2
- 2025Refactoring with LLMs: Bridging Human Expertise and Machine Understandingcited by 2
- 2025A Blueprint for AI-Driven Software Quality: Integrating LLMs with Established Standardscited by 1
- 2025Automatic Qiskit Code Refactoring Using Large Language Modelscited by 1
- 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenancecited by 0
- 2026AI-Assisted Unit Test Writing and Test-Driven Code Refactoring: A Case Studycited by 0
- 2026An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Gamecited by 0
- 2026An Exploratory Case Study of LLM-Assisted Refactoring and Gameplay Feature Generation in an Endless Runner Game19 Jun 2026
- 2026AI-Assisted Unit Test Writing and Test-Driven Code Refactoring: A Case Study3 Apr 2026
- 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenance26 Jan 2026
- 2025Refactoring with LLMs: Bridging Human Expertise and Machine Understanding4 Oct 2025
- 2025Trust Me, I Know This Function: Hijacking LLM Static Analysis using Bias24 Aug 2025
- 2025Can LLMs Replace Humans During Code Chunking?24 Jun 2025
- 2025Automatic Qiskit Code Refactoring Using Large Language Models17 Jun 2025
- 2025Taxonomy of migration scenarios for Qiskit refactoring using LLMs8 Jun 2025
- 2025A Blueprint for AI-Driven Software Quality: Integrating LLMs with Established Standards19 May 2025
- 2025Large Language Models (LLMs) for Source Code Analysis: applications, models and datasets21 Mar 2025
Similar, not cited
Close in wording, no citation either way
- 2024Rethinking Code Refinement: Learning to Judge Code Efficiency
- 2026RefactorAssist: Agentic Refinement for Reliable Code Refactoring
- 2025MANTRA: Enhancing Automated Method-Level Refactoring with Contextual RAG and Multi-Agent LLM Collaboration
- 2024The Impact of Prompt Programming on Function-Level Code Generation
- 2025Evaluating the Effectiveness of Small Language Models in Detecting Refactoring Bugs
- 2025Evaluating Large Language Models for Functional and Maintainable Code in Industrial Settings: A Case Study at ASML
- 2025FeedbackEval: A Benchmark for Evaluating Large Language Models in Feedback-Driven Code Repair Tasks
- 2026SmellBench: Towards Fine-Grained Evaluation of Code Agents on Refactoring Tasks