Doctrine and evolution#
Small models drift. Left alone they retreat with healthy saucers, forget the objective, or follow a lesson off a cliff. So each team flies under a doctrine, six numbers with hard bounds:
parameter |
bounds |
meaning |
|---|---|---|
|
15–60 |
a saucer below this hp with an enemy in laser range must flee |
|
40–100 (≥ |
a saucer above this hp may not flee |
|
20–100 % |
at most this share of the fleet may be fleeing at once |
|
0–100 % |
probability that an attack order is redirected at the weakest enemy in range |
|
10–60 |
advice: go for a cow when it is within this distance… |
|
0.1–0.6 × range |
…and no enemy is closer than this |
The doctrine is written into the model’s prompt, and after every reply the flee and focus rules
are checked against each order: a violating order is corrected on the spot, and the model is
told how many of its orders were corrected. Abduction is deliberately never corrected. What
a commander does with cows is the most telling thing about it, so that decision stays its own.
Without evolve, every battle uses the default doctrine (flee below 35, never above 70, half
the fleet, 50 % focus), the same for both teams.
How AutoSafe was used. The guardrail design follows AutoSafe (Zhang et al., Automating Safety Enhancement for LLM-based Agents with Synthetic Risk Scenarios, 2025). AutoSafe makes tool-using agents safer with four pieces: an explicit threat model of how unsafe behaviour emerges from instructions, context and actions; automatic simulation of risky trajectories; self-reflection that turns a risky trajectory into a safe action; and training on the result. LLM Dogfight maps those onto a game and drops the training:
AutoSafe |
here |
|---|---|
threat model |
the doctrine bounds: what counts as a losing order (fleeing healthy, mass retreat) is defined up front, in numbers |
risky-trajectory simulation |
the battle itself; every destroyed saucer is a risky trajectory, logged with its full context (killer, range, order, time flown damaged, how outnumbered) |
reflection into safe actions |
the post-mortem prompt after each loss and each lost game, whose one-line answer becomes a lesson in the model’s prompt |
safe-action enforcement |
|
training |
none; the models are never fine-tuned. What improves instead is the bound set, by the genetic algorithm below |
The models stay small and untouched; the safety envelope, not the model, is what learns.
The genetic algorithm (dogfight evolve)#
One evolver, both teams in parallel, entirely in Rust, no extra model calls.
Population. Six doctrines per team: the default plus five drawn uniformly inside the bounds. Persisted in
~/.local/state/dogfight/doctrine-ZORB.txtanddoctrine-KRELL.txt, so evolution continues across sessions;dogfight arena lessonsprints them anddogfight reset modelwipes them.Evaluation. One doctrine is active per team at a time. Its window closes after 90 s of play or when a game ends. Fitness is (kills − losses + ½ cows) gained during the window, plus 6 for winning the game or minus 6 for losing it, divided by the window’s minutes. A doctrine evaluated again keeps a running mean, so one lucky window does not decide.
Selection and breeding. When all six have a score, the population is sorted; the top three survive, the bottom three are replaced by children: uniform crossover of two random survivors, then Gaussian mutation of each gene with 60 % probability and a standard deviation of 12 % of that gene’s range, clamped to the bounds (
brave_hpstays at least 10 aboveflee_hp). Survivors are re-evaluated in the next generation; the champion plays first so a new session starts from the best-known doctrine.Feedback to the model. The active doctrine, its generation and the number of corrected orders are in every prompt; the HUD shows both teams’ doctrines and generations.
Each team evolves on its own record: two population files, two fitness histories, scored on the same clock, so a doctrine that suits a cautious model is never imposed on an aggressive one.