使用大型语言模型识别与优化冗余代码
Identification and Optimization of Redundant Code Using Large Language Models
AI总结:
本文研究利用大型语言模型自动检测和优化AI项目中的冗余代码,识别冗余模式及其成因,并提出LLM智能体以在保持功能的前提下实现大规模重构。
摘要:
冗余代码是软件开发中一个长期存在的挑战,它使系统更难维护、扩展和更新。它增加了不必要的复杂性,阻碍了缺陷修复,并提高了技术债务。尽管影响显著,手动移除冗余代码仍然风险高且容易出错,常常引入新的缺陷或遗漏依赖关系。虽然已有研究强调了冗余代码的普遍性及其负面影响,但很少有工作关注人工智能(AI)系统代码库以及导致冗余的常见模式。此外,开发人员无意中引入冗余代码背后的原因在很大程度上仍未得到探索。本研究通过利用大型语言模型(LLMs)自动检测和优化AI项目中的冗余代码来填补这些空白。我们的研究旨在识别反复出现的冗余模式,并分析其根本原因,例如过时的实践或对最佳编码原则认识不足。此外,我们计划提出一个LLM智能体,以促进大规模检测和重构冗余,同时保持原有功能。这项工作推进了AI在识别和优化冗余代码中的应用,最终帮助开发人员维护更干净、更易读且可扩展的代码库。
英文摘要:
Redundant code is a persistent challenge in software development that makes systems harder to maintain, scale, and update. It adds unnecessary complexity, hinders bug fixes, and increases technical debt. Despite their impact, removing redundant code manually is risky and error-prone, often introducing new bugs or missing dependencies. While studies highlight the prevalence and negative impact of redundant code, little focus has been given to Artificial Intelligence (AI) system codebases and the common patterns that cause redundancy. Additionally, the reasons behind developers unintentionally introducing redundant code remain largely unexplored. This research addresses these gaps by leveraging large language models (LLMs) to automatically detect and optimize redundant code in AI projects. Our research aims to identify recurring patterns of redundancy and analyze their underlying causes, such as outdated practices or insufficient awareness of best coding principles. Additionally, we plan to propose an LLM agent that will facilitate the detection and refactoring of redundancies on a large scale while preserving original functionality. This work advances the application of AI in identifying and optimizing redundant code, ultimately helping developers maintain cleaner, more readable, and scalable codebases.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。