A framework for improving factual consistency in text generation through multi-agent collaboration and debate.
Authors: David Wan, Justin Chen, Elias Stengel-Eskin, Mohit Bansal
git clone https://github.com/meetdavidwan/mammrefine.git
cd mammrefine
pip install -r requirements.txtexport OPENAI_API_KEY="your-openai-api-key"
export ANTHROPIC_API_KEY="your-anthropic-api-key"bash run_script.shpython example.pyMAMM-Refine improves text generation faithfulness through a three-stage pipeline:
- Detection: Identifies factually inconsistent sentences
- Critique: Generates detailed feedback explaining inconsistencies
- Refinement: Produces improved summaries based on critiques
Each stage supports both single-agent and multi-agent debate modes.
# Detection
python src/detect.py gpt-4o data/mediasum.json output/detection.json
# Critique
python src/critique.py gpt-4o detection.json output/critiques.json
# Refinement
python src/refine.py claude-3-sonnet critiques.json output/refined.json# Run the complete debate pipeline
bash run_script.shYour input JSON should contain documents with this structure:
[
{
"document": "Source document text...",
"summary": "Summary to be refined...",
"summary_sentences": ["Sentence 1", "Sentence 2"],
"topic": "Document topic"
}
]- OpenAI:
gpt-4o - Anthropic:
claude-3-sonnet
mammrefine/
βββ src/ # Core implementation
β βββ detect.py # Factual consistency detection
β βββ critique.py # Critique generation
β βββ refine.py # Summary refinement
β βββ model.py # Model interface
β βββ prompts.py # System prompts
βββ data/ # Input datasets
βββ output/ # Generated results
βββ run_script.sh # Complete pipeline script
βββ requirements.txt # Dependencies
The debate system uses iterative rounds:
- Initial: Multiple agents process input independently
- Selection: Agents choose between different outputs
- Debate: Agents review reasoning and make informed choices
- Final: Consensus or best-selected output
@inproceedings{wan-etal-2025-mamm,
title = "{MAMM}-Refine: A Recipe for Improving Faithfulness in Generation with Multi-Agent Collaboration",
author = "Wan, David and Chen, Justin and Stengel-Eskin, Elias and Bansal, Mohit",
booktitle = "Proceedings of NAACL 2025",
year = "2025"
}