Lc0 Settings

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

Moderators: hgm, Rebel, chrisw

Eduard
Posts: 1439
Joined: Sat Oct 27, 2018 12:58 am
Location: Germany
Full name: N.N.

Lc0 Settings

Post by Eduard »

Is there a page explaining how the different engine Settings work (With minimum and maximum of values)?

I found a page on the Leela homepage, but there are only parameters of Lc0 0.17. That's sad sorry.
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Lc0 Settings

Post by zullil »

Eduard wrote: Thu Aug 01, 2019 1:22 am Is there a page explaining how the different engine Settings work (With minimum and maximum of values)?

I found a page on the Leela homepage, but there are only parameters of Lc0 0.17. That's sad sorry.
You can see all the options, along with their default, min and max values here. What they all mean I cannot say!

Code: Select all

uci
id name Lc0 v0.21.4
id author The LCZero Authors.
option name WeightsFile type string default <autodiscover>
option name Backend type combo default cudnn var cudnn var cudnn-fp16 var opencl var check var random var roundrobin var multiplexing var demux
option name BackendOptions type string default 
option name Threads type spin default 2 min 1 max 128
option name NNCacheSize type spin default 200000 min 0 max 999999999
option name MinibatchSize type spin default 256 min 1 max 1024
option name MaxPrefetch type spin default 32 min 0 max 1024
option name CPuct type string default 3.000000
option name CPuctBase type string default 19652.000000
option name CPuctFactor type string default 2.000000
option name Temperature type string default 0.000000
option name TempDecayMoves type spin default 0 min 0 max 100
option name TempCutoffMove type spin default 0 min 0 max 1000
option name TempEndgame type string default 0.000000
option name TempValueCutoff type string default 100.000000
option name TempVisitOffset type string default 0.000000
option name DirichletNoise type check default false
option name VerboseMoveStats type check default false
option name SmartPruningFactor type string default 1.330000
option name FpuStrategy type combo default reduction var reduction var absolute
option name FpuValue type string default 1.200000
option name FpuStrategyAtRoot type combo default same var reduction var absolute var same
option name FpuValueAtRoot type string default 1.000000
option name CacheHistoryLength type spin default 0 min 0 max 7
option name PolicyTemperature type string default 2.200000
option name MaxCollisionEvents type spin default 32 min 1 max 1024
option name MaxCollisionVisits type spin default 9999 min 1 max 1000000
option name OutOfOrderEval type check default true
option name StickyEndgames type check default true
option name SyzygyFastPlay type check default true
option name MultiPV type spin default 1 min 1 max 500
option name ScoreType type combo default centipawn var centipawn var centipawn_2018 var win_percentage var Q
option name HistoryFill type combo default fen_only var no var fen_only var always
option name KLDGainAverageInterval type spin default 100 min 1 max 10000000
option name MinimumKLDGainPerNode type string default 0.000000
option name Slowmover type string default 1.000000
option name MoveOverheadMs type spin default 200 min 0 max 100000000
option name SyzygyPath type string default 
option name Ponder type check default true
option name ImmediateTimeUse type string default 1.000000
option name RamLimitMb type spin default 0 min 0 max 100000000
option name ConfigFile type string default lc0.config
option name LogFile type string default 
uciok
Fulvio
Posts: 395
Joined: Fri Aug 12, 2016 8:43 pm

Re: Lc0 Settings

Post by Fulvio »

zullil wrote: Thu Aug 01, 2019 1:37 am
Eduard wrote: Thu Aug 01, 2019 1:22 am Is there a page explaining how the different engine Settings work (With minimum and maximum of values)?

I found a page on the Leela homepage, but there are only parameters of Lc0 0.17. That's sad sorry.
You can see all the options, along with their default, min and max values here. What they all mean I cannot say!
There is a brief explanation in the source code:
https://github.com/LeelaChessZero/lc0/b ... ams.cc#L42
https://github.com/LeelaChessZero/lc0/b ... ine.cc#L41
Eduard
Posts: 1439
Joined: Sat Oct 27, 2018 12:58 am
Location: Germany
Full name: N.N.

Re: Lc0 Settings

Post by Eduard »

Thank You!

option name Slowmover type string default 1.000000

Which steps are here possible:

1.0, 2.0 etc.; or 1.1, 1.2, 1.3 etc. ?

And here:

option name MoveOverheadMs type spin default 200 min 0 max 100000000.

Real max 100.000.000 ms, 100.000 seconds? Is this a time to a move or time to game?
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: Lc0 Settings

Post by zullil »

Eduard wrote: Fri Aug 02, 2019 12:01 am Thank You!

option name Slowmover type string default 1.000000

Which steps are here possible:

1.0, 2.0 etc.; or 1.1, 1.2, 1.3 etc. ?

And here:

option name MoveOverheadMs type spin default 200 min 0 max 100000000.

Real max 100.000.000 ms, 100.000 seconds? Is this a time to a move or time to game?
About what values are permitted for the Slowmover multiplier---it is treated as a float, so I assume you could use any decimal value. Just try and see!

MoveOverheadMs is applied to each move. I have no idea why the max is so high.
crem
Posts: 177
Joined: Wed May 23, 2018 9:29 pm

Re: Lc0 Settings

Post by crem »

You can get short description of all parameters by running

Code: Select all

./lc0 --help
in command line.

Here is what it currently outputs:

Code: Select all

  -w,  --weights=STRING
               Path from which to load network weights.
               Setting it to <autodiscover> makes it search in ./ and ./weights/ subdirectories
               for the latest (by file date) file which looks like weights.
               [UCI: WeightsFile  DEFAULT: <autodiscover>]

  -b,  --backend=CHOICE
               Neural network computational backend to use.
               [UCI: Backend  DEFAULT: cudnn  VALUES: cudnn,cudnn-fp16,opencl,check,random,roundrobin,multiplexing,demux]

  -o,  --backend-opts=STRING
               Parameters of neural network backend. Exact parameters differ per backend.
               [UCI: BackendOptions]

  -t,  --threads=1..128
               Number of (CPU) worker threads to use.
               [UCI: Threads  DEFAULT: 2  MIN: 1  MAX: 128]

       --nncache=0..999999999
               Number of positions to store in a memory cache. A large cache can speed up
               searching, but takes memory.
               [UCI: NNCacheSize  DEFAULT: 200000  MIN: 0  MAX: 999999999]

       --minibatch-size=1..1024
               How many positions the engine tries to batch together for parallel NN
               computation. Larger batches may reduce strength a bit, especially with a small
               number of playouts.
               [UCI: MinibatchSize  DEFAULT: 256  MIN: 1  MAX: 1024]

       --max-prefetch=0..1024
               When the engine cannot gather a large enough batch for immediate use, try to
               prefetch up to X positions which are likely to be useful soon, and put them into
               cache.
               [UCI: MaxPrefetch  DEFAULT: 32  MIN: 0  MAX: 1024]

       --cpuct=0.00..100.00
               cpuct_init constant from "UCT search" algorithm. Higher values promote more
               exploration/wider search, lower values promote more confidence/deeper search.
               [UCI: CPuct  DEFAULT: 3.00  MIN: 0.00  MAX: 100.00]

       --cpuct-base=1.00..1000000000.00
               cpuct_base constant from "UCT search" algorithm. Lower value means higher growth
               of Cpuct as number of node visits grows.
               [UCI: CPuctBase  DEFAULT: 19652.00  MIN: 1.00  MAX: 1000000000.00]

       --cpuct-factor=0.00..1000.00
               Multiplier for the cpuct growth formula.
               [UCI: CPuctFactor  DEFAULT: 2.00  MIN: 0.00  MAX: 1000.00]

       --temperature=0.00..100.00
               Tau value from softmax formula for the first move. If equal to 0, the engine
               picks the best move to make. Larger values increase randomness while making the
               move.
               [UCI: Temperature  DEFAULT: 0.00  MIN: 0.00  MAX: 100.00]

       --tempdecay-moves=0..100
               Reduce temperature for every move from the game start to this number of moves,
               decreasing linearly from initial temperature to 0. A value of 0 disables
               tempdecay.
               [UCI: TempDecayMoves  DEFAULT: 0  MIN: 0  MAX: 100]

       --temp-cutoff-move=0..1000
               Move number, starting from which endgame temperature is used rather than initial
               temperature. Setting it to 0 disables cutoff.
               [UCI: TempCutoffMove  DEFAULT: 0  MIN: 0  MAX: 1000]

       --temp-endgame=0.00..100.00
               Temperature used during endgame (starting from cutoff move). Endgame temperature
               doesn't decay.
               [UCI: TempEndgame  DEFAULT: 0.00  MIN: 0.00  MAX: 100.00]

       --temp-value-cutoff=0.00..100.00
               When move is selected using temperature, bad moves (with win probability less
               than X than the best move) are not considered at all.
               [UCI: TempValueCutoff  DEFAULT: 100.00  MIN: 0.00  MAX: 100.00]

       --temp-visit-offset=-1000.00..1000.00
               Adjusts visits by this value when picking a move with a temperature. If a
               negative offset reduces visits for a particular move below zero, that move is
               not picked. If no moves can be picked, no temperature is used.
               [UCI: TempVisitOffset  DEFAULT: 0.00  MIN: -1000.00  MAX: 1000.00]

  -n,  --[no-]noise
               Add Dirichlet noise to root node prior probabilities. This allows the engine to
               discover new ideas during training by exploring moves which are known to be bad.
               Not normally used during play.
               [UCI: DirichletNoise  DEFAULT: false]

       --[no-]verbose-move-stats
               Display Q, V, N, U and P values of every move candidate after each move.
               [UCI: VerboseMoveStats  DEFAULT: false]

       --smart-pruning-factor=0.00..10.00
               Do not spend time on the moves which cannot become bestmove given the remaining
               time to search. When no other move can overtake the current best, the search
               stops, saving the time. Values greater than 1 stop less promising moves from
               being considered even earlier. Values less than 1 causes hopeless moves to still
               have some attention. When set to 0, smart pruning is deactivated.
               [UCI: SmartPruningFactor  DEFAULT: 1.33  MIN: 0.00  MAX: 10.00]

       --fpu-strategy=CHOICE
               How is an eval of unvisited node determined. "First Play Urgency" changes search
               behavior to visit unvisited nodes earlier or later by using a placeholder eval
               before checking the network. The value specified with --fpu-value results in
               "reduction" subtracting that value from the parent eval while "absolute"
               directly uses that value.
               [UCI: FpuStrategy  DEFAULT: reduction  VALUES: reduction,absolute]

       --fpu-value=-100.00..100.00
               "First Play Urgency" value used to adjust unvisited node eval based on
               --fpu-strategy.
               [UCI: FpuValue  DEFAULT: 1.20  MIN: -100.00  MAX: 100.00]

       --fpu-strategy-at-root=CHOICE
               How is an eval of unvisited root children determined. Just like --fpu-strategy
               except only at the root level and adjusts unvisited root children eval with
               --fpu-value-at-root. In addition to matching the strategies from --fpu-strategy,
               this can be "same" to disable the special root behavior.
               [UCI: FpuStrategyAtRoot  DEFAULT: same  VALUES: reduction,absolute,same]

       --fpu-value-at-root=-100.00..100.00
               "First Play Urgency" value used to adjust unvisited root children eval based on
               --fpu-strategy-at-root. Has no effect if --fpu-strategy-at-root is "same".
               [UCI: FpuValueAtRoot  DEFAULT: 1.00  MIN: -100.00  MAX: 100.00]

       --cache-history-length=0..7
               Length of history, in half-moves, to include into the cache key. When this value
               is less than history that NN uses to eval a position, it's possble that the
               search will use eval of the same position with different history taken from
               cache.
               [UCI: CacheHistoryLength  DEFAULT: 0  MIN: 0  MAX: 7]

       --policy-softmax-temp=0.10..10.00
               Policy softmax temperature. Higher values make priors of move candidates closer
               to each other, widening the search.
               [UCI: PolicyTemperature  DEFAULT: 2.20  MIN: 0.10  MAX: 10.00]

       --max-collision-events=1..1024
               Allowed node collision events, per batch.
               [UCI: MaxCollisionEvents  DEFAULT: 32  MIN: 1  MAX: 1024]

       --max-collision-visits=1..1000000
               Total allowed node collision visits, per batch.
               [UCI: MaxCollisionVisits  DEFAULT: 9999  MIN: 1  MAX: 1000000]

       --[no-]out-of-order-eval
               During the gathering of a batch for NN to eval, if position happens to be in the
               cache or is terminal, evaluate it right away without sending the batch to the
               NN. When off, this may only happen with the very first node of a batch; when on,
               this can happen with any node.
               [UCI: OutOfOrderEval  DEFAULT: true]

       --[no-]sticky-endgames
               When an end of game position is found during search, allow the eval of the
               previous move's position to stick to something more accurate. For example, if at
               least one move results in checkmate, then the position should stick as
               checkmated. Similarly, if all moves are drawn or checkmated, the position should
               stick as drawn or checkmate.
               [UCI: StickyEndgames  DEFAULT: true]

       --[no-]syzygy-fast-play
               With DTZ tablebase files, only allow the network pick from winning moves that
               have shortest DTZ to play faster (but not necessarily optimally).
               [UCI: SyzygyFastPlay  DEFAULT: true]

       --multipv=1..500
               Number of game play lines (principal variations) to show in UCI info output.
               [UCI: MultiPV  DEFAULT: 1  MIN: 1  MAX: 500]

       --score-type=CHOICE
               What to display as score. Either centipawns (the UCI default), win percentage or
               Q (the actual internal score) multiplied by 100.
               [UCI: ScoreType  DEFAULT: centipawn  VALUES: centipawn,centipawn_2018,win_percentage,Q]

       --history-fill=CHOICE
               Neural network uses 7 previous board positions in addition to the current one.
               During the first moves of the game such historical positions don't exist, but
               they can be synthesized. This parameter defines when to synthesize them (always,
               never, or only at non-standard fen position).
               [UCI: HistoryFill  DEFAULT: fen_only  VALUES: no,fen_only,always]

       --kldgain-average-interval=1..10000000
               Used to decide how frequently to evaluate the average KLDGainPerNode to check
               the MinimumKLDGainPerNode, if specified.
               [UCI: KLDGainAverageInterval  DEFAULT: 100  MIN: 1  MAX: 10000000]

       --minimum-kldgain-per-node=0.00..1.00
               If greater than 0 search will abort unless the last KLDGainAverageInterval nodes
               have an average gain per node of at least this much.
               [UCI: MinimumKLDGainPerNode  DEFAULT: 0.00  MIN: 0.00  MAX: 1.00]

       --slowmover=0.00..100.00
               Budgeted time for a move is multiplied by this value, causing the engine to
               spend more time (if value is greater than 1) or less time (if the value is less
               than 1).
               [UCI: Slowmover  DEFAULT: 1.00  MIN: 0.00  MAX: 100.00]

       --move-overhead=0..100000000
               Amount of time, in milliseconds, that the engine subtracts from it's total
               available time (to compensate for slow connection, interprocess communication,
               etc).
               [UCI: MoveOverheadMs  DEFAULT: 200  MIN: 0  MAX: 100000000]

  -s,  --syzygy-paths=STRING
               List of Syzygy tablebase directories, list entries separated by system separator
               (";" for Windows, ":" for Linux).
               [UCI: SyzygyPath]

       --[no-]ponder
               This option is ignored. Here to please chess GUIs.
               [UCI: Ponder  DEFAULT: true]

       --immediate-time-use=0.00..1.00
               Fraction of time saved by smart pruning, which is added to the budget to the
               next move rather than to the entire game. When 1, all saved time is added to the
               next move's budget; when 0, saved time is distributed among all future moves.
               [UCI: ImmediateTimeUse  DEFAULT: 1.00  MIN: 0.00  MAX: 1.00]

       --ramlimit-mb=0..100000000
               Maximum memory usage for the engine, in megabytes. The estimation is very rough,
               and can be off by a lot. For example, multiple visits to a terminal node counted
               several times, and the estimation assumes that all positions have 30 possible
               moves. When set to 0, no RAM limit is enforced.
               [UCI: RamLimitMb  DEFAULT: 0  MIN: 0  MAX: 100000000]

  -c,  --config=STRING
               Path to a configuration file. The format of the file is one command line
               parameter per line, e.g.:
               --weights=/path/to/weights
               [UCI: ConfigFile  DEFAULT: lc0.config]

  -l,  --logfile=STRING
               Write log to that file. Special value <stderr> to output the log to the console.
               [UCI: LogFile]
For backend configuration, there is a post in the blog: http://blog.lczero.org/2019/04/backend- ... ation.html
jp
Posts: 1470
Joined: Mon Apr 23, 2018 7:54 am

Re: Lc0 Settings

Post by jp »

crem wrote: Fri Aug 02, 2019 10:16 pm You can get short description of all parameters by running

Code: Select all

./lc0 --help
in command line.
Alexander, can you explain whether analysis can really go bad if you start from the analysis position FEN?

A Leela blog post last year said
Note that the analysis ... for all positions by Leela should be done by not providing the simple FEN or EPD and let it analyze, but by providing a history of moves that ended in that position. ... But practically ... you do not need to provide Leela with a full history from starting position to the desired one, but only 2-3 moves. By making her analyze from a FEN, you are IN A HUGE DANGER of obtaining an analysis that is completely meaningless.
But e.g. you'd think there must be some way for it to analyse the initial position of chess without a problem, and there's no way to give that a history...