Table of Contents
Fetching ...

Identification and Optimization of Redundant Code Using Large Language Models

Shamse Tasnim Cynthia

TL;DR

This work tackles the persistent challenge of redundant code in AI software, proposing to harness large language models (LLMs) to automatically detect and optimize redundancy while preserving original functionality. It outlines analyzing patterns and root causes of redundancy, building a catalog of common issues, and deploying an LLM-agent workflow that refactors code and validates changes through test suites. The expected contributions include prevalence analysis in open-source AI projects, a catalog of redundancy-inducing patterns, and a prototype automated refactoring tool, all aimed at improving code readability, maintainability, and scalability in AI systems. If successful, the approach could reduce technical debt and streamline maintenance for large-scale AI software deployments.

Abstract

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.

Identification and Optimization of Redundant Code Using Large Language Models

TL;DR

This work tackles the persistent challenge of redundant code in AI software, proposing to harness large language models (LLMs) to automatically detect and optimize redundancy while preserving original functionality. It outlines analyzing patterns and root causes of redundancy, building a catalog of common issues, and deploying an LLM-agent workflow that refactors code and validates changes through test suites. The expected contributions include prevalence analysis in open-source AI projects, a catalog of redundancy-inducing patterns, and a prototype automated refactoring tool, all aimed at improving code readability, maintainability, and scalability in AI systems. If successful, the approach could reduce technical debt and streamline maintenance for large-scale AI software deployments.

Abstract

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.
Paper Structure (6 sections)