Skip to content

Conversation

@Naphthalin
Copy link
Contributor

This PR allows for temp decay to start only after a given number of moves, and interprets TempDecayMoves as the length of the decay, starting at TempDecayStartMove. Default value 0 maintains backwards compatibility with old training parameters.

The first commit still allows temperature to be below endgame temperature during the decay, while the 2nd commit fixes this and caps the temp decay at the endgame temperature.

Naphthalin and others added 5 commits April 15, 2020 15:01
…umber of moves. This allows keeping initial game up for a few moves and still use decay.
…y. Still allows initial temp to be below endgame temp.
…y. Still allows initial temp to be below endgame temp.
@Naphthalin
Copy link
Contributor Author

The first commit still allows temperature to be below endgame temperature during the decay, while the 2nd commit fixes this and caps the temp decay at the endgame temperature.

The current formula doesn't check whether temperature has decayed below the specified endgame temperature. As I think this is unintended behavior and we neither did that intentionally in the past nor have any use case for this, the next commit also fixes this behavior.

@Tilps
Copy link
Contributor

Tilps commented Apr 22, 2020

I think discussion suggested hiding all the temp parameters.

"A value of 0 disables tempdecay."};
const OptionId SearchParams::kTempDecayStartMoveId{
"tempdecay-start-move", "TempDecayStartMove",
"Start the linear decrease of temperature after this number of moves, "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems wrong to number moves from 0?
Also to me "starting decay from move 2" sounds like move should already receive reduced temperature at move, and I guess that doesn't happen here.

E.g. currently if --temp-decay-start-move=1, then the first move to recieve reduced temperature is actually move 3.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename it to temp decay delay? - 0 means the decay line attaches at move 1, 1 means it attaches at move 2 (3rd ply)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be fine with either, renaming the variable or correct the off-by-one error explicitly.

E.g. currently if --temp-decay-start-move=1, then the first move to recieve reduced temperature is actually move 3.

but this already means that we have an off by one error already in the current code, right?

@Tilps Tilps merged commit c4c92f6 into LeelaChessZero:master Apr 23, 2020
AlexisOlson added a commit to AlexisOlson/lc0 that referenced this pull request May 10, 2020
* Added TempDecayStartMove for starting temp decay only after a given number of moves. This allows keeping initial game up for a few moves and still use decay.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Hide temp options

* renamed TempDecayStartMove to TempDecayDelayMoves

Co-authored-by: Alexis Olson <AlexisOlson@gmail.com>
AlexisOlson added a commit to AlexisOlson/lc0 that referenced this pull request May 10, 2020
* Time management refactoring (LeelaChessZero#1195)

* Appended files.

* Compiles.

* Compiles again.

* Make smart pruning use smoothed nps.

* Seems to be fully implemented.

* Mistype.

* One more bug.

* Found discrepancy with documentaiton.

* Bugfixes.

* Don't smooth nps during the first move.

* Too large default for timeuse decay.

* Bugfix.

* Fix build.

* Relax defaults a bit. Add fixed to logging.

* Remove "smooth" to "smooth-experimental" for now.

* MLH verbose stats - Issue 1200  (LeelaChessZero#1230)

* Add M effect logic to output section

* Fix missing prefixes and semicolons

* Some fixes.

* Slight format improvement?

Co-authored-by: Tilps <Tilps@users.noreply.github.com>

* Start TempDecay only after a given number of moves (LeelaChessZero#1212)

* Added TempDecayStartMove for starting temp decay only after a given number of moves. This allows keeping initial game up for a few moves and still use decay.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Hide temp options

* renamed TempDecayStartMove to TempDecayDelayMoves

Co-authored-by: Alexis Olson <AlexisOlson@gmail.com>

* Changelog for 0.25.0-rc2. (LeelaChessZero#1233)

* Changelog for 0.25.0-rc2.

* Add one more PR to the changelog.

* Cuda winograd (LeelaChessZero#1228)

* custom winograd convolution for cuda backends

* custom winograd fixes

- fix a bug to make it work for non-SE networks
- enable by default only with fp32.

* address review comments

* remove random line in comment

* remove unused constants

- W,H are hardcoded to 8 - because there are assumptions in the code based on that. No point in defining constants.

* cuda winograd fixes (LeelaChessZero#1238)

* cuda winograd fixes
- don't typecast directly to half datatype in CPU side code as older CUDA runtime doesn't support that.
 - don't use gemmEx version on GPUs older than Maxwell generation (not supported).
 - modify the check to enable custom_winograd setting. It should be faster in most cases - except  presently on RTX GPUs when using fp16.

* Allow most parts of fen to be optional. (LeelaChessZero#1234)

Default to white to move, no castling, no en passant, 0 rule50ply, 1 total move. Also convert other string to std::string and removing using.

* Fix UpdateNps to actually smooth the nps and correctly handle time_since_movestart_ms == 0 (LeelaChessZero#1243)

* Update changelog for 0.25.0 final release. (LeelaChessZero#1244)

* Always report at least 1 depth. (LeelaChessZero#1247)

* Fix un-intended regression for GTX GPUs (LeelaChessZero#1246)

* memory optimization for cudnn custom_winograd (LeelaChessZero#1250)

* memory optimization for cudnn custom_winograd

- don't save untransformed weights
- print warning message when low memory is detected.

* address review comments

* fix warning message

* fix total weight size calculation

2 layers per residual block!

* keep pdb files only for release builds  (LeelaChessZero#1256)

* doc update (LeelaChessZero#1267)

* Include verbose stats for the node. (LeelaChessZero#1268)

Use printing lambdas for parts of the verbose output to share between the newly outputted node and its children.

* add alphazero time manager (LeelaChessZero#1201)

* Updated FLAGS.md with logfile flag (LeelaChessZero#1275)

* Fixed a typo in CONTRIBUTING.md (LeelaChessZero#1274)

* Update Readme about using git (LeelaChessZero#1265)

* Make `wl_` double. (LeelaChessZero#1280)

* Move move filter population to a constructor. (LeelaChessZero#1281)

* Filter out illegal searchmoves to avoid crashing. (LeelaChessZero#1282)

* Clear policy for terminal loss. (LeelaChessZero#1285)

* Allow smart pruning to terminate search if win is known. (LeelaChessZero#1284)

* Allow smart pruning to terminate search if win is known.

* Minor tweak, better safe than sorry.

* Fix bug where pv might not update for best move change. (LeelaChessZero#1286)

* Fix bug where pv might not update.

* Fix...

Co-authored-by: Alexander Lyashuk <crem@google.com>
Co-authored-by: Tilps <Tilps@users.noreply.github.com>
Co-authored-by: Naphthalin <40385638+Naphthalin@users.noreply.github.com>
Co-authored-by: Ankan Banerjee <ankan.ban@gmail.com>
Co-authored-by: Ed Lee <edilee@mozilla.com>
Co-authored-by: borg323 <39573933+borg323@users.noreply.github.com>
Co-authored-by: Hace <mellekoning@gmail.com>
Co-authored-by: Kip Hamiltons <48076495+KipHamiltons@users.noreply.github.com>
Co-authored-by: nguyenpham <axchess@yahoo.com>
Tilps added a commit that referenced this pull request Jun 28, 2020
* Time management refactoring (#1195)

* Appended files.

* Compiles.

* Compiles again.

* Make smart pruning use smoothed nps.

* Seems to be fully implemented.

* Mistype.

* One more bug.

* Found discrepancy with documentaiton.

* Bugfixes.

* Don't smooth nps during the first move.

* Too large default for timeuse decay.

* Bugfix.

* Fix build.

* Relax defaults a bit. Add fixed to logging.

* Remove "smooth" to "smooth-experimental" for now.

* MLH verbose stats - Issue 1200  (#1230)

* Add M effect logic to output section

* Fix missing prefixes and semicolons

* Some fixes.

* Slight format improvement?

Co-authored-by: Tilps <Tilps@users.noreply.github.com>

* Start TempDecay only after a given number of moves (#1212)

* Added TempDecayStartMove for starting temp decay only after a given number of moves. This allows keeping initial game up for a few moves and still use decay.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Hide temp options

* renamed TempDecayStartMove to TempDecayDelayMoves

Co-authored-by: Alexis Olson <AlexisOlson@gmail.com>

* Changelog for 0.25.0-rc2. (#1233)

* Changelog for 0.25.0-rc2.

* Add one more PR to the changelog.

* Cuda winograd (#1228)

* custom winograd convolution for cuda backends

* custom winograd fixes

- fix a bug to make it work for non-SE networks
- enable by default only with fp32.

* address review comments

* remove random line in comment

* remove unused constants

- W,H are hardcoded to 8 - because there are assumptions in the code based on that. No point in defining constants.

* cuda winograd fixes (#1238)

* cuda winograd fixes
- don't typecast directly to half datatype in CPU side code as older CUDA runtime doesn't support that.
 - don't use gemmEx version on GPUs older than Maxwell generation (not supported).
 - modify the check to enable custom_winograd setting. It should be faster in most cases - except  presently on RTX GPUs when using fp16.

* Allow most parts of fen to be optional. (#1234)

Default to white to move, no castling, no en passant, 0 rule50ply, 1 total move. Also convert other string to std::string and removing using.

* Fix UpdateNps to actually smooth the nps and correctly handle time_since_movestart_ms == 0 (#1243)

* Update changelog for 0.25.0 final release. (#1244)

* Always report at least 1 depth. (#1247)

* Fix un-intended regression for GTX GPUs (#1246)

* memory optimization for cudnn custom_winograd (#1250)

* memory optimization for cudnn custom_winograd

- don't save untransformed weights
- print warning message when low memory is detected.

* address review comments

* fix warning message

* fix total weight size calculation

2 layers per residual block!

* keep pdb files only for release builds  (#1256)

* doc update (#1267)

* Include verbose stats for the node. (#1268)

Use printing lambdas for parts of the verbose output to share between the newly outputted node and its children.

* add alphazero time manager (#1201)

* Updated FLAGS.md with logfile flag (#1275)

* Fixed a typo in CONTRIBUTING.md (#1274)

* Update Readme about using git (#1265)

* Make `wl_` double. (#1280)

* Move move filter population to a constructor. (#1281)

* Filter out illegal searchmoves to avoid crashing. (#1282)

* Clear policy for terminal loss. (#1285)

* Allow smart pruning to terminate search if win is known. (#1284)

* Allow smart pruning to terminate search if win is known.

* Minor tweak, better safe than sorry.

* Fix bug where pv might not update for best move change. (#1286)

* Fix bug where pv might not update.

* Fix...

* Catch up to master (#6)

* Time management refactoring (#1195)

* Appended files.

* Compiles.

* Compiles again.

* Make smart pruning use smoothed nps.

* Seems to be fully implemented.

* Mistype.

* One more bug.

* Found discrepancy with documentaiton.

* Bugfixes.

* Don't smooth nps during the first move.

* Too large default for timeuse decay.

* Bugfix.

* Fix build.

* Relax defaults a bit. Add fixed to logging.

* Remove "smooth" to "smooth-experimental" for now.

* MLH verbose stats - Issue 1200  (#1230)

* Add M effect logic to output section

* Fix missing prefixes and semicolons

* Some fixes.

* Slight format improvement?

Co-authored-by: Tilps <Tilps@users.noreply.github.com>

* Start TempDecay only after a given number of moves (#1212)

* Added TempDecayStartMove for starting temp decay only after a given number of moves. This allows keeping initial game up for a few moves and still use decay.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Doesn't allow temperature to fall below endgame temp during temp decay. Still allows initial temp to be below endgame temp.

* Hide temp options

* renamed TempDecayStartMove to TempDecayDelayMoves

Co-authored-by: Alexis Olson <AlexisOlson@gmail.com>

* Changelog for 0.25.0-rc2. (#1233)

* Changelog for 0.25.0-rc2.

* Add one more PR to the changelog.

* Cuda winograd (#1228)

* custom winograd convolution for cuda backends

* custom winograd fixes

- fix a bug to make it work for non-SE networks
- enable by default only with fp32.

* address review comments

* remove random line in comment

* remove unused constants

- W,H are hardcoded to 8 - because there are assumptions in the code based on that. No point in defining constants.

* cuda winograd fixes (#1238)

* cuda winograd fixes
- don't typecast directly to half datatype in CPU side code as older CUDA runtime doesn't support that.
 - don't use gemmEx version on GPUs older than Maxwell generation (not supported).
 - modify the check to enable custom_winograd setting. It should be faster in most cases - except  presently on RTX GPUs when using fp16.

* Allow most parts of fen to be optional. (#1234)

Default to white to move, no castling, no en passant, 0 rule50ply, 1 total move. Also convert other string to std::string and removing using.

* Fix UpdateNps to actually smooth the nps and correctly handle time_since_movestart_ms == 0 (#1243)

* Update changelog for 0.25.0 final release. (#1244)

* Always report at least 1 depth. (#1247)

* Fix un-intended regression for GTX GPUs (#1246)

* memory optimization for cudnn custom_winograd (#1250)

* memory optimization for cudnn custom_winograd

- don't save untransformed weights
- print warning message when low memory is detected.

* address review comments

* fix warning message

* fix total weight size calculation

2 layers per residual block!

* keep pdb files only for release builds  (#1256)

* doc update (#1267)

* Include verbose stats for the node. (#1268)

Use printing lambdas for parts of the verbose output to share between the newly outputted node and its children.

* add alphazero time manager (#1201)

* Updated FLAGS.md with logfile flag (#1275)

* Fixed a typo in CONTRIBUTING.md (#1274)

* Update Readme about using git (#1265)

* Make `wl_` double. (#1280)

* Move move filter population to a constructor. (#1281)

* Filter out illegal searchmoves to avoid crashing. (#1282)

* Clear policy for terminal loss. (#1285)

* Allow smart pruning to terminate search if win is known. (#1284)

* Allow smart pruning to terminate search if win is known.

* Minor tweak, better safe than sorry.

* Fix bug where pv might not update for best move change. (#1286)

* Fix bug where pv might not update.

* Fix...

Co-authored-by: Alexander Lyashuk <crem@google.com>
Co-authored-by: Tilps <Tilps@users.noreply.github.com>
Co-authored-by: Naphthalin <40385638+Naphthalin@users.noreply.github.com>
Co-authored-by: Ankan Banerjee <ankan.ban@gmail.com>
Co-authored-by: Ed Lee <edilee@mozilla.com>
Co-authored-by: borg323 <39573933+borg323@users.noreply.github.com>
Co-authored-by: Hace <mellekoning@gmail.com>
Co-authored-by: Kip Hamiltons <48076495+KipHamiltons@users.noreply.github.com>
Co-authored-by: nguyenpham <axchess@yahoo.com>

* Change defaults and unhide MLH options

* Update values per @Naphthalin's comments

Co-authored-by: Alexander Lyashuk <crem@google.com>
Co-authored-by: Tilps <Tilps@users.noreply.github.com>
Co-authored-by: Naphthalin <40385638+Naphthalin@users.noreply.github.com>
Co-authored-by: Ankan Banerjee <ankan.ban@gmail.com>
Co-authored-by: Ed Lee <edilee@mozilla.com>
Co-authored-by: borg323 <39573933+borg323@users.noreply.github.com>
Co-authored-by: Hace <mellekoning@gmail.com>
Co-authored-by: Kip Hamiltons <48076495+KipHamiltons@users.noreply.github.com>
Co-authored-by: nguyenpham <axchess@yahoo.com>
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

Successfully merging this pull request may close these issues.

4 participants