Observed since 20 Oct, 20:03 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Dual-LLM adversarial content generation — Generator produces, Critic reviews, loop until PASS.
Dual-LLM adversarial content generation — Generator produces, Critic reviews, loop until PASS. 双 LLM 对抗式内容生成 — Generator 产出,Critic 审核,不通过则修订,循环直到 PASS。
Writing content is easy. Writing correct content is hard. 写内容容易,写"对"的内容很难。
Adversarial Solver makes two (or three) LLMs keep each other in check: 对抗式求解器让两个(或三个)LLM 互相制衡:
The result: content that has been through a quality-control pipeline before it reaches human eyes. 结果:内容在到达人眼之前,已经跑完一条质检流水线。
# Install / 安装
pip install adversarial-solver
# Create config templates / 生成配置模板
adversarial-solver init
# Edit config/departments.yaml and config/rules.yaml / 编辑配置文件
# Add your API keys to config/.env / 填入 API Key
# Run your first adversarial solve (mode auto-detected) / 跑第一次对抗求解
adversarial-solver solve -t "Write a product description." -d marketing
Task / 任务 → Generator (v1) → Critic reviews / 审核
↑ ↓
│ PASS? ─── Yes → Output / 输出
│ │
└─ Revise / 修订 ← No
│ │
│ Deadlocked? / 僵局? → Arbiter (optional / 可选) → Final verdict / 最终裁决
│
[Empty response? / 空值? → Retry / 重试 → Fallback model / 兜底模型]
The solver automatically detects whether to use standard or segmented mode based on model context windows: 求解器根据模型上下文窗口自动判断用 standard 还是 segmented 模式:
| Scenario / 场景 | Detection / 检测 | Behavior / 行为 |
|---|---|---|
| Both models 128K+ context / 两模型都 128K+ | → standard | Single-pass generation / 单次生成 |
| One model ≤16K context (e.g. M3) / 一个模型 ≤16K | → segmented | Auto-split into outline + sections / 自动分段 |
| Manual override / 手动覆盖 | -m standard or -m segmented | User choice respected / 尊重用户选择 |
Run adversarial-solver info -m MiniMax/M3 to check a model's context window.
运行 adversarial-solver info -m MiniMax/M3 查看模型上下文窗口。
departments:
marketing:
name: "Marketing" # Department name / 部门名称
primary_model: "openai/gpt-4.1" # Generator / 生成器
reviewer_model: "anthropic/claude-sonnet-4-6" # Critic / 审核者
arbiter_model: "" # Optional 3rd model / 可选仲裁
fallback_model: "" # Fallback on empty / 空值兜底
tone_checker: true # Enable tone checker / 启用调性检查
banned_words:
medical: # Medical claims / 医疗宣称
- "cure"
- "treat"
- "heal"
exaggeration: # Exaggerated language / 夸张用语
- "premium"
- "luxury"
- "revolutionary"
Write your brand guidelines, core principles, and hard rules. The Generator references this for every task. 写入你的品牌准则、核心原则和硬性规则。Generator 每次执行任务时都会参考。
# Single task (mode auto-detected) / 单任务(自动检测模式)
adversarial-solver solve -t "Write a landing page headline." -d marketing
# Force segmented mode / 强制分段模式
adversarial-solver solve -t "Generate a 50-page report." -d editorial -m segmented
# Tone check on existing text / 对已有文本做调性检查
adversarial-solver check-tone -t "This product cures everything."
# Check model context window / 查看模型上下文窗口
adversarial-solver info -m MiniMax/M3
# Create config templates / 创建配置模板
adversarial-solver init -p my_project/config
from adversarial_solver import adversarial_solve
result = adversarial_solve(
task="Write a product description.", # Task / 任务
dept="marketing", # Department / 部门
max_rounds=3, # Max review rounds / 最大审核轮次
config_path="my_config", # optional / 可选
mode=None, # None = auto-detect / 自动检测
)
print(result["final"]) # The approved output / 最终通过的输出
print(result["status"]) # "PASS" or "PENDING_REVIEW" / 通过或待人工审核
print(result["total_rounds"]) # How many review rounds / 审核轮次
print(result.get("tone_check")) # Tone checker results / 调性检查结果
from adversarial_solver import batch_solve
results = batch_solve([
{"task": "Write a homepage headline.", "dept": "marketing"},
{"task": "Write a privacy policy summary.", "dept": "legal"},
])
print(f"{results['passed']}/{results['total']} passed")
| Use Case / 场景 | Department / 部门 | Typical Mode / 模式 |
|---|---|---|
| Brand copy & ads / 品牌文案·广告 | marketing | standard |
| Legal/regulatory docs / 法律合规文档 | legal | standard |
| Code review / 代码审查 | engineering | standard |
| Blog posts / 博客文章 | editorial | standard |
| Competitive analysis (50+ pages) / 竞品分析 | editorial | auto-segmented |
| Strategy documents / 策略文档 | marketing | auto-segmented |
Q: Do I need two different models? / 必须用两个不同的模型吗? A: No. Same model works — the Critic gets a different system prompt that makes it behave as a reviewer. / 不需要。同一个模型也可以——Critic 用不同的 system prompt 就会以审核者身份工作。
Q: When do I need the Arbiter (3rd model)? / 什么时候需要第三个模型? A: When Generator and Critic disagree for multiple rounds and you want an automatic tie-breaker. Most cases, 2 models are enough. / Generator 和 Critic 多轮僵持不下时,Arbiter 自动裁决。大多数情况两个模型够了。
Q: What happens if a model returns empty? / 模型返回空值怎么办?
A: The solver retries with temperature escalation. If still empty, it switches to fallback_model (if configured). If fallback also fails, the task is archived for human review. / 先重试 + 升温。还空就切 fallback_model。都失败则归档待人工介入。
Q: How does auto mode detection work? / 自动模式检测怎么工作? A: The solver checks both models' context windows (via built-in lookup table). If either model has ≤16K context, it auto-switches to segmented mode. / 检查两个模型的上下文窗口,任一 ≤16K 就自动切分段模式。
Q: What if my model isn't in the context window lookup table? / 模型不在查表里? A: Unknown models default to 128K (safe for most modern LLMs). You can submit a PR to add your model. / 未知模型默认 128K。欢迎提 PR 添加。
Q: Can I use local models? / 能用本地模型吗? A: Yes — via LiteLLM's support for Ollama, vLLM, and other local providers. / 可以,通过 LiteLLM 对接 Ollama/vLLM 等。
Q: Does the tone checker work with non-English text? / 调性检查支持非英文吗?
A: Yes. Banned words are case-insensitive substring matches. Add any language words to rules.yaml. / 支持。违禁词是大小写不敏感的子串匹配,任何语言都行。
See / 参见 CONTRIBUTING.md.
MIT — see / 参见 LICENSE.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.3 | 18 Jul 2026 | 9 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 20:03 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:ded9d6c0b6c14ba2838bf6cbbc31154a42e42874ecbf58dc228fa69ab8addb85