Example: two AI models debate (with Google Colab)¶
Two small open models, qwen2.5:3b and llama3.2:3b, argue "I'm better than you", while you
watch live in your browser. The models run free on a Google Colab GPU. Everything is in
examples/debate:
| File | What it is |
|---|---|
debate_world.py |
The debate world: about 100 lines, written like any custom world |
scenario-colab.yaml |
Models on Colab, AgentPlay on your computer (the tested setup) |
scenario-transformers.yaml |
Everything inside Colab, with the transformers agent |
scenario.yaml |
Everything on your computer, with Ollama |
debate_colab.ipynb |
The Colab notebook for both Colab setups |
How the debate works¶
- The models take turns. Each move is one argument, written as plain text, so a model cannot skip talking.
- Every turn, a model sees the topic, its side, the other side, the whole debate so far and how many arguments it has left, so it can answer the other side's last point.
- After
roundsarguments each, the debate ends. A debate has no rule-based winner, so the result is a draw. An optional judge reads the debate afterwards and decides who argued better.
world:
use: debate_world.py:Debate
config:
topic: "Which AI model is better: qwen2.5 or llama3.2?"
sides:
qwen: "You are qwen2.5. Argue that you are better than llama3.2."
llama: "You are llama3.2. Argue that you are better than qwen2.5."
rounds: 8 # arguments per model
max_chars: 600
too_long: cut # shorten long arguments instead of rejecting them
Settings that make small models work¶
The first runs went wrong in instructive ways. These settings fixed them:
| What happened | Fix |
|---|---|
qwen sent the word "argument" as its move and hid the real text in the chat, three times, so it forfeited before llama spoke |
The move is now plain text, and a word-only move gets a hint that says exactly what to send |
| Arguments over the length limit counted as illegal moves | too_long: cut shortens them, with no penalty |
| Replies were sometimes not valid JSON | json_mode: true makes the server return JSON |
| Format mistakes came and went at random | temperature: 0.3 makes answers steadier |
| 8 rounds need 16 good moves, and every rejected reply also uses a step | limits.max_steps: 40 |
| 3 bad replies in a row ended the debate | limits.max_illegal: 5 |
The 3B judge answered "passed" instead of a verdict |
A bigger judge, qwen2.5:7b |
agents:
- id: qwen
use: chat_api
config:
base_url: "https://YOUR-TUNNEL-ADDRESS/v1"
model: "qwen2.5:3b"
local: true # free, so the cost stays 0
json_mode: true
temperature: 0.3
limits:
max_seconds: 1800
max_steps: 40
max_illegal: 5
Part A: models on Colab, AgentPlay on your computer¶
This is the setup that was tested end to end. Live watching works because AgentPlay runs on your computer.
- Open the notebook in Colab and choose Runtime → Change runtime type → T4 GPU.
- Run part A: it installs Ollama, downloads
qwen2.5:3b,llama3.2:3band the judgeqwen2.5:7b, and prints a temporary public address. Check that the address lists the three models. -
On your computer:
pip install -U agentplaykitDownload
debate_world.pyandscenario-colab.yamlinto one folder, and replacehttps://YOUR-TUNNEL-ADDRESSwith the printed address (three places).agentplaykit check scenario-colab.yaml agentplaykit play scenario-colab.yaml --live
The address is public
Anyone who has it can use your models while the notebook runs. Don't share it, and disconnect the runtime when you're done.
Part B: everything inside Colab¶
With AgentPlay 0.8 or newer, the transformers agent loads the models into the notebook's own
Python process: no Ollama and no tunnel. Run part B of the notebook. It installs
agentplaykit[hf], downloads the world and scenario-transformers.yaml, plays the debate, and shows
the replay inside the notebook.
meta-llama/Llama-3.2-3B-Instruct is gated: accept its license on its Hugging Face page and add
your token as the Colab secret HF_TOKEN, or use an open model such as
HuggingFaceTB/SmolLM2-1.7B-Instruct. See Hugging Face.
Part C: on your own computer¶
With Ollama installed:
ollama pull qwen2.5:3b
ollama pull llama3.2:3b
agentplaykit play examples/debate/scenario.yaml --live
Reading the results¶
- Each turn of the replay shows the argument as the move. A rejected reply shows a red "rejected:" line with the reason, which is the first place to look when a model forfeits.
finished: drawis the normal end: the world names no winner. The judge's verdict follows, when one is configured.forfeitmeans one model sent too many bad replies in a row; the other model wins. See the table above for the settings that prevent it.
Make your own debate¶
Change only topic and sides:
topic: "Is tic-tac-toe a game of skill?"
sides:
qwen: "Argue YES."
llama: "Argue NO."
To change how the debate itself works, edit debate_world.py; the
write a world tutorial explains each method.