Hosted by Darius, founder of Chessengeria.eu, March 2023.
„(…) I'm still having fun experimenting with changes to my NN structure and training new nets using training data from recent games.”.
John Stanback is a well-known creator of strong chess engines who has made significant contributions to the field of computer chess over several decades!
First Zarkov and then Wasp, both of these chess engines have been successful and have many fans. With his knowledge and experience in computer chess programming, John Stanback continues to push the boundaries of what is possible in this field and inspire future generations of computer chess enthusiasts.
Where did your passion for programming chess engines come from?
I've been programming chess engines since 1978. I'm not a good chess player, but I like to think up algorithms and code them. I started by writing a routine in Basic to generate moves, then wrote a text interface and had the engine make random moves. Next, I started adding some really simple evaluation heuristics and a one ply search.
And 45 years later I'm still at it :)
What are the biggest difficulties you have faced in developing chess engines?
I guess the only thing I would view as a difficulty is sometimes failing to improve playing strength after many months of trying out various ideas. Also, occasionally running out of ideas to code and test. Since I've never tried to make a living writing a chess engine, I view most obstacles as fun challenges rather than difficulties.
Are there any special algorithms or techniques that your chess engine uses to be so powerful?
I don't think there is anything unusual about the algorithms I use. I rarely look at the code for other chess engines and never copy anything, but occasionally I get an idea to try out.
Artificial intelligence is a trendy and frequently used phrase. In the context of chess engines, will AI be applicable in the future ? What could be the benefits of it ?
Perhaps AI will be able to suggest better neural network architectures for chess or better ways to train the *NN.
Does your chess engine use recently trending technologies such as machine learning?
What is your experience with implementing *NNUE in your chess engine? What are the advantages and disadvantages of this technique?
I'll provide a combined response to these questions.
Wasp uses a neural network for position evaluation, as do all of the top engines today. I was amazed when Alpha Zero demonstrated how strong an engine using neural network evaluation in combination with a Monte-Carlo tree search could be, and further impressed with the huge gain in strength when Stockfish implemented the NNUE evaluation.
I thought I might be too old or not motivated enough to learn how neural networks work, but after reading just a little bit about them I started writing some functions in C to generate inputs from a board position, and do a "forward pass" to produce an evaluation.
Initially I didn't worry at all about making the routines computationally efficient. I wrote a back-propogation routine and tested and debugged it using the training positions I had been using to tune my hand-crafted evaluation and found that even a fairly small network could get within about 100 Elo of my best handcrafted evaluation.
Initially I tried using a net with 2 hidden layers, but I found that the small 2nd layer I was using didn't help at all, so I changed to a single layer. I then improved the efficiency of the network evaluation and training functions by using SIMD (single instruction, multiple data) instructions and using integers for the forward pass except during training.
I've continuously added training positions taken from games between Wasp and other engines of similar strength and scored them using a short search using the latest NN evaluation. I've done a lot of experimenting with various training parameters such as minibatch size and learn rate and have tried to pick what works best for my engine.
What features or characteristics of your chess engine help it deal with the so-called "horizon effect" - a problem in which it is impossible/difficult to predict further best moves and game outcomes?
I don't have anything special for this. I think that today's fast CPU's and the various tree pruning techniques allow a deep enough search that horizon effect is rarely a problem. Having a stronger evaluation at the leaf nodes also helps a lot.
What are your favorite/used development tools for creating and testing the Wasp engine?
I develop under Windows using Notepad++ and use the gcc compiler from the command line, no *IDE.
Raspberry Pi are very interesting devices although not yet very popular among computer chess enthusiasts. What led you to prepare Wasp compilation for Raspberry Pi ?
I thought it was cool that I could get a fairly powerful computer for around $50. Of course I had to see if Wasp would compile and run on it.
What are your plans for the future with Wasp?
Just keep doing whatever seems interesting. I'm still having fun experimenting with changes to my NN structure and training new nets using training data from recent games. I'm running more games with *FRC and unbalanced openings to try to increase the variety of the training positions.
The creation of chess engines is quite popular. New ones are appearing and growing in strength. What advice or tips can you give to novice programmers who want to create and develop their own chess engines?
I think it's helpful not to worry about playing strength until later in development. The Chess Programmer's Wiki is a great resource.
It's probably more fun and productive to write your own code from scratch. Start by writing a clean move generator and test it using Perft() and try to make it reasonably fast. Then maybe write a simple hand-crafted evaluation using only piece/sq tables and material and don't worry about making it good until the search is working. Write a simple alpha-beta search without any enhancements and get it working well. Then add UCI handling.
By this time you should be hooked and can spend the next 45 years improving it :)
Thank you so much, John, on behalf of Chessengeria.eu Readers and myself, for taking the time to do this interview.
Best wishes for Wasp's future growth!
Further publication and reproduction of this interview is permitted only with the prior permission of Darius, founder of chessengeria.eu
The condition is that the content is preserved in its entirety and that a link to chessengeria.eu is included.
IDE - Integrated Development Environment
FRC - Fischer Random Chess, also known as Chess960.
NN, NNUE - Efficiently Updatable Neural Networks for Deep Reinforcement Learning.
You can find the latest Wasp chess engine for download from its homepage.