Skip to content

instadeepai/DebateLLM

Repository files navigation

πŸ’¬ DebateLLM - debating LLMs for truth discovery in medicine and beyond

πŸ‘€ Overview

DebateLLM is a library that encompasses a variety of debating protocols and prompting strategies, aimed at enhancing the accuracy of Large Language Models (LLMs) in Q&A datasets.

Our research (mostly using GPT-3.5) reveals that no single debate or prompting strategy consistently outperforms others across all scenarios. Therefore it is important to experiment with various approaches to find what works best for each dataset. However, implementing each protocol can be time-consuming. We therefore built and open-sourced DebateLLM to facilitate its use by the research community. It enables researchers to test various implementations from the literature on their specific problems (medical or otherwise), potentially driving further advancements in the intelligent prompting of LLMs.

We have various system implementations:

Society of Minds Medprompt Multi-Persona
Ensemble Refinement ChatEval Solo Performance Prompting

πŸ”§ Installation

To set up the DebateLLM environment, execute the following command:

make build_venv

πŸš€ Running an Experiment

To run an experiment:

  1. Activate the Python virtual environment:

    source venv/bin/activate
  2. Execute the evaluation script:

    python ./experiments/evaluate.py

    You can modify experiment parameters by using Hydra configs located in the conf folder. The main configuration file is found under conf/config.yaml. Changes at the database and system levels can be made by updating the configs in conf/dataset and conf/system.

To launch multiple experiments:

python ./scripts/launch_experiments.py

πŸ“Š Visualising Results

To visualize the results with Neptune:

  1. Run the visualisation script:
    python ./scripts/visualise_results.py
  2. The output results will be saved to ./data/charts/.

πŸ“Š Benchmarks

Our benchmarks showcase DebateLLM's performance on MedQA, PubMedQA, and MMLU datasets, focusing on accuracy versus cost, time efficiency, token economy, and agent agreement impact. For all our experiments we use GPT 3.5, unless specified otherwise. These visualizations illustrate the balance between accuracy and computational cost, the speed and quality of responses, linguistic efficiency, and the effects of consensus strategies in medical Q&A contexts. Each dataset highlights the varied capabilities of DebateLLM's strategies.

MedQA Dataset

Average Seconds per Question vs. Accuracy MedQA Average Tokens per Question vs. Accuracy MedQA
Accuracy vs. Cost MedQA Total Accuracy Box MedQA

PubMedQA Dataset

Average Seconds per Question vs. Accuracy PubMedQA Average Tokens per Question vs. Accuracy PubMedQA
Accuracy vs. Cost PubMedQA Total Accuracy Box PubMedQA

MMLU Dataset

Average Seconds per Question vs. Accuracy MMLU Average Tokens per Question vs. Accuracy MMLU
Accuracy vs. Cost MMLU Total Accuracy Box MMLU

Agent Agreement Analysis

Modulating the agreement intensity provides a substantial improvement in performance for various models. For Multi-Persona, there is an approximate 15% improvement, and for Society of Minds (SoM), an approximate 5% improvement on the USMLE dataset. The 90% agreement intensity prompts applied to Multi-Persona demonstrate a new high score on the MedQA dataset, highlighted in the MedQA dataset cost plot as a red cross.

Agreement Intensity Agreement vs Accuracy

The benchmarks indicate the effectiveness of various strategies and models implemented within DebateLLM. For detailed analysis and discussion, refer to our paper.

GPT4 results

We also assessed GPT-4's capability on the MedQA dataset, applying the optimal agreement modulation value identified for Multi-Persona with GPT-3.5 on USMLE. The results suggest that these hyperparameter settings are indeed capable of transferring effectively to more advanced models. The results are shown below:

MedQA gpt4 Total Accuracy Box MedQA

Contributing 🀝

Please read our contributing docs for details on how to submit pull requests, our Contributor License Agreement and community guidelines.

πŸ“š Citing DebateLLM

If you use DebateLLM in your work, please cite our paper:

@article{smit2024mad,
  title={Should we be going MAD? A Look at Multi-Agent Debate Strategies for LLMs},
  author={Smit, Andries and Duckworth, Paul and Grinsztajn, Nathan and Barrett, Thomas D. and Pretorius, Arnu},
  journal={arXiv preprint arXiv:2311.17371},
  year={2024},
  url={https://arxiv.org/abs/2311.17371}
}

Link to the paper: Benchmarking Multi-Agent Debate between Language Models for Medical Q&A.