Flychess FlyNet
FlyNet is the independent, from-scratch neural policy shipped by Flychess. It maps an inspectable chess-board representation through a seeded sparse signed recurrent graph to a policy over a fixed UCI action vocabulary and a bounded side-to-move value estimate.
This model repository contains the model artifacts only. The Python runtime, training scripts, tests, and browser application remain in the Flychess source repository.
Provenance
- The graph is generated by Flychess from a recorded integer seed.
- All trainable tensors are initialized from a recorded seed and optimized by the Flychess training pipeline.
- Stockfish supplies supervised move and value labels; it is a teacher and is not embedded in the weights.
- No pretrained model weights are used.
- The release receipt records the exact source commit, tensor hashes, graph summary, dataset metadata, training settings, and verification results.
The graph layout is an engineering abstraction with named regions. It is not a reconstruction of a biological connectome and makes no claim about animal cognition, consciousness, or biological equivalence.
Model contract
| Property | Value |
|---|---|
| Input features | 851 |
| Policy actions | 4,544 fixed UCI move shapes |
| Value output | Scalar in [-1, 1], from the side-to-move perspective |
| Recurrent computation | 6 synchronous graph updates in the default release |
| Default graph | 2,048 nodes and 64,000 signed directed edges |
| Legal move handling | Applied by the chess environment after neural scoring |
| Serialization | PyTorch tensors in SafeTensors; graph in compressed NumPy arrays |
The 851 input values contain twelve piece planes, side to move, castling rights, an en-passant one-hot plane, move counters, and normalized piece counts. The action vocabulary is generated deterministically and includes promotion shapes; legal-move masking is kept outside the neural graph.
The default forward computation is:
drive = tanh(layer_norm(linear(board_features)))
state = 0
for step in recurrent_steps:
messages[target] = sum(sign[source,target] * gain[source,target] * state[source])
state = 0.65 * state + 0.35 * tanh((messages + drive + bias) * scale[step])
latent = gelu(layer_norm(linear(state[readout_nodes])))
policy_logits = policy_head(latent)
value = tanh(value_head(latent))
Repository contents
flynet.safetensorsโ learned FlyNet tensors;flynet-graph.npzโ the actual generated sparse graph;flynet-graph.jsonโ graph schema, seed, ports, and region counts;flynet-config.jsonโ model dimensions and provenance flags;flynet-dataset.npzโ optional labeled training artifact when included in the release;flynet-dataset.jsonโ optional dataset schema, sampler, teacher, and hash;results/training.jsonโ epoch history and held-out metrics;results/release.jsonโ checksums and verification receipt;model_index.jsonโ Hub metadata.
The release receipt is authoritative for the exact file set. Dataset artifacts may be omitted from a deployment-sized release when the accompanying dataset receipt is retained separately.
Quick start
Install the runtime and Hub client in an isolated environment:
python -m pip install 'huggingface_hub' 'safetensors' 'torch' 'numpy' 'python-chess'
git clone https://github.com/EF-Code/flychess.git /content/flychess
python -m pip install -e '/content/flychess[flynet]'
Download the model-only artifacts and run one legal decision:
import os
import chess
from huggingface_hub import hf_hub_download
from flychess.flynet import FlyNetPolicy
from flychess.flynet_training import load_flynet_model
repo_id = os.environ["FLYCHESS_MODEL_REPO"]
weights = hf_hub_download(repo_id=repo_id, filename="flynet.safetensors", repo_type="model")
graph = hf_hub_download(repo_id=repo_id, filename="flynet-graph.npz", repo_type="model")
graph_metadata = hf_hub_download(repo_id=repo_id, filename="flynet-graph.json", repo_type="model")
config = hf_hub_download(repo_id=repo_id, filename="flynet-config.json", repo_type="model")
model = load_flynet_model(
weights,
graph,
graph_metadata_path=graph_metadata,
config_path=config,
device="cpu",
)
policy = FlyNetPolicy(model)
board = chess.Board()
move = policy.select_move(board)
print(move.uci(), policy.win_probability, policy.last_readout)
For a local checkout, the same contract is available through:
python scripts/evaluate_flynet.py \
--dataset /content/flynet-dataset.npz \
--weights /content/flynet-release/flynet.safetensors \
--graph /content/flynet-release/flynet-graph.npz \
--graph-metadata /content/flynet-release/flynet-graph.json \
--config /content/flynet-release/flynet-config.json
Evaluation
The release does not make an unqualified โ100ร betterโ claim. That statement
must be earned by a fixed, held-out comparison protocol covering teacher
agreement, legal-move rate, latency, centipawn loss, and head-to-head games at
matched engine settings. Reported values belong in results/training.json and
the release receipt, alongside the dataset and seed used to obtain them.
Training accuracy is not playing strength. The Stockfish teacher, position sampler, engine depth, color balance, and evaluation set all affect the result; changing any of them creates a new experiment rather than an apples-to-apples improvement.
Limitations and intended use
FlyNet is intended for reproducible research, education, and bounded chess experiments. It is not a general chess engine, a biological model, or a safety-critical decision system. It does not model phototransduction, neuromodulation, development, or the causal semantics of a living nervous system. The environment validates every selected move and may mask illegal actions after neural scoring.
The metadata license is other because the distribution terms for this
project must be read from the release that accompanies the artifact. Do not
assume additional reuse rights from the presence of a Hub repository.