월~금 오전 7시, 일요일 오전 8시 — AI 뉴스와 용어를 보내드립니다메일로 받아보기

METAL LAB

경쟁 프로그래밍 문제를 풀 때 하나의 만능 AI 대신 분야별 전문가 AI들이 릴레이로 코드를 고쳐가며 완성한다

arXiv:2608.239182026-08-26

MARS: Multi-Specialist LLM Relay System for Competitive Programming

경쟁 프로그래밍 문제를 풀 때 하나의 만능 AI 대신 분야별 전문가 AI들이 릴레이로 코드를 고쳐가며 완성한다

MARS는 알고리즘 대회 문제를 풀 때 기획자·코더·디버거 같은 뭉뚱그린 역할 대신, 동적계획법·그래프·문자열·기하 등 주제별 전문 에이전트가 팀을 이뤄 코드를 순서대로 넘겨받으며 고치는 시스템이다. 각 전문가는 알고리즘 이론 자료를 검색해 참고하고, 자신의 초안을 공개 예제로 직접 실행해 본 뒤 유지·수정·다음 전문가에게 넘기기 중 하나를 고른다. Gemma 4 모델로 CodeContests 테스트에서 직접 프롬프트보다 14.4퍼센트포인트 높은 0.624의 통과율을 기록했고, 최상위 비교 시스템 CodeSIM(0.731)과의 격차 대부분을 3.3배 낮은 실행 시간으로 좁혔다.

METAL LAB 해설 도표

11개 주제별 전문가 풀에서 문제에 맞는 최대 3명이 검색으로 선발되어 릴레이팀을 이룬다. 이 팀은 순환하며 코드를 고치는데, 매 턴마다 공개 예제로 실행해본 결과를 보고 유지·수정·인계를 결정하는 검증 관문을 거친 뒤 최종 완성 코드로 이어진다.
METAL LAB이 원문을 바탕으로 재구성한 해설 도표이며, 논문 저자의 원문 figure가 아닙니다.

무엇을 했나

  1. 기존 다중 에이전트 코딩 시스템은 기획자-코더-디버거처럼 일반적인 역할만 나누고 실제 알고리즘 지식은 언더라잉 LLM에 통째로 맡기는 문제가 있었다.
  2. MARS는 11개의 주제별 전문가 풀 중에서 문제와 관련된 최대 3명을 검색 기반으로 골라 팀을 꾸리고, 시작 전문가가 C++17 초안을 작성한 뒤 각 턴마다 공개 예제로 코드를 실행해 본 결과를 보고 유지·수정·인계를 결정하는 릴레이 방식으로 진행된다.
  3. 165개의 CodeContests 테스트 문제에 대해 Gemma 4 백본으로 실험한 결과, MARS는 과제당 평균 2.3단계만 거치고도 0.624±0.006의 통과율을 기록해 단일 호출 직접 프롬프트보다 14.4퍼센트포인트, 단일 전문가만 쓰는 Single-RAG보다 9.5퍼센트포인트, 병렬 앙상블보다 6.0퍼센트포인트 높았다.
  4. 계획-시뮬레이션-디버깅을 반복하는 더 무거운 시스템 CodeSIM(0.731)에는 못 미치지만 격차의 대부분을 좁혔고, 실행 시간은 3.3배 적게 들었으며 과제당 토큰 사용량의 변동폭도 훨씬 작았다.
  5. Qwen3.5-27B, GPT-5.4-mini 등 다른 백본과 Python 언어로 바꿔도 Direct보다 낫고 Single-RAG보다 낫다는 순서가 유지되었고, RAG 검색을 없애면 통과율이 2.0퍼센트포인트 떨어졌다.
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.
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.
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.
MethodPass rateSecTokensCalls
Direct0.48± 0.0234.9± 49.61.8± 1.21.0± 0.0
Single-RAG0.53± 0.0159.8± 21.225.0± 3.212.0± 0.0
Parallel ens.0.56± 0.00360.9± 172.929.8± 5.117.6± 0.8
Base relay0.55± 0.00191.6± 91.534.1± 10.217.1± 1.7
MARS0.62± 0.01244.3± 154.440.3± 8.116.6± 1.3
CodeSIM∗0.73± 0.01817.5± 1358.532.2± 54.810.2± 14.2
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.
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.
Table 2: Backbone and language transfer. The same 165 tasks and final harness as Table 1, using recorded model- and method-specific decoding. Time is in seconds, tokens in thousands, and calls per task; PairCoder includes embedding traffic.
MethodPass rateSecTokensCalls
Qwen3.5-27B, C++17
Direct0.192±0.01827.2±74.61.7±2.21.0±0.0
Single-RAG0.264±0.00471.0±57.126.5±4.012.0±0.0
MARS0.297±0.012109.7±99.740.5±18.715.3±3.3
GPT-5.4-mini, C++17
Direct0.149±0.0193.4±2.31.2±0.51.0±0.0
Single-RAG0.364±0.02449.7±26.324.7±3.212.0±0.1
MARS0.503±0.04392.2±61.136.8±7.415.8±1.8
Gemma 4, Python (PyPy 3)
Direct0.485±0.00070.0±137.81.6±1.01.0±0.0
MARS0.622±0.015307.6±215.742.9±9.117.1±1.4
PairCoder0.705±0.009426.7±451.727.6±20.97.6±5.4
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: Easy n=56, Medium n=39, Hard n=70.
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: Easy n=56, Medium n=39, Hard n=70.
Table 3: Ablations and protocol variants on Gemma 4. The generalist variant also disables RAG; the last two rows are the broader Base relay and Parallel ensemble comparisons from Table 1.
ConfigurationPass rateΔ
MARS (full)0.624±0.006
w/o RAG grounding0.604±0.007−0.020
Generalists, no RAG0.615±0.013−0.009
Earlier Base relay0.552±0.000−0.072
Parallel manager0.564±0.000−0.060
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.
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.

실제로 확인된 결과

  • Gemma 4 백본, CodeContests 165개 테스트 문제에서 MARS는 0.624±0.006의 통과율로 Direct 대비 +14.4퍼센트포인트, Single-RAG 대비 +9.5퍼센트포인트, Parallel ensemble 대비 +6.0퍼센트포인트 높았고 평균 2.3단계만 거쳤다.
  • CodeSIM은 0.731±0.009로 가장 높았지만 MARS는 이 격차 대부분을 3.3배 낮은 실행 시간(문제당 244.3초 대 CodeSIM 재현 실행 약 817초)으로 좁혔다.
  • 난이도별로 보면 Easy는 0.80~0.93으로 거의 만점권이고, Medium에서 MARS 0.72 대 Direct 0.59, Hard에서 MARS 0.40 대 Direct 0.18로 격차가 더 커졌다.
  • 다른 백본(Qwen3.5-27B, GPT-5.4-mini)과 Python 언어에서도 Direct < Single-RAG < MARS 순서가 유지되었고, Python에서는 0.622±0.015로 Direct(0.485)보다 13.7퍼센트포인트 높았다.
  • RAG를 제거하면 통과율이 2.0퍼센트포인트 낮아졌고, Base relay와 Parallel manager는 각각 MARS보다 7.2, 6.0퍼센트포인트 낮았다.

어디에 쓸 수 있나

  • 대회형 코딩 문제나 알고리즘 특화 작업에서 하나의 범용 모델 대신 주제별 검색 기반 전문가 에이전트 팀을 구성하는 파이프라인 설계에 참고할 수 있다.
  • 공개 테스트 실행 결과를 매 턴마다 에이전트 스스로 확인하고 유지·수정·인계를 결정하게 하는 자기점검형 워크플로우 설계에 응용할 수 있다.
  • 무거운 반복 탐색형 시스템 대비 실행 비용과 토큰 변동성을 낮추면서도 상당한 성능을 유지해야 하는 실무 코드 생성 서비스 설계에 참고할 수 있다.

한계와 남은 검증

  • 평가는 165개 CodeContests 문제, 세 개 백본, C++17과 Python 두 언어, 하나의 알고리즘 이론 자료(cp-algorithms), Codeforces 태그 체계로 한정되어 있어 다른 언어나 코퍼스로의 일반화는 검증되지 않았다.
  • 동일 턴 내 공개 테스트 회귀만 걸러내는 결정론적 게이트라서 숨겨진 테스트나 전문가 간 비교는 걸러내지 못하며, 생성된 모든 코드는 반드시 샌드박스 실행이 필요하다.
  • CodeSIM만 동일한 단계 구조로 직접 비교했고 PairCoder는 Python 전용으로만 비교했으며, LDB·LPW·MapCoder·MaintainCoder·Xolver 등은 언어·프로토콜 차이로 이식하지 못해 비교에서 제외되었다.
  • Base relay 대비 MARS의 성능 향상(0.552→0.624)은 공개 테스트 자기점검, 서브태스크 추적, 인프라 수정 등 여러 변경이 동시에 적용된 결과라 개별 요소의 기여도는 분리되지 않았다.
  • RAG 없는 일반전문가(generalist) 비교는 검색 자체도 함께 바뀌므로 전문화 자체의 순수 효과를 분리하지 못한다.

왜 중요한가

경쟁 프로그래밍처럼 정답 신호가 드물고 깊은 알고리즘 지식이 필요한 작업에서, 역할만 나누는 기존 다중 에이전트 방식보다 실제 주제 지식을 검색으로 보강한 전문가 팀이 더 적은 비용으로 비슷한 성능을 낼 수 있음을 보여준다. 코딩 자동화 파이프라인을 설계하는 개발자에게는 무거운 반복 탐색 대신 저비용 전문가 릴레이 구조가 실용적인 대안이 될 수 있다는 시사점을 준다.

이 논문의 용어

  • RAG (검색증강생성) · 모델이 답을 만들 때 외부 문서를 검색해서 그 내용을 참고하게 하는 기법
  • 릴레이 파이프라인 · 한 에이전트가 만든 코드를 다음 에이전트에게 순서대로 넘기며 고쳐 나가는 진행 방식
  • 통과율(pass rate) · 전체 문제 중 정답으로 판정된 문제의 비율
  • ExecEval · 생성된 코드를 실제로 실행해 공개 예제 테스트를 통과하는지 확인하는 샌드박스 실행 환경
  • CodeSIM · 계획을 세우고 시뮬레이션한 뒤 디버깅을 반복하는 비교 대상 다중 에이전트 코드 생성 시스템

저자 · Andrei Mikhailov, Mikhail Burtsev, Alsu Sagirova

arXiv에서 원문 보기

최신 논문

논문 전체 보기 →

METAL LAB 최신 기사

그림 출처: Andrei Mikhailov et al., arXiv:2608.23918, CC BY 4.0