arXiv:2605.24812cs.AI2026-05被引 4

让代码生成的AI分工协作,提升准确率和效率。

CoRe-Code: Collaborative Reinforcement Learning for Code Generation

论文配图:CoRe-Code: Collaborative Reinforcement Learning for Code Generation
图 1 · 摘自论文原文
  • 采用规划者与编码者角色分工,分步生成代码。
  • 在多个基准上准确率超越现有方法,执行更快更省内存。
  • 适合需要高质量代码生成的研究与工程场景。

大型语言模型在代码生成方面表现强劲,但多数方法依赖自回归解码,缺乏全局规划,常导致局部连贯但整体低效或失败(如测试不通过、复杂度高)。尽管链式思维(CoT)和多智能体系统(MAS)引入了规划,但其角色分工不清、协同能力弱,难以应对复杂任务。为此,我们提出协作强化代码生成框架CoRe-Code,通过角色专业化的大语言模型智能体,增强跨智能体协同能力。CoRe-Code采用简单的规划者-编码者范式:规划者生成高层方案,编码者据此生成代码。进一步引入基于组相对策略优化(GRPO)的协作感知强化学习阶段,促进角色专业化与对齐。实验表明,CoRe-Code在多种难度的基准上均优于主流基于强化学习和多智能体的方法。此外,该框架可拓展至检索与调试等其他多智能体结构,体现其灵活性与可扩展性。我们在三个基础模型上进行评估,结果一致显示准确率提升,同时执行时间与内存消耗更低,验证了CoRe-Code的有效性与实用性。

原文摘要 · Abstract (English)

Large language models (LLMs) have achieved strong performance in code generation, but most methods rely on autoregressive decoding without global planning, often leading to locally coherent yet globally suboptimal solutions (e.g., failing test cases or inefficient complexity). While recent approaches such as Chain-of-Thought (CoT) and multi-agent systems (MAS) introduce planning, their limited role specialization and coordination hinder performance on complex tasks. To address the challenges of coordination and specialization in multi-agent code generation, we propose Collaborative Reinforcement Code (CoRe-Code), a framework for role specialized LLM agents that enhances inter-agent coordination to generate more accurate and efficient code. CoRe-Code adopts a simple Planner-Coder paradigm, where the Planner produces high-level plans and the Coder executes them to generate code. We further introduce a collaboration-aware reinforcement learning stage based on Group Relative Policy Optimization (GRPO) to enhance role specialization and alignment. Experiments show that CoRe-Code outperforms a wide range of existing RL-based and multi-agent methods. In addition, we demonstrate that CoRe-Code can generalize to other multi-agent frameworks (e.g., Retrieval and Debugging agents), highlighting its flexibility and scalability. We evaluate CoRe-Code on multiple benchmarks of varying difficulty using three base models. Compared to existing baselines, the results show consistent improvements in accuracy, while also achieving higher efficiency in terms of execution time and memory usage, demonstrating the effectiveness and practicality of CoRe-Code.

代码生成多智能体强化学习

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