ChatPaper.aiChatPaper

MARS:用於競賽程式設計的多專家LLM接力系統

MARS: Multi-Specialist LLM Relay System for Competitive Programming

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

摘要

大型語言模型在程式碼生成方面表現優異,然而競賽程式設計揭示了持續存在的失敗模式:現有的多智慧體管線將工作分配給通用的規劃者、編碼者和除錯者角色,並將演算法技術的選擇完全交由骨幹模型決定。我們提出 MARS(專業化大型語言模型的多智慧體接力),這是一個僅依賴提示的框架,其中每個智慧體都是主題專家——涵蓋動態規劃、圖論、字串、幾何等——並透過基於演算法理論語料庫的檢索增強生成來奠定基礎。面對一個問題時,檢索程序會選出一小隊相關專家;起始者撰寫初始的 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。
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.