MARS: Multi-Specialist LLM Relay System for Competitive Programming
Organizations: MIRAI · London Institute for Mathematical Sciences · AXXX
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 reaches pass rate at recorded pipeline stages per task ( percentage points over direct prompting), closing most of the gap to CodeSIM () at 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.
Figures & tables
| Method | Pass rate | Sec | Tokens | Calls |
|---|---|---|---|---|
| Direct | ||||
| Single-RAG | ||||
| Parallel ens. | ||||
| Base relay | ||||
| MARS | ||||
| CodeSIM ∗ |
| Method | Pass rate | Sec | Tokens | Calls |
|---|---|---|---|---|
| Qwen3.5-27B, C++17 | ||||
| Direct | ||||
| Single-RAG | ||||
| MARS | ||||
| GPT-5.4-mini, C++17 | ||||
| Direct | ||||
| Configuration | Pass rate | |
|---|---|---|
| MARS (full) | — | |
| w/o RAG grounding | ||
| Generalists, no RAG | ||
| Earlier Base relay | ||
| Parallel manager |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
LLM-Based Program Synthesis
Large language model (LLM)-based program synthesis turns natural-language goals and examples into executable programs, often using tests or formal constraints.
See all 309 papers