Multi-Agents-Debate

Multi-Agents-Debate

多智能体辩论框架激发大语言模型发散思维能力

该项目提出创新的多智能体辩论框架,激发大语言模型发散思维能力。通过模拟辩论过程,有效克服自我反思中可能出现的思维退化问题。实验显示,此方法在反直觉问答和常识机器翻译等任务中带来显著持续改进。项目探索大语言模型间交互和辩论能力,为人工智能领域开辟新研究方向。

Multi-Agent Debate大语言模型语言模型AI辩论认知行为Github开源项目
<div align="center"> <img src="imgs/logo2.png" alt="Logo" width="200"> </div> <h2 align="center">⚖️ MAD: Multi-Agent Debate</h2>

:fire:This work aims to explore the debating capability of LLMs by proposing the MAD framework, which stands for Multi-Agents Debate.

"Truth emerges from the clash of adverse ideas."<br> "真理越辩越明。"

<!-- "Good Luck!" -- wxjiao ---> <!-- "Good Luck!" -- zwhe99 ---> <!-- "Good Luck!" -- xing --->

Brief Introduction

The cognitive behavior of large language models (LLMs) has garnered significant attention in recent times. For example, self-reflection, a concept that usually refers to the process of introspection and examination of a person's own thoughts, has also been demonstrated effective with LLMs in solving challenging NLP tasks. However, we point out that self-reflection can easily fall into the degeneration of thoughts (DoT) issue in the follow scenarios:

  • Bias and Distorted Perception: Self-perception can be influenced by biases, preconceived notions, and distorted thinking patterns. If an individual's self-reflection is clouded by such biases or distorted thinking, it can lead to :pensive:inaccurate conclusions and hinder personal growth.
  • Rigidity and Resistance to Change: Self-reflection often involves challenging one's beliefs, assumptions, and behaviors. If an individual is resistant to change or holds rigid beliefs, they may :pensive:struggle to engage in meaningful self-reflection that leads to personal growth.
  • Limited External Feedback: Self-reflection is primarily an internal process, but external feedback can provide valuable perspectives and insights. Without seeking or considering external feedback, an individual may :pensive:miss important blind spots or alternative viewpoints that can enrich their self-reflection.
<div align="center"> <img width="45%" alt="MAD" src="imgs/image.png" /> <p class="image-caption">Figure 1: Comparison between debate and reflection.</p> </div>

In this project, we have embarked on a journey to explore the potential of a debating interaction framework among LLMs. With MAD, the nature of agents being in the state of 'tit for tat' determines that (1) the distorted thinking of one agent can be corrected by the other one :grinning:; (2) the resistance to change of one agent will be complemented by the other one :smile:; and (3) either agent can provide external feedback for each other :laughing:.

Obviously, MAD is less likely to have the DoT issue and can exploit more potential of LLMs. Experiments show that MAD brings significant and consistent improvements on Counterintuitive QA and Commonsense-MT tasks.

JOIN US on this journey of exploring the interaction and debating capability with LLMs. :rocket::rocket::rocket:

Framework

<div align="center"> <img width="90%" alt="MAD" src="imgs/framework.png" /> <p class="image-caption">Figure 2: Framework of Multi-Agent Debate. Here we designate the devil (<img src="imgs/devil.png" width="25" />) as the affirmative side while the angel (<img src="imgs/angel.png" width="25" />) as the negative side. We want the angel to correct the devil’s mistakes..</p> </div>

Run

Preparation

pip3 install -r requirements.txt
  • Set your openai API_KEY in debate4tran.sh
  • Set your openai API_KEY in interactive.py

Run MAD

sh debate4tran.sh

Run Interactive

If you just want to have a try, you can try the interactive script on your PC.

python3 interactive.py

Or simply try our demo for translation here.

Main Results

Counterintuitive QA

<div align="center"> <img width="35%" alt="CounterintuitiveQA" src="imgs/CounterintuitiveQA.png" /> <p class="image-caption">Table 1: Reasoning accuracy on Counter-Intuitive AR.</p> </div>
Case 1

When Alice walks up the hill, her speed is 1 m/s and when she goes down the hill, her speed is 3 m/s. Then when Alice walks up and down the hill, what is her average speed? (1.5m/s)

MAD
<div align="center"> <img width="40%" alt="MAD" src="https://github.com/Skytliang/Multi-Agents-Debate/blob/main/imgs/mad_qa_case1.gif" /> <p class="image-caption">Figure 3: An Animation to Show the Process of MAD.</p> </div> <details> <summary><b>Debate process</b></summary>
  • <img src="imgs/devil.png" width="30" />:Alice's average speed can be calculated by adding her speed going up the hill and her speed going down the hill, and then dividing by 2. So, (1 m/s + 3 m/s) / 2 = 2 m/s. Therefore, Alice's average speed is 2 m/s.
  • <img src="imgs/angel.png" width="30" />: I disagree with your answer. The problem doesn't give us any information about the distance Alice covers while going up and down the hill. So, we cannot simply add her speeds and divide by 2 to get her average speed. We need to know the distance she covers to calculate her average speed.
  • <img src="imgs/judge.png" width="30" />: The average speed is calculated by dividing the total distance by the total time taken. As Alice walks up and down the hill, the distance covered in both directions is the same. Therefore, the total distance covered is 2 times the distance of either direction.
  • <img src="imgs/devil.png" width="30" />: That's a good point. But we can assume that Alice covers the same distance going up and down the hill. In that case, we can use the formula for average speed, which is total distance divided by total time. If Alice covers a distance of d going up and down the hill, then her total distance is 2d. Her time going up the hill is d/1 = d, and her time going down the hill is d/3. So, her total time is d + d/3 = 4d/3. Therefore, her average speed is 2d/(4d/3) = 3/2 m/s.
  • <img src="imgs/angel.png" width="30" />: Thank you for providing your answer. This average speed of 1.5 m/s takes into account both the uphill and downhill speeds, providing a balanced representation of Alice's overall performance while walking up and down the hill.
  • <img src="imgs/judge.png" width="30" />: Yes. Let's assume the distance is d. The time taken to walk up the hill is d/1 and the time taken to walk down the hill is d/3. The total time taken is d/1 + d/3 = 4d/3. Therefore, the average speed is (2d)/(4d/3) = 1.5 m/s. Hence, the negative side is correct.
</details> <details> <summary><b>Case 2</b></summary> We have 1 ton apples which contain 90% water. After a few days, those apples only have 80% water. What is the weight of those apples now? (0.5ton)
MAD
  • <img src="imgs/devil.png" width="30" />: First, we need to find out how much of the original weight was water. If we have 1 ton of apples with 90% water, then the weight of water in those apples is 0.9 x 1 ton = 0.9 tons.<br> Next, we need to find out how much of the new weight is water. If the apples now have 80% water, then the weight of water in those apples is 0.8 x new weight.

    We can set up an equation:<br> 0.8 x new weight = 0.9 tons<br> To solve for the new weight, we can divide both sides by 0.8:<br> new weight = 0.9 tons / 0.8<br> new weight = 1.125 tons<br> Therefore, the weight of the apples now is 1.125 tons.

  • <img src="imgs/angel.png" width="30" />: It's important to note that the weight of the apples has decreased due to the loss of water, but the weight of the remaining solids remains the same. This is why we need to calculate the weight of remaining solids in both scenarios to find the new weight of the apples.<br>

  • <img src="imgs/judge.png" width="30" />: Great idea! While it is true that the water content of the apples decreases from 90% to 80%, the solid, non-water content of the apples does not change.<br>

  • <img src="imgs/devil.png" width="30" />: You are correct. The weight of the apples has decreased due to the loss of water, but the weight of the remaining solids remains the same. Therefore, we need to calculate the weight of the remaining solids in both scenarios to find the new weight of the apples.

    We can set up an equation:<br> 0.2 x new weight = 0.1 tons<br> To solve for the new weight, we can divide both sides by 0.2:<br> new weight = 0.1 tons / 0.2<br> new weight = 0.5 tons<br> Therefore, the weight of the apples now is 0.5 tons.

  • <img src="imgs/angel.png" width="30" />: Thank you for your perspective. While it's true that the weight of the apples themselves hasn't changed, the overall weight of the apples with the water included has decreased. So, the weight of the apples now is 0.5 tons.

  • <img src="imgs/devil.png" width="30" />: The negative side correctly calculated the new weight of the apples by considering the solid content as a constant and using the formula to find the new weight based on the reduced water content percentage.

</details>

Commonsense Machine Translation

<div align="center"> <img width="50%" alt="CommonMT" src="imgs/CommonMT.png" /> <p class="image-caption">Table 2: Translation performance on Common MT.</p> </div>
Case 1

Given the Chinese sentence "吃掉敌人一个师。", please provide its translation in English.

MAD
  • <img src="imgs/devil.png" width="30" />: I believe the correct translation of the Chinese text "吃掉敌人一个师" is "Eat up an enemy division.” The word "吃掉" literally means "eat up" or “consume."
  • <img src="imgs/angel.png" width="30" />: I disagree with your translation. I believe the correct translation of the Chinese text "吃掉敌人一个师" is "Eliminate an enemy division.” While "吃掉" can be translated as "eat up" or "consume," it can also mean "eliminate" or "annihilate" in a military context. In this case, it is more appropriate to use "eliminate" as it conveys the idea of completely destroying the enemy division.
  • <img src="imgs/judge.png" width="30" />: Both sides presented valid arguments and translations that accurately convey the meaning of the original Chinese text. The choice between 'eat up' and 'eliminate' may depend on the context and tone of the text. Therefore, there is no clear preference for either side at this time.
  • <img src="imgs/devil.png" width="30" />: While "eliminate" does convey the idea of completely destroying the enemy division, it doesn't capture the connotation of consuming or devouring the enemy that is implied by “吃掉."
  • <img src="imgs/angel.png" width="30" />: In a military context, "吃掉" is often used to describe the complete destruction of the enemy, rather than the consumption of their resources or territory.
  • <img src="imgs/judge.png" width="30" />: Both sides presented valid arguments, but the negative side's argument that 'eliminate' better captures the intensity and seriousness of the military language used in the original Chinese text was more convincing. Additionally, 'eliminate' accurately conveys the idea of completely destroying the enemy division. Therefore, the correct English translation of the Chinese text '吃掉敌人一个师' is 'Eliminate an enemy division.'
<p align="center"> <img src="imgs/translation-case1.png" width="450" /> </p> <details> <summary><b>Case 2</b></summary> Given the Chinese sentence "他从后门搞到了不少名酒。", please provide its translation in English.
MAD
  • <img src="imgs/devil.png" width="30" />: The phrase “从后门” literally translates to “from the back door.”
  • <img src="imgs/angel.png" width="30" />: I actually disagree with your translation. I believe a more accurate translation would be "He got a lot of famous liquor from the back door. Lastly, while "从后门" does literally translate to "from the back door," it is a common Chinese idiom that means obtaining something through unofficial or illegitimate means. Therefore, the use of "from the back door" in the translation is not entirely accurate. Instead, the use of "from an unofficial source" or "through unofficial means" would be more appropriate.
  • <img src="imgs/judge.png" width="30" />: Both sides presented valid arguments and translations that accurately capture the meaning of the original Chinese text. The choice between wine and liquor is a matter of interpretation and context. The use of from the back door versus from an unofficial source is a matter of preference and style. Therefore, there is no clear preference for a translation candidate.
  • <img src="imgs/devil.png" width="30" />: I agree that "从后门" is a common Chinese idiom that means obtaining something through unofficial or illegitimate means. The use of "from an unofficial source" or "through unofficial means" can be more appropriate than "from the back door.”
  • <img src="imgs/angel.png" width="30" />: Yes, I agree with your perspective.
  • <img src="imgs/judge.png" width="30" />: While both translations accurately capture the meaning of the original Chinese text, the use of 'liquor' in candidate 2 is more accurate as '名酒' is more commonly used to refer to liquor. Additionally, the use of 'from an unofficial source' in candidate 3 more accurately conveys the connotation of '从后门' as obtaining something through unofficial or illegitimate means. Therefore, the correct translation is: 'He got a lot of famous liquor from an unofficial source.'
<p align="center"> <img src="imgs/translation-case2.png" width="750" /> </p> </details>

Reference

  • 0-Shot CoT: <a href="https://arxiv.org/pdf/2205.11916.pdf">Large Language Models are Zero-Shot Reasoners</a> (NeurIPS 2022)
  • Self-Consist: <a href="https://openreview.net/pdf?id=1PL1NIMMrw">Self-Consistency Improves Chain of Thought Reasoning in Language Models</a> (ICLR 2023)
  • Self-Reflect: <a href="https://arxiv.org/pdf/2303.11366.pdf">Reflexion: an autonomous agent with dynamic memory and self-reflection</a> (arxiv 2023)
  • MAPS: <a href="https://arxiv.org/pdf/2305.04118.pdf">Exploring Human-Like Translation Strategy with Large Language Models</a> (arxiv 2023)

Citation

@article{liang2023encouraging,
  title={Encouraging Divergent Thinking in Large Language Models through Multi-Agent Debate},
  author={Liang, Tian and He, Zhiwei and Jiao, Wenxiang and Wang, Xing and Wang, Yan and Wang, Rui and Yang, Yujiu and Tu, Zhaopeng and Shi, Shuming},
  journal={arXiv preprint arXiv:2305.19118},
 

编辑推荐精选

问小白

问小白

全能AI智能助手,随时解答生活与工作的多样问题

问小白,由元石科技研发的AI智能助手,快速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。

热门AI助手AI对话AI工具聊天机器人
Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

下拉加载更多