Adding a random small number to the evaluation function

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

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Uri Blass
Posts: 8310
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

Adding a random small number to the evaluation function

Post by Uri Blass » Sat Sep 03, 2016 9:03 am

I wonder if this idea can practically help chess engines to play better.

I think that the idea may help the program to prefer lines when it has many ways to get the same score(if we ignore the random numbers) and it may help to improve the playing strength.

I remember that people tried the idea in the past in the stockfish framework with no significant change in playing strength but note that there are many possibilities to choose random numbers(for example maybe it is better to have random numbers that are 0 in half of the cases).

mcostalba
Posts: 2681
Joined: Sat Jun 14, 2008 7:17 pm

Re: Adding a random small number to the evaluation function

Post by mcostalba » Sat Sep 03, 2016 10:00 am

Uri Blass wrote: I remember that people tried the idea in the past in the stockfish framework with no significant change in playing strength
The change was a loser.

User avatar
Evert
Posts: 2909
Joined: Fri Jan 21, 2011 11:42 pm
Location: NL
Contact:

Re: Adding a random small number to the evaluation function

Post by Evert » Sat Sep 03, 2016 10:34 am

Uri Blass wrote:I wonder if this idea can practically help chess engines to play better.

I think that the idea may help the program to prefer lines when it has many ways to get the same score(if we ignore the random numbers) and it may help to improve the playing strength.
I've heard about using random numbers to reduce strength, but no to improve it. Can you explain how this is supposed to work?
I remember that people tried the idea in the past in the stockfish framework with no significant change in playing strength but note that there are many possibilities to choose random numbers(for example maybe it is better to have random numbers that are 0 in half of the cases).
Personally, I use a random key (chosen when the game starts) xored with the hash key of a position to get a random component in the evaluation. He idea here is that the evaluation of identical positions is consistent when the position is re-visited. I don't know what was tried in Stockfish though.

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Adding a random small number to the evaluation function

Post by hgm » Sat Sep 03, 2016 11:46 am

The idea is based on the 'Beal effect': if there are many leave nodes that can be forced, the best one is more likely to have a high random than in the case where there are only a few possible outcomes you can force. So you tend to hedge against the odds that you make yourself dependent on a sigle line of play, that later might turn out to head for a position that is a lot worse than you originally thought.

I do this in Joker. Not so much to increase playing strength as to cause randomization. I use the method described by Evert. The randomization effect seems to disappear at high depth, however, when the magnitude of the random term is kept constant. I guess that there will always be a leave that gets maximum random addition for any 'bare' evaluation score, if the tree gets large enough. This of course could be countered by using amore fine-grained evaluation.

I guess the optimum distribution for the random would be one with a long but rapitly decaying tail to high addition.

Henk
Posts: 5481
Joined: Mon May 27, 2013 8:31 am

Re: Adding a random small number to the evaluation function

Post by Henk » Sat Sep 03, 2016 11:58 am

I added a small random number to evaluation otherwise I don't know how to prevent that Skipper will always play the same game or moves.

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Adding a random small number to the evaluation function

Post by hgm » Sat Sep 03, 2016 12:29 pm

The alternative method is to add a small random number to the move scores in the root, pre-compensating the alpha used when searching the move for this.

Vinvin
Posts: 4174
Joined: Thu Mar 09, 2006 8:40 am
Full name: Vincent Lejeune

Re: Adding a random small number to the evaluation function

Post by Vinvin » Sat Sep 03, 2016 1:12 pm

Uri Blass wrote:I wonder if this idea can practically help chess engines to play better.

I think that the idea may help the program to prefer lines when it has many ways to get the same score(if we ignore the random numbers) and it may help to improve the playing strength.

I remember that people tried the idea in the past in the stockfish framework with no significant change in playing strength but note that there are many possibilities to choose random numbers(for example maybe it is better to have random numbers that are 0 in half of the cases).
I'm curious about a simple experience : when Stockfish evaluate 1 millions positions, how many positions get the same evaluation score ?

User avatar
Luis Babboni
Posts: 422
Joined: Sat Feb 28, 2015 3:37 pm
Location: Argentina

Re: Adding a random small number to the evaluation function

Post by Luis Babboni » Sat Sep 03, 2016 2:10 pm

I´m a little ashamed making a comment here in the middle of as experimented people as you are.... but take it just as it is, a comment.

I felt disappointing with my first tests with my first and noob engine (Soberango) when playing against other weaks engines, they repeat allways the same game! :?
So I added random for moves of same score but with a different approach, not adding a random value to the scores but to the order in wich moves are analyzing.
So, cause the alpha beta and even with just minimax the engine choice the first found move out of all with same score, this ended my engine repeated bored games! :D

In fact my engine play better with this random than without it, but at least for the moment this is just cause two things relative just to my weak engine:
-it not have move ordering, so no random surely use a bad move order and then random order use to be better than just the bad order predefined in my engine.
-the evaluation function is too primitive, just material, so moves with same score are too much.

Now I´m working in add move ordering to my engine.... but at least with my still primitive mover orders points, I have many moves with same score... but now I still not know if the random choice of order will be better or worst than predetermined order.

Note: I change the random order before each move and use it for all plys searched for this move.

User avatar
Luis Babboni
Posts: 422
Joined: Sat Feb 28, 2015 3:37 pm
Location: Argentina

Re: Adding a random small number to the evaluation function

Post by Luis Babboni » Sat Sep 03, 2016 4:31 pm

Another comment:
An example of moves that I think have the same score are captures with promotions that end with promoted piece captured.
There is no importance to wich piece you promote to if in any case it will be captured.
My engine in this cases use to not promote queen just cause random, but I saw the same behavior in other engines.
If an engine have move ordering as I think most have, the promotion to a queen is no ever ahead promotion to other piece?
Why could be then choice to promote toother piece without some random?

Uri Blass
Posts: 8310
Joined: Wed Mar 08, 2006 11:37 pm
Location: Tel-Aviv Israel

Re: Adding a random small number to the evaluation function

Post by Uri Blass » Sat Sep 03, 2016 5:29 pm

mcostalba wrote:
Uri Blass wrote: I remember that people tried the idea in the past in the stockfish framework with no significant change in playing strength
The change was a loser.
I am not sure that there was a significant result that showed it is a loser.
Note that not passing SPRT only show that it is not an improvement and not that it lose elo and it can happen also to 0 elo change.

Note also that there are many ways to add random noise simply by having a different distribution of noise so one failure does not prove that the idea does not work.

Noise for example may also be 0 with probability of 50%.

Post Reply