paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Using Deep Learning to Automatically Improve Code Readability

使用深度学习自动改善代码可读性
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 2/10 · 论文聚焦用深度学习自动改进代码可读性,属于机器学习辅助软件工程/开发者工具,与用户关注的静态分析、Agentic程序分析、浮点程序分析、贝叶斯程序分析及LLM辅助形式化验证均无直接重合。仅标签“机器学习与程序语言”与研究方向有宽泛交集。引用 11 inbox
Antonio Vitale, Valentina Piantadosi, Simone Scalabrino, Rocco Oliveto
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:首次提出整体化代码可读性改进方法,构建122k提交数据集并训练T5自动建议可读性改进。

代码阅读占开发者日常活动的大部分,已有研究多聚焦于自动评估代码可读性或修复命名、格式等特定问题,但仍缺乏自动建议整体可读性改进动作的方法。本文提出首个整体化可读性改进方案:首先定义自动识别“可读性改进提交”的方法,并挖掘GitHub 2015至2022年全部项目历史,构建包含122k提交的数据集,识别准确率约86%;其次训练并测试T5模型,以模仿开发者改善可读性的编辑行为。评估显示,模型完全预测准确率在21%至28%之间;对500条预测的人工评估表明,当模型不改变输入行为且实际应用修改时(占34%),其中79.4%的情况确实提升了代码可读性。

问题
开发者需要阅读和理解代码,已有技术能检测不可读代码或修复特定可读性问题,但缺少自动建议应如何整体改进代码可读性的方法。
方法
提出自动识别可读性改进提交的方法,基于GitHub 2015至2022年全历史挖掘出122k提交数据集,并训练T5模型模仿开发者改善可读性的代码编辑。
评估
识别方法准确率约86%;T5完全预测准确率为21%至28%;对500条预测进行人工评估,模型保持行为并应用修改的34%案例中,79.4%提升了可读性。
原文摘要(Abstract)

Reading source code occupies most of developer's daily activities. Any maintenance and evolution task requires developers to read and understand the code they are going to modify. For this reason, previous research focused on the definition of techniques to automatically assess the readability of a given snippet. However, when many unreadable code sections are detected, developers might be required to manually modify them all to improve their readability. While existing approaches aim at solving specific readability-related issues, such as improving variable names or fixing styling issues, there is still no approach to automatically suggest which actions should be taken to improve code readability. In this paper, we define the first holistic readability-improving approach. As a first contribution, we introduce a methodology for automatically identifying readability-improving commits, and we use it to build a large dataset of 122k commits by mining the whole revision history of all the projects hosted on GitHub between 2015 and 2022. We show that such a methodology has ~86% accuracy. As a second contribution, we train and test the T5 model to emulate what developers did to improve readability. We show that our model achieves a perfect prediction accuracy between 21% and 28%. The results of a manual evaluation we performed on 500 predictions shows that when the model does not change the behavior of the input and it applies changes (34% of the cases), in the large majority of the cases (79.4%) it allows to improve code readability.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{VitalePSO23,
  title = {Using Deep Learning to Automatically Improve Code Readability},
  author = {Antonio Vitale and Valentina Piantadosi and Simone Scalabrino and Rocco Oliveto},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00112}
}