Building an LLM simulation, in order

Write the resolution rules before you write a prompt. Build a world that plays without a model at all, replace the decision function with one, and measure every threshold against what the model actually returns.

Step 1
rules that play headless
Step 2
a typed decision function
Step 3
measure the thresholds
Step 4
make it watchable

The order matters more than any individual choice, because the wrong order produces a system whose behaviour nobody can explain, including the person who wrote it.

1. Make it play with no model

Write the world, the actions and the resolution rules first, and drive them with a deterministic heuristic. If it is not interesting with a house brain, a model will not save it. It will only make the flatness harder to see, because a language model's output is fluent enough to be mistaken for content.

Keep that heuristic forever. It is your test harness, your offline mode and your control group.

2. Replace only the decision

The model should answer what does this person do and nothing else. It should not narrate, resolve, move anything or see the rules. Everything that happens stays in one file you can read.

Ask in typed questions built from the legal moves, so an illegal action is absent instead of forbidden, and there is no free text to parse or police.

3. Measure before you tune

Every threshold you put on a model's answer needs a ladder: the same question across six or eight hand-built situations, with the bar placed in the gap between the ones that should differ. A bar chosen by intuition usually sits somewhere the model never goes. This project shipped one at 0.72 against a question that tops out at 0.18, and no alliance ever died.

Anything with an economy gets the same treatment by playing it headless: a year in a second, then read the ledger.

4. Then make it watchable

A simulation nobody can read is a log file. Show the machine, meaning the near-misses, the overrides and the cost, and give the room a deadline so that something is always about to happen.

What to skip

  • A database, until state has to outlive a process. This one has none; a night you want to keep is a file.
  • Memory systems, until a fixed state object demonstrably is not enough. See generative agents.
  • More agents. Four hundred people needed about thirty guts, and the rest is code and is better for it.

Read next

More on Building one