跳到正文
EasyXiv 检索
投稿 关于 登录

按回车检索 · 直接输入编号(如 1706.03762)可跳转到论文

计算机科学 > 程序设计语言

arXiv:2311.11690 (cs)
[提交于 2023年11月20日]

标题:Refactoring Programs Using Large Language Models with Few-Shot Examples

作者:Atsushi Shirafuji, Yusuke Oda, Jun Suzuki, Makoto Morishita, Yutaka Watanobe
查看论文《Refactoring Programs Using Large Language Models with Few-Shot Examples》的 PDF
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读
摘要:A less complex and more straightforward program is a crucial factor that enhances its maintainability and makes writing secure and bug-free programs easier. However, due to its heavy workload and the risks of breaking the working programs, programmers are reluctant to do code refactoring, and thus, it also causes the loss of potential learning experiences. To mitigate this, we demonstrate the application of using a large language model (LLM), GPT-3.5, to suggest less complex versions of the user-written Python program, aiming to encourage users to learn how to write better programs. We propose a method to leverage the prompting with few-shot examples of the LLM by selecting the best-suited code refactoring examples for each target programming problem based on the prior evaluation of prompting with the one-shot example. The quantitative evaluation shows that 95.68% of programs can be refactored by generating 10 candidates each, resulting in a 17.35% reduction in the average cyclomatic complexity and a 25.84% decrease in the average number of lines after filtering only generated programs that are semantically correct. Furthermore, the qualitative evaluation shows outstanding capability in code formatting, while unnecessary behaviors such as deleting or translating comments are also observed.
评论: 10 pages, 10 figures, accepted to the 30th Asia-Pacific Software Engineering Conference (APSEC 2023)
主题: 程序设计语言 (cs.PL); 人工智能 (cs.AI); 计算与语言 (cs.CL); 软件工程 (cs.SE)
引用方式: arXiv:2311.11690 [cs.PL]
  (或者 arXiv:2311.11690v1 [cs.PL] 对于此版本)
  https://doi.org/10.48550/arXiv.2311.11690
相关 DOI: https://doi.org/10.1109/APSEC60848.2023.00025

提交历史

来自:Atsushi Shirafuji
[v1] 2023年11月20日 星期一 11:43:45 UTC
全文链接:

访问论文:

  • 查看原文 PDF
  • 中文 PDF (下批处理)
  • EasyResearch 阅读
  • TeX 源文件
  • arXiv 原文页面
查看许可

当前浏览上下文:

cs.PL
< 上一篇   |   下一篇 >
最新 | 近期 | 2023-11
切换浏览方式为:
cs
cs.AI
cs.CL
cs.SE

参考文献与引用

  • Google Scholar
  • Semantic Scholar

BibTeX 格式的引用

EasyXiv 是独立运营的中文预印本站点,与 arXiv 及康奈尔大学无隶属关系。 论文元数据与原文来自 arXiv.org,感谢 arXiv 提供开放获取服务。
关于 · 帮助 · 投稿指南 · 版权 · arXiv 原站