CAMEL: 대형 언어 모델 사회의 'Mind' 탐구를 위한 Communicative Agents
CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Society
TL;DR Highlight
두 AI 에이전트가 역할극(Role-Playing)으로 서로 대화하며 사람 개입 없이 복잡한 태스크를 자동으로 완료하는 멀티에이전트 프레임워크
Who Should Read
LLM 기반 자율 에이전트 시스템을 설계하거나 멀티에이전트 파이프라인을 구축하려는 백엔드/AI 개발자. 파인튜닝용 instruction-following 데이터셋을 자동 생성하고 싶은 ML 엔지니어에게도 유용.
Core Mechanics
- AI Assistant(실행자)와 AI User(지시자) 두 에이전트에게 역할을 부여하고, 사람이 아이디어만 던져주면 나머지는 에이전트끼리 대화로 태스크를 완료하는 Role-Playing 프레임워크 제안
- Inception Prompting: 대화 시작 전 시스템 프롬프트만 설계하면 이후 에이전트들이 서로를 자동으로 프롬프팅 - 역할 뒤바뀜(role flipping), 무한루프, 빈 답변(flake reply) 같은 문제를 프롬프트 엔지니어링으로 해결
- 이 프레임워크로 AI Society(25,000 대화), Code, Math(50K), Science(60K) 대규모 instruction-following 데이터셋을 자동 생성해 HuggingFace에 공개
- CAMEL 멀티에이전트 솔루션이 gpt-3.5-turbo 단일 호출 대비 AI Society 인간 평가에서 76.3% 승률 기록
- LLaMA-7B를 생성된 데이터셋으로 순차적으로 파인튜닝하면 도메인별 지식이 점진적으로 출현(knowledge emergence)하는 현상 확인
- Critic-in-the-Loop: 트리 탐색 방식의 의사결정을 위해 AI 또는 사람 critic 에이전트를 루프에 추가하는 확장 옵션 제공
Evidence
- AI Society 태스크에서 CAMEL 에이전트 솔루션이 gpt-3.5-turbo 단일 호출 대비 인간 평가 76.3% 승률, GPT-4 평가 73.0% 승률 (453명 인간 평가자 수집)
- Code 태스크 GPT-4 평가에서 CAMEL 76.0% 승률, gpt-3.5-turbo 단일 호출 24.0% 승률
- CAMEL-7B(LLaMA-7B 파인튜닝)가 HumanEval pass@1 14.0%, pass@100 57.9%로 LLaMA-7B(10.5%, 36.5%)와 Vicuna-7B(11.0%, 42.9%) 대비 큰 폭 향상
- LLaMA-7B를 AI Society → Code → Math → Science 순으로 누적 파인튜닝 시, 최종 모델이 모든 도메인에서 기존 모델 대비 20/20 태스크 승리 기록
How to Apply
- 자신의 프로젝트에서 두 역할(예: '도메인 전문가' + '개발자')을 정의하고, Figure 2의 Inception Prompt 템플릿을 그대로 복사해서 시스템 프롬프트에 적용하면 자율 협업 에이전트 즉시 구현 가능
- instruction-following 파인튜닝 데이터가 부족할 때, CAMEL 프레임워크로 원하는 도메인의 역할 조합을 설정하고 대화를 대량 생성해 학습 데이터로 활용 - 논문에서는 gpt-3.5-turbo 두 인스턴스로 25,000개 대화 자동 생성
- 에이전트 루프에서 무한 대화나 역할 뒤바뀜 문제가 생기면: 'Never flip roles!', '<CAMEL_TASK_DONE>' 종료 토큰, 최대 메시지 수 제한(40개) 같은 프롬프트 가드레일을 시스템 프롬프트에 명시적으로 추가
Code Example
Terminology
Related Resources
Original Abstract (Expand)
The rapid advancement of chat-based language models has led to remarkable progress in complex task-solving. However, their success heavily relies on human input to guide the conversation, which can be challenging and time-consuming. This paper explores the potential of building scalable techniques to facilitate autonomous cooperation among communicative agents, and provides insight into their"cognitive"processes. To address the challenges of achieving autonomous cooperation, we propose a novel communicative agent framework named role-playing. Our approach involves using inception prompting to guide chat agents toward task completion while maintaining consistency with human intentions. We showcase how role-playing can be used to generate conversational data for studying the behaviors and capabilities of a society of agents, providing a valuable resource for investigating conversational language models. In particular, we conduct comprehensive studies on instruction-following cooperation in multi-agent settings. Our contributions include introducing a novel communicative agent framework, offering a scalable approach for studying the cooperative behaviors and capabilities of multi-agent systems, and open-sourcing our library to support research on communicative agents and beyond: https://github.com/camel-ai/camel.