Improving history tables
Moderator: Ras
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: Improving history tables
You are using the history tables as a kind of super killer table. It sounds that you have an always replace scheme. By using the score entry as a score accumulator and adding a count variable (if you already do not have one) then you would be doing, what Mark has suggested, and keeping a running average for each move. I wonder if you have tried that. I wonder how differentiated the averages would remain.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Re: Improving history tables
Super Killer tables seems to be a good description of what is inside my code, since my tables are depth dependent. There is a counter for each move which is also depth dependent. So that the mean "score" for each move is known at any time (even if it's not an accurate score most of the time).
This mean score is used for move ordering in all cases (good captures, normal moves,...). I have found some time ago that doing that was the
best in my particular case (forgive me guys
).
The question is "is it better than normal history tables?". For my case the answer is yes, but I suspect it is not a general rule. The reason could be I have no "transposition tables", and no more "killer moves".
Yves
This mean score is used for move ordering in all cases (good captures, normal moves,...). I have found some time ago that doing that was the
best in my particular case (forgive me guys

The question is "is it better than normal history tables?". For my case the answer is yes, but I suspect it is not a general rule. The reason could be I have no "transposition tables", and no more "killer moves".
Yves
Re: Improving history tables
Also I tried to add constant scores depending on distance with beta and/or alpha, but found no improvements (should visit again this possibility); the most funny thing is I have no idea of how the "mean scores" evoluate during the search, and how they are different from other ones (should look at it). Also I'm obliged to test if the "total score" is not close to the maximum limit of 32 bit integers (using 64 bits integer to prevent this test did not help); if the score is too high or too low, it is kept constant.
Yves
Yves
Re: Improving history tables
Here are my 2 cents to the topic....
I am using a [piece_type][TO square] history table since I added history reductions to my engine.
I have been experimenting with the (classic?) [piece_type][FROM square][TO square] and it is obvious inferior to the above formula.
The strange thing about formula-2 is that it makes my engine a lot faster (28%) and in testsets it behaves as good as formula-1 but in real life (games) it scores considerable worse, -3%.
So maybe some of you would like to try the [piece_type][TO square] approach.
Ed
I am using a [piece_type][TO square] history table since I added history reductions to my engine.
I have been experimenting with the (classic?) [piece_type][FROM square][TO square] and it is obvious inferior to the above formula.
The strange thing about formula-2 is that it makes my engine a lot faster (28%) and in testsets it behaves as good as formula-1 but in real life (games) it scores considerable worse, -3%.
So maybe some of you would like to try the [piece_type][TO square] approach.
Ed
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: Improving history tables
Hi Ed,ed wrote:Here are my 2 cents to the topic....
I am using a [piece_type][TO square] history table since I added history reductions to my engine.
I have been experimenting with the (classic?) [piece_type][FROM square][TO square] and it is obvious inferior to the above formula.
The strange thing about formula-2 is that it makes my engine a lot faster (28%) and in testsets it behaves as good as formula-1 but in real life (games) it scores considerable worse, -3%.
So maybe some of you would like to try the [piece_type][TO square] approach.
Ed
I have both kind of tables. The [fig][ts] is used for tunning the piece square tables between iteratins and [fig][fs][ts] for LMR. I kept [fig][fs][ts] for LMR, because, for me it works better. I use neither if there are not at least 100 entries.
Mike
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Re: Improving history tables
Hi Mike,Michael Sherwin wrote:I have both kind of tables. The [fig][ts] is used for tunning the piece square tables between iteratins...
What a tricky thing to do, I would not dare.... Can you give an example what you update?
Ed
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: Improving history tables
Hi Ed,ed wrote:Hi Mike,Michael Sherwin wrote:I have both kind of tables. The [fig][ts] is used for tunning the piece square tables between iteratins...
What a tricky thing to do, I would not dare.... Can you give an example what you update?
Ed
It is in a primitive state and needs attention by someone other than my self as I can think of such things, but, am weak when it comes to perfecting them. The code that I am posting works best, sofar.
Code: Select all
// in the routine that sets up the piece square tables
points = evalHistTblg[BN][sq] / evalHistTbln[BN][sq];
bKnightTbl[sq] += points/4;
Code: Select all
// in the eval routine itself, this is a seperate idea
score += (wEvalBonus - bEvalBonus);<====
if(wBishopNum > 1) score += 32;
if(bBishopNum > 1) score -= 32;
score = score + wMat - bMat + wPos - bPos;
return wtm ? score : -score;
Code: Select all
// part of the search routine
best = NULL;
legalMoves = 0;
count = 0;
h->tries = 0;
h->phase = HASHMOVE1;
for(h->node = h->t; h->phase ;h->node++) {
if(!NextMove(alpha, beta, depth, extendBy)) break;
fs = h->node->fs;
ts = h->node->ts;
fig = piece[board[fs]].fig;
if(Ply == 1) { //also done in the root for the computer side
s32 g = evalHistTblg[fig][ts]; // and is part of the eval for the whole
s32 n = evalHistTbln[fig][ts]; // tree above
if(computer == WHITE) {
bEvalBonus = g/n/8;
} else {
wEvalBonus = g/n/8;
}
}
reduce = 1;
if(depth > 3 && h->phase == NEXTMOVE) { My LMR routine
count++;
if(!inCheck && !inNull && !inShort && h->node->score < alpha) {
if(didNull) reduce += 2;
if(count > 3 && board[ts] == EMPTY) {
s32 g = histTblg[fig][fs][ts];
s32 n = histTbln[fig][fs][ts];
if(n > 99 && g / n < 16) {
reduce += (1 + (depth - 2) / 4);
}
}
}
}
h->tries++;
MakeMove((moves *)&h->node->m);
g = h - 1;
if(GetReps() || h->fifty >= 100) {
if(InCheck(1 - wtm))
g->node->score = -mate + 1;
else
g->node->score = -100 + (ply >> 1);
} else {
g->node->score = -Search(-beta, -alpha, depth - reduce, extendBy);
}
ClrReps();
TakeBack();
if(histTbln[fig][fs][ts] > 200) {// reduce only one entry
histTbln[fig][fs][ts] /= 2;
histTblg[fig][fs][ts] /= 2;
}
if(evalHistTbln[fig][ts] > 20000) {
evalHistTbln[fig][ts] /= 2;
evalHistTblg[fig][ts] /= 2;
}
histTbln[fig][fs][ts]++; // increment the table count
evalHistTbln[fig][ts]++;
if(h->node->score > h->eval && board[ts] == EMPTY)
evalHistTblg[fig][ts] += 8; // multiple stages of reward
if(h->node->score > alpha) {
histTblg[fig][fs][ts] += 100;
if(h->node->score > h->eval && board[ts] == EMPTY)
evalHistTblg[fig][ts] += 12;
if(h->node->score >= beta) {
if(h->node->score > h->eval && board[ts] == EMPTY)
evalHistTblg[fig][ts] += 8;
Mike
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Re: Improving history tables
Hi Mike,
I am totally new to the (genius) idea, so don't expect too much from my feedback.
The first thing that came into my mind are the dangers of the approach, the history counters aren't exactly a shining example of accuracy and that is softly speaking. I wouldn't go as far as Bob who said that history counters are a useless set of random numbers but it's simply true history counters contain a lot of randomness. And to add randomness to eval is the world up-side-down since eval is supposed to be about accuracy.
Nevertheless, considerations don't gain elo-points, tries do and if your program plays better in real games with than without you have a winner no matter how weird and/or controversial the idea behind.
Needless to say I will do some experiments, I suppose that if you keep the modifications within a margin of (say) -0.10 and +0.10 not much harm can be done.
This is fun.....
Ed
I am totally new to the (genius) idea, so don't expect too much from my feedback.
The first thing that came into my mind are the dangers of the approach, the history counters aren't exactly a shining example of accuracy and that is softly speaking. I wouldn't go as far as Bob who said that history counters are a useless set of random numbers but it's simply true history counters contain a lot of randomness. And to add randomness to eval is the world up-side-down since eval is supposed to be about accuracy.
Nevertheless, considerations don't gain elo-points, tries do and if your program plays better in real games with than without you have a winner no matter how weird and/or controversial the idea behind.
Needless to say I will do some experiments, I suppose that if you keep the modifications within a margin of (say) -0.10 and +0.10 not much harm can be done.
This is fun.....
Ed
-
- Posts: 3196
- Joined: Fri May 26, 2006 3:00 am
- Location: WY, USA
- Full name: Michael Sherwin
Re: Improving history tables
Hey Ed,ed wrote:Hi Mike,
I am totally new to the (genius) idea, so don't expect too much from my feedback.
The first thing that came into my mind are the dangers of the approach, the history counters aren't exactly a shining example of accuracy and that is softly speaking. I wouldn't go as far as Bob who said that history counters are a useless set of random numbers but it's simply true history counters contain a lot of randomness. And to add randomness to eval is the world up-side-down since eval is supposed to be about accuracy.
Nevertheless, considerations don't gain elo-points, tries do and if your program plays better in real games with than without you have a winner no matter how weird and/or controversial the idea behind.
Needless to say I will do some experiments, I suppose that if you keep the modifications within a margin of (say) -0.10 and +0.10 not much harm can be done.
This is fun.....
Ed
Looking forward to your experiments!

Mike
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Re: Improving history tables
I have something running now, it will go into the autoplayer tonight. If you hear nothing no improvement, else I will report. The routine basically updates the PST between 2 iterations with (binary) values between -16 and + 24 based on the height of the corresponding history value. Here is some debug output from a random position:Michael Sherwin wrote:Looking forward to your experiments!![]()
Code: Select all
White Knight
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 00 | 10 | 20 | 20 | 20 | 20 | 10 | 00 | 8 | 00 | 11 | 21 | 21 | 23 | 21 | 10 | 00 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 10 | 24 | 26 | 26 | 26 | 26 | 24 | 10 | 7 | 10 | 25 | 27 | 32 | 21 | 27 | 25 | 10 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 10 | 28 | 40 | 50 | 50 | 40 | 28 | 10 | 6 | 01 | 23 | 41 | 51 | 51 | 52 | 29 | 11 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 10 | 23 | 36 | 40 | 40 | 36 | 23 | 10 | 5 | 08 | 09 | 39 | 41 | 41 | 39 | 07 | 11 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 10 | 22 | 28 | 30 | 30 | 28 | 22 | 10 | 4 | 10 | 17 | 29 | 31 | 31 | 29 | 09 | 11 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 00 | 26 | 26 | 30 | 30 | 26 | 26 | 00 | 3 | 00 | 13 | 27 | 31 | 31 | 27 | 12 | 00 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 05 | 20 | 20 | 23 | 20 | 20 | 20 | 05 | 2 | 06 | 15 | 20 | 26 | 21 | 21 | 20 | 00 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
| 00 | 05 | 15 | 15 | 15 | 15 | 00 | 00 | 1 | 00 | 05 | 08 | 01 | 09 | 01 | 00 | 00 |
+----+----+----+----+----+----+----+----+ +----+----+----+----+----+----+----+----+
a b c d e f g h a b c d e f g h
+------+------+------+------+------+------+------+------+
| 100| 133| 127| 126| 2484| 549| 47| 98| 8
+------+------+------+------+------+------+------+------+
| 100| 690| 207| 6346| 87| 446| 221| 44| 7
+------+------+------+------+------+------+------+------+
| 75| 94| 110| 1235| 554| 27474| 108| 106| 6
+------+------+------+------+------+------+------+------+
| 98| 49| 2848| 1012| 583| 3055| 145| 110| 5
+------+------+------+------+------+------+------+------+
| 49| 92| 226| 225| 1009| 107| 54| 170| 4
+------+------+------+------+------+------+------+------+
| 100| 49| 130| 159| 138| 252| 52| 52| 3
+------+------+------+------+------+------+------+------+
| 257| 91| 100| 2424| 449| 408| 100| 95| 2
+------+------+------+------+------+------+------+------+
| 98| 49| 71| 49| 90| 49| 99| 49| 1
+------+------+------+------+------+------+------+------+
a b c d e f g h

No expectations however, first tries seldom do, I will be more than glad if it doesn't score worse, that would mean the idea has a future.
Ed