How is automated parameter tuning done?
Is it as simple as the following: I imagine a bash script that loops an engine engine match, incrementing or decrementing a single parameter value by x amount after playing each round of 1000 or so games, and passing that parameter to the engine via uci setoption for instance. One could use cutechess-cli, for instance, or xboard. Each parameter increment also changes the name passed to cutechess-cli, so that after it's all done, you end up with a pgn file to run bayeselo and discover the so-called best value.
OR, do you all code parameter tuning code directly into the engine and let 'er rip?
howto for automated parameter tuning
Moderators: hgm, Rebel, chrisw
-
- Posts: 27795
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: howto for automated parameter tuning
I never believed much in automatic parameter tuning this way. If having a Queen value off by two Pawn units (750 in stead of 950) only costs you 10 Elo, (as, according to Bob, it does), and thus requires gauntlets of 6,400 games to even detect with 95% confience that it is worse, you could not even get a Queen value that is anywhere near the correct one (say within 25 cP). Let alone for the more subtle parameters...
-
- Posts: 12540
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: howto for automated parameter tuning
You have to tune with games or you get tactical settings (e.g. if you tune with an EPD set, you will solve the set like gangbusters, but it will not play as well in games).benstoker wrote:How is automated parameter tuning done?
Is it as simple as the following: I imagine a bash script that loops an engine engine match, incrementing or decrementing a single parameter value by x amount after playing each round of 1000 or so games, and passing that parameter to the engine via uci setoption for instance. One could use cutechess-cli, for instance, or xboard. Each parameter increment also changes the name passed to cutechess-cli, so that after it's all done, you end up with a pgn file to run bayeselo and discover the so-called best value.
OR, do you all code parameter tuning code directly into the engine and let 'er rip?
-
- Posts: 173
- Joined: Sun May 11, 2008 7:43 am
Re: howto for automated parameter tuning
Either method would do the trick...
The more automated the better
I would suggest a utility that adjusts values based on results for UCI engines. Store & compare automatically...
WB engines, I would suggest multiple parameter changes done automatically by ... Store & compare here also...
Then you could even have; edit & recompile your engine automatically after a result... for another test.
...but the engine has to have those parameter options coded to be manipulated first...
The more automated the better
I would suggest a utility that adjusts values based on results for UCI engines. Store & compare automatically...
WB engines, I would suggest multiple parameter changes done automatically by ... Store & compare here also...
Then you could even have; edit & recompile your engine automatically after a result... for another test.
...but the engine has to have those parameter options coded to be manipulated first...
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: howto for automated parameter tuning
Depends on the number of games. I believe ours is pretty reasonable (queen value and other pieces) = 1050 where pawn = 100.hgm wrote:I never believed much in automatic parameter tuning this way. If having a Queen value off by two Pawn units (750 in stead of 950) only costs you 10 Elo, (as, according to Bob, it does), and thus requires gauntlets of 6,400 games to even detect with 95% confience that it is worse, you could not even get a Queen value that is anywhere near the correct one (say within 25 cP). Let alone for the more subtle parameters...
Note that the value of a queen for an idiot player might actually only be +300, so there is no "correct" value in general. There is an optimal value for a particular player. For one that attacks a lot, it is probably higher. For one that plays slow positional stuff, it would probably be lower.
-
- Posts: 931
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: howto for automated parameter tuning
Rémi Coulom has done some work that seems perfect for this problem:
http://www.mail-archive.com/computer-go ... 00053.html
It doesn't consider the possibility of having a draw as a result, but it shouldn't be too hard to adapt his method to accommodate draws.
http://www.mail-archive.com/computer-go ... 00053.html
It doesn't consider the possibility of having a draw as a result, but it shouldn't be too hard to adapt his method to accommodate draws.
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: howto for automated parameter tuning
Most common approach is simulated annealing. The issue is, how do you test after the annealer has made a pass over the values? Cozzie worked on this a while, but for Crafty, it was never able to produce anything better. It would modify values all over the place, but the final result was no change in real games...jhaglund wrote:Either method would do the trick...
The more automated the better
I would suggest a utility that adjusts values based on results for UCI engines. Store & compare automatically...
WB engines, I would suggest multiple parameter changes done automatically by ... Store & compare here also...
Then you could even have; edit & recompile your engine automatically after a result... for another test.
...but the engine has to have those parameter options coded to be manipulated first...
-
- Posts: 65
- Joined: Thu Jul 08, 2010 9:16 am
Re: howto for automated parameter tuning
Hi,
I had some tests with a gen-pool related optimization. Having a population of about 1000 parameter vectors that are dying after too many lost games or getting childs with mixted or mutated parameters if successful.
This was very fun to do but absolutely useless. You can´t get enough testgames in your lifetime.
Greetings Volker
I had some tests with a gen-pool related optimization. Having a population of about 1000 parameter vectors that are dying after too many lost games or getting childs with mixted or mutated parameters if successful.
This was very fun to do but absolutely useless. You can´t get enough testgames in your lifetime.
Greetings Volker
Mangar Spike Chess
-
- Posts: 613
- Joined: Sun Jan 18, 2009 7:03 am
Re: howto for automated parameter tuning
I won't go into the details, but I can say that what we've done with Stockfish is not much more complicated than that. If you do not happen to have a cluster (and cannot afford to spend 10 years for tuning) what you are suggesting is a very reasonable starting point. There are many good sides in this basic method:benstoker wrote: Is it as simple as the following: I imagine a bash script that loops an engine engine match, incrementing or decrementing a single parameter value by x amount after playing each round of 1000 or so games, and passing that parameter to the engine via uci setoption for instance. One could use cutechess-cli, for instance, or xboard. Each parameter increment also changes the name passed to cutechess-cli, so that after it's all done, you end up with a pgn file to run bayeselo and discover the so-called best value.
* It's based on real games
* It's very scalable on the number of variables
* Meaningful variables are adjusting quickly while less meaningful suffer only from small random noise
* It's not going to find perfect solution, but often good enough solutions
* It's ugly and unscientific, but who cares if it can give you elo boost.
IMO genetic algorithms are hopeless thing to try. They work only if you can order the population reliably and this is impossible with real games in reasonable time scale.
This being said, I hope that Remi's work will show us more scientific and better way for doing the parameter optimization...
Joona Kiiski
-
- Posts: 900
- Joined: Tue Apr 27, 2010 3:48 pm
Re: howto for automated parameter tuning
For the eval related params, how were the test games played? Very fast timecontrol, or perhaps even just a 1-ply / 2-ply search? If that is enough, it's not hard to make it play thousands of games.zamar wrote:I won't go into the details, but I can say that what we've done with Stockfish is not much more complicated than that.benstoker wrote: incrementing or decrementing a single parameter value by x amount after playing each round of 1000 or so games, and passing that parameter to the engine via uci setoption for instance.