Multi-Agent Conversation(MAC) 프레임워크로 의료 진단 능력 강화하기
Enhancing diagnostic capability with multi-agents conversational large language models
TL;DR Highlight
여러 AI 의사 에이전트가 MDT 회의처럼 토론해서 희귀 질환 진단 정확도를 GPT-4 단독보다 높인다.
Who Should Read
의료 AI 솔루션을 개발하는 백엔드 개발자 또는 멀티 에이전트 시스템을 설계 중인 AI 엔지니어. 특히 LLM 단독 추론의 한계를 느끼고 에이전트 협업 구조를 고민하는 분들.
Core Mechanics
- 임상 다학제팀(MDT, 여러 전문의가 모여 논의하는 방식)을 모방한 MAC 프레임워크 설계 — 여러 Doctor 에이전트가 토론하고 Supervisor 에이전트가 최종 판단
- 302개 희귀 질환 케이스로 GPT-3.5, GPT-4, MAC 세 가지 비교 — 초진과 추가 상담 모두에서 MAC이 단독 모델 대비 진단 정확도와 검사 제안 정확도 모두 우세
- 최적 구성은 Doctor 에이전트 4명 + Supervisor 에이전트 1명, 베이스 모델은 GPT-4
- CoT(Chain of Thought, 단계별 추론), Self-Refine(스스로 답 수정), Self-Consistency(여러 번 답하고 다수결) 등 기존 프롬프트 기법들과 비교했을 때 MAC이 정확도와 출력 토큰 수 모두에서 앞섬
- 반복 실행 시 결과 일관성이 높아 실제 임상 적용 가능성 있음
Evidence
- MAC은 GPT-4 단독 대비 초진 및 추가 상담 진단 정확도 모두에서 더 높은 수치 달성 (논문 내 희귀질환 302케이스 기준)
- CoT, Self-Refine, Self-Consistency 대비 MAC이 더 높은 진단 정확도 + 더 많은 출력 토큰(근거 서술 풍부) 기록
- Doctor 에이전트 수를 1→4명으로 늘릴수록 성능 향상, 4명에서 최적점 도달
How to Apply
- 복잡한 분류/판단 태스크에서 단일 LLM 호출 대신, 역할이 다른 에이전트(예: 전문가 A, 전문가 B, 검토자)를 병렬로 돌리고 Supervisor 에이전트가 최종 결론 내리는 구조로 바꿔보면 정확도 향상 기대 가능
- GPT-4 기반으로 에이전트를 구성할 때 4~5개 에이전트가 최적 — 에이전트가 너무 많으면 비용과 지연이 증가하고 성능 향상이 둔화되므로 이 범위 참고
- 의료 외에도 법률 검토, 코드 리뷰, 요구사항 분석처럼 여러 관점이 필요한 도메인에 동일한 MDT 패턴 적용 가능 — 각 에이전트에 다른 전문 역할 페르소나를 부여하면 됨
Code Example
# OpenAI API를 활용한 간단한 MAC 패턴 예시
import openai
client = openai.OpenAI()
def doctor_agent(case: str, specialty: str) -> str:
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": f"You are an experienced {specialty} physician. Analyze the case and suggest a diagnosis with reasoning."},
{"role": "user", "content": case}
]
)
return response.choices[0].message.content
def supervisor_agent(case: str, doctor_opinions: list[str]) -> str:
opinions_text = "\n\n".join([f"Doctor {i+1}: {op}" for i, op in enumerate(doctor_opinions)])
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are a senior supervising physician. Review all doctor opinions and provide a final integrated diagnosis."},
{"role": "user", "content": f"Case:\n{case}\n\nDoctor Opinions:\n{opinions_text}\n\nProvide the final diagnosis."},
]
)
return response.choices[0].message.content
# 사용 예시
case = "28-year-old patient with progressive muscle weakness, fatigue, and elevated CK levels..."
specialties = ["neurologist", "rheumatologist", "internal medicine specialist", "geneticist"]
# 4명의 Doctor 에이전트 실행
opinions = [doctor_agent(case, s) for s in specialties]
# Supervisor가 최종 진단
final_diagnosis = supervisor_agent(case, opinions)
print(final_diagnosis)Terminology
Original Abstract (Expand)
Large Language Models (LLMs) show promise in healthcare tasks but face challenges in complex medical scenarios. We developed a Multi-Agent Conversation (MAC) framework for disease diagnosis, inspired by clinical Multi-Disciplinary Team discussions. Using 302 rare disease cases, we evaluated GPT-3.5, GPT-4, and MAC on medical knowledge and clinical reasoning. MAC outperformed single models in both primary and follow-up consultations, achieving higher accuracy in diagnoses and suggested tests. Optimal performance was achieved with four doctor agents and a supervisor agent, using GPT-4 as the base model. MAC demonstrated high consistency across repeated runs. Further comparative analysis showed MAC also outperformed other methods including Chain of Thoughts (CoT), Self-Refine, and Self-Consistency with higher performance and more output tokens. This framework significantly enhanced LLMs’ diagnostic capabilities, effectively bridging theoretical knowledge and practical clinical application. Our findings highlight the potential of multi-agent LLMs in healthcare and suggest further research into their clinical implementation.