top of page

Deep Learning journey!

Deep Learning is a self-learning algorithm that you can put a model on training to make it find patterns and learn. This is applied for chess, too!



Deep Learning Self-Play - Bot journey!

 

In these days, while my Zoe_ChessBot kept playing online with the help of Stockfish 17 and reaching 3008 rapid, on the background me, its owner, started to build a Deep Learning model to make it learn how to play on its own.


Since Lichess is an open-source platform, you can access games and download millions of analyzed fen positions.This is like giving honey to bears! And this is how I've started this journey.




The Goal

 

My objective is create a Deep Learning model that learns how to play first. And to create one that knows how to play good, very good, even better than using Stockfish on a local pc!


Also, i want to build a model that is able to play a full game on its own without the help of Stockfish.




Model Progression (first phase)

 

In my path of creating a good Deep Learning model, i had a few experiments.

I'll share you some informations.Please note that for "param" i mean a FEN position with the analyzed Stockfish move.


  • Model with 220 , 500 and 1000 params:

    Too low params made this embrion models to stop moving after first 5 moves. They simply didn't know what to do and started saying illegal moves (like bishop f1 .. to f1 ?!?).


  • Model with 100k params:

    This was a massive upgrade, but i soon discovered that it had just 5% to find best Stockfish move and after 8 moves it stopped playing (same problem as previous models)!

  • Model with 2m params:

    Ok, let's go all-in! I spent (well, not me but the whole process) a lot of time on training it.. and in the end it had 23% on predicting Stockfish move but in a game against the real Stockfish, it got crushed in only 15 moves.




Model Progression (second phase)

 

This wasn't looking good and my hardware didn't support any more increase in params.

So instead i've programmed a new neural network and other methods, to potentiate this Deep Learning.


  • Model with 100k params:

    Fewer params but this surprisingly had a huge improvement on accuracy: 46%!

    However, in a game against me (a 1800 lichess player) it lost in 17 moves.




Model Progression (third phase)

 

And then i had the idea. Why should i just rely on my model when i already have Stockfish 17? Why don't I let the model think first and if it doesn't find the move it switches with Stockfish?


  • Model with 100k params + Stockfish:

    This time i made this combination play against Lichess engine. This was an improvement, it lost on 31 moves with 90% game-accuracy.. but most of the moves were Stockfish ones.


  • Model with 500k params + Stockfish:

    This model required me 3 hours on Kaggle Tpu Server, it was so long but i thought that this may be even more accurate.Instead, only 26% precision on predicting Stockfish best move!And, in a game with the support of Stockfish, it had a draw against Lichess engine... but 85% of the moves were Stockfish ones.




The "Revolutionary Idea"

 

The problem was the fact that after a few moves it started telling illegal moves and thus switched to Stockfish to keep the game on.

And i found that the issue was on "how" a Deep Learning model makes a prediction: it just says the one move that thinks is the most efficient or that has the most similar pattern with the position.A single shoot. "The predicted move is... XX"


So i thought, instead of make it telling a single move, why don't i make it tell it a few moves and let it select which one to play after evaluating the position after each one?

This is legal, this is programming. This puts together the Deep Learning model with the code and Stockfish.This doesn't mean that it use Stockfish again because in the end the move is really a prediction of the model..


In this way the code can select the predicted move with the best evaluation.


And that's it!


Now the model is able to play a full game on its own without using Stockfish!




The final match! 100k VS 500k!

 

The following is the game between my two models.

They played on their own without using Stockfish.


In the end, the game ended in a draw but we managed to see a "knight sacrifice as TAL".

Both the bots still lack attacking skills, but the game ended with 85% and 87% accuracy respectively!






Next Step: Infinite Self-Play!

 

This game was the milestone of this project.

Now the model is able to play against itself for unlimited games.. and i can make re-do the learning process after each game!


This will add the dataset of trained positions and perhaps improve the bot chess skills!


Please note that this model isn't available on Zoe_ChessBot yet.

I'm using it on my own (for now it's just a code and not a Lichess bot!).

For more information you can write me a message here!

6 visualizzazioni0 commenti

Post recenti

Mostra tutti

Zoe Development Updates

In this post will be added updates of the bot, with its performances and coding advancements. Updates are sorted in chronological order,...

Komentarze


bottom of page