The Nostradamus experiment

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
Sylwy
Posts: 4856
Joined: Fri Apr 21, 2006 4:19 pm
Location: IAȘI - the historical capital of MOLDOVA
Full name: Silvian Rucsandescu

Re: The Nostradamus experiment

Post by Sylwy »

David Carteau wrote: Tue Dec 24, 2024 2:11 pm
Thanks Selwy! If you play several games against Zoe, I will be curious to see the results!
A tournament ! :D

viewtopic.php?p=974384#p974384

Merry Christmas !
User avatar
mclane
Posts: 18911
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: The Nostradamus experiment

Post by mclane »

Merry Christmas to all. Yes everything now running ….
What seems like a fairy tale today may be reality tomorrow.
Here we have a fairy tale of the day after tomorrow....
David Carteau
Posts: 151
Joined: Sat May 24, 2014 9:09 am
Location: France
Full name: David Carteau

Re: The Nostradamus experiment

Post by David Carteau »

Hi everyone!

For those who are interested, I have just released version v0.3 of the Nostradamus chess engine.

I spent a few days over the summer holidays working on it. My goal was to explore the Transformers architecture and create my own custom model.

I was largely inspired by Andrej Karpathy's excellent tutorial on how LLMs work. Many thanks to him for sharing this material!

https://www.youtube.com/watch?v=kCc8FmEb1nY

The source code is available if you would like to tweak and train your own version of Nostradamus :)

Regards,

David
Download the Orion chess engine --- Train your NNUE with the Cerebrum library --- Contribute to the Nostradamus experiment !
David Carteau
Posts: 151
Joined: Sat May 24, 2014 9:09 am
Location: France
Full name: David Carteau

Re: The Nostradamus experiment

Post by David Carteau »

Hi all,

I'm happy to share a new version (v0.4) of the Nostradamus engine!

Image

This time, I was able to accurately mimic how language models work: the engine takes a 'sentence' as input (a fenstring), converts it into a sequence of 64 tokens (one per square) and then predicts 3 new tokens iteratively, which will encode the best move ('fr' square, 'to' square and promotion, if applicable).

This iterative prediction process drastically reduces the number of illegal moves: once you know which piece is moving, the target square ('to' token) becomes easier to predict :)

Please do not hesitate to contribute or give feedback to help me improve the model!

David
Download the Orion chess engine --- Train your NNUE with the Cerebrum library --- Contribute to the Nostradamus experiment !
User avatar
Tibono
Posts: 142
Joined: Sat Aug 01, 2015 6:16 pm
Location: France
Full name: Eric Bonneau

Re: The Nostradamus experiment

Post by Tibono »

Hi David,
refreshing experiment. So eccentric! Thanks for sharing.

Yet I am still using v0.2 thanks to Jim Ablett's Win executable, as I had no clue how to install and run v0.3, despite some instructions you included within the package. I did try, but was definitely puzzled :oops: .
David Carteau
Posts: 151
Joined: Sat May 24, 2014 9:09 am
Location: France
Full name: David Carteau

Re: The Nostradamus experiment

Post by David Carteau »

Tibono wrote: Sat Sep 20, 2025 7:00 pm Hi David,
refreshing experiment. So eccentric! Thanks for sharing.

Yet I am still using v0.2 thanks to Jim Ablett's Win executable, as I had no clue how to install and run v0.3, despite some instructions you included within the package. I did try, but was definitely puzzled :oops: .
Hi Tibono,

Thank you for your interest in my little experiment!

If you just want to use the engine, the simplest thing to do is:
- Install Python
- Open a console/terminal and type pip install -U torch==2.7.1 chess==1.11.2 tqdm==4.67.1
- Launch nostradamus.bat

I will try to bundle everything necessary into a ready-to-use executable, but as I have never done this before, it may take me some time: stay tuned!

David
Download the Orion chess engine --- Train your NNUE with the Cerebrum library --- Contribute to the Nostradamus experiment !
User avatar
Tibono
Posts: 142
Joined: Sat Aug 01, 2015 6:16 pm
Location: France
Full name: Eric Bonneau

Re: The Nostradamus experiment

Post by Tibono »

Thanks a lot, David. Merci infiniment.

I succeeded performing this installation. My first run failed with a runtime error: Numpy is not available.
So I performed this additional command: pip install -U numpy ; resulting in: Successfully installed numpy-2.3.3

My first test game was again itself without openings book, ended with a mate after 57 played moves (so yes, it can give a mate!) but the final stats say: 87/114 random moves (76.32%). Is that the order of magnitude to be expected? I suspect there is an issue with my setup. It plays instantly (whilst v0.2 uses few seconds thinking time before moving). Maybe another python library I should install, even if not preventing the engine to run?
David Carteau
Posts: 151
Joined: Sat May 24, 2014 9:09 am
Location: France
Full name: David Carteau

Re: The Nostradamus experiment

Post by David Carteau »

Tibono wrote: Sun Sep 21, 2025 12:05 pm I succeeded performing this installation. My first run failed with a runtime error: Numpy is not available.
So I performed this additional command: pip install -U numpy ; resulting in: Successfully installed numpy-2.3.3
My mistake, sorry, I forgot Numpy ;-)
Tibono wrote: Sun Sep 21, 2025 12:05 pm My first test game was again itself without openings book, ended with a mate after 57 played moves (so yes, it can give a mate!) but the final stats say: 87/114 random moves (76.32%). Is that the order of magnitude to be expected? I suspect there is an issue with my setup. It plays instantly (whilst v0.2 uses few seconds thinking time before moving). Maybe another python library I should install, even if not preventing the engine to run?
After spending some time trying to understand what is going on, I suspect that there is different behaviour when loading with PyTorch 2.7.1+CPU a network saved with PyTorch 2.7.1+CUDA, resulting in a lot more illegal moves. Perhaps this is because I used BFloat16 for training? I'll investigate.

In the meantime, uninstall PyTorch 2.7.1+CPU and install PyTorch 2.7.1+CUDA using the following commands:
- pip uninstall torch
- pip install torch==2.7.1 --index-url https://download.pytorch.org/whl/cu128

Let me know if this solves your problem!

@Community: help needed there! If anyone has already encountered a CUDA-to-CPU problem, assistance would be very helpful!

Thanks!

David
Download the Orion chess engine --- Train your NNUE with the Cerebrum library --- Contribute to the Nostradamus experiment !
David Carteau
Posts: 151
Joined: Sat May 24, 2014 9:09 am
Location: France
Full name: David Carteau

Re: The Nostradamus experiment

Post by David Carteau »

David Carteau wrote: Sun Sep 21, 2025 5:52 pm @Community: help needed there! If anyone has already encountered a CUDA-to-CPU problem, assistance would be very helpful!
Ha ha! I suspect a bug in my code! I'm investigating... :oops:
Download the Orion chess engine --- Train your NNUE with the Cerebrum library --- Contribute to the Nostradamus experiment !
David Carteau
Posts: 151
Joined: Sat May 24, 2014 9:09 am
Location: France
Full name: David Carteau

Re: The Nostradamus experiment

Post by David Carteau »

@Tibono:

The bug has been fixed, but you will need to download the engine again from GitHub. Please confirm that illegal moves have been eliminated :)

I also tried to build a standalone executable (with PyInstaller): you can download it here (please let me know if it works!).

Regards,

David
Download the Orion chess engine --- Train your NNUE with the Cerebrum library --- Contribute to the Nostradamus experiment !