AI 辩论系统是人工智能在自然语言理解和生成领域的重要应用。IBM 的 Project Debater 在 2019 年首次展示了 AI 与人类专家进行辩论的能力,标志着 AI 在语言理解领域的重大突破。
基于话题自动生成支持/反对的论证,逻辑清晰、结构完整
识别对方论点中的漏洞并进行有效反驳
理解人类对手的长篇发言并提取关键论点
从大规模语料库中检索相关证据支持论点
多维度评估辩论质量,给出专业反馈
CLI 和 Web 界面,支持实时流式输出
┌─────────────────────────────────────────────────────────────────┐
│ AI Debater System │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Human │ │ AI │ │ Judge │ │
│ │ Debater │◄──►│ Debater │ │ System │ │
│ │ (用户) │ │ (Hermes) │ │ (评判系统) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │ │ │
│ └──────────────────┼──────────────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Debate Engine │ │
│ │ (辩论引擎) │ │
│ └────────┬────────┘ │
│ │ │
│ ┌──────────────────┼──────────────────┐ │
│ │ │ │ │
│ ┌──────▼──────┐ ┌──────▼──────┐ ┌──────▼──────┐ │
│ │ Argument │ │ Rebuttal │ │ Evidence │ │
│ │ Generator │ │ Generator │ │ Finder │ │
│ │ (论点生成器) │ │ (反驳生成器) │ │ (证据检索) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ LLM Provider (qwen3.5-plus) │ │
│ │ https://llm-nscc.sgmw.com.cn:9001/v1 │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
| 层级 | 技术选型 | 说明 |
|---|---|---|
| LLM | qwen3.5-plus | 通过自定义 API 接入 |
| 框架 | Hermes Agent | AI Agent 运行时 |
| 后端 | Python 3.11+ | 核心逻辑实现 |
| CLI | Rich + prompt_toolkit | 终端交互界面 |
| Web | Streamlit / FastAPI | 可选 Web 界面 |
| 部署 | Cloudflare Pages | 静态页面托管 |
AI 辩手核心类,负责生成论点和反驳
控制辩论流程,管理回合和状态
多维度评分,判定胜负,提供反馈
基于 LLM 生成有说服力的论点
识别对方弱点并生成针对性反驳
从知识库检索相关证据支持论点
from core.debater import Debater from core.engine import DebateEngine from core.judge import Judge # 创建辩手 supporter = Debater( name="AI 正方", stance="supporter", model="qwen3.5-plus" ) opposer = Debater( name="AI 反方", stance="opposer", model="qwen3.5-plus" ) # 创建辩论引擎 engine = DebateEngine( topic="人工智能应该纳入义务教育课程", supporter=supporter, opposer=opposer, judge=Judge(), num_rounds=3 ) # 运行辩论 result = engine.run() print(f"获胜方:{result.winner}")
@dataclass class DebateState: """辩论状态""" topic: str current_round: int total_rounds: int supporter_history: list[str] opposer_history: list[str] current_speaker: str # "supporter" or "opposer" phase: str # "opening", "rebuttal", "closing", "judging" @dataclass class DebateResult: """辩论结果""" topic: str winner: str supporter_total_score: float opposer_total_score: float detailed_scores: dict judge_feedback: str full_transcript: str
| 维度 | 权重 | 评分标准 |
|---|---|---|
| 逻辑性 | 30% | 论证结构完整,无逻辑谬误,推理严密 |
| 证据使用 | 25% | 证据充分、可靠、相关,引用准确 |
| 说服力 | 25% | 语言有感染力,论证令人信服 |
| 相关性 | 20% | 紧扣话题,不偏题,回应对方论点 |
论证完美,几乎无懈可击
论证有力,少量可改进之处
论证基本成立,有明显不足
论证薄弱,多处问题
明显获胜: 分差 ≥ 15 分
获胜: 分差 ≥ 8 分
激烈辩论: 分差 < 8 分,难分胜负
# 创建项目目录 mkdir ai-debater && cd ai-debater # 创建虚拟环境 python -m venv venv source venv/bin/activate # 安装依赖 pip install hermes-agent rich prompt_toolkit pyyaml
llm:
provider: custom
base_url: https://llm-nscc.sgmw.com.cn:9001/v1
model: qwen3.5-plus
max_tokens: 2048
temperature: 0.7
debate:
rounds: 3
max_argument_words: 300
max_rebuttal_words: 250
judge:
criteria:
logic: 0.30
evidence: 0.25
rhetoric: 0.25
relevance: 0.20
clear_win_threshold: 15
ai-debater/ ├── core/ │ ├── __init__.py │ ├── debater.py # 辩手类 │ ├── engine.py # 辩论引擎 │ ├── judge.py # 评判系统 │ ├── generator.py # 论点/反驳生成器 │ └── state.py # 状态管理 ├── topics/ │ ├── __init__.py │ └── topics.json # 辩论话题库 ├── tests/ │ ├── __init__.py │ └── test_debate.py # 测试用例 ├── static/ │ ├── index.html # 静态页面 │ ├── styles.css # 样式 │ └── script.js # 交互脚本 ├── config.yaml ├── main.py # 主程序入口 └── README.md
# 安装 wrangler (跳过 esbuild 编译) npm install -g wrangler --ignore-scripts # 登录 Cloudflare npx wrangler login # 部署静态页面 cd static npx wrangler pages deploy . --project-name=ai-debater
人工智能应该纳入义务教育课程
远程办公应该成为常态
应该实行全民基本收入制度
基因编辑技术应该用于人类胚胎