Revisiting code readability improvement with LLMs: A critical assessment of fine-tuned models
Abstract Code comprehension is vital for software development. Still, unreadable code remains a significant issue, costing substantial time and money losses. While tools to identify code exhibiting a low readability exist, take actions to improve such a quality aspect is far from trivial. To support developers in such a task, Vitale et al. introduced at ASE’23 an approach using a transformer model (T5) fine-tuned on code commits in which developers explicitly stated their goal to improve code readability. The authors reported that their model is able to generate readability-improving changes being identical to those implemented by developers (exact matches) in 21% of cases and that, even when they differ, they still improve readability in the vast majority of cases ( $$\sim $$ 80%). Given the major advances in AI made in the last few years, we questioned whether a fine-tuning for such a task was still needed in the era of Large Language Models (LLMs), thus revisiting the work by Vitale et al. with state-of-the-art models. In doing so, we found out one major issue with the original study design: The training-test splitting was performed randomly ( i.e., readability-improving commits mined from open source projects were randomly split between training and test) rather than by project, significantly inflating the reported performance due to repeating readability-improving commits done within the same project. Indeed, as we will show, even newer and more powerful LLMs fine-tuned for this task can only achieve a $$\sim $$ 1% of exact matches. Once fixed this issue, we shifted our attention on assessing whether fine-tuning on available developer readability improvements is actually needed given the recent advances in general-purpose LLMs. We compare the performance of fine-tuned state-of-the-art LLMs with what they achieve in zero-shot setting, also including in our study commercial LLMs (GPT-4.1). As we will show, quantitative metrics ( e.g., exact matches, CrystalBLEU) tell very little about the readability-improving capabilities of LLMs and, thus, our study is mainly qualitative in nature, with a total of $$\sim $$ 9,500 inspected LLMs’ change recommendations. While all models do improve code readability, our results clearly show that fine-tuning using mined readability-improving commits does not help and, instead, results in sensibly poorer readability recommendations as compared to LLMs used in a zero-shot setting, with GPT-4.1 being the one achieving the best results.
Authors
- Rocco Oliveto (ORCID: https://orcid.org/0000-0002-7995-8582)
- Antonio Mastropaolo (ORCID: https://orcid.org/0000-0002-7965-7712)
- Simone Scalabrino (ORCID: https://orcid.org/0000-0003-1764-9685)
- Valentina Piantadosi (ORCID: https://orcid.org/0000-0003-0666-6121)
- Antonio Vitale
- Gabriele Bavota
- Emanuela Guglielmi
Institutions
- University of Molise (IT)
- William & Mary (US)
- Politecnico di Torino (IT)
- Williams (United States) (US)
- Università della Svizzera italiana (CH)
Publication Details
- Journal
- Empirical Software Engineering
- Published
- 2026-07-23
- DOI
- https://doi.org/10.1007/s10664-026-10933-0
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- National Science Foundation
- Politecnico di Torino
- European Commission
- Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung