ChatPaper.aiChatPaper

MARS:面向竞赛编程的多专家大语言模型接力系统

MARS: Multi-Specialist LLM Relay System for Competitive Programming

August 24, 2026
作者: Andrei Mikhailov, Mikhail Burtsev, Alsu Sagirova
cs.AI

摘要

大语言模型在代码生成方面表现出色,但竞争性编程暴露了一个持续存在的失败模式:现有的多智能体流水线将工作分配给通用的规划者、编码者和调试者角色,并将算法技术的选择完全交由主干模型处理。我们提出了MARS(专用大语言模型的多智能体中继,Multi-Agent Relay of Specialized LLMs)框架,这是一种纯提示框架,其中每个智能体都是特定主题的专家——涵盖动态规划、图论、字符串、几何等——并通过基于算法理论语料库的检索增强生成提供支撑。给定一个问题,检索模块会选出一小支相关专家团队;一名初始编写者生成一个初步的C++17解决方案,随后每一轮都在沙箱中针对公开示例运行候选方案,由当前活跃专家决定保留、修复或移交草稿,并将结构化数据包转发给下一位专家。最后,通过一次基础设施修复过程来规范化样板代码。在CodeContests测试集上使用Gemma 4时,MARS的通过率达到0.624±0.006,每项任务记录2.3个流水线阶段(较直接提示提升14.4个百分点),以3.3倍更低的墙钟时间成本缩小了与CodeSIM(0.731)之间的大部分差距,且每项任务的词元消耗方差显著更小。源代码可在GitHub上获取:https://github.com/fckand/mars。
English
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.