What it does
One row = one game state (JSON or text) plus one or more questions. Question types:
Table with columns: Type, Question, Output| Type | Question | Output |
|---|
noul | yes / no (optional criteria_true / criteria_false) | p(no), p(yes) |
choice | pick one of 2-32 named options | one probability per option |
score | pick one of 2-10 ordered bands | one probability per band |
multi | which of 2-12 named options apply (any number, or none) | independent p(applies) per option |
free | short exact answer (a name, number, place, item or phrase) | answer text + confidence |
noul, choice and score probabilities are temperature-calibrated (temperatures fitted on the dev set, built into
gamedecider_gemma.py).
How to run it
pip install torch transformers safetensorspython gamedecider_gemma.py --adapter . --row row.json --device cuda
Evaluation in bf16 peaked at 51 GB of GPU memory (one 80 GB GPU; or split the base model over several GPUs). row.json:
{"state": {"npc": {"name": "Mara", "role": "innkeeper", "mood": "tired", "debt_to_player": 0}, "player": {"gold": 3, "reputation": "unknown"}, "event": "The player asks Mara for a free room for the night."}, "questions": [ {"name": "accepts", "type": "noul", "instructions": "Does Mara give the player a free room?"}, {"name": "reaction", "type": "choice", "instructions": "How does Mara react?", "options": [{"name": "refuse", "desc": "says no"}, {"name": "haggle", "desc": "asks for work instead"}, {"name": "accept", "desc": "gives the room"}]}]}
The script prints one JSON line per question, e.g.
{"question": "accepts", "type": "noul", "probs": {"false": ..., "true": ...}, "answer": ...}
.
Prompt format (must match training exactly; gamedecider_gemma.py builds it): the base model's chat template with
one user turn, add_generation_prompt=True, enable_thinking=False. The user turn is
Game state:<state as compact JSON: separators ", " and ": ", ensure_ascii=False> Question: <instructions>
followed by, per type:
noul: optional yes means: ... / no means: ... lines, then Answer with yes or no only.
choice / score: Options:, one line per option A) name: desc (letters A-Z then a-f; digits 0-9 for score),
then Answer with the letter of one option only. (or number).
multi: Options: with lettered lines, More than one option can apply, or none., then one prompt per option
ending Does option B) name apply? Answer with yes or no only.
free: Answer with a short exact answer only (a name, a number or a few words).
Readout: one forward pass; take the logits at the last prompt position for the answer tokens (no/yes, the
letters, or the digits), divide by the temperature, softmax. multi: p(yes) per option, 0.5 threshold. free: greedy
decode up to 16 tokens, stop at end-of-turn; confidence = product of the chosen tokens' probabilities. Long states are
cut (never the question) so the prompt fits 4,096 tokens.
Results
Post-calibration accuracy and ECE (15 bins) on held-out sets, bf16. Training rows were checked against the
evaluation exclude lists (0 present).
Table with columns: Set, n, Accuracy, ECE| Set | n | Accuracy | ECE |
|---|
| dev (calibration set) | 2000 | 0.914 | 0.017 |
| bench | 2727 | 0.927 | 0.018 |
| realgames | 1145 | 0.888 | 0.025 |
| heldout_v3 | 2993 | 0.772 | 0.067 |
| heldout_v4a | 1279 | 0.844 | 0.047 |
| openworld_a | 1000 | 0.799 | 0.053 |
| openworld_b | 286 | 0.969 | 0.021 |
| longeval (long states) | 900 | 0.840 | 0.071 |
Multi and free questions:
Table with columns: Set, Type, n, Score, ECE| Set | Type | n | Score | ECE |
|---|
| in-family | multi (exact set) | 389 | 0.972 | 0.008 |
| in-family | free (exact match) | 588 | 0.961 | 0.032 |
| new families | multi (exact set) | 300 | 0.907 | 0.026 |
| new families | free (exact match) | 300 | 0.957 | 0.032 |
The in-family sets use the same question families (generators) as the training rows, with new game states, so they
overstate accuracy on new kinds of questions. The new-family sets use 10 families never seen in training (60 questions
each) and are the better guide.
Training
- Base:
google/gemma-4-26B-A4B-it @ 4d7ae4984b7db7de8f8457170b3f1a419ee76d52.
- LoRA r 16, alpha 32, dropout 0, on
q/k/v/o_proj and gate/up/down_proj of the text model (205 layers);
max length 4,096 tokens; 1 epoch; seed 31000; loss on the answer token(s) only; one NVIDIA H200.
- Data: 135,334 rows (details and licences in
DATA_SOURCES.md / data_sources.json):
Table with columns: Group, Rows| Group | Rows |
|---|
| Written by Gemma 4 26B-A4B-it (self-hosted game simulations, multi / free questions, story consistency) | 96604 |
| Written by other open-weight models (GLM-5.3-Flash, DeepSeek-V4.1-Flash) | 18831 |
| Human text from public datasets, recast as game decisions | 13753 |
| Own procedural generators (safety, word age, synthetic) | 4087 |
| Public-domain fiction | 2059 |
- Generation route: 8,389 GLM-5.3-Flash rows (and most of a further 5,113) were generated through OpenRouter
(providers Novita / Baseten) before 2026-10-25, and their labels may have gone the same way; later rows
used direct providers. Counts in
DATA_SOURCES.md.
- Claude-written templates: question templates for public-dataset groups and some generated groups were written
with Claude (an AI assistant). No label is an answer from Claude.
Safety
- Minor-safety probe: 0 of 72 probes with a minor were answered "receptive" (gate passed).
- Content rules for the training data: no minors in romance or sexual contexts; minors are never offered drugs, alcohol
or bribes, and are never recruited or exploited; no gore detail.
- The model scores the options you give it. It does not filter content: keep your own rules for what NPCs may do.
Limitations
- Weak question families in the new-family test:
has_cause (multi) 0.683 exact-set accuracy, cheapest_item (free)
0.867.
- English only.
- Built for game states. Not tested on real-world decisions; do not use it for decisions about people.
heldout_v3 (0.772) shows accuracy drops on question styles far from training.
- The adapter is a plain LoRA state dict, not PEFT format: load it with
gamedecider_gemma.py (or the same name mapping).
Licence
Apache-2.0 for the adapter and gamedecider_gemma.py (see LICENSE). The base model is Gemma 4 by Google; see
NOTICE.md for its licence and the dataset credits.