New engine: a0lite

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

Moderators: hgm, Rebel, chrisw

dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

New engine: a0lite

Post by dkappe »

For those wanting to tinker with their own NN engine, I present a0lite. It's written in python. The core of the algorithm is just 95 lines.

https://github.com/dkappe/a0lite
It's meant for tinkering. As such, more complex developments will be in branches rather than in the master. Also check out the forks and see what others are doing.

You will need to install badgyal for the neural nets.

By default it uses MeanGirl-8 (32x4) net on CPU. Plays about ~2050 CCRL in this configuration. The shell script a0lite.sh works as a uci engine. You can find a log file, a0lite.log in the same dir as the script.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: New engine: a0lite

Post by dkappe »

I've created a branch called 'fancy' that has tree reuse and 'smart' pruning. On a 2070 with Bad Gyal it plays about 2500 CCRL.

https://github.com/dkappe/a0lite/tree/fancy
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
Jamal Bubker
Posts: 326
Joined: Mon May 24, 2010 4:32 pm

Re: New engine: a0lite

Post by Jamal Bubker »

thank you !
jhellis3
Posts: 546
Joined: Sat Aug 17, 2013 12:36 am

Re: New engine: a0lite

Post by jhellis3 »

This seems like it would be a good test bed for ideas; I wonder what happens if one only increments visits for own moves...
jhellis3
Posts: 546
Joined: Sat Aug 17, 2013 12:36 am

Re: New engine: a0lite

Post by jhellis3 »

I don't really know python syntax but I am guessing

Code: Select all

if turnfactor > 0:
	current.number_visits += 1
in the while loop would get the job done.
cucumber
Posts: 144
Joined: Sun Oct 14, 2018 8:21 pm
Full name: JSmith

Re: New engine: a0lite

Post by cucumber »

Your code is beautifully succinct.
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: New engine: a0lite

Post by dkappe »

I've created a branch called 'batching' that uses virtual loss to gather batches of positions for the gpu. https://github.com/dkappe/a0lite/tree/batching

The speed now seems dominated by the python-chess code, and my inefficient implementation.

On a 2070, the difference with batching is

Code: Select all

info depth 1 seldepth 1 score cp 22 nodes 10000 nps 1170 pv e2e4
bestmove e2e4
and without

Code: Select all

info depth 1 seldepth 1 score cp 28 nodes 10000 nps 446 pv e2e4
bestmove e2e4
Will try to fold in tree reuse in another branch and also get a 256x20 net working.
Last edited by dkappe on Mon Mar 30, 2020 9:30 pm, edited 1 time in total.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: New engine: a0lite

Post by dkappe »

Ah, you'll need to reinstall badgyal, as it has some bulk eval support added.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: New engine: a0lite

Post by dkappe »

Added in a branch that combines batching with tree reuse.

https://github.com/dkappe/a0lite/tree/b ... tree-reuse

I will add in smart pruning in a day or two. Then I will need to think about simplifying the code.
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".
dkappe
Posts: 1631
Joined: Tue Aug 21, 2018 7:52 pm
Full name: Dietrich Kappe

Re: New engine: a0lite

Post by dkappe »

Tried out a0lite with batching and tree reuse at a tc of 30 m + 5 sec. Donna 4.1 lost on time, but it was a foregone conclusion.

[pgn]
[Event "?"]
[Site "?"]
[Date "2020.03.30"]
[Round "2"]
[White "Donna"]
[Black "A0Lite"]
[Result "0-1"]
[ECO "B00"]
[GameDuration "01:03:06"]
[GameEndTime "2020-03-30T21:52:18.464 CDT"]
[GameStartTime "2020-03-30T20:49:12.074 CDT"]
[Opening "KP"]
[PlyCount "106"]
[Termination "time forfeit"]
[TimeControl "1800+5"]
[Variation "Nimzovich defense"]

1. e4 {book} Nc6 {book} 2. d4 {book} e5 {book} 3. d5 {book} Nce7 {book}
4. Nc3 {+0.99/15 149s} Ng6 {-0.35/1 73s} 5. Bc4 {+0.94/14 139s}
Bc5 {-0.12/1 70s} 6. Nf3 {+0.84/14 72s} Nf6 {-0.06/1 68s} 7. h4 {+0.52/14 124s}
d6 {-0.12/1 65s} 8. h5 {+0.66/15 23s} Nf4 {-0.15/1 63s} 9. Bxf4 {+0.42/14 113s}
exf4 {+0.02/1 60s} 10. h6 {+0.43/14 105s} O-O {+0.05/1 58s}
11. hxg7 {+0.29/14 36s} Re8 {-0.03/1 56s} 12. Bd3 {+0.33/15 95s}
Ng4 {+0.11/1 54s} 13. O-O {+0.45/15 18s} Ne5 {+1.00/1 52s}
14. Be2 {+0.20/14 88s} a6 {+1.11/1 50s} 15. Qd2 {+0.12/15 41s} Qf6 {+1.10/1 49s}
16. Nxe5 {+0.12/15 16s} dxe5 {+1.14/1 47s} 17. Na4 {+0.11/15 78s}
Bd4 {+1.19/1 45s} 18. c3 {-0.07/15 72s} Ba7 {+1.23/1 43s} 19. b4 {-0.34/16 67s}
Kxg7 {+1.33/1 42s} 20. Nc5 {+0.11/15 13s} Kh8 {+1.25/1 40s}
21. Rfb1 {-0.25/14 16s} Rg8 {+1.28/1 39s} 22. Bf3 {-0.48/15 13s}
Bg4 {+1.07/1 38s} 23. Qd1 {-1.04/16 61s} Qh4 {+1.53/1 36s}
24. Qd3 {-1.04/16 16s} b6 {+2.13/1 35s} 25. Nxa6 {-0.12/17 18s} b5 {+1.46/1 34s}
26. Nc5 {-0.35/18 11s} c6 {+0.84/1 33s} 27. dxc6 {+0.19/17 54s}
Rad8 {+1.82/1 32s} 28. Qxd8 {-6.44/18 51s} Rxd8 {+2.95/1 30s}
29. Bxg4 {-6.45/19 47s} Qxg4 {+3.48/1 30s} 30. f3 {-6.28/19 44s}
Qg3 {+3.34/1 29s} 31. Rb2 {-6.39/18 8.5s} Bxc5+ {+2.71/1 28s}
32. bxc5 {-5.14/19 41s} Rg8 {+2.26/1 27s} 33. Rf1 {-5.56/17 38s}
Rc8 {+2.40/1 26s} 34. c7 {-4.85/16 20s} Rxc7 {+2.38/1 25s}
35. Rxb5 {-5.07/15 20s} Kg7 {+2.87/1 24s} 36. a4 {-5.17/18 33s}
Qg5 {+2.69/1 23s} 37. Rd1 {-3.87/18 31s} Qg3 {+2.58/1 23s} 38. a5 {-4.19/17 29s}
h5 {+2.20/1 22s} 39. a6 {-3.67/17 27s} h4 {+2.05/1 21s} 40. Rb2 {-4.88/17 10s}
Ra7 {+2.36/1 21s} 41. Ra1 {-5.67/18 25s} h3 {+2.25/1 20s} 42. c6 {-5.72/18 24s}
Qg6 {+1.60/1 19s} 43. c7 {-6.10/16 7.0s} Qc6 {+1.88/1 19s}
44. gxh3 {-5.33/15 12s} Qxc7 {+2.70/1 18s} 45. Rba2 {-5.90/15 22s}
Qc4 {+3.29/1 18s} 46. h4 {-5.90/15 12s} Qd3 {+3.66/1 17s} 47. Kf2 {-5.82/15 20s}
Qe3+ {+3.44/1 17s} 48. Kg2 {-5.89/15 19s} Qxc3 {+3.42/1 16s}
49. Rf1 {-6.46/15 18s} Kg6 {+3.55/1 16s} 50. Rff2 {-6.42/14 17s}
Kh7 {+3.47/1 16s} 51. Kh2 {-6.68/14 8.6s} Kh6 {+3.70/1 15s}
52. Rac2 {-6.73/15 3.5s} Qe3 {+3.82/1 15s} 53. Rce2 {-6.99/15 16s}
Qa3 {+4.05/1 14s, White loses on time} 0-1
[/pgn]
Fat Titz by Stockfish, the engine with the bodaciously big net. Remember: size matters. If you want to learn more about this engine just google for "Fat Titz".