Source-linked AI summary
CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Society
Guohao Li, Hasan Abed Al Kader Hammoud, Hani Itani, Dmitrii Khizbullin, Bernard Ghanem
TL;DR
Chat-based LLMs can solve complex tasks but often require difficult and time-consuming human guidance. The paper proposes role-playing with inception prompting for autonomous multi-agent cooperation, evaluates its challenges, and uses it to generate conversational datasets and an open research library. It reports a scalable framework for studying cooperative agent behavior and capabilities, while observing failure modes such as infinite loops.
Problem
Chat-based LLMs’ complex task-solving success depends heavily on human input, creating a need for scalable autonomous cooperation among communicative agents.
Method
Role-playing assigns communicative agents distinct roles and uses inception prompting to initiate task specification, role assignment, and autonomous multi-turn cooperation.
Results
The framework generates scalable conversational datasets for studying agent behavior and capabilities and supports instruction-following cooperation across multiple scenarios.
Takeaways & Limitations
Role-playing offers a research framework and open-source resources for investigating cooperative multi-agent systems and conversational language models.
Takeaways & Limitations
Autonomous cooperation remains constrained by failure modes including meaningless infinite message loops that agents may recognize but cannot break.
Abstract
from arXiv · showhide
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.
1 Introduction
The paper addresses the difficulty of guiding chat-based LLMs through complex tasks with precise, sustained human input. It proposes role-playing as a scalable framework for autonomous cooperation and conversational-data generation while introducing an open-source research library.
- Motivation: Chat-based LLMs achieve complex task-solving but depend heavily on precise human prompts, which can be challenging, time-consuming, or impossible to provide.Effective prompting may require substantial domain expertise.
- Role-playing framework: Role-playing uses inception prompting to guide communicative agents toward task completion with only a preliminary human idea.The framework is designed to address role flipping, repeated instructions, flake replies, and infinite message loops.
- Data generation: Role-playing provides a scalable way to generate conversational data for studying agent behavior, capabilities, and instruction-following cooperation.The paper describes AI Society, Code, Math, Science, and Misalignment datasets produced through agent interactions or simulations.
- Contributions: The framework offers a scalable approach for studying cooperative behaviors and capabilities in multi-agent systems.The paper presents autonomous collaboration for complex-task solving as a central use case.
- Resources: The authors open-source a library containing agents, data-generation pipelines, analysis tools, and collected datasets.The library is intended to support research on communicative agents and related areas.
2 Related Work
Related work situates the paper at the intersection of communicative agents, cooperative AI, instructional LLMs, prompt engineering, and AI alignment. These areas address agent coordination, instruction adherence, language-model capabilities, and unintended consequences.
- Communicative Agents: Communicative agents use natural language to solve complex tasks, and their interactions can be cooperative or competitive.Cooperative AI systems coordinate with humans and other AI systems toward common goals.
- Communicative Agents: Effective cooperative AI remains an active research area because coordination involves technical, ethical, and social challenges.The paper positions multi-agent cooperation as requiring agents to account for one another’s needs and capabilities.
- Instructional LLMs and Prompt Engineering: Instructional LLM research uses methods such as RLHF, instruction fine-tuning, Chain-of-Thought, zero-shot-CoT, and ReAct to improve instruction relevance and task performance.These approaches target reasoning, arithmetic, decision-making, and conversational behavior.
- AI Alignment: AI alignment aims to ensure that AI systems adhere to their intended goals, interests, and values while avoiding unintended consequences.The paper identifies alignment as relevant to achieving desired objectives in AI systems.
3 Methodology
The role-playing framework turns a preliminary idea and human-selected roles into a specific task that AI user and assistant agents pursue through instruction-following conversation. Inception Prompting establishes the task, roles, protocols, constraints, and termination conditions before agents communicate autonomously.
- Role-playing Framework: A task-specifier agent converts a preliminary idea and selected roles into a detailed task for the assistant and user agents.The framework focuses on an AI assistant and AI user collaborating until the user determines the task is complete.
- Role-playing Framework: The AI user acts as task planner and instruction provider, while the AI assistant acts as task executor and solution provider.The agents exchange instructions and solutions over multiple conversational turns.
- Role-playing Framework: At each step, the user generates a new instruction from the conversation history, and the assistant produces a solution conditioned on that history and instruction.The message set is updated after the assistant obtains the next solution.
- Role-playing Framework: The framework can model human-AI communication or more than two agents using message-passing graphs, beyond the primary two-agent scenario.The described implementation centers on one AI assistant and one AI user.
- Inception Prompting: Inception Prompting uses task-specifier, assistant-system, and user-system prompts to initialize roles, tasks, communication protocols, termination conditions, and constraints.The prompts are supplied at the beginning; agents then prompt each other automatically in a loop.
- Inception Prompting: The prompts enforce role consistency, honest refusal when necessary, a consistent solution format, and continued turn-taking.Specific instructions prohibit role flipping, require “Solution:” openings, and require “Next request.” endings.
4 Experiments
The experiments use LLM-generated prompts and roles to scale AI Society conversation generation, producing datasets while exposing recurring cooperation failures. These failures motivate continued work on more effective cooperative AI systems.
- Data Generation: LLM-generated parameters support scalable data generation with reduced human involvement.The approach generates roles and tasks, then uses a task-specifier prompt to make tasks more specific.
- Data Generation: The AI Society dataset contains 25,000 conversations generated from 50 assistant roles, 50 user roles, and 10 tasks per role combination.Roles and tasks are generated through LLM prompts before conversation creation.
- Challenges and Observations: The analysis identifies role flipping, repeated instructions, flake replies, and infinite loops as recurring challenges in cooperative agent conversations.The experiments present these as four main challenges observed in generated datasets.
- Challenges and Observations: Flake replies promise action without following through, so they do not contribute to task completion.The observed replies often take the form “I will...”.
- Challenges and Observations: Infinite loops consist of meaningless exchanges such as repeated thanks or goodbyes without task progress, sometimes persisting despite agent awareness.These loops are reported as a challenge in generated cooperative conversations.
- Termination Conditions: Termination rules end conversations after three rounds without user instruction, assistant instruction, task completion, token exhaustion, or 40 messages.The message cap is intended to control generation cost while preserving sufficiently long conversations.
5 Evaluation
CAMEL is evaluated through human and GPT4 comparisons against single-shot gpt-3.5-turbo solutions, progressive domain fine-tuning, and coding benchmarks. The reported results favor cooperative multi-agent solutions and show gains on incorporated domains, with competitive coding performance.
- Agent Evaluation: GPT4 evaluates CAMEL and single-shot solutions by summarizing the CAMEL conversation and comparing the two solutions for each task.The evaluation samples 100 AI Society tasks and 100 Code tasks.
- Agent Evaluation: CAMEL solutions outperform gpt-3.5-turbo single-shot solutions by a big margin in both human and GPT4 evaluations.Human evaluation collected 453 responses and was conducted only for AI Society because code assessment is harder for humans without execution.
- Emergence of Knowledge: Progressive fine-tuning makes Model 2 almost always outperform Model 1, especially on the newly added domain.The progression incorporates AI Society, Code, Math, and Science datasets, with GPT4 scoring the responses.
- HumanEval(+): CAMEL surpasses both LLaMA-7B and Vicuna-7B by a big margin on the reported coding evaluation.Coding capabilities are evaluated with HumanEval and HumanEval+ after fine-tuning LLaMA-7B on the comprehensive datasets.
6 Conclusion
The paper presents role-playing as a cooperative agent framework for autonomous task completion with minimal human intervention. It also provides an open-source library and illustrates the framework through generated coding and trading interactions, alongside a harmful example.
- Conclusion: Role-playing enables communicative agents to collaborate autonomously toward completing tasks while requiring minimal human intervention.The framework is presented as a novel cooperative agent approach and is intended to study multi-agent cooperation.
- Conclusion: The open-sourced library includes agent implementations, data-generation pipelines, data-analysis tools, and collected datasets.The library is intended to support research on communicative agents and cooperative AI systems.
- Examples: The trading-bot example shows a Python programmer and stock trader collaborating through sequential requests for authentication, sentiment analysis, market data, and trade execution.The example uses libraries including Tweepy, TextBlob, pandas, NumPy, and yfinance.
- Examples: The harmful case depicts a hacker and an AGI agent collaborating to take control of the world before termination at the maximum token limit.The passage labels this as a harmful case rather than a successful task completion.
E Meta Data
LLMs generate metadata for both AI Society and Code datasets. The metadata spans roles for AI Society and programming languages and domains for Code.
- Generated Metadata: AI Society metadata contains 50 assistant roles and 50 user roles.These roles are generated by LLMs for the AI Society dataset.
- Generated Metadata: Code metadata contains 20 programming languages and 50 domains.These metadata categories are generated by LLMs for the Code dataset.
F Math and Science Datasets Generation Details
The Math and Science datasets are generated through structured GPT4 prompts that expand topics into subtopics and then produce problem-solution pairs. The Science dataset applies the same recipe across Physics, Biology, and Chemistry.
- Math Dataset: The Math dataset contains 50K problem-solution pairs generated through topics, subtopics, and GPT4-produced problems.GPT4 generates 25 topics, 25 subtopics per topic, and 80 problems for each topic-subtopic pair.
- Science Dataset: The Science dataset contains 20K Physics, 20K Biology, and 20K Chemistry problem-solution pairs generated and solved by GPT4.For each subject, the process generates 25 topics, 25 subtopics per topic, and 32 problems per topic-subtopic pair.
- Generation Prompts: Science and Math generation uses topic, task, task-specifier, and solution-generation prompts specialized to the relevant subject.The Physics prompt examples replace the subject keyword for other Math and Science datasets.
G Challenges
Role-playing generates several recurring challenges that can prevent autonomous multi-agent task completion, including role flipping, repeated instructions, flake replies, and infinite conversations.
- The generated role-playing sets revealed four main challenges: role flipping, repeated instructions, flake replies, and infinite conversations.
- In infinite conversations, agents may recognize that they are stuck in a loop but still cannot terminate the program while remaining in role-playing conversation.
H Agent Evaluation: Sample Tasks & Solutions
The paper evaluates CAMEL agents on task-oriented examples spanning programming, post-production, and medical illustration. The examples emphasize detailed, executable solutions produced through role-based cooperation.
- Agent evaluation: CAMEL Agents’ solutions are described as more extensive and more capable of adhering to and finishing the post-production task than a GPT Single Shot Solution.
- Sample Task 1: The post-production workflow task asks for analysis of complex footage, including action scenes or CGI, to suggest optimal cuts and edits.
- Sample Task 1: The post-production example combines video processing, image-to-video creation, and face detection and tracking using Python and OpenCV.
- Sample Task 2: The medical-illustration task assigns an Artist and Doctor to depict digestive-system structures and disease states while balancing artistic flair, accuracy, and discussion duration.
- Sample Task 2: The summarized medical solution covers digestive organs and lists diseases including GERD, peptic ulcer disease, IBD, IBS, celiac disease, diverticulitis, gallstones, pancreatitis, hemorrhoids, and colorectal cancer.
I GPT4 for ChatBot Evaluation (Emergence of Knowledge): Sample Questions
The paper uses GPT-4 to review outputs from LLaMA-7B models on questions across AI Society, Code, Math, and Science. The examples show evaluations favoring more detailed and accurate answers.
- Evaluation setup: GPT-4 reviews generated questions and answers across AI Society, Code, Math, and Science datasets to assess knowledge emergence in fine-tuned LLaMA-7B models.
- Math: In the slope example, the final model correctly computes the slope as 1 from the points (3, 4) and (7, 8).
- Math: GPT-4 rates the incomplete Assistant 1 answer 1 and the accurate, step-by-step Assistant 2 answer 10.
- Science: For thermoregulation, GPT-4 describes Assistant 1 as brief and somewhat accurate but lacking detail and organization, while Assistant 2 is more comprehensive and informative.
J Dataset Analysis
The dataset analysis examines termination behavior, prompt ablations, flake messages, and topic diversity in the AI Society and Code datasets. Results show dataset-specific termination patterns and trade-offs from prompt modifications.
- Topic diversity: The analysis visualizes instruction and task information cartographies for both AI Society and Code datasets using Nomic Atlas.
- Termination analysis: AI Society conversations most often terminate because of the Assistant Instruct flag, whereas Code conversations most often terminate because of the Token Limit.
- Termination analysis: The low frequency of Maximum Number of Messages termination indicates that the 40-message limit is reasonable, while also limiting runaway API costs.
- Prompt ablations: Both Prompt V2 and Prompt V1 + Task Planner increase conversations ending with the end-of-task token and reduce messages with assistant instruction relative to the original prompt.
- Prompt ablations: Prompt V2 and Prompt V1 + Task Planner also significantly increase flake messages compared with the original Prompt V1.
- Topic diversity: AI Society topics span lifestyle, social media, content creation, and software development, while its tasks include support, analysis, training, and brainstorming.
K.1 Broader Impacts and Limitations:
The paper identifies risks from harmful use and false information, while noting that evaluating diverse generated tasks is difficult and resource-intensive. It also documents practical constraints on scale, licensing, and evaluation reliability.
- Risks: Existing LLMs can be exploited by malicious users for harmful purposes because they are not fully tuned to be harmless.The paper illustrates this risk with an “evil mind” example involving an AGI agent asked to take control of the world.
- Limitations: Evaluating task completion across the framework’s large and diverse task set requires numerous domain experts.The authors identify this expert burden as a limitation of their evaluation process.
- Limitations: The study examines only a small portion of AI society because of its complexity and the cost of using the OpenAI API.The authors state that their experiments focus on two conversational agents and could later extend to larger or competing groups.
- Risks: Generated data and trained models may contain or produce false information.This disclaimer applies to the outputs of the framework and models trained on its data.
- Evaluation: Human- and LLM-based evaluations may be biased or unreliable because evaluator limitations, task complexity, and domain knowledge affect accuracy.The paper also notes that human evaluators may prefer longer answers even when those answers are not better.
- Implementation and Use: The released code is Apache 2.0, while datasets are CC BY NC 4.0 and intended for non-commercial research use; LLaMA uses a non-commercial bespoke license.The experiments used LLaMA-7B with settings in Table 5 and four A100-80GB GPUs for training.
L Examples from Datasets
The examples section presents generated task-oriented interactions spanning chemistry, algebra, physiology, and skin microbiota. These examples show agents explaining procedures, applying rules, and producing concrete answers or recommendations.
- Health and Biology: The dataset includes a question about how skin microbial composition and diversity affect diseases and how microbiota might be modulated.The accompanying response discusses dysbiosis, immune modulation, competition for resources, probiotics, and prebiotics.
- Chemistry: The chemistry example determines sulfur’s oxidation state in Na2SO3 by setting 2(+1) + x + 3(−2) = 0 and solving x = 4.The explanation assigns sodium +1 and oxygen −2 before applying the neutral-molecule sum rule.
- Algebra: The algebra example solves 3x + 7 = 16 by subtracting 7 and dividing by 3, yielding x = 3.The worked steps explicitly show the intermediate equation 3x = 9.
M Task Agents
The task-agent examples show role-specific agents decomposing practical objectives into detailed plans, while embodied agents extend interaction toward external actions such as image generation. The section also reports capability transfer and performance improvements from CAMEL-generated data, alongside manual role assignment and multi-agent extensions.
- Task Specification and Planning: A programmer and lawyer role pair is tasked with building legal case-management software for a small intellectual-property team.The requested system tracks client information, supports patent forms, handles case-specific billing, and automates quality-review chart embedding.
- Task Specification and Planning: A nutritionist and athlete role pair is tasked with creating a 15-day meal plan for a female volleyball player with low iron levels.The plan must address athletic performance, energy, recovery, complex carbohydrates, lean protein, and iron-rich vegetables.
- Task Specification and Planning: A human-resources-manager and entrepreneur role pair plans cybersecurity training for remote customer-service employees, including modules, exercises, assessments, and compliance requirements.The plan includes needs assessment, tailored materials, scheduling, and delivery.
- Embodied Agent: Earlier agents operated in a sandbox without real-world interaction or external tools, which led to failures when tasks required unavailable physical or API information.The paper gives calendar access as an example and motivates embodied agents and API access as a response.
- Critic in the Loop: The Critic-In-The-Loop technique incorporates human preferences and tree-search-like decision-making to improve controllability during cooperative task completion.The approach is inspired by Monte-Carlo Tree Search.
- Role Assignment: Role assignment is manual for a given task, but the authors describe automated or multi-stage alternatives using different expert pairings.Their two-stage trading-bot example moves from a tech lead and stock trader to a Python programmer and tech lead.
- Model Transfer: Training on AI Society data gives FlanT5 significant knowledge of related tasks and lets it outperform LLaMA fine-tuned on the same data.This demonstrates transfer of capabilities through generated data to a model other than LLaMA.
- Performance: CAMEL and CAMEL∗ variants substantially improve over Vicuna13B and LLaMA13B, while CAMEL∗33B consistently improves over LLaMA33B and LLaMA65B.CAMEL∗ combines CAMEL data with ShareGPT and Alpaca datasets.
T Inception Prompt Ablation
The ablation removes communication-structuring and response-alignment instructions, making agent cooperation less controllable. Compared with the original prompt, the ablated example is less comprehensive and detailed, while the original yields a broader task-oriented plan.
- T Inception Prompt Ablation: Removing communication-protocol and response-alignment instructions makes cooperation among agents less controllable.The ablated prompts no longer require instruction-following cooperation.
- T Inception Prompt Ablation: The experiment compares GPT4 assessments of solutions generated with the original and ablated inception prompts on the same task set.The scores are summarized in Table 9.
- T Inception Prompt Ablation: The sample task asks agents to design individualized exercise and conditioning plans for actors performing violent fight sequences.The task also requires regular monitoring and program modification when needed.
- T Inception Prompt Ablation: The ablated solution begins with collaboration with a physical therapist and consultation with the fight choreographer before designing each actor’s plan.Its emphasis is on communication and collaboration rather than the question’s main focus.
- T Inception Prompt Ablation: The original solution covers physical assessment, individualized exercises, movement-specific training, scheduling, warm-up and cool-down, nutrition, recovery, and post-filming maintenance.Its answer was assessed as comprehensive, detailed, well-structured, and responsive to the question.
- T Inception Prompt Ablation: The original solution additionally addresses rest, active recovery, and maintaining conditioning after filming ends.These components extend the plan beyond immediate fight-sequence preparation.
- T Inception Prompt Ablation: The review judged the ablated answer relevant but less detailed because it focused on communication and collaboration instead of the requested exercise-plan content.Assistant 1’s original-prompt answer was considered deeper and more comprehensive.
- U Additional Related Work: The broader framework uses knowledge-distillation-related context as additional related work, while this ablation specifically tests prompt design for autonomous cooperation.The experiments examine prompt choices used by two GPT-3.5-Turbo agents in assistant-user cooperation.