arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2504.20434cs.SEcs.AI

ARCS:基于智能体检索增强的代码合成与迭代优化

ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinement

Los Alamos National Laboratory(洛斯阿拉莫斯国家实验室)

Manish Bhattarai, Miguel Cordova, Minh Vu, Javier Santos, Ismael Boureima, Dan O'Malley

AI总结:

ARCS提出了一种无需微调的智能体检索增强代码合成系统,通过预算化的合成-执行-修复循环和分层控制器,在HumanEval上达到87.2%的pass@1,超越现有方法,并提供了可证明的收敛保证。

摘要:

我们提出了智能体检索增强代码合成(ARCS),一种无需微调即可改进基于LLM的代码生成的系统。ARCS通过一个预算化的合成-执行-修复循环在冻结模型上运行:在生成前检索相关代码上下文,提出候选方案,针对测试执行它们,并根据执行反馈进行修复。这种生成前检索的设计减少了幻觉并加速了收敛。我们将ARCS形式化为一个状态-动作过程,具有关于终止、单调改进和有界成本的可证明保证。一个分层控制器(小/中/大)可预测地以延迟换取准确性。在HumanEval上,ARCS使用Llama-3.1-405B实现了高达87.2%的pass@1,超过了CodeAgent(82.3%),同时使用了比树搜索方法更简单的控制。在TransCoder上,它在大多数翻译对上实现了>=90%的准确率。在LANL科学语料库上,它比基线RAG提高了CodeBLEU +0.115。ARCS提供了一种实用、可复现的方法,利用现有LLM检查点实现可靠的代码合成。

英文摘要:

We present Agentic Retrieval-Augmented Code Synthesis (ARCS), a system that improves LLM-based code generation without fine-tuning. ARCS operates through a budgeted synthesize-execute-repair loop over a frozen model: it retrieves relevant code context before generation, proposes candidates, executes them against tests, and repairs based on execution feedback. This retrieval-before-generation design reduces hallucination and accelerates convergence. We formalize ARCS as a state-action process with provable guarantees on termination, monotonic improvement, and bounded cost. A tiered controller (Small/Medium/Large) trades latency for accuracy predictably. On HumanEval, ARCS achieves up to 87.2% pass@1 with Llama-3.1-405B, surpassing CodeAgent (82.3%) while using simpler control than tree-search methods. On TransCoder, it achieves >= 90% accuracy on most translation pairs. On a LANL scientific corpus, it improves CodeBLEU by +0.115 over baseline RAG. ARCS provides a practical, reproducible approach to reliable code synthesis using existing LLM checkpoints.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑