New Giraffe

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
matthewlai
Posts: 791
Joined: Sun Aug 03, 2014 2:48 am
Location: London, UK
Contact:

New Giraffe

Post by matthewlai » Sun Oct 23, 2016 1:15 pm

A few months ago I promised a cleaned up version of Giraffe, but since that actually requires quite a bit of work, I haven't had a chance to get to it till now.

New version: https://bitbucket.org/waterreaction/gir ... 161023.zip

* The biggest change is porting the neural network code from my own DIY framework to Torch (http://torch.ch/). The neural network code was by far the messiest part of Giraffe, and so I'm very happy to have gotten rid of that. However, calling Torch through the Lua interpreter during play is way too slow, so I wrote partial (evaluation only, no training support) Eigen implementations of the Torch modules I use. That means if you are building Giraffe yourself, unless you want to train the net, there's no dependency on Torch. This also means training on Windows is now totally impossible.

* I have removed the move evaluator net for now. I haven't ported that to Torch, and the benefit from that isn't that big anyways.

* ~200 Elo improvement in self-play through optimizing the training process. The only real difference is in eval.

* Network format changed completely. Don't try to use the new net (included in the zip file) with old Giraffe, or old net with new Giraffe. Both will fail spectacularly.

64-bit and 32-bit Windows compiles included. As always, the 32-bit compile was not tested on a 32-bit machine, because I haven't even seen one in years. Also, the 32-bit compile is very slow (~half speed) because Giraffe really needs SSE and ideally SSE2, and for some reason enabling them makes the 32-bit build crash (though strangely, not under wine - only real Windows). It could be due to Eigen (since they do explicit vectorization), or something else. This is unfortunate, but building portable code on Windows is such a big clusterfuck that I'm not going to waste any more time on this. The 64-bit build runs on almost all 64-bit processors. POPCNT doesn't benefit Giraffe noticeably so isn't enabled. It does use SSE3, but the only 64-bit CPUs without SSE3 are early AMD K8s from ~2003.

STS: 9736/15000 @ 1s.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.

Werewolf
Posts: 1184
Joined: Thu Sep 18, 2008 8:24 pm

Re: New Giraffe

Post by Werewolf » Sun Oct 23, 2016 2:27 pm

EXCELLENT, thanks.

Are we to understand that you have improved the eval since the previous release to get the +200 elo?

I thought this was impossible because you couldn't use the giant cluster anymore.

matthewlai
Posts: 791
Joined: Sun Aug 03, 2014 2:48 am
Location: London, UK
Contact:

Re: New Giraffe

Post by matthewlai » Sun Oct 23, 2016 3:01 pm

Werewolf wrote:EXCELLENT, thanks.

Are we to understand that you have improved the eval since the previous release to get the +200 elo?

I thought this was impossible because you couldn't use the giant cluster anymore.
I have my own little 16-core machine for training now :). The training process has also been optimized to be much faster (now takes about 16-24 hours on 16 cores).

Yes, it scores +200 Elo against the last version in self-play at short time controls. Against other opponents at longer time controls it will probably be less.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.

MikeB
Posts: 3267
Joined: Thu Mar 09, 2006 5:34 am
Location: Pen Argyl, Pennsylvania

Re: New Giraffe

Post by MikeB » Sun Oct 23, 2016 4:31 pm

Thank you Matthew -

Below is a link to a MacOS exe version

https://www.dropbox.com/s/89emxa87zyqx2 ... S.zip?dl=1

source is here:
https://bitbucket.org/waterreaction/giraffe/overview

Below are some games against a modified Stockfish at tc 1 1 using the "Throttle" setting. The throttle setting, if set, weakens Stockfish exponentially by limiting search time, the higher the setting , the weaker it plays. The range is from 0 to 20, with zero being full force SF ( no throttling at all) and 20 being the weakest ,i.e most severe throttling. But otherwise, SF is using it's standard and tuned evaluation function. The weaker play is totally derived from limiting the number of positions SF searches.


SF 101016-12y with Throttle setting set to 15
[pgn][Event "Computer Chess Game"]
[Site "Mac-Pro.local"]
[Date "2016.10.23"]
[Round "-"]
[White "Stockfish 101016-12y"]
[Black "Giraffe"]
[Result "0-1"]
[TimeControl "60+1"]
[Annotator "1. +0.15 1... -1.43"]

1. Nf3 {+0.15/4} Nc6 {-1.43/15 2.4} 2. d4 {+1.22/1 0.2} d5 {-1.11/15 2.4}
3. e3 {+0.48/7 0.1} Nf6 {+0.02/15 2.0} 4. Bb5 {+0.48/4 0.2} a6 {-0.71/15 3}
5. Bxc6+ {+0.81/6 0.2} bxc6 {-1.34/17 2.1} 6. Ne5 {+0.81/5 0.1} g6
{-1.34/15 3} 7. Nxc6 {+7.29/3 0.2} Qd6 {+0.19/16 1.6} 8. Ne5 {+1.23/5 0.2}
Nd7 {+0.59/15 3} 9. Nc3 {+0.69/7 0.2} Bg7 {+0.24/15 1.7} 10. O-O
{+1.05/4 0.1} Nxe5 {+3.29/16 2.9} 11. dxe5 {+0.05/8 0.2} Bxe5
{+2.28/16 1.9} 12. Qxd5 {+0.18/9 0.2} Bb7 {+2.90/16 1.8} 13. Qxb7
{+3.59/4 0.1} Rd8 {-7.93/16 1.8} 14. Ne4 {+7.18/6 0.1} Bxh2+ {-7.46/17 2.2}
15. Kh1 {+7.25/1 0.2} Qe5 {-7.03/16 1.9} 16. f4 {+7.40/3 0.1} Qh5
{-4.81/15 1.8} 17. Qc6+ {+3.90/6 0.2} Kf8 {-5.17/14 1.4} 18. Qxc7
{+5.06/4 0.1} Bg3+ {+29.99/24 1.7} 19. Kg1 {-1000.01/1 0.1} Qh2#
{+29.99/27 1.6}
{Black mates} 0-1[/pgn]

Throttle setting set to 10
[pgn][Event "Computer Chess Game"]
[Site "Mac-Pro.local"]
[Date "2016.10.23"]
[Round "-"]
[White "Stockfish 101016-12y"]
[Black "Giraffe"]
[Result "1-0"]
[TimeControl "60+1"]
[Annotator "1. +0.50 1... -1.45"]

1. e4 {+0.50/10} d6 {-1.45/15 2.2} 2. d4 {+0.64/10 0.2} Nf6 {-2.20/14 2.1}
3. Nc3 {+0.81/10 0.1} Bg4 {-3.30/14 1.7} 4. f3 {+1.28/10 0.2} Bd7
{-3.92/16 2.0} 5. e5 {+0.94/11 0.2} Ng8 {-4.50/16 1.6} 6. f4 {+1.08/11 0.2}
dxe5 {-3.12/14 1.8} 7. fxe5 {+1.16/11 0.1} h5 {-4.42/14 2.0} 8. Bg5
{+1.95/10 0.1} Bg4 {-4.50/14 2.0} 9. Nf3 {+2.46/11 0.2} Nc6 {-5.30/14 1.7}
10. Bb5 {+2.50/11 0.2} a6 {-5.92/15 2.2} 11. Ba4 {+2.47/11 0.2} f6
{-4.68/14 2.0} 12. Qd3 {+2.58/11 0.1} b5 {-5.38/15 2.0} 13. d5
{+3.14/11 0.1} Nb4 {-4.24/14 2.9} 14. Qg6+ {+3.00/11 0.2} Kd7
{-4.43/13 1.9} 15. Bb3 {+3.66/11 0.1} fxg5 {-5.68/14 1.8} 16. Nxg5
{+3.58/11 0.1} e6 {-6.21/14 2.8} 17. Nxe6 {+3.54/11 0.1} Qe7 {-5.97/13 2.1}
18. a3 {+5.08/12 0.1} Rh6 {-6.53/13 1.5} 19. Qe4 {+4.91/12 0.2} Qh4+
{-7.86/14 2.7} 20. g3 {+8.21/11 0.2} Qh3 {-9.42/15 1.9} 21. axb4
{+8.52/11 0.1} Bf5 {-8.64/15 2.1} 22. Qd4 {+10.87/10 0.1} h4 {-8.44/13 2.5}
23. Nxf8+ {+11.45/9 0.1} Rxf8 {-8.57/14 1.5} 24. e6+ {+15.26/9 0.2} Ke8
{-9.55/15 2.1} 25. Rxa6 {+18.06/10 0.1} Rg6 {-9.96/16 1.4} 26. Ra8+
{+1000.09/11 0.2} Ke7 {-9.99/16 2.1} 27. d6+ {+1000.08/1 0.1} cxd6
{-9.99/15 1.5} 28. Nd5+ {+1000.07/1 0.2} Kxe6 {-9.99/15 1.8} 29. Rxf8
{+1000.06/9 0.1} Qf1+ {-9.99/15 2.3} 30. Rxf1 {+1000.04/4 0.2} Bd3
{-29.99/15 1.3} 31. Qe3+ {+1000.03/2 0.2} Be4 {-29.99/15 1.5} 32. Qxe4+
{+1000.02/10 0.1} Kd7 {-29.99/17 2.0} 33. Qe8# {+1000.01/1 0.1}
{White mates} 1-0
[/pgn]

Throttle setting set to 13
[pgn][Event "Computer Chess Game"]
[Site "Mac-Pro.local"]
[Date "2016.10.23"]
[Round "-"]
[White "Stockfish 101016-12y"]
[Black "Giraffe"]
[Result "0-1"]
[TimeControl "60+1"]
[Annotator "1. +0.66 1... -1.16"]

1. e4 {+0.66/5} Nc6 {-1.16/16 1.9} 2. d4 {+0.83/8 0.2} d5 {-1.76/16 3} 3.
Nc3 {+0.72/8 0.2} Nf6 {-1.91/15 3} 4. e5 {+0.60/8 0.2} Ne4 {-1.82/15 1.9}
5. Nxe4 {+1.08/9 0.2} dxe4 {-1.71/16 1.7} 6. c3 {+1.08/7 0.1} h5
{-1.21/14 2.0} 7. Qc2 {+1.38/6 0.2} Be6 {-0.20/14 1.6} 8. f3 {+1.12/8 0.2}
exf3 {-1.15/14 2.5} 9. Nxf3 {+1.56/9 0.1} Qd5 {-2.14/14 1.6} 10. Be3
{+1.56/1 0.2} g6 {-1.28/15 1.8} 11. Bd3 {+1.22/8 0.1} O-O-O {-2.76/15 1.5}
12. c4 {+1.30/8 0.2} Qa5+ {-1.64/15 2.3} 13. Bd2 {+0.79/8 0.2} Nb4
{-1.56/18 2.3} 14. Qc3 {+0.47/10 0.2} Nxd3+ {+2.46/16 2.0} 15. Qxd3
{+0.56/9 0.2} Qa6 {+2.44/15 1.5} 16. b3 {+0.71/8 0.1} Bf5 {+1.83/15 1.5}
17. Qc3 {+0.57/8 0.1} Bh6 {+0.64/14 2.1} 18. Bxh6 {+0.92/8 0.2} Rxh6
{-1.02/15 2.5} 19. O-O {+0.83/7 0.2} Qb6 {-1.43/14 2.2} 20. a4
{+1.51/8 0.1} a5 {-0.58/13 1.5} 21. Ng5 {+0.41/7 0.2} Rxd4 {+1.52/16 1.6}
22. c5 {+2.50/8 0.2} Qb4 {+3.41/17 1.5} 23. Qxb4 {-0.18/8 0.1} Rxb4
{+3.67/18 2.1} 24. Nxf7 {-0.78/9 0.1} Rh7 {+2.75/17 1.7} 25. Ng5
{-0.88/8 0.1} Rh8 {+4.42/15 1.6} 26. c6 {-1.00/8 0.1} bxc6 {+5.73/15 1.4}
27. Rac1 {-0.39/8 0.2} Kb7 {+5.41/16 1.7} 28. Rc5 {-1.10/7 0.1} Rxb3
{+6.78/16 1.5} 29. Rfc1 {-1.25/7 0.1} Rd8 {+7.37/16 1.8} 30. Nf7
{-0.91/8 0.2} Rd7 {+7.31/16 2.0} 31. e6 {-1.24/8 0.2} Bxe6 {+7.43/16 2.3}
32. Ne5 {-1.65/9 0.1} Rd5 {+7.18/18 1.6} 33. Nxc6 {-1.15/9 0.2} Rxc5
{+7.02/17 2.2} 34. Rxc5 {-1.15/9 0.1} Kb6 {+6.38/15 1.1} 35. Re5
{-1.20/7 0.2} Bd7 {+7.25/16 1.4} 36. Nxe7 {-1.20/8 0.1} Bxa4 {+7.31/16 1.4}
37. Nd5+ {-1.21/7 0.2} Kb7 {+7.79/16 1.5} 38. Nf4 {-1.97/7 0.1} Bb5
{+8.32/17 1.3} 39. Nxg6 {-2.58/7 0.2} a4 {+8.99/18 1.5} 40. Re1
{-3.83/7 0.1} a3 {+9.43/16 1.1} 41. Kf2 {-3.71/9 0.1} Rb2+ {+9.68/17 1.3}
42. Kg3 {-3.81/8 0.1} a2 {+9.57/18 1.4} 43. Ra1 {-4.97/10 0.2} Bc4
{+9.68/17 1.0} 44. Nf4 {-5.05/10 0.2} Rb1 {+9.75/18 1.2} 45. Rxa2
{-5.32/9 0.2} Bxa2 {+9.78/18 1.5} 46. Nxh5 {-5.64/8 0.2} c5 {+9.86/18 1.2}
47. Nf6 {-5.97/8 0.1} c4 {+9.85/18 1.6} 48. Ne4 {-7.60/8 0.1} c3
{+9.85/17 1.4} 49. h3 {-11.36/7 0.1} c2 {+9.99/18 1.0} 50. Nd6+
{-16.39/7 0.1} Kc6 {+9.99/16 1.0} 51. Nf5 {-17.41/7 0.1} c1=Q
{+9.99/19 1.4} 52. Nd4+ {-18.18/8 0.1} Kc5 {+9.99/19 1.3} 53. Nf3
{-20.00/7 0.1} Rb4 {+29.98/20 1.8} 54. Kf2 {-20.74/8 0.2} Qf4
{+29.98/17 1.1} 55. h4 {-128.46/4 0.2} Bc4 {+29.99/16 1.9} 56. h5
{-1000.03/3 0.2} Rb2+ {+29.99/16 1.1} 57. Kg1 {-1000.02/1 0.1} Rb1+
{+29.99/15 1.9} 58. Kf2 {-1000.01/6 0.2} Rf1# {+29.99/18 1.4}
{Black mates} 0-1[/pgn]

Throttle setting set to 12
[pgn][Event "Computer Chess Game"]
[Site "Mac-Pro.local"]
[Date "2016.10.23"]
[Round "-"]
[White "Stockfish 101016-12y"]
[Black "Giraffe"]
[Result "1-0"]
[TimeControl "60+1"]
[Annotator "1. +0.51 1... -1.16"]

1. e4 {+0.51/7} Nc6 {-1.16/15 1.9} 2. d4 {+0.60/8 0.2} d5 {-2.14/16 2.6} 3.
e5 {+0.52/8 0.2} Bf5 {-1.27/15 2.9} 4. Bb5 {+0.95/9 0.2} e6 {-0.03/15 1.7}
5. Bxc6+ {+0.77/8 0.1} bxc6 {+1.17/15 1.9} 6. Nf3 {+0.61/9 0.1} Bb4+
{+1.34/14 2.0} 7. Nbd2 {+0.58/9 0.2} h5 {+1.83/13 3} 8. c3 {+1.22/9 0.1}
Be7 {+0.40/15 1.5} 9. Nb3 {+0.99/9 0.2} g5 {+0.84/14 3} 10. Na5
{+0.93/9 0.2} g4 {+2.84/15 1.8} 11. Nxc6 {+0.79/9 0.2} Qd7 {+2.04/16 1.6}
12. Nxe7 {+1.74/9 0.1} Nxe7 {+1.19/16 2.0} 13. Nh4 {+1.08/9 0.2} O-O-O
{+1.05/15 2.8} 14. Bg5 {+1.83/9 0.1} Be4 {+0.29/16 2.7} 15. Bf6
{+1.97/9 0.1} Rhg8 {-0.01/15 2.4} 16. Qb3 {+2.29/9 0.2} a5 {+0.00/13 2.6}
17. Rd1 {+2.18/9 0.2} Rde8 {+0.51/13 1.9} 18. Qa3 {+1.65/9 0.1} Qb5
{-0.29/14 2.3} 19. Bxe7 {+4.19/11 0.2} Kb7 {-1.18/13 1.8} 20. Rd2
{+4.37/10 0.1} g3 {-2.84/12 1.5} 21. hxg3 {+5.16/9 0.1} f6 {-5.00/12 1.5}
22. exf6 {+9.35/11 0.1} Rxe7 {-7.29/12 1.3} 23. Qxe7 {+12.96/12 0.1} Rg4
{-9.54/14 1.4} 24. f7 {+15.70/9 0.2} Bxg2 {-9.93/14 1.2} 25. Nxg2
{+22.50/8 0.2} Rg7 {-9.98/14 1.3} 26. Qe8 {+25.33/10 0.2} Qxe8
{-9.99/19 1.3} 27. fxe8=Q {+25.91/10 0.2} c6 {-9.99/21 1.5} 28. Rxh5
{+28.08/10 0.2} a4 {-9.99/18 2.3} 29. Rh8 {+70.25/8 0.1} Kb6 {-9.99/17 1.2}
30. Qd8+ {+70.25/5 0.1} Rc7 {-9.99/16 2.3} 31. Rh7 {+1000.06/1 0.2} e5
{-29.99/13 1.5} 32. Qxc7+ {+1000.03/7 0.1} Kb5 {-29.99/11 2.2} 33. Qb8+
{+1000.02/1 0.1} Ka6 {-29.99/11 2.2} 34. Ra7# {+1000.01/21 0.1}
{White mates} 1-0[/pgn]

matthewlai
Posts: 791
Joined: Sun Aug 03, 2014 2:48 am
Location: London, UK
Contact:

Re: New Giraffe

Post by matthewlai » Sun Oct 23, 2016 4:48 pm

MikeB wrote:Thank you Matthew -

Below is a link to a MacOS exe version

https://www.dropbox.com/s/89emxa87zyqx2 ... S.zip?dl=1

source is here:
https://bitbucket.org/waterreaction/giraffe/overview
Thanks Mike! I am so sorry but I just realized there's one last change that I forgot to push. It fixed a bug that made Giraffe quite a lot weaker. Didn't think someone would grab the sources that quickly!

Would be really nice if you can pull and do another build!

Thanks!

PS. The Windows version is fine. It was already built with the fix.
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.

jmartus
Posts: 198
Joined: Sun May 16, 2010 12:50 am

Re: New Giraffe

Post by jmartus » Sun Oct 23, 2016 5:53 pm

I tried training it with the ccrl epd file and it just gave me a error when I used this in the command console OMP_NUM_THREADS=n ./giraffe tdl ccrl.fen sts.epd

How do I train it from home?

matthewlai
Posts: 791
Joined: Sun Aug 03, 2014 2:48 am
Location: London, UK
Contact:

Re: New Giraffe

Post by matthewlai » Sun Oct 23, 2016 5:55 pm

jmartus wrote:I tried training it with the ccrl epd file and it just gave me a error when I used this in the command console OMP_NUM_THREADS=n ./giraffe tdl ccrl.fen sts.epd

How do I train it from home?
Well, posting the error message would be nice.

Did you install Torch and change the Makefile to set HAS_TORCH to 1 and TORCH_DIR to where your Torch installation is?
Disclosure: I work for DeepMind on the AlphaZero project, but everything I say here is personal opinion and does not reflect the views of DeepMind / Alphabet.

MikeB
Posts: 3267
Joined: Thu Mar 09, 2006 5:34 am
Location: Pen Argyl, Pennsylvania

Re: New Giraffe

Post by MikeB » Sun Oct 23, 2016 7:00 pm

matthewlai wrote:
MikeB wrote:Thank you Matthew -

Below is a link to a MacOS exe version

https://www.dropbox.com/s/89emxa87zyqx2 ... S.zip?dl=1

source is here:
https://bitbucket.org/waterreaction/giraffe/overview
Thanks Mike! I am so sorry but I just realized there's one last change that I forgot to push. It fixed a bug that made Giraffe quite a lot weaker. Didn't think someone would grab the sources that quickly!

Would be really nice if you can pull and do another build!

Thanks!

PS. The Windows version is fine. It was already built with the fix.
Not a problem - MacOS exe updated - same link as before - timestamped 11/23/16 2:53 PM ET.

User avatar
Kirk
Posts: 5615
Joined: Sat Mar 11, 2006 2:44 am

Re: New Giraffe

Post by Kirk » Sun Oct 23, 2016 10:36 pm

matthewlai wrote:A few months ago I promised a cleaned up version of Giraffe, but since that actually requires quite a bit of work, I haven't had a chance to get to it till now.

New version: https://bitbucket.org/waterreaction/gir ... 161023.zip

* The biggest change is porting the neural network code from my own DIY framework to Torch (http://torch.ch/). The neural network code was by far the messiest part of Giraffe, and so I'm very happy to have gotten rid of that. However, calling Torch through the Lua interpreter during play is way too slow, so I wrote partial (evaluation only, no training support) Eigen implementations of the Torch modules I use. That means if you are building Giraffe yourself, unless you want to train the net, there's no dependency on Torch. This also means training on Windows is now totally impossible.

* I have removed the move evaluator net for now. I haven't ported that to Torch, and the benefit from that isn't that big anyways.

* ~200 Elo improvement in self-play through optimizing the training process. The only real difference is in eval.

* Network format changed completely. Don't try to use the new net (included in the zip file) with old Giraffe, or old net with new Giraffe. Both will fail spectacularly.

64-bit and 32-bit Windows compiles included. As always, the 32-bit compile was not tested on a 32-bit machine, because I haven't even seen one in years. Also, the 32-bit compile is very slow (~half speed) because Giraffe really needs SSE and ideally SSE2, and for some reason enabling them makes the 32-bit build crash (though strangely, not under wine - only real Windows). It could be due to Eigen (since they do explicit vectorization), or something else. This is unfortunate, but building portable code on Windows is such a big clusterfuck that I'm not going to waste any more time on this. The 64-bit build runs on almost all 64-bit processors. POPCNT doesn't benefit Giraffe noticeably so isn't enabled. It does use SSE3, but the only 64-bit CPUs without SSE3 are early AMD K8s from ~2003.

STS: 9736/15000 @ 1s.
Hi,

Any plans to upgrade the engine to SMP and able to show Multi-PV?

Thanks!
“He knew all the tricks, dramatic irony, metaphor, pathos, puns, parody, litotes and... satire. He was vicious”

User avatar
Graham Banks
Posts: 32876
Joined: Sun Feb 26, 2006 9:52 am
Location: Auckland, NZ

Re: New Giraffe

Post by Graham Banks » Sun Oct 23, 2016 10:42 pm

matthewlai wrote:A few months ago I promised a cleaned up version of Giraffe, but since that actually requires quite a bit of work, I haven't had a chance to get to it till now.

New version: https://bitbucket.org/waterreaction/gir ... 161023.zip
Thanks Matthew. :)
My email addresses:
gbanksnz at gmail.com
gbanksnz at yahoo.co.nz

Post Reply