Thursday, March 20, 2025

MarsCode Agent: A Technological Marvel for Software Bug Fixing

  MarsCode Agent: A Technological Marvel for Software Bug Fixing

In the realm of software development, hunting down and fixing bugs in code is like an endless battle. In the past, developers had to painstakingly search for and resolve issues manually, which was not only inefficient and time - consuming but also a major headache. However, Yizhou Liu, Pengfei Gao and others from ByteDance and Harbin Institute of Technology (Shenzhen) have brought a game - changer - the MarsCode Agent framework, making automated software bug fixing a reality.


With the rise of large language models (LLMs), the software development field has entered a new era. LLMs, having undergone pre - training on vast corpora, perform outstandingly in natural language processing and software engineering tasks. They can be classified into encoder - only models, decoder - only models, and encoder - decoder models based on their architectures, and most models can be fine - tuned with task - specific data to enhance their performance. When it comes to fault localization, traditional dynamic and static methods each have their pros and cons. Dynamic methods rely on the dynamic execution information of programs to locate faults, consuming a large amount of resources, while static methods analyze semantically or syntactically, with low resource consumption. Besides, there are advanced methods that combine multiple techniques. Automated program repair is also evolving, from search - based, semantics - based, and learning - based approaches to the current use of LLMs. Meanwhile, agent - based frameworks such as Devin, OpenDevin, SWE - agent, and AutoCodeRover play important roles in software engineering tasks. The SWE - bench benchmark provides a standard for evaluating the performance of LLMs in complex software engineering tasks, yet the success rates of existing models in this test are not high.


What makes the MarsCode Agent framework so remarkable? It adopts a multi - agent collaboration model, allocating static or dynamic resolution processes according to the nature of the problem. It consists of six roles: Searcher, Planner, Reproducer, Programmer, Tester, and Editor, each equipped with a corresponding set of tools. In the dynamic debugging and repair scenario, the Reproducer writes scripts, the Tester verifies, and the Programmer makes repairs based on the feedback until the problem is resolved. In the static repair scenario, the Editor directly repairs based on the code snippets, generating multiple candidate solutions and determining the final result through a voting mechanism. To retrieve code more efficiently, MarsCode Agent has developed a variety of code indexing tools. The code knowledge graph represents code elements and their relationships in a graph structure, supporting multilingual retrieval. The Language Server Protocol (LSP) is used for global and precise code retrieval, with added fuzzy positioning capabilities. Additionally, general project file retrieval and identifier retrieval functions are integrated. To address the weak code modification capabilities of LLMs, MarsCode Agent has developed the AutoDiff tool, which describes code editing in a way similar to git conflict markers, avoiding complex line - number calculations. Finally, static code diagnostics are performed to check for syntax issues in the modified code.


Researchers tested MarsCode Agent on the SWE - bench Lite dataset. This dataset, extracted from SWE - bench, contains 300 instances and is specifically designed to evaluate the ability of agents to solve software engineering problems. The results were astonishing. MarsCode Agent successfully solved 102 instances, achieving a resolution rate of 34%. The file localization accuracy was as high as 88.3%, and the code snippet localization accuracy was 68.7%. During the problem - solving process, 28% of the problems entered the dynamic debugging stage, with a success rate of 38.1%, and 72% entered the static repair stage, with a success rate of 32.4%. In terms of code retrieval and error - localization capabilities, MarsCode Agent far outperformed other tools.

No comments:

Post a Comment