How composable-models/llm_multiagent_debate works
Project Type and Purpose
• This is a research‐oriented, modular experimental framework for “multiagent debate” on language model tasks.
• It is not a full‐stack application or web service; rather, it’s a collection of task‐specific pipelines that generate answers via a debate of multiple LLM agents, then evaluate those answers.
File Structure Analysis
• Root:
• README.md – high‐level description and instructions
• requirements.txt – Python dependencies, likely including an LLM client library (e.g., OpenAI SDK)
• Subfolders (each implements one task domain):
• math/
– gen_math.py (generation pipeline)
• gsm/
– gen_gsm.py (generation)
– eval_gsm.py (evaluation)
• biography/
– article.json (input data)
– gen_conversation.py (generation)
– eval_conversation.py (evaluation)
• mmlu/
– gen_mmlu.py (generation)
– eval_mmlu.py (evaluation)
• Pattern: for each domain you have a “gen_*.py” script (runs the debate) and an “eval_*.py” script (computes metrics).
Key Architectural Insights from README
• Each generation script:
a. Loads a dataset (e.g., article.json or external GSM/MMLU data).
b. Spawns two or more LLM agents.
c. Orchestrates a debate via repeated prompt exchanges.
d. Collects final answer(s) and logs debate transcripts.
• Each evaluation script:
a. Reads debate outputs.
b. Compares against ground‐truth.
c. Computes accuracy or other metrics.
Main Components
A. Dataset Layer (Input)
– article.json, GSM dataset, MMLU dataset, Math problem set
B. Generation Pipeline (Per Task Module)
– Scripts: gen_math.py, gen_gsm.py, gen_conversation.py, gen_mmlu.py
– Common multiagent debate engine (shared orchestration logic)
– Represent with a group of processing blocks
C. LLM Service (External)
– OpenAI API or other LLM provider
D. Debate Log Store
– Generated transcripts and final answers (could be files or in‐memory)
E. Evaluation Pipeline (Per Task Module)
– Scripts: eval_gsm.py, eval_conversation.py, eval_mmlu.py (and potentially eval_math)
– Metrics computation
– Represent with processing blocks culminating in reports
F. Results/Reports
– Accuracy, reasoning metrics, saved to files or printed to console
Architectural Patterns and Principles
• Modular design by domain: math, GSM, biography, MMLU.
• Separation of concerns: generation (debate orchestration) vs evaluation (metric computation).
• Single point of integration with external LLM service.
• Data‐driven: each pipeline reads from a dataset, writes logs, then evaluation reuses logs.