Answers.Body: <p>The bigger weights file corresponds to a larger Neural Network, which means more computation per node, but better evaluation per node.This is expected, and there is nothing that can make a bigger NN as fast as a smaller NN. The best solution is to use a small NN for blitz time control. I would personally recommend LD2 (available at Lc0.org/LD2)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-19T05:33:47.667Z
Answers.LastActivityDate: 2019-10-19T05:33:47.667Z
Answers.UserDisplayName: Oscar Smith
Body: <p>I have two weight files, one with a size of 6MB and the other <a href="http://lczero.org/get_network?sha=8e36e7bb2f857eadf3163cb5d6cc3c5800fac0eba5951f8b1e51e3b732ee938b" rel="nofollow noreferrer">45MB</a> (files is listed <a href="http://lczero.org/networks/http://lczero.org/networks/" rel="nofollow noreferrer">here</a>). The problem is that when I start to compute a move, it takes too much time, especially when I use the larger weight file. Below I start lc0 with the larger weight file</p>
  
  <pre><code>$&gt; ./build/release/lc0 --weights=/weights/weight-4305
         _
  |   _ | |
  |_ |_ |_| v0.23.0-dev+git.9bac230 built Oct 17 2019
  </code></pre>
  
  <p>and compute a move</p>
  
  <pre><code>position fen rnb1kb1r/pp1p1ppp/4pn2/q7/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 3 6
  go  wtime 59000 btime 59000
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>Loading weights file from: /weights/weight-4305
  Creating backend [blas]...
  Using Eigen version 3.3.5
  BLAS max batch size is 256.
  info depth 1 seldepth 1 time 193 nodes 1 score cp 44 hashfull 0 nps 5 
  tbhits 0 pv d4b3
  bestmove d4b3
  </code></pre>
  
  <p>This takes approximately 3 seconds. Now, when I do this computation again, it seems to take even more time</p>
  
  <pre><code>position fen rnb1kb1r/pp1p1ppp/4pn2/q7/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 3 6
  go  wtime 59000 btime 59000
  info depth 2 seldepth 2 time 4957 nodes 3 score cp 44 hashfull 0 nps 0 tbhits 0 pv c1d2 a7a6
  bestmove c1d2 ponder a7a6
  </code></pre>
  
  <p>If I use the smaller weight file it takes about 1 seconds. </p>
  
  <p>In my case I would like to use lc0 to play 1 minute games, so these delays are way to huge. For example, I'm also using Stockfish which doesn't have these issues. </p>
  
  <p>I would like to play 1 minutes games with lc0, but with these slow computation times it is not possible. Is there a way to speed things up?</p>
  
  <p>If you want to see it yourself, I've published <code>lc0</code> on my <a href="https://cloud.docker.com/repository/list" rel="nofollow noreferrer">DockerHub</a>, so you can try it out yourself</p>
  
  <p>Using the smaller weight file:</p>
  
  <pre><code>$&gt; docker run --rm -it jeanluca/leela-chess-zero:1.0.2
  </code></pre>
  
  <p>And to run the one using the bigger weight file</p>
  
  <pre><code>$&gt; docker run --rm -it jeanluca/leela-chess-zero:latest
  </code></pre>
  
  <p>After you have entered one of the above commands you can simply past the positions into the terminal and see the result</p>
  
  <p>Also, to get an idea of how I've build lc0, here is my dockerfile</p>
  
  <p>From jeanluca/base:latest</p>
  
  <pre><code>RUN apt update &amp;&amp; apt install clang-6.0 ninja-build pkg-config protobuf-compiler libprotobuf-dev meson -y &amp;&amp;\
  git clone https://github.com/LeelaChessZero/lc0.git &amp;&amp;\
  cd lc0 &amp;&amp; ./build.sh -Dblas=true -Deigen=true
  COPY ./weights /weights
  CMD ["/lc0/build/release/lc0", "--weights=/weights/weight-4305", "--threads=4" ]
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-18T16:04:00.700Z
Comments.Text: Looks fine to me, but you should clarify your exact question. It's hard to find in the code and explanations.
Comments.UserDisplayName: Herb
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-18T19:11:27.027Z
Comments.Text: It turns out that the bigger the weight file, the more time it takes to compute moves. It can be solved to use the GPU, which I don't have / or can't use :(
Comments.UserDisplayName: Jeanluca Scaljeri
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-10-21T07:49:23.340Z
Comments.Text: Without GPU, I think there is little reason to try to use lc0.
Comments.UserDisplayName: RemcoGerlich
Tags: <performance><leela>
Title: Lc0 gets slower if weight file gets bigger
ThreadText: # Lc0 gets slower if weight file gets bigger
  
  (Asked by: username_0 on 2019-10-18)
  
  I have two weight files, one with a size of 6MB and the other [45MB](http://lczero.org/get_network?sha=8e36e7bb2f857eadf3163cb5d6cc3c5800fac0eba5951f8b1e51e3b732ee938b) (files is listed [here](http://lczero.org/networks/http://lczero.org/networks/)). The problem is that when I start to compute a move, it takes too much time, especially when I use the larger weight file. Below I start lc0 with the larger weight file
  
  ```
  $> ./build/release/lc0 --weights=/weights/weight-4305
         _
  |   _ | |
  |_ |_ |_| v0.23.0-dev+git.9bac230 built Oct 17 2019
  
  ```
  
  and compute a move
  
  ```
  position fen rnb1kb1r/pp1p1ppp/4pn2/q7/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 3 6
  go  wtime 59000 btime 59000
  
  ```
  
  I get
  
  ```
  Loading weights file from: /weights/weight-4305
  Creating backend [blas]...
  Using Eigen version 3.3.5
  BLAS max batch size is 256.
  info depth 1 seldepth 1 time 193 nodes 1 score cp 44 hashfull 0 nps 5 
  tbhits 0 pv d4b3
  bestmove d4b3
  
  ```
  
  This takes approximately 3 seconds. Now, when I do this computation again, it seems to take even more time
  
  ```
  position fen rnb1kb1r/pp1p1ppp/4pn2/q7/3NP3/2N5/PPP2PPP/R1BQKB1R w KQkq - 3 6
  go  wtime 59000 btime 59000
  info depth 2 seldepth 2 time 4957 nodes 3 score cp 44 hashfull 0 nps 0 tbhits 0 pv c1d2 a7a6
  bestmove c1d2 ponder a7a6
  
  ```
  
  If I use the smaller weight file it takes about 1 seconds.
  
  In my case I would like to use lc0 to play 1 minute games, so these delays are way to huge. For example, I'm also using Stockfish which doesn't have these issues.
  
  I would like to play 1 minutes games with lc0, but with these slow computation times it is not possible. Is there a way to speed things up?
  
  If you want to see it yourself, I've published `lc0` on my [DockerHub](https://cloud.docker.com/repository/list), so you can try it out yourself
  
  Using the smaller weight file:
  
  ```
  $> docker run --rm -it username_0/leela-chess-zero:1.0.2
  
  ```
  
  And to run the one using the bigger weight file
  
  ```
  $> docker run --rm -it username_0/leela-chess-zero:latest
  
  ```
  
  After you have entered one of the above commands you can simply past the positions into the terminal and see the result
  
  Also, to get an idea of how I've build lc0, here is my dockerfile
  
  From username_0/base:latest
  
  ```
  RUN apt update && apt install clang-6.0 ninja-build pkg-config protobuf-compiler libprotobuf-dev meson -y &&\
  git clone https://github.com/LeelaChessZero/lc0.git &&\
  cd lc0 && ./build.sh -Dblas=true -Deigen=true
  COPY ./weights /weights
  CMD ["/lc0/build/release/lc0", "--weights=/weights/weight-4305", "--threads=4" ]
  
  ```
  
  **Tags:** performance, leela
  
  > **Comments:**
  > **username_1**: Looks fine to me, but you should clarify your exact question. It's hard to find in the code and explanations.  
  > **username_0**: It turns out that the bigger the weight file, the more time it takes to compute moves. It can be solved to use the GPU, which I don't have / or can't use :(  
  > **username_2**: Without GPU, I think there is little reason to try to use lc0.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2019-10-19. Score: 5 | Accepted answer
  
  The bigger weights file corresponds to a larger Neural Network, which means more computation per node, but better evaluation per node.This is expected, and there is nothing that can make a bigger NN as fast as a smaller NN. The best solution is to use a small NN for blitz time control. I would personally recommend LD2 (available at Lc0.org/LD2)
  
  
  ---
  
  