arXiv:2409.11190cs.SEcs.AI2024-09被引 5

AI自主编程新突破,能自动定位修复代码并验证结果。

SuperCoder2.0: Technical Report on Exploring the feasibility of LLMs as Autonomous Programmer

  • 用AST解析和RAG技术重构代码,减少语法错误。
  • 84.33%案例在前5候选文件中准确定位,34%问题成功解决。
  • 适合想提升开发效率的程序员与自动化工具研究者。

我们提出SuperCoder2.0,一个先进的自主编程系统,通过人工智能增强软件开发。系统结合AI原生开发方法与智能代理,实现完全自主编码。核心包括:基于错误回溯的重试机制、利用抽象语法树(AST)解析进行代码重构以降低lint问题、代码嵌入技术支持检索增强生成,并聚焦方法级定位而非具体行号。采用三步层级搜索空间缩减策略进行代码库导航与缺陷定位:(1) 使用RAG与仓库文件级映射识别候选文件,(2) 通过文件级示意图进一步筛选相关文件,(3) 提取文件内相关位置。代码编辑由生成与编辑双模块完成,生成多温度解并替换整个方法或类以保证代码完整性。通过执行仓库级测试用例形成反馈循环,验证并优化方案。在SWE-bench Lite数据集上的实验表明,系统在84.33%案例中于前5候选文件内准确完成文件定位,成功解决34%测试实例,全球排名第四。系统处理多样仓库与问题类型的能力,凸显其作为通用自主开发工具的潜力。未来工作将优化代码编辑流程,并探索更优嵌入模型以提升自然语言到代码映射能力。

原文摘要 · Abstract (English)

We present SuperCoder2.0, an advanced autonomous system designed to enhance software development through artificial intelligence. The system combines an AI-native development approach with intelligent agents to enable fully autonomous coding. Key focus areas include a retry mechanism with error output traceback, comprehensive code rewriting and replacement using Abstract Syntax Tree (ast) parsing to minimize linting issues, code embedding technique for retrieval-augmented generation, and a focus on localizing methods for problem-solving rather than identifying specific line numbers. The methodology employs a three-step hierarchical search space reduction approach for code base navigation and bug localization:utilizing Retrieval Augmented Generation (RAG) and a Repository File Level Map to identify candidate files, (2) narrowing down to the most relevant files using a File Level Schematic Map, and (3) extracting 'relevant locations' within these files. Code editing is performed through a two-part module comprising CodeGeneration and CodeEditing, which generates multiple solutions at different temperature values and replaces entire methods or classes to maintain code integrity. A feedback loop executes repository-level test cases to validate and refine solutions. Experiments conducted on the SWE-bench Lite dataset demonstrate SuperCoder2.0's effectiveness, achieving correct file localization in 84.33% of cases within the top 5 candidates and successfully resolving 34% of test instances. This performance places SuperCoder2.0 fourth globally on the SWE-bench leaderboard. The system's ability to handle diverse repositories and problem types highlights its potential as a versatile tool for autonomous software development. Future work will focus on refining the code editing process and exploring advanced embedding models for improved natural language to code mapping.

自主编程代码生成AI开发RAG

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。