Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leela misses "obvious" en passant captures #634

Closed
Elfhelm opened this issue May 19, 2018 · 7 comments
Closed

Leela misses "obvious" en passant captures #634

Elfhelm opened this issue May 19, 2018 · 7 comments

Comments

@Elfhelm
Copy link

Elfhelm commented May 19, 2018

I was playing around with Leela Zero today (platform: Linux, 64-bit, NVIDIA CUDA) and I noticed that it misses strong en passant captures in certain positions.

Here's an example. In the following position, after White plays 1. g4??, Black's best move is to take en passant and then capture the undefended e3-pawn, with a winning advantage. Instead Leela plays something else.

./lczero -w weights_312.txt
position fen r7/1p2rpk1/2pn4/p1Np2p1/P2P3p/1P2P2P/2R2PP1/2R2K2 w - - 2 30
g2g4
go movetime 20000
bestmove f7f5

If White plays 1. g3 instead, Leela spots the right move very quickly:

position fen r7/1p2rpk1/2pn4/p1Np2p1/P2P3p/1P2P2P/2R2PP1/2R2K2 w - - 2 30
g2g3
go movetime 20
bestmove h4g3

On the other hand, Leela doesn't seem to have a problem finding en passant captures in very simple positions, for example:

position fen 8/p7/k7/8/K5p1/6P1/7P/8 w - - 0 1
h2h4
go movetime 1000
bestmove g4h3

Is this worth fixing? I assume it's just a matter of Leela not having much "experience" in positions where en passant captures are possible, so the problem will go away eventually. Still, "eventually" might be a very long time.

@steve3140
Copy link

I just tried this position on my setup (Windows 10, GPU version of lczero.exe 0.10 running as UCI engine in Chessbase Reader) and with NN316 she finds 1...hxg3 in a couple of seconds, less than 1000 nodes.

I then tried running from the command line as you did (something I've not tried before) and this was the result, again with NN316:

C:\Temp>lczero.exe -w weights_316.txt.gz
Using 2 thread(s).
Detecting residual layers...v2...192 channels...15 blocks.
Initializing OpenCL.
Detected 2 OpenCL platforms.
Platform version: OpenCL 2.1
Platform profile: FULL_PROFILE
Platform name: Intel(R) OpenCL
Platform vendor: Intel(R) Corporation
Device ID: 0
Device name: Intel(R) UHD Graphics 620
Device type: GPU
Device vendor: Intel(R) Corporation
Device driver: 22.20.16.4749
Device speed: 1150 MHz
Device cores: 24 CU
Device score: 621
Device ID: 1
Device name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Device type: CPU
Device vendor: Intel(R) Corporation
Device driver: 7.2.0.10
Device speed: 1800 MHz
Device cores: 8 CU
Device score: 521
Platform version: OpenCL 2.0 AMD-APP (2348.4)
Platform profile: FULL_PROFILE
Platform name: AMD Accelerated Parallel Processing
Platform vendor: Advanced Micro Devices, Inc.
Device ID: 2
Device name: Iceland
Device type: GPU
Device vendor: Advanced Micro Devices, Inc.
Device driver: 2348.4
Device speed: 1024 MHz
Device cores: 6 CU
Device score: 1120
Device ID: 3
Device name: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Device type: CPU
Device vendor: GenuineIntel
Device driver: 2348.4 (sse2,avx)
Device speed: 1992 MHz
Device cores: 8 CU
Device score: 520
Selected platform: AMD Accelerated Parallel Processing
Selected device: Iceland
with OpenCL 2.0 capability.
Loaded existing SGEMM tuning.
Wavefront/Warp size: 64
Max workgroup size: 256
Max workgroup dimensions: 256 256 256
BLAS Core: Prescott
info string Found 0 wdl tablebases
info string Found 0 dtz tablebases
position fen r7/1p2rpk1/2pn4/p1Np2p1/P2P3p/1P2P2P/2R2PP1/2R2K2 w - - 2 30
g2g4
usermove g2g4
go movetime 20000
RNG seed: 0xa09af885 (thread: 2712793523)
info depth 6 nodes 2 nps 5 tbhits 0 score cp -98 time 220 pv f7f5 g4f5
info depth 7 nodes 3 nps 9 tbhits 0 score cp -185 time 234 pv g7g6 c5d3
RNG seed: 0x65a6d8d2 (thread: 2720991330)
info depth 9 nodes 8 nps 23 tbhits 0 score cp -168 time 309 pv f7f5 g4f5 g7f6
info depth 10 nodes 14 nps 35 tbhits 0 score cp -187 time 373 pv f7f5 g4f5 d6f5 f1g2 g7f6
info depth 10 nodes 20 nps 43 tbhits 0 score cp -111 time 446 pv f7f5 g4f5 g7f6 f1g2 f6f5
info depth 11 nodes 22 nps 45 tbhits 0 score cp -117 time 470 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3
info depth 11 nodes 34 nps 53 tbhits 0 score cp -100 time 618 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6e4
info depth 11 nodes 38 nps 55 tbhits 0 score cp -83 time 667 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6e4 d3e5
info depth 12 nodes 40 nps 56 tbhits 0 score cp -85 time 692 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6e4 d3e5
info depth 12 nodes 42 nps 57 tbhits 0 score cp -80 time 715 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6e4 d3e5
info depth 14 nodes 198 nps 75 tbhits 0 score cp 26 time 2643 pv f7f5 f1g2 a8f8 g4f5 f8f5 c5d3 d6e4 b3b4 a5b4 d3b4
info depth 15 nodes 295 nps 78 tbhits 0 score cp 102 time 3775 pv h4g3 f1g2 g3f2 g2f2 a8h8 c1h1 d6f5 c2c3 h8e8 h1e1 f5d4 e1g1 d4f5
info depth 15 nodes 383 nps 78 tbhits 0 score cp 140 time 4871 pv h4g3 f1g2 g3f2 g2f2 a8h8 c1h1 d6f5 c2c3 h8e8 h1e1 f5d4 e1g1 d4f5
info depth 16 nodes 500 nps 79 tbhits 0 score cp 167 time 6302 pv h4g3 f1g2 g3f2 g2f2 a8h8 c1h1 d6f5 c2c3 h8e8 h1e1 f5d4 e1g1 d4f5 g1g5
Time Budgeted 19.95s Used 11.47s Saved 8.48s (43%)

info string Rxe3 -> 0 (V: 50.76%) (N: 0.04%) PV: Rxe3
info string Re4 -> 0 (V: 50.76%) (N: 0.05%) PV: Re4
info string Ra6 -> 0 (V: 50.76%) (N: 0.07%) PV: Ra6
info string Re5 -> 0 (V: 50.76%) (N: 0.07%) PV: Re5
info string Rd7 -> 0 (V: 50.76%) (N: 0.10%) PV: Rd7
info string Nf5 -> 0 (V: 50.76%) (N: 0.10%) PV: Nf5
info string Nc4 -> 0 (V: 50.76%) (N: 0.10%) PV: Nc4
info string Nb5 -> 0 (V: 50.76%) (N: 0.10%) PV: Nb5
info string Re6 -> 0 (V: 50.76%) (N: 0.11%) PV: Re6
info string b5 -> 0 (V: 50.76%) (N: 0.11%) PV: b5
info string b6 -> 0 (V: 50.76%) (N: 0.29%) PV: b6
info string Nc8 -> 0 (V: 50.76%) (N: 0.33%) PV: Nc8
info string Ree8 -> 0 (V: 50.76%) (N: 0.57%) PV: Ree8
info string Kh8 -> 0 (V: 50.76%) (N: 0.86%) PV: Kh8
info string Ra7 -> 1 (V: 15.48%) (N: 2.03%) PV: Ra7 Nd3
info string Kf6 -> 1 (V: 16.49%) (N: 2.75%) PV: Kf6 Kg2
info string Rg8 -> 1 (V: 16.77%) (N: 1.14%) PV: Rg8 Nd3
info string Kh6 -> 1 (V: 16.83%) (N: 1.63%) PV: Kh6 Kg2
info string Rh8 -> 1 (V: 18.19%) (N: 1.08%) PV: Rh8 Kg2
info string Kg8 -> 1 (V: 19.46%) (N: 0.92%) PV: Kg8 Kg2
info string Rc7 -> 1 (V: 19.68%) (N: 2.38%) PV: Rc7 Nd3
info string Rd8 -> 1 (V: 19.92%) (N: 1.27%) PV: Rd8 Nd3
info string Kf8 -> 1 (V: 20.20%) (N: 1.36%) PV: Kf8 Kg2
info string Kh7 -> 1 (V: 20.78%) (N: 1.70%) PV: Kh7 Nd3
info string Rb8 -> 1 (V: 21.12%) (N: 1.37%) PV: Rb8 Nd3
info string Ne8 -> 1 (V: 25.80%) (N: 1.28%) PV: Ne8 Nd3
info string Rc8 -> 1 (V: 26.29%) (N: 1.99%) PV: Rc8 Nd3
info string Ne4 -> 1 (V: 30.94%) (N: 1.91%) PV: Ne4 Nxe4
info string f6 -> 3 (V: 42.73%) (N: 7.30%) PV: f6 Nd3 f5
info string Kg6 -> 5 (V: 31.14%) (N: 11.59%) PV: Kg6 Nd3 f5 Ne5+
info string Rae8 -> 6 (V: 36.11%) (N: 7.93%) PV: Rae8 Kg2 f5 gxf5
info string Rf8 -> 15 (V: 41.54%) (N: 7.79%) PV: Rf8 Kg2 f5 gxf5 Rxf5 Nd3 Ne4 b4
info string f5 -> 97 (V: 43.16%) (N: 37.69%) PV: f5 Kg2 Rf8 gxf5 Rxf5 Nd3 Ne4 b4 axb4 Nxb4
info string hxg3 -> 781 (V: 76.71%) (N: 1.98%) PV: hxg3 Kg2 gxf2 Kxf2 Rh8 Rh1 Nf5 Rc3 Rhe8 Re1 Nxd4 Rg1 Nf5 Rxg5+
info string stm Black winrate 71.11%

info depth 17 nodes 922 nps 80 tbhits 0 score cp 222 time 11536 pv h4g3 f1g2 g3f2 g2f2 a8h8 c1h1 d6f5 c2c3 h8e8 h1e1 f5d4 e1g1 d4f5 g1g5
bestmove h4g3

@Elfhelm
Copy link
Author

Elfhelm commented May 20, 2018

I updated my weights from NN312 to NN316 and can confirm that NN316 finds hxg3 much faster. It takes a little more than 1 second on my (admittedly not very impressive) hardware. Here's the output after 1 second:

./lczero -w weights_316.txt 
Using 2 thread(s).
Detecting residual layers...v2...192 channels...15 blocks.
Initializing OpenCL.
Detected 1 OpenCL platforms.
Platform version: OpenCL 1.2 CUDA 9.0.282
Platform profile: FULL_PROFILE
Platform name:    NVIDIA CUDA
Platform vendor:  NVIDIA Corporation
Device ID:     0
Device name:   GeForce 940MX
Device type:   GPU
Device vendor: NVIDIA Corporation
Device driver: 384.111
Device speed:  860 MHz
Device cores:  4 CU
Device score:  1112
Selected platform: NVIDIA CUDA
Selected device: GeForce 940MX
with OpenCL 1.2 capability.
Loaded existing SGEMM tuning.
Wavefront/Warp size: 32
Max workgroup size: 1024
Max workgroup dimensions: 1024 1024 64 
BLAS Core: Prescott
info string Found 0 wdl tablebases
info string Found 0 dtz tablebases
position fen r7/1p2rpk1/2pn4/p1Np2p1/P2P3p/1P2P2P/2R2PP1/2R2K2 w - - 2 30
g2g4
usermove g2g4
go movetime 1000
update_root, 0 -> 0 expanded nodes (0.0% reused)
NNCache: 0/0 hits/lookups = 0.0% hitrate, 0 inserts, 0 size
RNG seed: 0xc1de461d0ac338c1 (thread: 13311663682764956351)
info depth 6 nodes 2 nps 10 tbhits 0 score cp -98 time 96 pv f7f5 g4f5
info depth 7 nodes 3 nps 19 tbhits 0 score cp -185 time 103 pv g7g6 c5d3
RNG seed: 0x645b2c026ef11783 (thread: 5101975080571383265)
info depth 9 nodes 7 nps 44 tbhits 0 score cp -136 time 134 pv f7f5 g4f5 g7f6
info depth 10 nodes 13 nps 70 tbhits 0 score cp -202 time 170 pv f7f5 f1g2 g7f6 g2f3
info depth 10 nodes 21 nps 90 tbhits 0 score cp -113 time 222 pv f7f5 f1g2 a8f8 c5d3 f5g4 h3g4
info depth 11 nodes 23 nps 93 tbhits 0 score cp -105 time 236 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3
info depth 11 nodes 35 nps 111 tbhits 0 score cp -94 time 306 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6e4
info depth 12 nodes 40 nps 118 tbhits 0 score cp -85 time 329 pv f7f5 f1g2 a8f8 c2e2 f5f4 c1e1 f4f3 g2f1
info depth 12 nodes 42 nps 119 tbhits 0 score cp -80 time 344 pv f7f5 f1g2 a8f8 c5d3 f5g4 h3g4 e7e4 d3e5 d6f7 e5f7
info depth 12 nodes 44 nps 119 tbhits 0 score cp -76 time 360 pv f7f5 f1g2 a8f8 c5d3 f5g4 h3g4 e7e4 d3e5 d6f7 e5f7 f8f7

info string  Rxe3 ->       0   (V: 50.76%) (N:  0.04%) PV: Rxe3 
info string   Re4 ->       0   (V: 50.76%) (N:  0.05%) PV: Re4 
info string   Ra6 ->       0   (V: 50.76%) (N:  0.07%) PV: Ra6 
info string   Re5 ->       0   (V: 50.76%) (N:  0.07%) PV: Re5 
info string   Rd7 ->       0   (V: 50.76%) (N:  0.10%) PV: Rd7 
info string   Nf5 ->       0   (V: 50.76%) (N:  0.10%) PV: Nf5 
info string   Nc4 ->       0   (V: 50.76%) (N:  0.10%) PV: Nc4 
info string   Nb5 ->       0   (V: 50.76%) (N:  0.10%) PV: Nb5 
info string   Re6 ->       0   (V: 50.76%) (N:  0.11%) PV: Re6 
info string    b5 ->       0   (V: 50.76%) (N:  0.11%) PV: b5 
info string    b6 ->       0   (V: 50.76%) (N:  0.29%) PV: b6 
info string   Nc8 ->       0   (V: 50.76%) (N:  0.33%) PV: Nc8 
info string  Ree8 ->       0   (V: 50.76%) (N:  0.57%) PV: Ree8 
info string   Kh8 ->       0   (V: 50.76%) (N:  0.86%) PV: Kh8 
info string   Kg8 ->       0   (V: 50.76%) (N:  0.92%) PV: Kg8 
info string   Rh8 ->       0   (V: 50.76%) (N:  1.08%) PV: Rh8 
info string   Rg8 ->       0   (V: 50.76%) (N:  1.14%) PV: Rg8 
info string   Rd8 ->       0   (V: 50.76%) (N:  1.27%) PV: Rd8 
info string   Ne8 ->       0   (V: 50.76%) (N:  1.28%) PV: Ne8 
info string   Kf8 ->       0   (V: 50.76%) (N:  1.36%) PV: Kf8 
info string   Rb8 ->       0   (V: 50.76%) (N:  1.37%) PV: Rb8 
info string   Kh6 ->       0   (V: 50.76%) (N:  1.63%) PV: Kh6 
info string   Kh7 ->       0   (V: 50.76%) (N:  1.70%) PV: Kh7 
info string    f6 ->       1   (V: 13.67%) (N:  7.30%) PV: f6 Kg2
info string   Ra7 ->       1   (V: 15.48%) (N:  2.03%) PV: Ra7 Nd3
info string   Kf6 ->       1   (V: 16.49%) (N:  2.75%) PV: Kf6 Kg2
info string   Rc7 ->       1   (V: 19.68%) (N:  2.38%) PV: Rc7 Nd3
info string   Rc8 ->       1   (V: 26.29%) (N:  1.99%) PV: Rc8 Nd3
info string   Ne4 ->       1   (V: 30.94%) (N:  1.91%) PV: Ne4 Nxe4
info string   Kg6 ->       5   (V: 31.14%) (N: 11.59%) PV: Kg6 Nd3 f5 Ne5+
info string  Rae8 ->       6   (V: 36.11%) (N:  7.93%) PV: Rae8 Kg2 f5 gxf5
info string   Rf8 ->      15   (V: 41.54%) (N:  7.79%) PV: Rf8 Kg2 f5 gxf5 Rxf5 Nd3 Ne4 b4
info string  hxg3 ->      25   (V: 74.55%) (N:  1.98%) PV: hxg3 Kg2 gxf2 Kxf2 Rh8 Rh1 Nf5 Rc3 Rhe8
info string    f5 ->      97   (V: 43.16%) (N: 37.69%) PV: f5 Kg2 Rf8 gxf5 Rxf5 Nd3 Ne4 b4 axb4 Nxb4
info string stm Black winrate 46.57%

info depth 14 nodes 155 nps 161 tbhits 0 score cp -30 time 956 pv f7f5 f1g2 a8f8 g4f5 f8f5 c5d3 d6e4 b3b4 a5b4 d3b4
bestmove f7f5

@Elfhelm
Copy link
Author

Elfhelm commented May 20, 2018

On NN312, Leela does not find hxg3 even after 10,000 nodes. Here's the output:

./lczero -w weights_312.txt 
Using 2 thread(s).
Detecting residual layers...v2...192 channels...15 blocks.
Initializing OpenCL.
Detected 1 OpenCL platforms.
Platform version: OpenCL 1.2 CUDA 9.0.282
Platform profile: FULL_PROFILE
Platform name:    NVIDIA CUDA
Platform vendor:  NVIDIA Corporation
Device ID:     0
Device name:   GeForce 940MX
Device type:   GPU
Device vendor: NVIDIA Corporation
Device driver: 384.111
Device speed:  860 MHz
Device cores:  4 CU
Device score:  1112
Selected platform: NVIDIA CUDA
Selected device: GeForce 940MX
with OpenCL 1.2 capability.
Loaded existing SGEMM tuning.
Wavefront/Warp size: 32
Max workgroup size: 1024
Max workgroup dimensions: 1024 1024 64 
BLAS Core: Prescott
info string Found 0 wdl tablebases
info string Found 0 dtz tablebases
position fen r7/1p2rpk1/2pn4/p1Np2p1/P2P3p/1P2P2P/2R2PP1/2R2K2 w - - 2 30
g2g4
usermove g2g4
go nodes 20000
update_root, 158558 -> 0 expanded nodes (0.0% reused)
info depth 6 nodes 2 nps 56 tbhits 0 score cp -246 time 17 pv f7f5 g4f5
info depth 7 nodes 3 nps 111 tbhits 0 score cp -176 time 17 pv f7f5 g4f5 g7f6
info depth 8 nodes 5 nps 222 tbhits 0 score cp -183 time 17 pv f7f5 f1g2 a8f8 c5d3
info depth 9 nodes 10 nps 500 tbhits 0 score cp -203 time 17 pv f7f5 f1g2 a8f8 c5d3 f5g4
info depth 10 nodes 18 nps 895 tbhits 0 score cp -171 time 18 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3
info depth 10 nodes 20 nps 1000 tbhits 0 score cp -164 time 18 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6f7
info depth 11 nodes 29 nps 1474 tbhits 0 score cp -136 time 18 pv f7f5 g4f5 g7f6 f1g2 f6f5 g2f3 d6e4
info depth 12 nodes 39 nps 2000 tbhits 0 score cp -119 time 18 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 d6f7 b3b4
info depth 13 nodes 103 nps 5100 tbhits 0 score cp -119 time 19 pv f7f5 g4f5 g7f6 f1g2 f6f5 c2c3 g5g4 h3g4 f5g4 f2f3
info depth 15 nodes 301 nps 14286 tbhits 0 score cp -103 time 20 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 e7g7 d3e5 d6f7 e5f7
info depth 15 nodes 371 nps 16818 tbhits 0 score cp -94 time 21 pv f7f5 g4f5 g7f6 f1g2 f6f5 c5d3 e7g7 d3e5 d6f7 e5f7
info depth 16 nodes 442 nps 20045 tbhits 0 score cp -87 time 21 pv a8f8 f1g2 f7f5 g4f5 f8f5 c5d3 d6e4 b3b4 a5b4 d3b4 e7f7 b4d3 f5f3
info depth 16 nodes 450 nps 20409 tbhits 0 score cp -87 time 21 pv a8f8 f1g2 f7f5 g4f5 f8f5 c5d3 d6e4 b3b4 a5b4 d3b4 e7f7 b4d3 f5f3 a4a5
info depth 16 nodes 482 nps 21864 tbhits 0 score cp -86 time 21 pv a8f8 f1g2 f7f5 g4f5 f8f5 c5d3 d6e4 b3b4 a5b4 d3b4 e7f7 b4d3 f5f3 a4a5 g5g4
RNG seed: 0x935c4962cf7448fa (thread: 18048850457057847999)
info depth 18 nodes 1660 nps 25523 tbhits 0 score cp -80 time 64 pv f7f5 g4f5 g7f6 f1g2 f6f5 c2b2 g5g4 h3g4 f5g4 c5d3 h4h3 g2h2 g4f5
info depth 18 nodes 2004 nps 29456 tbhits 0 score cp -78 time 67 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 c2c5 g5g4 h3g4 e4g4 g1h1 f5g5 c5c1 a8h8
NNCache: 4220/10000 hits/lookups = 42.2% hitrate, 5779 inserts, 5779 size
info depth 18 nodes 2169 nps 30971 tbhits 0 score cp -78 time 69 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 c2c5 g5g4 h3g4 e4g4 g1h1 f5g5 c5c1 a8h8 h1h2
info depth 18 nodes 2267 nps 31472 tbhits 0 score cp -78 time 71 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 c2c5 g5g4 h3g4 e4g4 g1h1 f5g5 c5c1 a8h8 h1h2 h4h3
info depth 19 nodes 3365 nps 35042 tbhits 0 score cp -77 time 95 pv f7f5 g4f5 g7f6 f1e2 f6f5 e2d3 d6e4 c5e4 d5e4 d3e2 e7f7 c2c5 f5g6 c1g1 f7f5 c5f5 g6f5 g1c1 g5g4 c1c5
info depth 19 nodes 3609 nps 36816 tbhits 0 score cp -76 time 97 pv f7f5 g4f5 g7f6 f1e2 f6f5 e2d3 d6e4 c5e4 d5e4 d3e2 e7f7 c2c5 f5g6 c1g1 f7f5 c5f5 g6f5 f2f3 a8e8 f3e4
info depth 19 nodes 3708 nps 37444 tbhits 0 score cp -75 time 98 pv f7f5 g4f5 g7f6 f1e2 f6f5 e2d3 d6e4 c5e4 d5e4 d3e2 e7f7 c2c5 f5g6 c1g1 f7f5 c5f5 g6f5 f2f3 e4f3 e2f3 a8e8
info depth 20 nodes 6808 nps 1185 tbhits 0 score cp -69 time 5741 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 e3e4 d5e4 f3e4 f5g6 e4e5 e8f8 e2e3
info depth 20 nodes 6827 nps 1165 tbhits 0 score cp -69 time 5856 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1a1 a5a4 b3a4 b5a4
info depth 20 nodes 7186 nps 898 tbhits 0 score cp -69 time 8000 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1g4 a5a4 e3e4 f5f6 e2g2 a4b3 g4g5
info depth 20 nodes 7603 nps 727 tbhits 0 score cp -70 time 10456 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1c1 a5a4 c1c5 a4b3 c5d5 f5f6 d5b5 e6a6 b5b3
info depth 20 nodes 8362 nps 567 tbhits 0 score cp -71 time 14754 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1c1 a5a4 c1c5 a4b3 c5d5 f5g6 d5b5 e6f6 e2f2
info depth 21 nodes 8558 nps 540 tbhits 0 score cp -71 time 15857 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1c1 f5g6 c1c5 a5a4 c5d5 a4b3 d5b5 e6f6
info depth 21 nodes 8922 nps 500 tbhits 0 score cp -71 time 17832 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1g4 a5a4 e3e4 f5f6 e2g2 a4b3 g4g5 d5e4 f3e4 e6e4 g5g6 f6f7
info depth 21 nodes 9076 nps 486 tbhits 0 score cp -72 time 18687 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1g4 a5a4 e3e4 f5f6 e2g2 a4b3 e4e5 f6f7 g4g5 e6c6 g5g7 f7f8
info depth 21 nodes 10314 nps 404 tbhits 0 score cp -74 time 25496 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1g4 a5a4 e3e4 f5f6 e2g2 a4a3 e4e5 f6f7 g4g5 e6a6 g5g7 f7f8 g7g8

info string  Rxe3 ->       0   (V: 27.64%) (N:  0.03%) PV: Rxe3 
info string   Re4 ->       0   (V: 27.64%) (N:  0.05%) PV: Re4 
info string   Ra6 ->       0   (V: 27.64%) (N:  0.07%) PV: Ra6 
info string   Re5 ->       0   (V: 27.64%) (N:  0.08%) PV: Re5 
info string   Nc4 ->       0   (V: 27.64%) (N:  0.10%) PV: Nc4 
info string   Nb5 ->       0   (V: 27.64%) (N:  0.10%) PV: Nb5 
info string   Re6 ->       0   (V: 27.64%) (N:  0.11%) PV: Re6 
info string   Rd7 ->       0   (V: 27.64%) (N:  0.11%) PV: Rd7 
info string   Nf5 ->       0   (V: 27.64%) (N:  0.11%) PV: Nf5 
info string  hxg3 ->       0   (V: 27.64%) (N:  0.15%) PV: hxg3 
info string    b5 ->       0   (V: 27.64%) (N:  0.17%) PV: b5 
info string   Kh8 ->       1   (V: 17.29%) (N:  0.77%) PV: Kh8 Nd3
info string  Ree8 ->       1   (V: 25.12%) (N:  0.52%) PV: Ree8 Kg2
info string   Nc8 ->       1   (V: 28.65%) (N:  0.33%) PV: Nc8 Nd3
info string    b6 ->       2   (V: 35.95%) (N:  0.30%) PV: b6 Nd3 Rc8
info string   Kf8 ->       3   (V: 23.55%) (N:  1.18%) PV: Kf8 Kg2 f6
info string   Kg8 ->       3   (V: 26.12%) (N:  0.93%) PV: Kg8 Kg2 f6
info string   Kh6 ->       4   (V: 22.47%) (N:  1.48%) PV: Kh6 Nd3 Kg7 b4
info string   Rh8 ->       4   (V: 26.53%) (N:  1.14%) PV: Rh8 Kg2 f5 Nd3
info string   Rg8 ->       4   (V: 26.82%) (N:  1.19%) PV: Rg8 Kg2 f5 Nd3
info string   Rb8 ->       5   (V: 26.11%) (N:  1.55%) PV: Rb8 Kg2 f5 Nd3
info string   Rc7 ->       7   (V: 26.52%) (N:  2.07%) PV: Rc7 Kg2 Re8 Nd3 Rce7
info string   Ne8 ->       7   (V: 29.15%) (N:  1.66%) PV: Ne8 Nd3 Nd6 b4 axb4
info string   Ra7 ->       8   (V: 25.96%) (N:  2.30%) PV: Ra7 Kg2 Ra8 Nd3 f5
info string   Kf6 ->      11   (V: 24.90%) (N:  3.16%) PV: Kf6 Kg2 Rc7 Kf3 Ke7
info string   Kh7 ->      11   (V: 32.71%) (N:  1.73%) PV: Kh7 Kg2 f5 gxf5 Nxf5 Rc3
info string   Rd8 ->      13   (V: 35.82%) (N:  1.29%) PV: Rd8 Kg2 f5 Kf3 Rf8 Kg2
info string   Rc8 ->      23   (V: 35.97%) (N:  2.36%) PV: Rc8 Kg2 f5 Nd3 fxg4 hxg4 Re4
info string   Ne4 ->      27   (V: 39.42%) (N:  1.34%) PV: Ne4 Nxe4 Rxe4 Rc5 f5 gxf5 Kf6 Kg2 Kxf5
info string    f6 ->      80   (V: 35.08%) (N:  9.52%) PV: f6 Kg2 f5 gxf5 Kf6 Rc3 Kxf5 Nd3
info string  Rae8 ->     105   (V: 37.20%) (N:  8.83%) PV: Rae8 Kg2 f5 gxf5 Nxf5 Rc3 Kg6 Nd3 Kf6 Ne5
info string   Kg6 ->     136   (V: 37.59%) (N: 10.39%) PV: Kg6 Nd3 f5 Ne5+ Kf6 Ke2 Nf7 Nd3 fxg4 hxg4
info string   Rf8 ->     628   (V: 41.25%) (N:  6.41%) PV: Rf8 Kg2 f5 gxf5 Rxf5 Nd3 Ne4 b4 axb4 Nxb4 Ref7 Nd3 Rf3 a5 g4
info string    f5 ->    9773   (V: 42.16%) (N: 38.45%) PV: f5 gxf5 Kf6 Ke2 Kxf5 Rg1 Ne4 Nxe4 Rxe4 f3 Re6 Kd3 Rae8 Re2 b5 axb5 cxb5 Rg4 a4 e4+ Kf6 Reg2 axb3 e5+ Kf7 Rxg5 Rc6 Rg7+ Kf8 Rg8+ Ke7
info string stm Black winrate 41.82%

info depth 21 nodes 10858 nps 383 tbhits 0 score cp -75 time 28383 pv f7f5 g4f5 g7f6 f1e2 f6f5 c1g1 d6e4 c5e4 e7e4 f2f3 e4e6 e2d3 a8e8 c2e2 b7b5 a4b5 c6b5 g1g4 a5a4 e3e4 f5f6 e2g2 a4b3 e4e5 f6f7 g4g5 e6c6 g5g7 f7f8 g7g8 f8e7
bestmove f7f5

I had no idea the network was improving that fast.

@Elfhelm
Copy link
Author

Elfhelm commented May 20, 2018

OK, sorry for wasting your time. Should I close this issue?

@killerducky
Copy link
Collaborator

The real problem is LZ needs to know the previous 8 moves leading up to a position. If you only give a FEN it will do weird things, especially in the case of en-passant because it ignores the FEN codes telling about that and instead relies on the previous 8 moves, which are missing here.

@Elfhelm
Copy link
Author

Elfhelm commented May 20, 2018

@killerducky I can confirm that as well. Here's the output from NN312 starting from a position 8 half-moves before the one I initially gave:

./lczero -w weights_312.txt 
Using 2 thread(s).
Detecting residual layers...v2...192 channels...15 blocks.
Initializing OpenCL.
Detected 1 OpenCL platforms.
Platform version: OpenCL 1.2 CUDA 9.0.282
Platform profile: FULL_PROFILE
Platform name:    NVIDIA CUDA
Platform vendor:  NVIDIA Corporation
Device ID:     0
Device name:   GeForce 940MX
Device type:   GPU
Device vendor: NVIDIA Corporation
Device driver: 384.111
Device speed:  860 MHz
Device cores:  4 CU
Device score:  1112
Selected platform: NVIDIA CUDA
Selected device: GeForce 940MX
with OpenCL 1.2 capability.
Loaded existing SGEMM tuning.
Wavefront/Warp size: 32
Max workgroup size: 1024
Max workgroup dimensions: 1024 1024 64 
BLAS Core: Prescott
info string Found 0 wdl tablebases
info string Found 0 dtz tablebases
position fen r3r3/pp3pkp/2pn2p1/3p4/3P4/1P1NP3/P3RPPP/2R2K2 w - - 0 30
a2a4
usermove a2a4
a7a5
usermove a7a5
e2c2
usermove e2c2
e8e7
usermove e8e7
h2h3
usermove h2h3
h7h5
usermove h7h5
d3c5
usermove d3c5
h5h4
usermove h5h4
g2g4
usermove g2g4
go movetime 1000
update_root, 0 -> 0 expanded nodes (0.0% reused)
NNCache: 0/0 hits/lookups = 0.0% hitrate, 0 inserts, 0 size
RNG seed: 0x22ee1bb75c668503 (thread: 1650823960604945066)
info depth 6 nodes 2 nps 9 tbhits 0 score cp -56 time 108 pv h4g3 f2g3
info depth 6 nodes 2 nps 9 tbhits 0 score cp -56 time 108 pv h4g3 f2g3
RNG seed: 0xec10282f188476a2 (thread: 8750623847591276590)
info depth 8 nodes 6 nps 35 tbhits 0 score cp 172 time 143 pv h4g3 f1g2 g3f2 g2f2
info depth 9 nodes 10 nps 50 tbhits 0 score cp 185 time 178 pv h4g3 c2c3 g3f2 f1f2
info depth 10 nodes 14 nps 62 tbhits 0 score cp 231 time 207 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3
info depth 10 nodes 18 nps 73 tbhits 0 score cp 243 time 231 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3
info depth 11 nodes 34 nps 103 tbhits 0 score cp 295 time 319 pv h4g3 c2c3 g3f2 f1f2 a8e8 c1e1 e8h8 f2g2
info depth 12 nodes 43 nps 109 tbhits 0 score cp 304 time 384 pv h4g3 c2c3 g3f2 f1f2 a8e8 c1e1 e8h8 f2g2
info depth 12 nodes 64 nps 125 tbhits 0 score cp 328 time 502 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3 f1f2 e3e7 g3g4
info depth 12 nodes 66 nps 127 tbhits 0 score cp 327 time 512 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3 f1f2 e3e7 g3g4
info depth 13 nodes 82 nps 134 tbhits 0 score cp 325 time 603 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3 f1f2 e3e7 g3g4 g6g5
info depth 13 nodes 95 nps 137 tbhits 0 score cp 334 time 687 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3 f1f2 e3e7 g3g4 g6g5 f2f3
info depth 14 nodes 142 nps 149 tbhits 0 score cp 341 time 943 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3 f1f2 e3e7 g3g4 g6g5 f2f3 f7f5

info string  Rxe3 ->       0   (V: 45.55%) (N:  0.01%) PV: Rxe3 
info string   Ra6 ->       0   (V: 45.55%) (N:  0.01%) PV: Ra6 
info string   Re4 ->       0   (V: 45.55%) (N:  0.01%) PV: Re4 
info string   Re5 ->       0   (V: 45.55%) (N:  0.02%) PV: Re5 
info string   Re6 ->       0   (V: 45.55%) (N:  0.02%) PV: Re6 
info string   Rd7 ->       0   (V: 45.55%) (N:  0.02%) PV: Rd7 
info string   Nc4 ->       0   (V: 45.55%) (N:  0.02%) PV: Nc4 
info string   Nb5 ->       0   (V: 45.55%) (N:  0.02%) PV: Nb5 
info string   Nf5 ->       0   (V: 45.55%) (N:  0.02%) PV: Nf5 
info string    b5 ->       0   (V: 45.55%) (N:  0.04%) PV: b5 
info string   Nc8 ->       0   (V: 45.55%) (N:  0.05%) PV: Nc8 
info string  Ree8 ->       0   (V: 45.55%) (N:  0.07%) PV: Ree8 
info string    b6 ->       0   (V: 45.55%) (N:  0.09%) PV: b6 
info string   Kg8 ->       0   (V: 45.55%) (N:  0.09%) PV: Kg8 
info string   Kh8 ->       0   (V: 45.55%) (N:  0.11%) PV: Kh8 
info string   Ne4 ->       0   (V: 45.55%) (N:  0.11%) PV: Ne4 
info string   Rd8 ->       0   (V: 45.55%) (N:  0.11%) PV: Rd8 
info string   Rg8 ->       0   (V: 45.55%) (N:  0.12%) PV: Rg8 
info string   Kf8 ->       0   (V: 45.55%) (N:  0.12%) PV: Kf8 
info string   Kh7 ->       0   (V: 45.55%) (N:  0.14%) PV: Kh7 
info string   Ra7 ->       0   (V: 45.55%) (N:  0.15%) PV: Ra7 
info string    f6 ->       0   (V: 45.55%) (N:  0.16%) PV: f6 
info string   Kh6 ->       0   (V: 45.55%) (N:  0.18%) PV: Kh6 
info string   Rb8 ->       0   (V: 45.55%) (N:  0.19%) PV: Rb8 
info string   Ne8 ->       0   (V: 45.55%) (N:  0.19%) PV: Ne8 
info string   Rc7 ->       0   (V: 45.55%) (N:  0.22%) PV: Rc7 
info string   Rh8 ->       0   (V: 45.55%) (N:  0.26%) PV: Rh8 
info string   Kf6 ->       0   (V: 45.55%) (N:  0.26%) PV: Kf6 
info string   Rf8 ->       0   (V: 45.55%) (N:  0.27%) PV: Rf8 
info string   Rc8 ->       0   (V: 45.55%) (N:  0.33%) PV: Rc8 
info string    g5 ->       0   (V: 45.55%) (N:  0.54%) PV: g5 
info string  Rae8 ->       0   (V: 45.55%) (N:  0.75%) PV: Rae8 
info string    f5 ->       0   (V: 45.55%) (N:  1.37%) PV: f5 
info string  hxg3 ->     144   (V: 78.09%) (N: 93.97%) PV: hxg3 fxg3 Rxe3 Rc3 Rae8 Rxe3 Rxe3 Kf2 Re7 g4 g5 Kf3 f5 gxf5
info string stm Black winrate 77.87%

info depth 14 nodes 145 nps 150 tbhits 0 score cp 339 time 960 pv h4g3 f2g3 e7e3 c2c3 a8e8 c3e3 e8e3 f1f2 e3e7 g3g4 g6g5 f2f3 f7f5 g4f5
bestmove h4g3

Does this mean that if you're analyzing a game with LZ, you can't go back and forth within a variation or turn the engine on and off?

@killerducky
Copy link
Collaborator

It would be nice if one of these PRs #632 #633 could detect e.p. in the FEN and account for it.

Also see #452 and #443. Let's keep track of this issue in those other PRs/Issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants