惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
F
Fortinet All Blogs
L
LangChain Blog
D
Docker
G
Google Developers Blog
B
Blog RSS Feed
Google DeepMind News
Google DeepMind News
Vercel News
Vercel News
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Recorded Future
Recorded Future
I
InfoQ
博客园 - 【当耐特】
The Cloudflare Blog
P
Proofpoint News Feed
GbyAI
GbyAI
博客园 - 司徒正美
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
Stack Overflow Blog
Stack Overflow Blog
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Jina AI
Jina AI
量子位
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
有赞技术团队
有赞技术团队
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
大猫的无限游戏
大猫的无限游戏
F
Full Disclosure
雷峰网
雷峰网
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
SegmentFault 最新的问题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Built a Multi-LLM Debate Engine That Fact-Checks Itself in Real Time
Suat · 2026-04-24 · via DEV Community

When you ask one LLM a question, you get one answer. When you ask five LLMs the same question, you get five answers and no way to tell which is right.

The naive fix — make them vote, or make them argue, or summarize them all — turns out to make things worse, not better. LLMs are prone to sycophancy; when one confidently states a wrong fact, the others tend to concede rather than push back. Add a summarizer on top and you get a polished, cited-looking answer that is confidently wrong.

I wanted a different shape: a structured debate between agents with different roles, plus a sixth agent whose only job is to fact-check the others mid-debate — before any of them gets a chance to agree with a hallucination.

This post is a walkthrough of what I built, why it works, and where it doesn't. The code is on GitHub under MIT: capitansuat/swarm-debate.

The shape of the problem

Imagine you ask five LLMs: "Is Acme Corp's recent acquisition of Beta Inc going to close by year end?"

You'll get responses that sound like this, rewritten for brevity:

Model A: "Morgan Stanley's November 28 M&A tracker shows the deal at 85% approval probability..."
Model B: "According to the DOJ Second Request docket DOJ-HSR-2025-4471..."
Model C: "The Wall Street Journal reported on October 17 that both parties received antitrust clearance..."

One of those is real. The other two are fabrications — a made-up Morgan Stanley tracker (dated in the future, which makes it impossible), and a DOJ docket number that doesn't exist.

A human reading the three responses is probably fine. A human running a downstream pipeline that summarizes them into a single answer is not fine, because the fabricated citations carry the same rhetorical weight as the real one. If a second LLM is then asked to synthesize these three, the odds it surfaces the fabrication as a problem are low. It will more likely produce a smoothly paraphrased answer that treats all three sources as equivalent.

The pattern I borrowed

While reading about Mixture-of-Experts language models, I came across the shared expert pattern. In an MoE model with routing, each input token selects K experts to process it. But some architectures also include one shared expert that runs on every token, regardless of what the router picks. The shared expert handles general competence; the routed experts handle specialization.

This is a strong structural answer to the debate problem: what if the "shared expert" in a multi-agent system is just... a fact-checker?

The shape would look like this:

Round 1:
  Analyst -> opinion
  Strategist -> opinion
  Devil's Advocate -> opinion
  Researcher -> opinion
  Validator -> reads all four, fact-checks every concrete claim

Round 2:
  Each persona sees the previous round's output
  AND the validator's findings (OK / WARN / FAIL markers)
  AND is told: "Do not use claims marked FAIL"
  ... generates a new, hopefully more grounded opinion
  Validator runs again on the new outputs

Round 3: same pattern, then synthesize

Enter fullscreen mode Exit fullscreen mode

The key design choices:

  1. The Validator does not debate. It doesn't take sides, doesn't argue, only verifies.
  2. Validator output is filtered before injection. Other agents see only the structured markers, not the full validator reasoning. Otherwise they start quoting the validator as a peer, which defeats the point.
  3. FAIL findings carry forward explicitly. The next round's prompt literally says "claims marked FAIL were verified wrong; do not reuse them." This is not subtle; it's what makes the pattern work.

What the Validator actually sees

The Validator's system prompt is strict and narrow. Paraphrased:

You are a validator. You do NOT participate in the debate.
Read what was said this round. Identify verifiable claims:
numbers, dates, company names, reports, URLs, events.

For each concrete claim, you MUST use web_search to verify.
Future-dated source claims (e.g. "May 25 report" cited on April 24)
are automatically [FAIL].

Output format:
  [OK]   <claim> — verified, source URL: ...
  [WARN] <claim> — suspect, reason: ...
  [FAIL] <claim> — fabricated or wrong, correction: ..., source URL: ...

Enter fullscreen mode Exit fullscreen mode

Run this on the acquisition example and you get something like:

[OK]   WSJ reported antitrust clearance on Oct 17 (wsj.com/articles/..., 2025-10-17)
[FAIL] "Morgan Stanley M&A tracker, November 28" — today is October 20, future-dated
[FAIL] "DOJ Second Request docket DOJ-HSR-2025-4471" — no such filing in PACER or DOJ records
[WARN] "85% approval probability" — probability figure unsourced, no widely published tracker confirms

Enter fullscreen mode Exit fullscreen mode

Those FAIL lines get inlined into the next round's prompt. Model A, which fabricated the Morgan Stanley citation, reads its own claim marked [FAIL] and is told not to reuse it. In my test runs, the same model, given the same topic, in the very next round, correctly drops the fabrication and reframes its argument around real data. No fine-tuning, no retraining — just structured feedback during generation.

Before/after numbers from a real run

I ran the same 4-persona × 3-round debate twice on the same topic. The only difference: the first run had a broken Validator (timeouts mid-round so most fact-checks didn't land). The second had the Validator running cleanly every round.

Run 1 (broken validator) Run 2 (clean)
Persona calls completed 9/12 12/12
Validator rounds that ran 1/3 3/3
Fabricated citations in log 2 0
Validator FAIL markers 1 3
Verified source URLs in log ~5 ~20
Total runtime 26 min 30 min

Four extra minutes of runtime. Two fewer fabrications surviving to the synthesis step. For any downstream use that treats the synthesis as input — a decision support pipeline, a summary for a human in a hurry, a training dataset — this is a disproportionately good trade.

The implementation is boring (intentionally)

The engine is one Python file, under 600 lines, pure stdlib plus PyYAML. Personas are YAML. Providers are OpenAI-compatible HTTP endpoints with a dispatcher that also knows how to shell out to CLI tools (useful if you already pay for a chat subscription and would rather reuse that access than buy API credits).

swarm-debate/
├── src/
│   ├── swarm_debate.py    # the engine
│   ├── config.yaml         # providers, timeouts
│   └── personas.yaml       # the six roles
├── examples/
│   ├── topics.md           # topics that produce good debates
│   └── product-brief-...   # example context document

Enter fullscreen mode Exit fullscreen mode

I deliberately kept the model names and auth patterns out of the hot path. Which model you pick for each persona is in personas.yaml; the engine itself doesn't care. You can run the whole thing entirely on local Ollama if you want, or mix local personas for cheap speech with a single cloud-backed persona for the Validator.

Things that surprised me

The validator is the bottleneck by a wide margin. On my setup, the debating personas each took 30-180 seconds per round. The Validator took 300+ seconds because it has to read all four persona outputs and run a web search per claim. If you want this faster, lowering reasoning effort on the validator is the single highest-leverage knob.

Quality is non-linear in reasoning effort for the validator specifically. Cheap validator = performative. It nods at claims without actually looking anything up. It might say [OK] "according to Reuters" without verifying that Reuters actually said the thing. You can tell from the log: a good validator produces URLs; a cheap one produces vague attributions. This matches the intuition that fact-checking is harder than answering.

Personas with single-responsibility prompts outperform multi-responsibility prompts. An early version had the Researcher persona double as the validator — "when you research, also fact-check the others." Argument quality dropped, fact-check quality dropped, and both responsibilities became half-hearted. Splitting them fixed both.

What's not solved

A few things I left on the roadmap because I didn't want to ship speculative solutions:

  • Round adaptivity. All debates run a fixed number of rounds. Most topics converge by round 3 anyway, but "no new information" detection would save time on easy questions.
  • Async validator. The validator currently blocks the next round. Running it in parallel is straightforward but changes the injection semantics.
  • Meta-validator. Two validators from different model families, disagreements flagged. Cheap insurance against validator-specific failure modes.
  • Persona reliability metrics. Track which personas accumulate the most FAIL markers in your domain. In my runs one persona was noticeably more prone to fabrication than the others; I'd rather surface that data than guess.

Try it

git clone https://github.com/capitansuat/swarm-debate.git
cd swarm-debate
pip install -r requirements.txt
mkdir -p swarm/debates
cp src/*.yaml swarm/

python3 src/swarm_debate.py \
  --topic "Should we migrate our 65kLOC TypeScript backend to Rust?" \
  --agents analyst,strategist,devils_advocate,researcher \
  --rounds 3

Enter fullscreen mode Exit fullscreen mode

Edit swarm/personas.yaml to point at whatever providers you have (API keys, CLI tools, local Ollama — any combination works). The dispatcher figures out which path to use based on what's configured.

The output is a Markdown log with all rounds, validator findings, and a synthesis section ready to pipe into a strong model for the final answer.

Credit

The shared-expert idea came from reading the OpenMythos community repository — a speculative reconstruction of a hypothetical MoE language model. OpenMythos is architecture-level speculation rather than a runnable model, and its specific claims about actual production systems are unverified, but the structural idea of one expert always running alongside the routed experts is a real pattern in MoE research and it translates cleanly into multi-agent systems.

Related papers worth a skim if you find this interesting:

If you run it on a topic I wouldn't think to try, I'd like to see the log. Open an issue with the result attached — it's the kind of feedback that tells me whether the pattern generalizes or works only in my specific workload.

Repo: capitansuat/swarm-debate