About
by Wenyou (Tobias) Tian, Daochen Wang, and Rain Zimin Yang
Our model, HexNet, is a neural network $M_\theta$ parametrized by weight vector $\theta$, that takes as input a board configuration $c$ and outputs a value $v_\theta(c) \in [-1,1]$ and stochastic policy $\pi_\theta(c) \in [0,1]^N$, where $N$ is the number of board cells.The main training loop is as follows. More details on the neural network and the tree search appear afterwards.
Repeat for multiple rounds:
- Freeze the network and play 48 complete self-play games, using tree search guided by the frozen network.
- Save training examples $(c_i,t_i,w_i)$, $i = 1,2,\dots$, where:
- $c_i$ is the position.
- $t_i$ is the policy target, the search visit distribution.
- $w_i \in \{-1,+1\}$ is the eventual game outcome from the perspective of the player to move at $c_i$: $+1$ for a win and $-1$ for a loss.
- Repeat the following 80 times: sample a fresh minibatch $B$ of 512 examples uniformly with replacement from the replay buffer, which contains examples from this round and earlier rounds. Take one optimizer step on the loss function $$ \mathcal{L}_B(\theta) = \frac{1}{|B|} \sum_{i \in B} \left[ \bigl(v_\theta(c_i)-w_i\bigr)^2 + \mathrm{D}_{\mathrm{KL}}\!\left( t_i \,\|\, \pi_\theta(c_i) \right) \right] $$ with learning rate $\alpha = 0.002$ and the Adam optimizer.
Neural network
For an $11 \times 11$ board, two input planes pass through a shared trunk of convolutions. The trunk then branches into a policy head, which scores moves, and a value head, which evaluates the position.
1 × 1 convolution
64 → 1 channel
then softmax → policy πθ(c).
1 × 1 convolution
64 → 16 channels · 16 × 11 × 11
5 averages per map → 80 numbers
Whole board + top, bottom, left, right edges
Dense 80 → 32 → 1
ReLU after 32 · tanh after 1
From the player-to-move’s perspective
Tree search
Tree search uses the frozen network to look ahead from a position $c$. Each simulation selects a path, evaluates its endpoint, expands its legal replies, and backs the value up the path. Repeating this process updates the search statistics while the network weights $\theta$ stay fixed.
Write $n(c)$ for a position’s visit count, $W(c)$ for its accumulated backed-up value, and $Q(c)=W(c)/n(c)$ for its average value, measured from the player-to-move’s perspective; set $Q(c)=0$ when $n(c)=0$. For a child $d$ of $c$, let $P(d)$ be the prior assigned to its move by $\pi_\theta(c)$. Selection follows the child with the largest PUCT score:
The first term favors moves with good observed values; the second encourages exploring moves with a high prior and relatively few visits. The minus sign converts the child’s value to its parent’s viewpoint. In the example below, the root has already been evaluated and expanded; its three children start with zero visits and $Q=0$.
Loading the tree-search walkthrough…
This example uses a tiny fixed game and lookup predictions in place of $M_\theta$, and shows eight simulations rather than the training run’s 160 per searched turn. It omits Dirichlet root noise, Gumbel candidate ordering, and opening-move sampling. Actual training reserves up to 16 simulations for distinct unvisited root moves before PUCT takes over. It also reuses subtrees, batches network calls, and checks immediate wins and forced blocks.