MARS: Multi-Specialist LLM Relay System for Competitive Programming
Summary
MARS is a multi-agent LLM framework using specialized agents for different algorithmic topics to solve competitive programming problems, achieving a 0.624 pass rate with lower cost and variance than direct prompting.
View Cached Full Text
Cached at: 08/26/26, 09:17 AM
# Multi-Specialist LLM Relay System for Competitive Programming
Source: [https://arxiv.org/html/2608.23918](https://arxiv.org/html/2608.23918)
###### Abstract
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 reaches0\.624±0\.0060\.624\\pm 0\.006pass rate at2\.32\.3recorded pipeline stages per task \(\+14\.4\+14\.4percentage points over direct prompting\), closing most of the gap to CodeSIM \(0\.7310\.731\) at3\.3×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](https://github.com/fckand/mars)\.
## 1Introduction
Multi\-agent LLM systems recently became a popular solution for complex tasks, including software development, mathematical reasoning, and even scientific discovery\([Guo et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib8);[Tran et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib9);[Chen et al\., 2025a](https://arxiv.org/html/2608.23918#bib.bib10)\)\. Such tasks often require specialized domain knowledge to succeed\. For example, solving competitive programming problems requires a combination of theoretical algorithmic insights and problem\-specific context, and advanced mathematical reasoning tasks require a combination of reasoning skills and a strong theoretical background\.
Existing approaches generally assume that LLMs’ massive pre\-training assures their wide\-range expertise and rely on large proprietary pre\-trained models as universal experts\. This leads multi\-agent systems to treat agent roles as generic abstractions rather than as carriers of real domain expertise\.
In this work, we propose a framework for a self\-organized team of domain\-specialized agents called MARS – Multi\-Agent Relay of Specialized LLMs – a multi\-agent framework featuring RAG\-specialized agents for solving competitive programming problems\.
Competitive programming has become a standard stress test for code\-generating LLMs because the tasks require careful implementation and verification under sparse signal\([Li et al\., 2022](https://arxiv.org/html/2608.23918#bib.bib1);[Chen et al\., 2023a](https://arxiv.org/html/2608.23918#bib.bib2);[Islam et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib5)\)\. Moreover, problems often blend multiple theoretical areas to challenge algorithmic knowledge\. Existing multi\-agent approaches\([Islam et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib4);[Islam et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib5);[Li et al\., 2026](https://arxiv.org/html/2608.23918#bib.bib12)\)treat competitive programming problems as general code generation\. They apply teams of planner, coder, and debugger agents that are generic with respect to the algorithmic content of the task, and topic competence is expected to emerge from the underlying LLMs\. Content\-agnostic pipelines provide no mechanism to supply the algorithmic expertise crucial for a correct solution\. To address this gap, we propose MARS \(Multi\-Agent Relay of Specialized LLMs\), a framework in which each agent is a domain expert specialized in a single algorithmic topic, grounded through retrieval\-augmented generation\. Given a problem, all available agents are asked two questions: whether the task matches their specialization and whether the agent can initialize the relay\. Then, a small team of task\-matched agents is formed\. The initial agent generates the candidate solution \(with iterative refinement based on public test execution results\) and selects the next contributing agent from the team\. The relay terminates when an agent judges the solution complete\.
We propose MARS, a topic\-aligned multi\-agent relay in which each agent is a single\-domain expert grounded by RAG over an algorithmic theory corpus, replacing the stage\-aligned planner\-coder\-debugger decomposition\. We make public\-test execution an in\-loop signal at every relay step: the same specialist sees its draft’s report before keeping, repairing, or handing off\. On CodeContests with Gemma 4, MARS reaches0\.624±0\.0060\.624\\pm 0\.006pass rate at2\.32\.3recorded pipeline stages per task \(\+14\.4\+14\.4percentage points over direct prompting\), closing most of the gap to CodeSIM \(0\.7310\.731\) at3\.3×3\.3\{\\times\}lower wall\-clock cost and∼7×\{\\sim\}7\{\\times\}smaller standard deviation in per\-task token spend\.
## 2Related Work
Heterogeneous multi\-agent LLM systems have been studied along the axes of backbone diversity\([Ye et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib7)\), decentralized coordination without central orchestrators\([Yang et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib14)\), and dynamic teaming of capability\-described agents drawn from a shared pool\([Yun et al\., 2026](https://arxiv.org/html/2608.23918#bib.bib13);[Chen et al\., 2025b](https://arxiv.org/html/2608.23918#bib.bib15)\)\. A parallel line equips agents with persona or professional heterogeneity: inception\-prompted role\-playing\([Li et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib16)\), medical specialties for clinical reasoning\([Tang et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib17)\), Thinker/Judge/Executor roles for mathematics\([Lei et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib18)\), and stacked heterogeneous LLM layers\([Wang et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib19)\)\. Across these systems heterogeneity is realized through personas, backbone diversity, evolving graph connections, or generic capability descriptions\. None of them couples agent specialization to the topic structure of the task or grounds each specialist in a topical knowledge corpus, which is the gap MARS targets\.
Several studies used retrieval mechanisms to improve code generation accuracy\. REDCODER\([Parvez et al\., 2021](https://arxiv.org/html/2608.23918#bib.bib20)\)retrieves relevant code or summaries from a database and supplies them to the generator; DocPrompting\([Zhou et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib21)\)retrieves library documentation in response to a natural\-language intent; and RepoCoder\([Zhang et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib22)\)uses the task\-supplied repo as a retrieval database for repository\-level code completion; closer to deployment,[Wang et al\. \(2025a\)](https://arxiv.org/html/2608.23918#bib.bib34)retrieve context from an evolving codebase to synthesize tests and detect bugs\. All of these retrieve over code, API documentation, or the codebase itself\. MARS instead retrieves over distinct algorithmic\-theory topics, one corpus slice per agent, which targets the algorithmic expertise a contest task needs rather than its implementation surface\.
Once agents are heterogeneous the team is no longer fixed, and a growing body of work forms it at inference time: recruiting experts from task\-conditional descriptions\([Chen et al\., 2023b](https://arxiv.org/html/2608.23918#bib.bib23)\), generating both agents and plan from the task specification on the fly\([Chen et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib24)\), ranking candidates by an unsupervised importance score\([Liu et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib25)\), or optimizing node prompts together with inter\-agent edges over a graph of LLM operations\([Zhuge et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib33)\)\. MARS instead organizes teams through self\-reported topical competence: every specialist decides whether the problem falls within its expertise, and the matching specialists form the team\.
Most progress in code generation has come from pairing a single strong base model with an outer loop that searches, verifies, or repairs its outputs: execution\-based evaluation\([Chen et al\., 2021](https://arxiv.org/html/2608.23918#bib.bib26)\), executed test cases\([Chen et al\., 2023a](https://arxiv.org/html/2608.23918#bib.bib2)\), execution\-grounded debugging\([Chen et al\., 2023c](https://arxiv.org/html/2608.23918#bib.bib27)\), iterative self\-feedback\([Madaan et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib28)\), and verbal reinforcement from past trials\([Shinn et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib29)\); a complementary line aligns noisy crowd\-sourced human feedback for RL\-based code generation\([Wong and Tan, 2024](https://arxiv.org/html/2608.23918#bib.bib35)\), whereas MARS stays prompt\-only and takes its feedback from deterministic public\-test execution\. Competitive programming is the principal stress test of this paradigm, because its problems combine a sparse correctness signal with deep algorithmic content: AlphaCode\([Li et al\., 2022](https://arxiv.org/html/2608.23918#bib.bib1)\)reached contest level only through enormous sampling with strong filtering, and later benchmarks report that even strong models solve a small fraction of olympiad problems, with the hardest tiers unsolved\([Jain et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib30);[Shi et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib31)\)\.
Multi\-agent approaches to code generation respond to this difficulty by decomposing the task into roles\. AgentCoder\([Huang et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib32)\)couples a programmer with a test designer and a test executor that iterate on each other’s feedback; MapCoder\([Islam et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib4)\)chains retrieval, planning, coding, and debugging agents in a pipeline aimed at competitive problem solving; CodeSIM\([Islam et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib5)\)continues this line with simulation\-driven planning and debugging; and Solvita\([Li et al\., 2026](https://arxiv.org/html/2608.23918#bib.bib12)\)develops a related multi\-agent decomposition for the same setting\.
Figure 1:MARS relay pipeline\.A task is routed from a pool of RAG\-grounded topic specialists to a team of at most three agents\. Each turn runs code generation, public\-test execution, and self\-check/handoff; repair code is rerun locally before the current code and relay packet move to the next specialist or final submission\.
## 3Method
Figure[1](https://arxiv.org/html/2608.23918#S2.F1)summarizes MARS\. From a pool of eleven topic\-specialized agents, a per\-specialist self\-assessment over a shared retrieval corpus shortlists a small team that relays a single C\+\+17 program through self\-checking handoffs\. Full prompt templates and an end\-to\-end example are given in Appendices[A](https://arxiv.org/html/2608.23918#A1)and[B](https://arxiv.org/html/2608.23918#A2); Appendix[C](https://arxiv.org/html/2608.23918#A3)gives pseudocode for MARS and for every baseline\.
Each specialist is identified by a topic description and a tag set, and self\-assesses against the shared cp\-algorithms corpus filtered by its own tags\. The assessment returns an in\-scope flag, a relevance flag, and a confidence score\. We shortlist up to three matches by these scores and pick the starter with a separate can\-start probe\.
Each turn issues two LLM calls\. The first writes a draft from the current code, the assigned subtask, the starter contract, a compact summary of the previous relay state, and retrieved RAG context\. The draft is executed against the public examples in ExecEval\([Khan et al\., 2023](https://arxiv.org/html/2608.23918#bib.bib11)\)\. The second call sees the report and returns one of keep\-code, repair\-code, or no\-change together with structured handoff fields\. A repair candidate is rerun on the public examples and accepted only if it compiles and does not reduce the number of passing public tests relative to that turn’s draft; otherwise the repair is rejected and the draft is restored\. This deterministic local gate governs the keep/repair decision using observable execution signal rather than self\-reported confidence: confidence scores enter only at team selection\. The relay is budget\-bounded to at most three unique specialists and eight steps, and stops on an explicit stop signal, when no unused selected specialist remains, at the step budget, or at a no\-progress cutoff that reroutes at a streak of two and stops at three\. After the relay the code is sanitized, and an infrastructure\-fixer is invoked only when boilerplate\-level failures \(I/O wiring, includes, type widths\) are detected\.
We evaluate on 165 tasks from the CodeContests test split\([Li et al\., 2022](https://arxiv.org/html/2608.23918#bib.bib1)\)\. The backbone is instruction\-tuned Gemma 4111[https://huggingface\.co/google/gemma\-4\-31B\-it](https://huggingface.co/google/gemma-4-31B-it)\([Gemma Team, Google DeepMind, 2026](https://arxiv.org/html/2608.23918#bib.bib6)\)with temperature0\.00\.0, top\-pp0\.950\.95, and a40964096token budget\. Retrieval uses the cp\-algorithms corpus222[https://github\.com/cp\-algorithms/cp\-algorithms](https://github.com/cp-algorithms/cp-algorithms)encoded with Jina Embeddings v2\. All Table[1](https://arxiv.org/html/2608.23918#S4.T1)systems use Gemma 4, temperature0\.00\.0, and a40964096\-token budget\. MARS, Parallel ensemble, Base relay, and CodeSIM use top\-pp0\.950\.95; logged Direct and Single\-RAG runs use1\.01\.0\. Transfer runs follow their recorded model\- and method\-specific settings \(Appendix[F](https://arxiv.org/html/2608.23918#A6)\)\. Direct uses one call; Single\-RAG uses the top retrieved specialist; Parallel ensemble merges specialist candidates; Base relay omits public\-test self\-check, subtask tracking, and the infrastructure\-fixer\. We adapt CodeSIM’s open\-source harness to the same165165tasks\. Its published GPT\-4 result uses a156156\-task subset\([Islam et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib4);[Islam et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib5)\)and is not directly comparable\.
## 4Results
### 4\.1Main results
Table[1](https://arxiv.org/html/2608.23918#S4.T1)summarizes the main results\. MARS reaches0\.624±0\.0060\.624\\pm 0\.006at2\.32\.3recorded pipeline stages per task, improving over Direct \(\+0\.144\+0\.144\), Single\-RAG \(\+0\.095\+0\.095\), and the Parallel ensemble baseline \(\+0\.060\+0\.060\)\. CodeSIM reaches0\.731±0\.0090\.731\\pm 0\.009; our method narrows this gap while using a simpler protocol with execution feedback at every specialist turn\.
Table 1:Main results\.Pass rate is solved\-task fraction\. Time in sec, tokens in thousands and number of calls are per\-task\. All values averaged across 3 runs\. CodeSIM∗is our rerun on Gemma4\.Among prompt\-only baselines, Single\-RAG plateaus at0\.5290\.529because a single specialist with no test signal cannot recover from algorithmic missteps, and Parallel ensemble pays360\.9360\.9\\,s per task on isolated candidates reconciled only at merge time\. MARS adds in\-step public\-test feedback and opens a\+0\.14\+0\.14gap on Hard tasks, where prompt\-only baselines hover near0\.180\.18–0\.260\.26\(Figure[3](https://arxiv.org/html/2608.23918#S4.F3)\)\. CodeSIM still leads on every tier via up to4545debug iterations per Hard task, but MARS closes most of the gap at3\.3×3\.3\{\\times\}lower wall\-clock cost by routing to a topic specialist instead of re\-planning a generic solution\.
Figure 2:Team\-selection frequency per specialist\.Fraction of tasks on which each specialist joins the team, averaged over runs\. Base relay and MARS share a deterministic assessor and coincide; the Parallel ensemble uses an earlier, less selective prompt and spreads selections more widely, which does not translate into accuracy\.Routing concentrates on Mathematics, Constructive Algorithms, Data Structures, and Dynamic Programming; rarer specialists fire only on tag\-matched tasks \(Figure[2](https://arxiv.org/html/2608.23918#S4.F2)\)\. Base relay and MARS share the same deterministic assessor and therefore coincide in team distributions\. Their difference is downstream of selection and reflects the combined update to public\-test self\-check, subtask tracking, and final infrastructure handling\.
Figure 3:Average pass rate by Codeforces difficulty tier\.MARS dominates prompt\-only baselines on Medium and more than doubles Direct on Hard; CodeSIM∗leads on every tier\. Tier sizes: Easyn=56n\{=\}56, Mediumn=39n\{=\}39, Hardn=70n\{=\}70\.Parallel ensemble’s earlier assessor admits more borderline specialists \(Brute Force, Graphs\), but broader selection alone does not improve accuracy without execution feedback\. Base relay and MARS share the subtask graph and starter contract; the broader MARS protocol adds public\-test self\-check and final infrastructure handling and reaches0\.6240\.624rather than0\.5520\.552, although this comparison does not isolate the contribution of each change\. Scores remain near ceiling on Easy \(0\.800\.80–0\.930\.93\), while MARS’s advantage over Direct widens on Medium \(0\.720\.72vs\.0\.590\.59\) and Hard \(0\.400\.40vs\.0\.180\.18; Figure[3](https://arxiv.org/html/2608.23918#S4.F3)\)\.
### 4\.2Other backbones and target languages
Table[2](https://arxiv.org/html/2608.23918#S4.T2)keeps tasks, methods, and final evaluation fixed while following each run’s recorded API settings\. MARS has the highest pass rate of the three methods on every backbone, beating Single\-RAG by9\.59\.5points on Gemma 4,3\.33\.3on Qwen3\.5\-27B, and13\.913\.9on GPT\-5\.4\-mini\. The ordering Direct<<Single\-RAG<<MARS therefore persists across backbones\. On Python, MARS reaches0\.622±0\.0150\.622\\pm 0\.015against Direct’s0\.485±0\.0000\.485\\pm 0\.000\(\+13\.7\+13\.7points\); both match their C\+\+17 counterparts within uncertainty, although Python is slower \(307\.6307\.6vs\.244\.3244\.3s\)\.
PairCoder\([Zhang et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib3)\)is a Navigator/Driver MAS with multi\-plan search\. Our adapter preserves its role flow and prompts but replaces the dataset, model API, and execution boundaries\. It reaches0\.705±0\.0090\.705\\pm 0\.009,8\.38\.3points above MARS at1\.4×1\.4\{\\times\}the wall\-clock cost, making it a strong, heavier\-search competitor\. Its plan clustering uses a proprietary embedding model; the matched Python MARS run uses open\-weight components throughout\.
Table 2:Backbone and language transfer\.The same165165tasks and final harness as Table[1](https://arxiv.org/html/2608.23918#S4.T1), using recorded model\- and method\-specific decoding\. Time is in seconds, tokens in thousands, and calls per task; PairCoder includes embedding traffic\.
### 4\.3Ablations and protocol variants
Table[3](https://arxiv.org/html/2608.23918#S4.T3)combines one RAG ablation with broader protocol variants\. Removing RAG alone costs2\.02\.0points\. Generalists without RAG are0\.90\.9points below MARS within one standard deviation, but take31%31\\%longer \(319\.8±245\.1319\.8\\pm 245\.1vs\.244\.3±154\.4244\.3\\pm 154\.4s\) and more calls \(17\.3±1\.317\.3\\pm 1\.3vs\.16\.6±1\.316\.6\\pm 1\.3\)\. Because retrieval also changes, this row does not isolate specialization\. Base relay and Parallel manager alter several post\-selection components and trail MARS by7\.27\.2and6\.06\.0points; the full relay remains strongest among our configurations\.
Table 3:Ablations and protocol variantson Gemma 4\. The generalist variant also disables RAG; the last two rows are the broader Base relay and Parallel ensemble comparisons from Table[1](https://arxiv.org/html/2608.23918#S4.T1)\.
### 4\.4Relay behaviour and failure modes
Teams contain one, two, or three agents on1\.8%1\.8\\%,15\.8%15\.8\\%, and82\.4%82\.4\\%of task\-runs\. An average of1\.351\.35specialists change the code; the reported2\.32\.3recorded stages also count the final sanitizer/fixer record and therefore measure pipeline\-history depth, not specialist turns\.
The next specialist receives shared code and a compact relay summary, not the raw public\-test report\. The gate compares a repair only with its same\-turn draft; a later specialist may replace that code\. It reverted4\.4±0\.9%4\.4\\pm 0\.9\\%of697697self\-check decisions \(Appendix[D](https://arxiv.org/html/2608.23918#A4)\)\.
Multi\-topic tasks \(88%88\\%\) need no reconciliation because specialists edit one shared draft sequentially\. Pass rate is0\.612±0\.0100\.612\\pm 0\.010on multi\-topic and0\.719±0\.0300\.719\\pm 0\.030on single\-topic tasks\. The boilerplate\-only fixer changed one task \(≈0\.2%\\approx 0\.2\\%of task\-runs\), so the headline0\.6240\.624is independent of it \(Appendix[E](https://arxiv.org/html/2608.23918#A5)\)\.
## 5Conclusion
MARS is a prompt\-only, topic\-aligned MAS that beats single\-agent and ensemble baselines by66–1414percentage points, with public\-test feedback at every specialist step, and holds that advantage across three backbones and two languages\. Heavier\-search systems—CodeSIM and PairCoder in Python—still lead on pass rate\.
## Limitations
The evaluation covers165165CodeContests tasks, three backbones, two languages, one corpus, and Codeforces tags\. Python reuses the same corpus and index; further languages need their own prompts, extraction, sandbox, and infrastructure\. Transfer beyond C\+\+17 and Python remains untested\.
The local gate rejects only same\-turn public\-test regressions; it misses hidden tests and comparisons between specialists\. All generated code requires sandboxed execution\.
CodeSIM is the only stage\-aligned comparison, and PairCoder remains Python\-only\. Other baselines need method\-specific ports \(Appendix[F](https://arxiv.org/html/2608.23918#A6)\)\.
## References
- Chenet al\.\(2023a\)B\. Chen, F\. Zhang, A\. Nguyen, D\. Zan, Z\. Lin, J\. Lou, and W\. ChenCodeT: code generation with generated tests\.InInternational Conference on Learning Representations,External Links:[Link](https://arxiv.org/abs/2207.10397)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p4.1),[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Chenet al\.\(2024\)G\. Chen, S\. Dong, Y\. Shu, G\. Zhang, J\. Sesay, B\. F\. Karlsson, J\. Fu, and Y\. ShiAutoAgents: a framework for automatic agent generation\.External Links:2309\.17288,[Link](https://arxiv.org/abs/2309.17288)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p3.1)\.
- Chenet al\.\(2021\)M\. Chen, J\. Tworek, H\. Jun, Q\. Yuan, H\. P\. de Oliveira Pinto, J\. Kaplan, H\. Edwards, Y\. Burda, N\. Joseph, G\. Brockman, A\. Ray, R\. Puri, G\. Krueger, M\. Petrov, H\. Khlaaf, G\. Sastry, P\. Mishkin, B\. Chan, S\. Gray, N\. Ryder, M\. Pavlov, A\. Power, L\. Kaiser, M\. Bavarian, C\. Winter, P\. Tillet, F\. P\. Such, D\. Cummings, M\. Plappert, F\. Chantzis, E\. Barnes, A\. Herbert\-Voss, W\. H\. Guss, A\. Nichol, A\. Paino, N\. Tezak, J\. Tang, I\. Babuschkin, S\. Balaji, S\. Jain, W\. Saunders, C\. Hesse, A\. N\. Carr, J\. Leike, J\. Achiam, V\. Misra, E\. Morikawa, A\. Radford, M\. Knight, M\. Brundage, M\. Murati, K\. Mayer, P\. Welinder, B\. McGrew, D\. Amodei, S\. McCandlish, I\. Sutskever, and W\. ZarembaEvaluating large language models trained on code\.External Links:2107\.03374Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Chenet al\.\(2025a\)S\. Chen, Y\. Liu, W\. Han, W\. Zhang, and T\. LiuA survey on llm\-based multi\-agent system: recent advances and new frontiers in application\.External Links:2412\.17481,[Link](https://arxiv.org/abs/2412.17481)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p1.1)\.
- Chenet al\.\(2023b\)W\. Chen, Y\. Su, J\. Zuo, C\. Yang, C\. Yuan, C\. Qian, C\. Chan, Y\. Qin, Y\. Lu, R\. Xie,et al\.Agentverse: facilitating multi\-agent collaboration and exploring emergent behaviors in agents\.arXiv preprint arXiv:2308\.10848\.Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p3.1)\.
- Chenet al\.\(2025b\)W\. Chen, Z\. You, R\. Li, Y\. Guan, C\. Qian, C\. Zhao, C\. Yang, R\. Xie, Z\. Liu, and M\. SunInternet of agents: weaving a web of heterogeneous agents for collaborative intelligence\.InThe Thirteenth International Conference on Learning Representations \(ICLR\),External Links:2407\.07061,[Link](https://arxiv.org/abs/2407.07061)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Chenet al\.\(2023c\)X\. Chen, M\. Lin, N\. Schärli, and D\. ZhouTeaching large language models to self\-debug\.External Links:2304\.05128,[Link](https://arxiv.org/abs/2304.05128)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Gemma Team, Google DeepMind \(2026\)Gemma Team, Google DeepMindGemma 4: our most capable open models to date\.Note:Google AI BlogModel weights:[https://huggingface\.co/google/gemma\-4\-31B\-it](https://huggingface.co/google/gemma-4-31B-it)External Links:[Link](https://blog.google/innovation-and-ai/technology/developers-tools/gemma-4/)Cited by:[§3](https://arxiv.org/html/2608.23918#S3.p4.1)\.
- Guoet al\.\(2024\)T\. Guo, X\. Chen, Y\. Wang, R\. Chang, S\. Pei, N\. V\. Chawla, O\. Wiest, and X\. ZhangLarge language model based multi\-agents: a survey of progress and challenges\.External Links:2402\.01680,[Link](https://arxiv.org/abs/2402.01680)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p1.1)\.
- Hosainet al\.\(2025\)M\. T\. Hosain, S\. Rahman, M\. K\. Morol, and M\. R\. ParvezXolver: multi\-agent reasoning with holistic experience learning just like an olympiad team\.External Links:2506\.14234,[Link](https://arxiv.org/abs/2506.14234)Cited by:[Appendix F](https://arxiv.org/html/2608.23918#A6.p7.1)\.
- Huanget al\.\(2024\)D\. Huang, J\. M\. Zhang, M\. Luck, Q\. Bu, Y\. Qing, and H\. CuiAgentCoder: multi\-agent\-based code generation with iterative testing and optimisation\.External Links:2312\.13010,[Link](https://arxiv.org/abs/2312.13010)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p5.1)\.
- Islamet al\.\(2024\)Md\. A\. Islam, M\. E\. Ali, and M\. R\. ParvezMapCoder: multi\-agent code generation for competitive problem solving\.InProceedings of the 62nd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 4912–4944\.External Links:[Document](https://dx.doi.org/10.18653/v1/2024.acl-long.269),[Link](https://arxiv.org/abs/2405.11403)Cited by:[Appendix F](https://arxiv.org/html/2608.23918#A6.p4.1),[§1](https://arxiv.org/html/2608.23918#S1.p4.1),[§2](https://arxiv.org/html/2608.23918#S2.p5.1),[§3](https://arxiv.org/html/2608.23918#S3.p4.1)\.
- Islamet al\.\(2025\)Md\. A\. Islam, M\. E\. Ali, and M\. R\. ParvezCodeSim: multi\-agent code generation and problem solving through simulation\-driven planning and debugging\.InFindings of the Association for Computational Linguistics: NAACL 2025,pp\. 5128–5154\.External Links:[Document](https://dx.doi.org/10.18653/v1/2025.findings-naacl.285),[Link](https://arxiv.org/abs/2502.05664)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p4.1),[§2](https://arxiv.org/html/2608.23918#S2.p5.1),[§3](https://arxiv.org/html/2608.23918#S3.p4.1)\.
- Jainet al\.\(2024\)N\. Jain, K\. Han, A\. Gu, W\. Li, F\. Yan, T\. Zhang, S\. Wang, A\. Solar\-Lezama, K\. Sen, and I\. StoicaLiveCodeBench: holistic and contamination free evaluation of large language models for code\.arXiv preprint\.Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Khanet al\.\(2023\)M\. A\. M\. Khan, M\. S\. Bari, X\. L\. Do, W\. Wang, M\. R\. Parvez, and S\. JotyXCodeEval: a large scale multilingual multitask benchmark for code understanding, generation, translation and retrieval\.External Links:2303\.03004Cited by:[§3](https://arxiv.org/html/2608.23918#S3.p3.1)\.
- Leiet al\.\(2024\)B\. Lei, Y\. Zhang, S\. Zuo, A\. Payani, and C\. DingMACM: utilizing a multi\-agent system for condition mining in solving complex mathematical problems\.External Links:2404\.04735,[Link](https://arxiv.org/abs/2404.04735)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Leiet al\.\(2025\)C\. Lei, Y\. Chang, N\. Lipovetzky, and K\. A\. EhingerPlanning\-driven programming: a large language model programming workflow\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),Vienna, Austria,pp\. 12647–12684\.External Links:[Document](https://dx.doi.org/10.18653/v1/2025.acl-long.621),[Link](https://aclanthology.org/2025.acl-long.621/)Cited by:[Appendix F](https://arxiv.org/html/2608.23918#A6.p3.1)\.
- Liet al\.\(2023\)G\. Li, H\. A\. A\. K\. Hammoud, H\. Itani, D\. Khizbullin, and B\. GhanemCAMEL: communicative agents for "mind" exploration of large language model society\.External Links:2303\.17760,[Link](https://arxiv.org/abs/2303.17760)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Liet al\.\(2026\)H\. Li, J\. Tian, R\. Feng, Y\. Du, C\. Zheng, C\. Wang, C\. Liu, S\. Li, X\. Lei, Y\. Yao, W\. Xie, L\. Zhu, and J\. LiuSolvita: enhancing large language models for competitive programming via agentic evolution\.External Links:2605\.15301,[Link](https://arxiv.org/abs/2605.15301)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p4.1),[§2](https://arxiv.org/html/2608.23918#S2.p5.1)\.
- Liet al\.\(2022\)Y\. Li, D\. Choi, J\. Chung, N\. Kushman, J\. Schrittwieser, R\. Leblond, T\. Eccles, J\. Keeling, F\. Gimeno, A\. Dal Lago,et al\.Competition\-level code generation with alphacode\.Science378\(6624\),pp\. 1092–1097\.External Links:[Document](https://dx.doi.org/10.1126/science.abq1158),[Link](https://arxiv.org/abs/2203.07814)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p4.1),[§2](https://arxiv.org/html/2608.23918#S2.p4.1),[§3](https://arxiv.org/html/2608.23918#S3.p4.1)\.
- Liuet al\.\(2023\)Z\. Liu, Y\. Zhang, P\. Li, Y\. Liu, and D\. YangDynamic llm\-agent network: an llm\-agent collaboration framework with agent team optimization\.External Links:2310\.02170Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p3.1)\.
- Madaanet al\.\(2023\)A\. Madaan, N\. Tandon, P\. Gupta, S\. Hallinan, L\. Gao, S\. Wiegreffe, U\. Alon, N\. Dziri, S\. Prabhumoye, Y\. Yang, S\. Welleck, B\. P\. Majumder, S\. Gupta, A\. Yazdanbakhsh, and P\. ClarkSelf\-refine: iterative refinement with self\-feedback\.External Links:2303\.17651Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Parvezet al\.\(2021\)M\. R\. Parvez, W\. Ahmad, S\. Chakraborty, B\. Ray, and K\. ChangRetrieval augmented code generation and summarization\.InFindings of the Association for Computational Linguistics: EMNLP 2021,M\. Moens, X\. Huang, L\. Specia, and S\. W\. Yih \(Eds\.\),Punta Cana, Dominican Republic,pp\. 2719–2734\.External Links:[Link](https://aclanthology.org/2021.findings-emnlp.232/),[Document](https://dx.doi.org/10.18653/v1/2021.findings-emnlp.232)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p2.1)\.
- Shiet al\.\(2024\)Q\. Shi, M\. Tang, K\. Narasimhan, and S\. YaoCan language models solve olympiad programming?\.External Links:2404\.10952Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Shinnet al\.\(2023\)N\. Shinn, F\. Cassano, E\. Berman, A\. Gopinath, K\. Narasimhan, and S\. YaoReflexion: language agents with verbal reinforcement learning\.External Links:2303\.11366,[Link](https://arxiv.org/abs/2303.11366)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Tanget al\.\(2024\)X\. Tang, A\. Zou, Z\. Zhang, Z\. Li, Y\. Zhao, X\. Zhang, A\. Cohan, and M\. GersteinMedAgents: large language models as collaborators for zero\-shot medical reasoning\.External Links:2311\.10537,[Link](https://arxiv.org/abs/2311.10537)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Tranet al\.\(2025\)K\. Tran, D\. Dao, M\. Nguyen, Q\. Pham, B\. O’Sullivan, and H\. D\. NguyenMulti\-agent collaboration mechanisms: a survey of llms\.External Links:2501\.06322,[Link](https://arxiv.org/abs/2501.06322)Cited by:[§1](https://arxiv.org/html/2608.23918#S1.p1.1)\.
- Wanget al\.\(2024\)J\. Wang, J\. Wang, B\. Athiwaratkun, C\. Zhang, and J\. ZouMixture\-of\-agents enhances large language model capabilities\.External Links:2406\.04692,[Link](https://arxiv.org/abs/2406.04692)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Wanget al\.\(2025a\)Y\. Wang, S\. Guo, and C\. W\. TanFrom code generation to software testing: AI copilot with context\-based retrieval\-augmented generation\.IEEE Software42\(4\),pp\. 34–42\.External Links:[Document](https://dx.doi.org/10.1109/MS.2025.3549628)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p2.1)\.
- Wanget al\.\(2025b\)Z\. Wang, R\. Ling, C\. Wang, Y\. Yu, S\. Wang, Z\. Li, F\. Xiong, and W\. ZhangMaintainCoder: maintainable code generation under dynamic requirements\.InAdvances in Neural Information Processing Systems \(NeurIPS\),Vol\.38,pp\. 15399–15436\.External Links:[Document](https://dx.doi.org/10.52202/085713-0521),[Link](https://proceedings.neurips.cc/paper_files/paper/2025/hash/16c3c941409d0581286eff49b180930f-Abstract-Conference.html)Cited by:[Appendix F](https://arxiv.org/html/2608.23918#A6.p6.1)\.
- Wong and Tan \(2024\)M\. F\. Wong and C\. W\. TanAligning crowd\-sourced human feedback for reinforcement learning on code generation by large language models\.IEEE Transactions on Big Data,pp\. 1–12\.External Links:[Document](https://dx.doi.org/10.1109/TBDATA.2024.3524104)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p4.1)\.
- Yanget al\.\(2025\)Y\. Yang, H\. Chai, S\. Shao, Y\. Song, S\. Qi, R\. Rui, and W\. ZhangAgentNet: decentralized evolutionary coordination for LLM\-based multi\-agent systems\.InAdvances in Neural Information Processing Systems \(NeurIPS\),External Links:[Link](https://openreview.net/forum?id=tXqLxHlb8Z)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Yeet al\.\(2025\)R\. Ye, X\. Liu, Q\. Wu, X\. Pang, Z\. Yin, L\. Bai, and S\. ChenX\-MAS: towards building multi\-agent systems with heterogeneous LLMs\.External Links:2505\.16997,[Link](https://arxiv.org/abs/2505.16997)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Yunet al\.\(2026\)S\. Yun, J\. Peng, P\. Li, W\. Fan, J\. Chen, J\. Zou, G\. Li, and T\. ChenGraph\-of\-agents: a graph\-based framework for multi\-agent LLM collaboration\.InThe Fourteenth International Conference on Learning Representations \(ICLR\),External Links:[Link](https://openreview.net/forum?id=34cANdsHKV)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p1.1)\.
- Zhanget al\.\(2023\)F\. Zhang, B\. Chen, Y\. Zhang, J\. Keung, J\. Liu, D\. Zan, Y\. Mao, J\. Lou, and W\. ChenRepoCoder: repository\-level code completion through iterative retrieval and generation\.InProceedings of the 2023 Conference on Empirical Methods in Natural Language Processing,H\. Bouamor, J\. Pino, and K\. Bali \(Eds\.\),Singapore,pp\. 2471–2484\.External Links:[Link](https://aclanthology.org/2023.emnlp-main.151/),[Document](https://dx.doi.org/10.18653/v1/2023.emnlp-main.151)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p2.1)\.
- Zhanget al\.\(2024\)H\. Zhang, W\. Cheng, Y\. Wu, and W\. HuA pair programming framework for code generation via multi\-plan exploration and feedback\-driven refinement\.InProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering,pp\. 1319–1331\.External Links:[Document](https://dx.doi.org/10.1145/3691620.3695506),[Link](https://arxiv.org/abs/2409.05001)Cited by:[Appendix F](https://arxiv.org/html/2608.23918#A6.p5.1),[§4\.2](https://arxiv.org/html/2608.23918#S4.SS2.p2.1)\.
- Zhonget al\.\(2024\)L\. Zhong, Z\. Wang, and J\. ShangDebug like a human: a large language model debugger via verifying runtime execution step by step\.InFindings of the Association for Computational Linguistics: ACL 2024,Bangkok, Thailand,pp\. 851–870\.External Links:[Document](https://dx.doi.org/10.18653/v1/2024.findings-acl.49),[Link](https://aclanthology.org/2024.findings-acl.49/)Cited by:[Appendix F](https://arxiv.org/html/2608.23918#A6.p2.1)\.
- Zhouet al\.\(2023\)S\. Zhou, U\. Alon, F\. F\. Xu, Z\. Wang, Z\. Jiang, and G\. NeubigDocPrompting: generating code by retrieving the docs\.External Links:2207\.05987,[Link](https://arxiv.org/abs/2207.05987)Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p2.1)\.
- Zhugeet al\.\(2024\)M\. Zhuge, W\. Wang, L\. Kirsch, F\. Faccio, D\. Khizbullin, and J\. SchmidhuberGPTSwarm: language agents as optimizable graphs\.InForty\-first International Conference on Machine Learning,Cited by:[§2](https://arxiv.org/html/2608.23918#S2.p3.1)\.
## Appendix APrompt Templates
MARS uses four prompt templates at runtime\. Each specialist is first queried with a self\-assessment prompt \(Figure[4](https://arxiv.org/html/2608.23918#A1.F4)\) that gates inclusion in the team\. The shortlisted specialists then run a first\-agent probe \(Figure[5](https://arxiv.org/html/2608.23918#A1.F5)\) that elects the starter\. Each relay turn afterwards consists of a code\-generation call \(Figure[6](https://arxiv.org/html/2608.23918#A1.F6)\) followed by an execution\-aware self\-check and handoff call \(Figure[7](https://arxiv.org/html/2608.23918#A1.F7)\)\. Placeholders in\{braces\}are filled by the harness from per\-agent metadata, the current task, relay state, and retrieved RAG context; long in\-prompt examples are abbreviated for space\.
Yourspecialty:\{agent\_description\}
Analyzeifthisprogrammingproblemmatches
YOURspecificexpertise\.
CRITICAL:Beselective\!Onlysay"can\_solve":
trueiftheproblemDIRECTLYrelatestoyour
specialty\.
REQUIREDFORMAT:
\{"can\_solve":true/false,
"is\_relevant\_to\_specialty":true/false,
"confidence":0\.0\-1\.0,
"reasoning":"explainhowyoucanhelp"\}
EXAMPLE:
\-GraphTheoryAgent\+"Findshortestpath"\-\>
\{"can\_solve":true,
"is\_relevant\_to\_specialty":true,
"confidence":0\.88,
"reasoning":"Dijkstraapplieshere"\}
GUIDELINES:
\-ONLYanswertrueiftheproblemisDIRECTLY
inyourdomain\.
\-Ifamajorpartofthetaskisinyour
specialty,answeris\_relevant\_to\_specialty
=trueevenwhenotherspecialtiesarealso
needed\.
PROGRAMMINGPROBLEM:
\{task\}
Relevantdocumentation:
\{rag\_context\}
STRICTOUTPUTRULES:
\-ReturnONLYasinglevalidJSONobject\.
\-Donotoutputthinkingstepsorchain\-of\-
thought\.
Figure 4:Specialist self\-assessment prompt; the output gates inclusion in the relay team\.\{agent\_description\}\.
\{rag\_context\}
TASK:
\{task\}
Youareevaluatingwhetheryoushouldbethe
FIRSTagenttostartsolvingthisprogramming
task\.
YourjobisNOTtodescribethefullsolution\.
Yourjobistodecidewhetherthetaskshould
STARTinyourspecialty,andifyes,todefine
exactlyonenarrowfirstcontributionthat
belongstoyou\.
RespondwithONLYonevalidJSONobject:
\{
"can\_start":true/false,
"start\_confidence":0\.0\-1\.0,
"owned\_subproblem":"<onenarrowsub\-problem
thatbelongstoyourspecialty\>",
"what\_would\_you\_do\_first":"<oneconcrete
firststepyouwouldpersonallyown\>",
"starter\_reasoning":"<concretelocal
reasoningforonlythatfirststep\>",
"out\_of\_scope":\["<whatyouwouldexplicitly
NOTsolveinthefirststep\>"\]
\}
Rules:
\-Bestrict\.IfthetaskshouldnotSTARTin
yourspecialty,setcan\_start=false\.
\-Keepthefirststepnarrowandspecialty\-
specific;donotdescribethefullalgorithm\.
\-DoNOTwritecodeinthisstage\.
\-DoNOToutputchain\-of\-thoughtormarkdown
fences\.
Figure 5:First\-agent probe; sets the starter contract that is later passed to every relay step\.\{agent\_description\}\.
Youareinarelayloop\.Thiscallis
CODEGENERATIONONLY\.
TASK:
\{task\}
ASSIGNEDSUBTASK:
\{assigned\_subtask\}
STARTERCONTRACT\(FROMFIRST\-AGENTDECISION\):
\{starter\_contract\}
CURRENTCODE\(\{code\_length\}chars\):
“‘cpp
\{current\_code\}
“‘
YOURSELECTION\-TIMEREASONING:
\{agent\_task\_reasoning\}
PREVIOUSHANDOFF:
\{previous\_handoff\}
SUBTASKGRAPH:
\{subtask\_graph\}
GATEFEEDBACKFROMRECENTSTEPS:
\{gate\_feedback\}
NO\-PROGRESSSTREAK:\{no\_progress\_streak\}
RAGCONTEXT:
\{rag\_context\}
RespondwithONLYonevalidJSONobject:
\{
"action":"write\_code"\|"no\_change",
"new\_code":"<completeC\+\+17codeorempty\>",
"stop":true/false,
"confidence":0\.0\-1\.0
\}
Rules:
\-Use"write\_code"onlywhenyouprovidefull
runnableC\+\+17innew\_code\.
\-Ifaction="no\_change",new\_codemustbeempty\.
\-stop=trueonlywhentherelaycanfinishnow\.
\-IfNO\-PROGRESSSTREAK\>=2,preferaconcrete
fixoverrepeatedno\_change\.
\-new\_codemustcontainONLYrawC\+\+code\(no
markdownfences,prose,orJSONfragments\)\.
\-Codemustcontainzerocomments\.
Figure 6:Relay step call 1 \(code generation\)\. The draft is then executed on public examples in the sandbox before call 2\.\{agent\_description\}\.
Youareinarelayloop\.Thiscallis
SELF\-CHECK\+HANDOFFONLY\.
TASK:
\{task\}
ASSIGNEDSUBTASK:
\{assigned\_subtask\}
STARTERCONTRACT\(FROMFIRST\-AGENTDECISION\):
\{starter\_contract\}
DRAFTCODEAFTERYOURFIRSTCALL
\(\{draft\_code\_length\}chars\):
“‘cpp
\{draft\_code\}
“‘
PUBLICTESTREPORTFORTHEDRAFT:
\{public\_test\_report\}
PREVIOUSHANDOFF:
\{previous\_handoff\}
SUBTASKGRAPH:
\{subtask\_graph\}
GATEFEEDBACKFROMRECENTSTEPS:
\{gate\_feedback\}
NO\-PROGRESSSTREAK:\{no\_progress\_streak\}
AVAILABLEUNUSEDAGENTS:
\{available\_agents\}
RespondwithONLYonevalidJSONobject:
\{
"self\_check\_action":
"keep\_code"\|"repair\_code"\|"no\_change",
"new\_code":"<completeC\+\+17codeorempty\>",
"self\_check\_summary":"<whatyouchecked
orfixed\>",
"test\_report\_interpretation":"<short
interpretationofthepublic\-testreport\>",
"stop":true/false,
"next\_agent":"<agentnameornull\>",
"completed\_scope":"<whatyourfullstep
completed\>",
"remaining\_scope":"<whatisstillmissing\>",
"resolved\_subtasks":\["<ids/titlesresolved\>"\],
"unresolved\_subtasks":\["<ids/titlespending\>"\],
"handoff\_instruction":"<explicitinstruction
forthenextagent\>",
"known\_risks":"<mainrisks/uncertainties
or’none’\>"
\}
Rules:
\-Treatthepublic\-testreportasadiagnostic
signal,notabsoluteproof\.
\-Ifthedraftisalreadybetterthanany
possiblerepair,setself\_check\_action=
"keep\_code"andnew\_code=""\.
\-Useself\_check\_action="repair\_code"onlywhen
youreturnfullrunnableC\+\+17innew\_code\.
\-Ifstop=false,next\_agentisREQUIREDand
mustbeonenamefromAVAILABLEUNUSEDAGENTS\.
\-Ifstop=trueornounusedagentsremain,
next\_agentmustbenull\.
\-Donotaddtestingcode,asserts,debug
prints,orhardcodedsampleanswers\.
\-Forrepair\_code,new\_codemustcontainONLY
rawC\+\+code\(nomarkdownfences,prose,or
JSONfragments\)\.
Figure 7:Relay step call 2 \(execution\-aware self\-check and handoff\)\. Output drives the keep/repair/skip decision and selects the next specialist\.
## Appendix BExample Run
Figure[8](https://arxiv.org/html/2608.23918#A2.F8)shows one successful MARS trace on Codeforces problem 1620\_B*Triangles on a Rectangle*\. The system selects three specialists: MathematicsAgent, GeometryAgent, and ConstructiveAlgorithmsAgent\. MathematicsAgent derives the area formula and four\-side enumeration; its first draft fails the public sample because the rectangle height and width are swapped for two sides, and the same specialist repairs the draft after seeing the public\-test report\. GeometryAgent then reduces each side to a single endpoint subtraction and clarifies the opposite\-dimension height\. ConstructiveAlgorithmsAgent completes the multi\-test scaffold, fast I/O, and 64\-bit arithmetic\. The final program returned by the third relay step passes the hidden tests\.
Figure 8:Example MARS trace for Codeforces 1620\_B with three contributing specialists\. Step 1 includes a within\-step self\-check repair loop: the first draft fails the public sample, the same specialist consumes the test report and emits a corrected draft before handing off\. Later steps show the specialist contribution, public\-test outcome, and structured handoff to the next agent\.
## Appendix CMethod Pseudocode
For a side\-by\-side qualitative comparison of MARS with every baseline, Algorithms 1–6 give the control flow of each system in the form actually run in our harness\. MARS forms a team of task\-relevant specialists that sequentially edit one shared draft, with an intra\-step refinement loop driven by public\-test execution and a post\-relay infrastructure check\. Direct and Single\-RAG are single\-agent: the former prompts the backbone with the task description alone, the latter first elects one specialist from the pool\. Parallel ensemble extends Single\-RAG to several pre\-selected specialists that generate independently, with a manager LLM aggregating the drafts\. Base relay performs team formation and relay editing but no execution feedback\. CodeSIM plans, simulates the plan, revises it, generates code, and debugs against the public tests until they pass or the attempt limit is reached\.
Input:problemP,publicexamplesS,poolA
1\.ForeachspecialistainA:
retrievetopic\-matchedcontext;
self\-assesscapability,relevance,confidence\.
2\.Rankeligiblespecialistsbytagoverlap,RAG
coverage,confidence,retrievalquality;
selectuptothree;chooseastarter\.
3\.InitshareddraftC,handoffH,subtaskstateG\.
4\.Whileastepispermittedandaspecialistis
available:
C\_draft,H,next,stop<\-
active\(P,C,G,H,retrievedcontext\)
R\_before<\-executeC\_draftonS
action,C\_repair,H,stop<\-
self\_check\(C\_draft,R\_before\)
ifaction==repair\_code:
R\_after<\-executeC\_repaironS
ifC\_repaircompilesand
R\_after\.passed\>=R\_before\.passed:
C<\-C\_repair
else:
C<\-C\_draft
else:
C<\-C\_draft
ifstop,ornounusedspecialistremains,
orno\-progresscutofffires:break
active<\-requestedeligiblespecialist,
elsefallback
5\.Applytheinfrastructurefixeronlyif
boilerplate\-levelfailureisdetected;returnC\.
Figure 9:MARS: a selected team of task\-relevant specialists relays solution updates with an intra\-step self\-refinement loop over public\-test execution and a post\-relay infrastructure check\.Input:problemP
1\.PrompttheLLMoncewithPandtherequested
C\+\+17outputformat\.
2\.C<\-generatedprogram\.
3\.ReturnCunchanged\.
Figure 10:Direct: a single agent generates code from the task description\.Input:problemP,specialistpoolA
1\.Retrievetopic\-matchedcontextandself\-assess
eachspecialistinA\.
2\.a\*<\-highest\-rankedeligiblespecialist\.
3\.C<\-a\*generatesoneprogramfromPandits
retrievedcontext\.
4\.ReturnCunchanged\.
Figure 11:Single\-RAG: the single most suitable specialist solves the task directly\.Input:problemP,specialistpoolA
1\.Retrievecontext;selecttask\-matched
specialistsfromA\.
2\.Eachselectedspecialistindependently
producesaplanandcandidatecode\.
3\.C<\-managerLLMcombinesthecandidatesinto
onefinalprogram\.
4\.ReturnC\.
Figure 12:Parallel ensemble: task\-matched specialists solve independently in parallel and a general\-purpose manager aggregates the candidates\.Input:problemP,specialistpoolA
1\.ForeachspecialistainA:
retrievetopic\-matchedcontext;
self\-assesscapability,relevance,
confidence\.
2\.RankeligiblespecialistsasinAlgorithm1;
chooseastarter\.
3\.InitshareddraftC,handoffH,subtaskstateG\.
4\.Whileastepispermittedandanactive
specialistisavailable:
C\_draft,H,next,stop<\-active\(P,C,G,H\)
C<\-C\_draft
ifstop:break
active<\-requestedeligiblespecialist,
elsefallback
5\.ReturnC\.
Figure 13:Base relay: the team relays edits to a shared draft with no public\-test execution inside the step\.Input:problemP,publicexamplesS
foreachplanattempt\(uptothelimit\):
plan<\-PlanningAgent\(P\)
simulation<\-simulateplanonS
ifsimulationrequestsrevision:
plan<\-refineplanusingthecritique
C<\-CodingAgent\(P,plan\)
passed,log<\-executeConS
ifpassed:returnC
foreachdebuggingattempt\(uptothelimit\):
C<\-DebuggingAgent\(P,plan,C,log\)
passed,log<\-executeConS
ifpassed:returnC
returnthelastgeneratedC
Figure 14:CodeSIM: plan, simulate, revise, generate, then debug against the public tests\.
## Appendix DRelay Decision Statistics
Across the reported MARS runs the relay took697697self\-check decisions\. Of these,38\.4±1\.0%38\.4\\pm 1\.0\\%accepted a repair,55\.4±1\.4%55\.4\\pm 1\.4\\%kept the draft unchanged,4\.4±0\.9%4\.4\\pm 0\.9\\%proposed a repair that the gate rejected and reverted, and1\.7±0\.8%1\.7\\pm 0\.8\\%were compile failures the specialist did not repair\. Repair acceptance requires non\-regression against the same\-turn draft on the public tests\. This guarantee does not extend to a new draft written by the next specialist; over\-inclusive selection is instead bounded by the shared\-code workflow and the no\-progress cutoff\.
## Appendix EInfrastructure\-Fixer Statistics
The infrastructure\-fixer runs only when post\-relay code fails at the template level \(I/O format, headers, integer width\), and is prompted to touch boilerplate rather than logic; a deterministic sanitization pass \(strip code fences, ensure a compilable shell\) runs on every candidate regardless\. Over the reported MARS runs it produced a substantive edit in a single task \(≈0\.2%\\approx 0\.2\\%of task\-runs\), and in≈1\.2%\\approx 1\.2\\%of task\-runs in the ablation without RAG, which indicates that Gemma 4 already emits compilable input/output wiring in most cases\. Its edits are confined to I/O and compilation fixes or removal of a non\-compiling fragment\. It does not mask errors: the only failing task it edited stayed failing, and the task it helped passed through a legitimate output\-format correction\.
## Appendix FBaseline Selection
Our comparisons use the full165165\-task split and the same final ExecEval evaluation within each language block\. The generator backbone is fixed within each table block, while decoding and intermediate execution follow the logged requirements of each model and method\. CodeSIM and PairCoder retain their method flows but use adapters for our dataset, model endpoint, and execution service\. Published numbers for the systems below use different backbones, splits, and in several cases a different task formulation, so they cannot be transferred; each would have to be ported and rerun under our protocol\. PairCoder was the one additional system whose Python\-specific core could be integrated without redesigning its Navigator/Driver method, and we report it in Table[2](https://arxiv.org/html/2608.23918#S4.T2)\. For the rest we record the concrete obstacle\.
LDB\([Zhong et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib36)\)is a debugger rather than an end\-to\-end generator: it presupposes a candidate program from an external generator\. Its released pipeline builds control\-flow graphs from the Python AST, segments Python programs into basic blocks, and records Python runtime variables with a custom tracer; the TransCoder setting uses C\+\+ only as the*source*language, while the program being debugged remains Python\. Supporting C\+\+17 would require a new control\-flow/basic\-block tracer and runtime\-state collector\.
LPW\([Lei et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib37)\)is a single\-model plan–verify–refine workflow rather than a multi\-agent system\. Although its repository contains CodeContests data, the implementation is built onPyGenerator/PyExecutorand asks the model to insert Pythonprintstatements at individual lines, comparing runtime values against an LLM\-generated plan verification\. A faithful C\+\+17 port needs compiler\-safe source instrumentation, trace parsing, and redesigned extraction and repair prompts, and its two iterative phases allow up to twelve iterations each\.
MapCoder\([Islam et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib4)\)is the earlier framework from the CodeSIM authors and is outperformed by CodeSIM in comparable GPT\-based settings; we therefore rerun the stronger successor\.
PairCoder\([Zhang et al\., 2024](https://arxiv.org/html/2608.23918#bib.bib3)\)*is*reported, in Python\. We ran the official Navigator/Driver implementation at upstream commitac7ce88through an adapter to our task loader, model endpoint, and ExecEval sandbox, with Gemma 4 as the generator and a40964096\-token completion budget\. Its upstream plan request uses temperature0\.80\.8and draws five completions in one call; the remaining generation stages use their released settings\. The plan stage clusters these candidates withtext\-embedding\-3\-large, the one component we could not replace with an open\-weights model\. Embedding traffic is included in the token and call counts of Table[2](https://arxiv.org/html/2608.23918#S4.T2)\. Around11%11\\%of the165165tasks ended in a truncated completion and are counted as failures, making the completion budget a material limitation of the reported0\.7050\.705\. We have no C\+\+17 number for it: its upstream prompts, code extraction, and lint logic are Python\-specific\.
MaintainCoder\([Wang et al\., 2025b](https://arxiv.org/html/2608.23918#bib.bib38)\)targets maintainability under changing requirements, not one\-shot functional correctness\. Its protocol applies requirement modifications after an initial solution and reports Pass@5, AST similarity, change volume, maintainability index, and cyclomatic complexity\. Reproducing it here would mean constructing a C\+\+17 dynamic benchmark with requirement changes and hidden tests, not running a baseline\.
Xolver\([Hosain et al\., 2025](https://arxiv.org/html/2608.23918#bib.bib39)\)targets cross\-problem experience accumulation with episodic and shared memory, a planner, dynamic agents, a judge, and a final verifier, at a substantially higher inference budget; its LiveCodeBench results are averaged over3232inference runs, which for165165tasks would be5,2805\{,\}280multi\-agent executions per model\. The authors describe the released code as preliminary, with hard\-coded paths and a default of five examples and two agents against the paper’s three\.
Beyond the ports, none of these systems was published with our backbones, so each additionally requires provider adaptation, response\-parsing validation, and token\-budget alignment\. As a scale reference, our own CodeSIM rerun averages≈817\{\\approx\}817s per task\.Similar Articles
New LLM Coordination Benchmark - Benchmarking Open-Ended Multi-Agent Coordination in Language Agents [R]
Introduces a new benchmark for evaluating multi-agent coordination in LLMs, finding that most models struggle with long-horizon open-ended tasks, but Gemini 3.1 Pro performs comparably to trained MARL agents on the hardest setting.
LEAP: Supercharging LLMs for Formal Mathematics with Agentic Frameworks
LEAP is an agentic framework that enables general-purpose LLMs to achieve state-of-the-art performance in formal theorem proving in Lean, solving all 12 problems from the 2025 Putnam Competition and boosting formal solve rates from below 10% to 70% on a new benchmark (Lean-IMO-Bench), surpassing specialized systems.
COOPA: A Modular LLM Agent Architecture for Operations Research Problems
This paper introduces COOPA, a modular LLM agent architecture for operations research problems that combines iterative confidence-based modeling, element-level provenance, and multi-solver routing. Evaluated across eight LLM backbones and four baselines, COOPA achieves the best macro-average accuracy on six backbones and improves over the strongest baseline by up to 6.7 percentage points.
When LLMs Develop Languages: Symbolic Communication for Efficient Multi-Agent Reasoning
This paper introduces Communicative Language Symbolism Routing (CLSR), where multiple LLM agents autonomously invent and evolve compact symbolic languages for reasoning, achieving 3-6x token reduction over chain-of-thought while maintaining accuracy.
@rohanpaul_ai: New Stanford paper argues that, under equal reasoning budgets, one LLM usually solves multi-hop problems better than ma…
A new Stanford paper shows that under equal reasoning token budgets, single LLMs typically outperform multi-agent systems on multi-hop reasoning tasks, with gains from multi-agent setups often stemming from additional compute rather than architectural superiority. The paper uses the Data Processing Inequality to explain why information loss in handoffs harms multi-agent performance, and identifies context quality as the key factor where multi-agent systems can provide benefits.