MARS: Multi-Specialist LLM Relay System for Competitive Programming
Abstract
MARS uses retrieval-augmented specialist agents for algorithmic topics to iteratively generate, test, and refine C++ solutions, improving competitive programming pass rates with lower cost.
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.
Community
MARS is a relay pipeline for RAG-grounded agents collaborative code generation for competitive programming.
To solve the task, a team of at
most three agents is formed from a pool of available specialists. Each agent's 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.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- Two Calls Beat Five Agents: Evaluating Multi-Agent Pipelines Against Self-Refinement for Local Language Models (2026)
- AlgoSkill: Learning to Design Algorithms by Scheduling Human-Like Skills (2026)
- Muscle Memory for Agents: Compile not Merely Retrieve (2026)
- TDD-Agent: Test-Driven Reasoning for Code Generation (2026)
- MERA: Model Evolution and Routing with Skill Adaptation for Agentic Systems at Scale (2026)
- MemoHarness: Agent Harnesses That Learn from Experience (2026)
- SWE-Pruner Pro: The Coder LLM Already Knows What to Prune (2026)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment: @librarian-bot recommend
Get this paper in your agent:
hf papers read 2608.23918 Don't have the latest CLI?
curl -LsSf https://hf.co/cli/install.sh | bash Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper
Collections including this paper 0
No Collection including this paper



