RuleSmith: Multi-Agent LLMs for Automated Game Balancing

Ziyao Zeng, Hao Wang, Chen Liu, Youheng Yao, Jingcheng Ni, Tianyu Liu, Xiatao Sun, Fengyu Yang, Chenyu You, Xiaofeng Liu, Daniel Rakita, Ronald R. Coifman, Yuval Kluger, Zhiwen FanNeurIPS 2026

TL;DR

Balancing asymmetric strategy games—where opposing factions have fundamentally different abilities and economies—usually requires exhausting cycles of manual tuning and human playtesting. RuleSmith automates this headache by pairing zero-shot Large Language Model (LLM) self-play with Bayesian optimization. Instead of training AI to master fixed rules, it treats the rules themselves as variables, using battling LLMs to find the sweet spot where wildly different factions achieve a fair 50/50 win rate.

Conceptual illustration of RuleSmith balancing asymmetric factions via LLM self-play and Bayesian optimization.

What Problem Does This Paper Address?

Imagine designing a game like StarCraft or Civilization. Faction A builds slow, fortified economic engines; Faction B relies on fast, aggressive cavalry raids. How much health should a soldier have compared to a horseman so the game is fair?

Traditionally, designers tweak a spreadsheet, hire playtesters, watch what breaks, and repeat. You could use Reinforcement Learning (RL) bots to test the game, like AlphaStar, except every time you tweak unit damage by +1, you might invalidate your bots' strategies and have to retrain them from scratch. Some recent AI work uses LLMs to suggest rule edits, but RuleSmith flips the script: an external mathematical optimizer tweaks the dials, while instruction-following LLMs act as instant, zero-shot playtesters that adapt to new rulebooks on the fly without any retraining.

Methods

RuleSmith operates as a closed-loop system connecting a game engine, LLM players, and a black-box optimizer:

Figure 2: Overview of the RuleSmith method. We represent an asymmetric, turn-based strategy game (CivMini) as a parameterized rule space θ ∈Θ, covering economy, combat, production, and scoring parameters. Given a candidate rule configuration θt, two role-specific LLM agents (Empire and Nomads) play Nt self-play games in the CivMini environment, producing a balance loss L(θ) = |wE(θ) −0.5| + |wN(θ) −0.5| + 0.5 wD(θ), where wE, wN, and wD are the Empire win rate, Nomads win rate, and draw rate, respectively. A Bayesian optimizer maintains a surrogate model g(θ) over a continuous relaxation of the rule space and selects new candidates ˜θt+1 by maximizing an acquisition function. The number of games Nt is adaptively determined based on the Expected Improvement: promising candidates receive more games for accurate evaluation. Each continuous proposal is mapped to a valid, discrete ruleset via a deterministic discretization operator D(·) before evaluation. Cartoons in this figure were generated using ChatGPT-5.2.
  1. Zero-Shot LLM Playtesters: Given a candidate set of numerical rules, two LLM agents (primarily InternVL3.5 at 2B and 8B scales, run text-only) read the natural-language rulebook (via lightweight TF-IDF retrieval), current board state, and strategy guides. Each turn, an agent outputs a single JSON object commanding all its units simultaneously. The game engine validates legality and falls back to simple priority rules if the LLM hallucinates an illegal move.
  2. Balance Loss Function: After $N$ games, the system calculates a loss score penalizing any deviation from a 50% win rate for either faction, plus an extra penalty for draws so the optimizer doesn't "balance" the game by making it impossible for anyone to win.
  3. Bayesian Optimization with Adaptive Sampling: Searching $1.9 \times 10^{10}$ discrete rule combinations by brute force is impossible. RuleSmith uses a standard Gaussian Process (GP) surrogate model to predict how rule changes affect balance, rounding continuous suggestions to valid discrete game numbers. What’s clever here is acquisition-based adaptive sampling: LLM rollouts are slow and noisy, so RuleSmith scales the number of evaluation games ($N_t \in [16, 64]$) based on Expected Improvement (EI). Unpromising rule tweaks get a quick 16-game check; strong candidates get up to 64 games to be sure.

Datasets

Because this is a simulation-driven optimization problem, there are no static training datasets. Instead, the authors built CivMini, a new, deterministic $7 \times 7$ grid-based 4X benchmark game featuring two asymmetric factions:

  • Empire: Uses specialized Farmers (to gather resources) and slow Soldiers.
  • Nomads: Field mobile Cavalry that cannot gather resources, earning income instead by killing enemy units.

CivMini exposes 12 tunable parameters across economy, combat (HP and damage), unit production costs, and tie-breaker scoring weights.

Key Insights and Ideas

  • Flipping the RL paradigm: Self-play RL optimizes policies under fixed rules; RuleSmith optimizes rules under zero-shot policies. Because LLMs read the updated stats directly in the prompt, zero policy training is required when the rules shift.
  • Balance is relative to player IQ: When the authors pitted a smaller 2B model against a smarter 8B model during optimization, RuleSmith still achieved a 50/50 split—by quietly buffing the stats and economy of the "dumber" 2B faction to compensate for its weaker tactical play!
  • Cross-population transfer: A lingering worry with AI playtesting is that rules balanced for one quirkily behaving bot won't hold up for anyone else. Surprisingly, rules balanced by InternVL3.5-8B remained balanced when played by Qwen3.5-9B, Gemini 2.5, and even a small sample of human players.
  • Compute goes where it counts: Adaptive game allocation reached the same balance quality as a fixed 64-game budget while cutting total simulated games nearly in half (~3,500 vs. 6,400).

Key Results

Starting from decisively broken configurations—an initial setup where Empire won 100% of games, and a code default where Empire won just 11.3%—RuleSmith reliably discovered balanced rulesets:

Table 3: Additional held-out evaluations. Empire win rates, Wilson 95% intervals, and two-sided exact binomial tests against 0.5. Counts are drawn from the evaluation logs; the test compares Empire and Nomads wins among decisive games (Appendix H). The default batch is separate from the authors’ initial configuration. NTBEA/TPE replace the search component; GP-LCB replaces the acquisition rule.
  • Consistent Convergence: Across three independent GP optimization runs, held-out 300-game evaluations hit Empire win rates of 51.7%, 49.3%, and 52.7%. A 500-game deep evaluation of their primary optimized ruleset landed at 47.6% | 52.4%.
  • Optimizer Agnostic: Swapping the GP optimizer for alternative search algorithms like NTBEA and TPE achieved 48.0% and 54.3% win rates, proving the LLM self-play interface is modular.
  • Cross-Model & Human Transfer: Rules optimized on InternVL3.5-8B yielded an exact 50% | 50% split when evaluated by Qwen3.5-9B. In preliminary human tests, humans easily beat the AI agents (winning 80–92% of matches), yet faction win rates stayed remarkably even: 43.3%–45.0% in human-vs-AI games and 53.3% across 60 human-vs-human games.
  • Scalability: RuleSmith successfully scaled to $11 \times 11$ maps and simultaneously balanced a three-faction variant (Empire, Nomads, Theocracy) to a 32% | 33% | 35% split.

Limitations and Future Work

RuleSmith isn't ready to balance Civilization VII overnight. Running 100 optimization iterations with 8B models took ~40 hours across 8 NVIDIA A100 GPUs—even for a tiny $7 \times 7$ game. Furthermore, CivMini has full observability and just 12 numerical dials; scaling to high-dimensional commercial games with fog-of-war (partial observability) remains an open challenge. Finally, because game balance inherently depends on who is playing, rules tuned for zero-shot LLMs may still drift if human players discover deep "meta" exploits that LLMs miss—especially since the human study here involved only three participants. Future work aims to tackle larger rule spaces, visual map inputs, and broader multi-agent simulations like economic policy or cybersecurity modeling.

Summary updated

Abstract

Game balancing is a longstanding challenge requiring repeated playtesting, expert intuition, and extensive manual tuning. We introduce RuleSmith, a framework that couples multi-agent LLM self-play with surrogate-based optimization over a parameterized rule space. As a proof of concept, we build CivMini, a simplified civilization-style game with two asymmetric factions governed by 12 tunable parameters. LLM agents interpret textual rulebooks and game states to propose actions that are validated by the game engine, yielding noisy estimates of faction win rates. Our primary implementation uses Gaussian-process Bayesian optimization with Expected-Improvement-based adaptive sampling to allocate more evaluation games to promising candidates. RuleSmith consistently finds near-balanced configurations: three independent optimization runs reach near-even empirical win rates in independent 200- and 300-game evaluations, and additional experiments with NTBEA and TPE show that the same self-play interface supports different search components. Cross-model evaluations and small human studies provide preliminary evidence of transfer across player populations. RuleSmith produces interpretable numerical rule adjustments without task-specific policy training. Project and code: https://adonis-galaxy.github.io/RuleSmith-website/
BibTeX
@inproceedings{zeng2026rulesmith,
  author = {Ziyao Zeng and Hao Wang and Chen Liu and Youheng Yao and Jingcheng Ni and Tianyu Liu and Xiatao Sun and Fengyu Yang and Chenyu You and Xiaofeng Liu and Daniel Rakita and Ronald R. Coifman and Yuval Kluger and Zhiwen Fan},
  title = {{RuleSmith: Multi-Agent LLMs for Automated Game Balancing}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=GDFl7AUtqB},
}
Figure