MARS: Multi-Specialist LLM Relay System for Competitive Programming
MARS is a prompt-only, retrieval-augmented multi-agent framework that employs topic-specialized LLMs in a relay system to iteratively refine competitive programming solutions, achieving a 0.624 pass rate on CodeContests with significantly lower cost and variance compared to existing methods.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
In the high-stakes world of competitive programming, computer scientists and students alike face a unique challenge: solving complex logic puzzles under strict time limits. These problems are not merely about writing code that runs; they require a deep understanding of specific mathematical strategies, such as how to find the shortest path between points or how to organize data efficiently. For years, artificial intelligence researchers have tried to teach computers to master these puzzles. They have built systems where a single powerful computer program attempts to solve the entire problem at once, or where a team of general-purpose digital assistants divides the work into planning, coding, and checking. While these methods have improved, they often stumble when the problem demands a specific, deep insight that a generalist might miss. The core difficulty lies in the fact that a computer program needs to know exactly which mathematical tool to use before it can begin building the solution, much like a carpenter must choose the right saw before cutting wood.
A new study introduces a different approach, one that treats the problem not as a task for a generalist, but as a relay race for a team of specialists. The researchers, working with a system called MARS, designed a framework where the computer does not rely on a single brain to solve everything. Instead, when a difficult programming problem appears, the system first consults a library of digital experts, each trained in a narrow field like geometry, graph theory, or dynamic programming. The system asks each expert if the problem fits their specific area of knowledge. Based on these answers, it assembles a small, custom team of two or three relevant specialists to tackle the task together. This method ensures that the right kind of knowledge is applied from the very beginning, rather than hoping a general model will stumble upon the correct strategy by chance.
Once the team is formed, the work begins in a structured sequence. The first specialist writes an initial draft of the solution in a standard programming language. This draft is then immediately tested against a set of public examples provided with the problem. The results of this test are fed back to the same specialist, who then decides whether to keep the code as is, fix the errors, or pass the draft to the next specialist on the team. This process repeats, with each expert refining the work based on the concrete feedback from the tests. If a specialist cannot improve the code or if the solution is complete, they hand it off to the next person. The system includes a safety mechanism that stops the process if the team gets stuck in a loop of making no progress, ensuring that the computer does not waste time on a dead end. Finally, a quick check ensures the code is formatted correctly before it is submitted.
The results of this experiment were measured on a collection of 165 challenging programming problems. The new system, MARS, solved a significantly higher percentage of these problems compared to previous methods that relied on a single model or a team of generalists. Specifically, the specialized team approach solved about 62 percent of the problems, a notable improvement over the 48 percent achieved by the standard single-model method. The researchers found that this gain was most dramatic on the hardest problems, where the specialized team solved more than double the number of tasks compared to the baseline. While another advanced system known as CodeSIM still achieved the highest success rate, the new method reached a similar level of performance while using far less computing time and resources. The study suggests that by organizing artificial intelligence into a team of topic-focused experts who can check and correct each other's work in real time, computers can become much more effective at solving complex logical puzzles.
The researchers also tested how well this system worked with different underlying computer brains and programming languages. They found that the specialized team approach consistently outperformed other methods across various models, proving that the strategy of using topic-specific experts is robust. However, they noted that the system still relies on the ability to run the code in a safe, isolated environment to get the test results. Without this ability to see the immediate outcome of the code, the specialists would not have the feedback they need to make corrections. The study concludes that while there is still room for improvement, particularly on the most difficult tiers of problems, the shift from generalist teams to specialized, self-correcting relays represents a meaningful step forward in teaching machines to think like expert problem solvers.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.