Skip to content

About

Chess as Generative Models · Preprint v1

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Active_Chessference

Chess as Generalized Notation Notation (GNN) generative models for active inference agents. It contains exact micro-models, a full-board opponent-modeling agent, a perft-validated rules oracle, and moves that come with their expected-free-energy (EFE) decomposition. Browse the documentation.

Preprint v1. Read Chess as Generative Models as a PDF or with the complete HTML reader. Cite the version DOI and download the offline reader and checksums from the paper-v1 release.

Cover: one decision of the full-board agent, drawn as its generative model

The graphical abstract, in three pages:

  • Models: chess as a family of GNN documents.

  • Agent: how the agent decides.

  • Strength: what planning costs and what it buys.

  • Repository: Active_Chessference · distribution gnn-chess · import gnn_chess

  • Specification: SPEC.md (GNN_Chess v0.1.0-draft)

  • GNN: pinned consumer of Generalized_Notation_Notation v5.4.0 (pin, pointer)

What is here

Fourteen packaged GNN documents, each parsed by the pinned upstream parser and checked against the code that runs it (inventory):

Family Model Tier Verified against
M0 Hexapawn, exact (white, black) T-A inline solved game (second-player win), minimax limit
M1 Gardner 5×5 minichess T-C oracle 8×8 differential vs the standard oracle
M2–M4 KPK, KRK, KQK endgames T-B sidecar + T-C retrograde tablebases (mate in 10 / 16 golden maxima)
M5+M6 Full board with opponent-type inference T-C oracle perft, python-chess differential
M7 When to search deeper (metareasoning) T-A, calibrated recorded calibration run
M8 Plans above moves (hierarchy) T-A plan-matches-situation tests
M9 Kriegspiel KR vs K, exact belief T-C oracle-checked referee
M10 Perception with a camera confusion matrix T-C every other declaration equals M5
M11 Theory of mind (mirror opponent type) T-C mirror weights equal the agent's
M12 Learning precisions and habits from games T-A parameter recovery, calibration
— SPEC Appendix A strategic exemplar T-A canonical B orientation

The full-board agent picks each move by minimising

G(u) = E_Q[-ln σ(C_outcome)] + E_Q[-ln σ(C_eval)] − I(opponent type ; reply | u) + E[continuation]

with the rules oracle as its transition model, Boltzmann reply likelihoods per opponent type, and a Bayesian type posterior. Every move carries its decomposition (annotated PGN, UCI info, dashboard). The A1 ablation in docs/theory.md explains why the model takes this form.

Cost, strength and model dimensions. C1 accounts for what each model and the planner cost, exactly and with the pinned GNN package's resource estimator (complexity). E12 rates the agents in a closed pool on the Elo scale (Bradley–Terry, bootstrap intervals), and E13 fits strength against search compute (ratings). E14 measures how strength moves along each generative-model dimension: planning depth and width, sophistication (precision over future choices, anticipated belief updates), epistemic weight and the composition of pragmatic preferences (dimensions). E16 crosses planning depth with epistemic weight, evaluation preference and future-choice precision to ask whether each dimension's effect depends on depth (interactions). E15 compares linear, quadratic, saturating and logistic laws of strength in log compute, with the marginal returns each implies (scaling). E17 makes the opponent types harder to tell apart and asks whether weighting the information gain about the type then buys faster identification or score (probing). Ratings are internal to the pool, not FIDE or engine ratings.

Interfaces. gnn-chess dashboard serves a loopback web app (play, analysis, model inspector, Hexapawn). output/web/game_explorer.html is a self-contained explorer of seeded games, rebuilt by scripts/explorer/build.py; output/web/tournament_explorer.html browses the rated games (ladder, strength against compute, score matrix, replay), rebuilt by scripts/explorer/build_tournament.py. The model explorer shows every packaged GNN document and every tensor it declares as an interactive heatmap, offline; scripts/explorer/build_models.py rebuilds it and ./run.sh docs checks it. The manuscript reader guide links the PDF and HTML editions and their evidence. See Reproduction for the locked render workflow and Publication for release preparation.

Status

Version 0.2.0. Every SPEC model family has at least a first implementation; docs/roadmap.md records the scope of each and what remains open. docs/results.md records the command, commit, and environment for each measured result. The ratings describe performance within the registered agent pool under the stated experiment protocols. docs/scholarship.md maps the prior work.

Install and run

uv sync --locked                                   # Python 3.12–3.14, uv 0.13.7
uv run --locked --no-sync gnn-chess perft --depth 4          # 197281
uv run --locked --no-sync gnn-chess hexapawn --games 200     # exact M0 agents
uv run --locked --no-sync gnn-chess analyze --fen "6k1/5ppp/8/8/8/8/5PPP/R5K1 w - - 0 1"
uv run --locked --no-sync gnn-chess play --white gnn --black typed:materialist --out runs/demo
uv run --locked --no-sync gnn-chess uci            # offline UCI engine for GUIs
uv run --locked --no-sync gnn-chess dashboard      # loopback web app on http://127.0.0.1:8765
uv run --locked --no-sync python scripts/run_experiments.py   # every registered experiment
from gnn_chess.aif.agent import GNNChessAgent
from gnn_chess.oracle import Game

agent = GNNChessAgent.from_model()  # digest-checked, pinned-parser-bound
game = Game()
move = agent.select_move(game)
print(move.uci(), agent.decisions[-1].comment(agent.type_names))

Run ./run.sh package after preparing the locked development environment to build a source distribution and wheel and exercise the installed package from a temporary directory. See Testing.

Gate

run.sh runs the local review gates defined in scripts/gate.py. The manually dispatched hosted job gnn conformance (pinned) runs selected arms on Linux.

./run.sh all
./run.sh package

./run.sh gnn runs the upstream importer reader (python -m gnn.importers check --require-pointer), the generated-model drift guard, and scripts/validate_gnn_spec.py. The validator exits 0 on pass, 1 on failure and 2 when the pinned runtime is unavailable; exit 2 is never a pass.

License

Code and documentation are MIT (LICENSE). The runtime uses the pinned upstream GNN distribution. The development group supplies python-chess (GPL-3.0-or-later) for differential tests and optional research comparisons. See docs/licensing.md.

About

Chess as Generative Models · Preprint v1

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages