← All projects

Project 02 · Feb 2026

DebateForge.

A vocal, multi-agent sparring partner for debate practice

High-level architecture

UsersNext.js frontendFastAPI backendModels and statespeak turnRESTverdictprompt + contextDebaterWatches, interrupts, arguesClerkSign-in, route protectionDebate UIuseDebate hook, debate stageWeb Speech APISpeaks each turn in-browserModeratorSessions, personas, turnsREST APIstart, next, interrupt, judgeAI engineRebuttal, fallacy, steelman, judgeleaderboard.jsonPersona winsOllamaLLaMA 3.2, kept warm
PersonService I builtData storeExternal / separate serviceOne deployable unit

Overview

Full-stack multi-agent AI debate system built with Next.js, FastAPI, Ollama (LLaMA 3.2), TypeScript, and the Web Speech API. A prefetch pipeline overlaps inference and speech to cut response delay by 30%, with local LLM tuning (context reduction, warmup, keepalive) for 15% faster tokens, plus human-in-the-loop fallacy detection and argument reconstruction.

What I built

  • 01Real-time multi-agent argument generation with near-zero latency transitions between speakers
  • 02Prefetch pipeline overlaps inference with speech playback, reducing response delay by 30%
  • 03Local LLM tuning: context reduction (4096 to 2048), warmup and keepalive for 15% faster tokens and no cold starts
  • 04Human-in-the-loop mode with fallacy detection and argument reconstruction

Deep dive

How it works under the hood

  1. 01

    Turn orchestration

    The backend keeps each debate as an in-memory session in the moderator: topic, the two personas, language and the running transcript. Each call to the next-turn endpoint picks the speaker, builds a persona-locked system prompt plus recent context, and asks the model for a rebuttal. Personas (Professor, Troll, Aggressor, Philosopher) are enforced purely by prompting, which keeps them swappable without retraining anything.

  2. 02

    Hiding model latency behind speech

    A local model is slow enough that waiting for each turn kills the feel of a live debate. The frontend prefetches the next speaker's argument while the current one is still being spoken, so inference and playback overlap and response delay drops by about 30%. On the model side, the context window was cut from 4096 to 2048 tokens, the model is warmed up in the FastAPI startup lifecycle and kept alive between calls, which made tokens about 15% faster and removed cold starts.

  3. 03

    Human in the loop: fallacy check, then steelman

    The user can pause the autonomous loop and argue against either persona. The input first goes through fallacy detection, which flags flaws such as false dichotomy or ad hominem. It is then rewritten into its strongest logical form and that steelmanned version, not the raw text, is injected into the debate state, so the AI responds to the best version of the argument and the debate continues without a break.

  4. 04

    Judging and what I kept simple

    A separate judge prompt reads the full transcript, declares a winner on logical merit and updates a persistent leaderboard. Persistence is a single JSON file and sessions live in memory: that was a deliberate choice for a single-machine, local-first tool, and the first thing to replace with a database if it ever ran multi-user.