MARS:面向竞赛编程的多专家大语言模型中继系统
观点分析 · 2026/08/27
大型语言模型在代码生成方面表现出色,但竞赛编程暴露了一个持续的失败模式:现有的多智能体流水线将工作分配给通用的规划者、编码者和调试者角色,并将算法技术的选择完全委托给主干模型。我们提出了MARS(专业LLM的多智能体中继),这是一个仅基于提示的框架,其中每个智能体都是主题专家——动态规划、图论、字符串、几何等——并通过检索增强生成在算法理论语料库上进行基础。给定一个问题,检索会选择一小队相关专家;一个起始者编写初始的C++17解决方案,随后每一轮在沙箱中针对公开示例运行候选方案,让活跃专家保留、修复或移交草稿,并将结构化数据包转发给下一个专家。最后,一个单一的基础设施修复过程会规范化样板代码。在CodeContests测试集上,使用Gemma 4,MARS达到了0.624±0.006的通过率,平均每个任务2.3个流水线阶段(比直接提示高14.4个百分点),以3.3倍更低的墙钟时间和显著更小的每任务token消耗方差,缩小了与CodeSIM(0.731)的大部分差距。源代码可在GitHub上获取:https://github.com/fckand/mars。
该论文针对竞赛编程中多智能体系统的关键缺陷,提出了一种新颖的专家中继框架,通过检索增强和主题专业化显著提升了代码生成性能,同时降低了计算成本。实验结果表明其有效性和效率,为多智能体协作在复杂任务中的应用提供了新思路。
Large Language Models excel at code generation, yet competitive programming exposes a persistent failure mode: existing multi-agent pipelines distribute work over generic planner, coder, and debugger roles and delegate the choice of algorithmic technique to the backbone alone. We present MARS (Multi-Agent Relay of Specialized LLMs), a prompt-only framework in which each agent is a topic specialist---dynamic programming, graphs, strings, geometry, and so on---grounded by retrieval-augmented generation over an algorithm-theory corpus. Given a problem, retrieval selects a small team of relevant specialists; a starter writes an initial C++17 solution, and each subsequent turn runs the candidate against public examples in a sandbox, lets the active specialist keep, repair, or hand off the draft, and forwards a structured packet to the next specialist. A single infrastructure-fixer pass normalizes boilerplate at the end. On the CodeContests test split with Gemma 4, MARS reaches 0.624 pm 0.006 pass rate at 2.3 recorded pipeline stages per task (+14.4 percentage points over direct prompting), closing most of the gap to CodeSIM (0.731) at 3.3{times} lower wall-clock cost and substantially smaller variance in per-task token spend. The source code is available on GitHub: https://github.com/fckand/mars.