Clean Code, Better Models: Enhancing LLM Performance with Smell-Cleaned Dataset

The Large Language Models (LLMs) have demonstrated great potential in code-related tasks. However, most research focuses on improving the output quality of LLMs (e.g., correctness), and less attention has been paid to the LLM input (e.g., the training code quality). Given that code smells are widely existed in practice and can negatively impact software maintainability and readability, this study takes the first systematic research to assess and improve dataset quality in terms of code smells. In this work, we first conduct a preliminary study to explore the presence of code smells in a popular benchmark dataset (i.e., CodeSearchNet -Python) and evaluate the output of several popular LLMs (i.e., DeepSeek-Coder, CodeLlama, and MagiCoder), revealing that code smell issues extensively exist in LLM’s input (e.g., benchmark dataset) and output (e.g., generated code). We also perform a user study to investigate developers’ perspectives on LLM-generated code with and without smells, which indicated developers’ strong preference for smell-free code and their willingness to leverage LLMs for intricate code smell removal. We then conduct our systematic research by taking three main steps: Firstly, we propose an LLM-based code smell cleaning tool, named Smell CC ( Smell C ode C leaner), which automatically refactors and removes code smells. To evaluate the correctness of the code refactoring, we construct a test set of 50 repositories sourced from the CodeSearchNet -Python benchmark for functional testing. Then we apply our curated smell-cleaned dataset to fine-tune two LLMs (i.e., DeepSeek-V2 and Qwen-Coder) to explore their potential for generating high-quality code. Thirdly, we investigate the impact of code smells on two downstream tasks: code completion and code search. Furthermore, to access the generalizability of Smell CC , we conduct a cross-project evaluation. Lastly, we derive several actionable implications for software engineering researchers and industry practitioners from our findings. The experimental results show that our Smell CC eliminates 91.6% of code smells across the entire CodeSearchNet -Python corpus, curating a smell-cleaned benchmark dataset. On a curated 50-repository subset, Smell CC achieves 96.8% smell removal while maintaining 91.3% correctness through test verification. The LLMs fine-tuned on this smell-cleaned dataset reduce code smells in generated code by 79.6% and 83.1% for DeepSeek-V2 and Qwen-Coder respectively. Moreover, applying the smell-cleaned dataset to code completion and code search tasks yields significant improvements across all models (DeepSeek-V1/V2, Qwen-Coder), with Qwen-Coder achieving peak gains of 12.2% in completion and 4.3% in search performance. Finally, Smell CC also demonstrates strong generalization capabilities in a cross-project setting.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-02-05
DOI
https://doi.org/10.1145/3793252
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Clean Code, Better Models: Enhancing LLM Performance with Smell-Cleaned Dataset

Zhipeng Gao, Xiaozhi Hu, Zhipeng Xue, Xiaoting Zhang et al.
ACM Transactions on Software Engineering and Methodology
Software Engineering Research
article

Clean Code, Better Models: Enhancing LLM Performance with Smell-Cleaned Dataset

Zhipeng Gao, Xiaozhi Hu, Zhipeng Xue, Xiaoting Zhang, Shanping Li, Shan Gao, Xin Xia
article en

Abstract

The Large Language Models (LLMs) have demonstrated great potential in code-related tasks. However, most research focuses on improving the output quality of LLMs (e.g., correctness), and less attention has been paid to the LLM input (e.g., the training code quality). Given that code smells are widely existed in practice and can negatively impact software maintainability and readability, this study takes the first systematic research to assess and improve dataset quality in terms of code smells. In this work, we first conduct a preliminary study to explore the presence of code smells in a popular benchmark dataset (i.e., CodeSearchNet -Python) and evaluate the output of several popular LLMs (i.e., DeepSeek-Coder, CodeLlama, and MagiCoder), revealing that code smell issues extensively exist in LLM’s input (e.g., benchmark dataset) and output (e.g., generated code). We also perform a user study to investigate developers’ perspectives on LLM-generated code with and without smells, which indicated developers’ strong preference for smell-free code and their willingness to leverage LLMs for intricate code smell removal. We then conduct our systematic research by taking three main steps: Firstly, we propose an LLM-based code smell cleaning tool, named Smell CC ( Smell C ode C leaner), which automatically refactors and removes code smells. To evaluate the correctness of the code refactoring, we construct a test set of 50 repositories sourced from the CodeSearchNet -Python benchmark for functional testing. Then we apply our curated smell-cleaned dataset to fine-tune two LLMs (i.e., DeepSeek-V2 and Qwen-Coder) to explore their potential for generating high-quality code. Thirdly, we investigate the impact of code smells on two downstream tasks: code completion and code search. Furthermore, to access the generalizability of Smell CC , we conduct a cross-project evaluation. Lastly, we derive several actionable implications for software engineering researchers and industry practitioners from our findings. The experimental results show that our Smell CC eliminates 91.6% of code smells across the entire CodeSearchNet -Python corpus, curating a smell-cleaned benchmark dataset. On a curated 50-repository subset, Smell CC achieves 96.8% smell removal while maintaining 91.3% correctness through test verification. The LLMs fine-tuned on this smell-cleaned dataset reduce code smells in generated code by 79.6% and 83.1% for DeepSeek-V2 and Qwen-Coder respectively. Moreover, applying the smell-cleaned dataset to code completion and code search tasks yields significant improvements across all models (DeepSeek-V1/V2, Qwen-Coder), with Qwen-Coder achieving peak gains of 12.2% in completion and 4.3% in search performance. Finally, Smell CC also demonstrates strong generalization capabilities in a cross-project setting.

ACM Transactions on Software Engineering and Methodology
Shanghai Advanced Research Institute (CN), Zhejiang University (CN)
Industry, innovation and infrastructure
Openalex Percentile: Top 76%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.