The right scale was worth 55 Elo

Pikafish multiplies the net's score by a scale before the search uses it. Its search margins assume the units of its own nets, so a net from another engine needs a scale of its own. Our first port used 1.70. Fitted to the results of 2,000 Pikafish self-play games, it came out at 0.79.

MatchPer moveWonDrawnLostElo (95%)
Pikafish at 0.79 vs Pikafish at 1.70100,000 nodes4818410+55.0 [+35.1, +75.3]
Pikafish at 1.70 vs Fairy-Stockfish1 second2721,65276+34.3 [+28.1, +40.6]
Pikafish at 0.79 vs Fairy-Stockfish1 second5501,43119+94.5 [+87.5, +101.6]

In both Fairy-Stockfish matches each side ran the CC0 net, so they compare the two searches. Every Pikafish on the site now runs at the fitted scale.

Fine-tuning needs gentler settings than training from scratch

Fine-tuning starts from the CC0 net and trains it on positions scored by a deeper search. The first round used 20 million positions, each scored by Fairy-Stockfish with the CC0 net at 20,000 nodes. All five nets we tested from it lost 171 to 278 Elo against the net they started from. The trainer's defaults were set for a net that starts from random weights:

  • The learning rate, 1.5e-3 and 5e-4, was sized for random weights.
  • The trainer assumed an output scale of 361. The CC0 net's own scores measure about 490, so training shrank every score it learned.
  • Every weight was trainable, including the first layer, which holds most of the net.

To test the settings alone, we retrained the CC0 net on its own scores at the measured scale. Those scores hold nothing the net does not already know, so the best a recipe can do is keep its strength.

Learning rate, layers trainedElo vs CC0 (95%)
2e-5, first layer frozen−3.7 [−14.1, +6.7]
2e-5, all layers−9.5 [−23.4, +4.4]
1e-4, first layer frozen−10.5 [−23.7, +2.6]
1e-4, all layers−33.0 [−54.4, −11.7]

The small rate with the first layer frozen stayed level. The large rate on every layer lost 33.

Px0 predicted game results better than the CC0 net's search

A net only gains from scores that know more than it does. Px0 is an open-source xiangqi engine trained by self-play, which its site describes as "Xiangqi learned from scratch". Its networks are public domain (CC0) and separate from Pikafish's own. Px0 runs a much larger network on a graphics card, so it is slow: about 91 positions a second at one node on ours.

We took 27,705 positions from 200 games between Px0 and Pikafish with the CC0 net, so each source had played one side of every game. Each source's scores were turned into a win chance with its own best-fitting curve, and log loss measures how far those chances were from the results. Lower is better.

Scores fromNodesLog loss
No information (50%)0.6931
Fairy-Stockfish, CC0 net20,0000.6523
Px04000.6305
Px010.6405

Even at one node, Px0 predicted the results better than a 20,000-node search. Its edge came from the decisive games. In drawn games, 85% of the positions, the two were level.

Px0's scores made a stronger net at 100,000 nodes

We scored the same 2 million positions twice, once with Px0 at one node and once with the CC0 net's search, and fine-tuned four nets from CC0 with the gentler settings. Each Px0 net has a twin that differs only in its scores.

NetOpponentWonDrawnLostElo (95%)
Px0 scores, first layer frozenCC0123769108+5.2 [−5.0, +15.4]
CC0 scores, first layer frozenCC0115767118−1.0 [−11.8, +9.7]
Px0 scores, all layersCC012877597+10.8 [+0.8, +20.8]
CC0 scores, all layersCC0116776108+2.8 [−7.2, +12.8]
Px0 scores, first layer frozenIts CC0-scored twin11779885+11.1 [+1.2, +21.0]

The Px0 net with every layer trained is the first of ours whose interval against CC0 sits above zero. The two frozen twins also played each other, and the Px0 one won.

At one second a move the gain was 2.7 Elo

The last test played that net against CC0 at one second a move, under a rule set before it began: stop once the games show a gain of 10 Elo or rule it out. It stopped after 894 games, 853 of them drawn, and ruled it out. The interval runs from −2.2 to +7.6.

Px0's scores carry more than the CC0 net's, but 2 million of them did not turn that into strength at a real time per move. The site's Pikafish keeps the CC0 net at the fitted scale.

Play the xiangqi botPikafish on Mistboard