What makes Rybka so strong?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: What makes Rybka so strong?

Post by bob »

Gian-Carlo Pascutto wrote:
mcostalba wrote: 1) The only further "separation" that there is more then in SF is white/black splitting. I have tested not the search, but the do_move(), to split in do_move_white() and do_move_black(), with almost no difference.
Do you also have separate search functions for when being in check, for being close to the leaves but not in qsearch, and for doing a "move excluded" search?

Last time I looked, you did not.
2) This is what I call an ugly trick because is not platform independent (32/64 bit). And also if you save an add you also earn a left shift ;-)
The scores probably fit in 32 bits (16/16) which is portable.

You save much more than a single add at the cost of the shift, don't forget you save also all the lookups of the target addresses and the actual load+store on the value you are adding to.
3) This is horribly ugly becasue compeltely breaks the nice separation between move generation, scoring and sorting. And BTW I am not sure you save anything becasue you need an extra access during capture's move generation to a big table of precalculated MVV/LVA scores and also an extra access to look up what kind of piece you have in destination square.
You need those anyway if you score later, so doing it immediately saves instructions.
Also could be extra work if the scores are not needed because of an early cutoff??

So the only save you have is the piece lookup of the origin square that during move generation is already known (of course) while if you score later you have to do it, but the origin square piece lookup is very fast because board[] is only 64 squares and is always in L1 for the whole scoring. So I think it is ugly and with very little gain (if any).
You also save the entire loop which has to go through the move data.

I'm not arguing about the layering violations - I also wouldn't write my engine like Rybka/Ippolit. But there's no doubt all those tricks combined are what make it faster than most programs.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: What makes Rybka so strong?

Post by mcostalba »

bob wrote: Also could be extra work if the scores are not needed because of an early cutoff??
No, you need to score before to sort or pick the best. So scoring of all the moves is unavoidable even if the first picked will cut-off....but you have to know _what_ move is the best to pick.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: What makes Rybka so strong?

Post by Don »

bob wrote:
frankp wrote:
Don wrote:
I recently performed a massive overhaul of my engine to get the level approximately where stockfish 1.4 is and it's probably not 100 ELO any longer because I am more aggressive about other kinds of pruning. ( http://greencheeks.homelinux.org:8015/~ ... islap.html )
Geez... I am impressed. I cannot even get my new program to the level of my old one :-(
One has to be very careful when making comparisons based on 300-400 games. I will try to post some samples later today if I have time. It is quite easy to be _way_ off after 200-300 games, compared to where things finish after 40,000 games. The error bar is not that wide "just because". It really does mean "this is only accurate as a guess that is somewhere inside the window, not right at the center of the window"
My statement is not based on this particular test. Version 09.941 which you see here has already been fully evaluated with tens of thousand of games at faster time controls before this test ever started.
Hart

Re: What makes Rybka so strong?

Post by Hart »

What in the world would cause this? Rybka gets stuck on ply 15, maybe something to do with a high branching factor? while RobboLito hits ply 24 near instantly and keeps on going.

[D]8/1p6/1P3k2/5r1p/p5qP/P2QP3/1P3R2/5K2 w - - 14 46

Code: Select all

RobboLito 0.85d2 x64:
30/70  02:06.203   319.508.038  2.538.000  +14.86  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Ke3 Ke5 50.Kf3 Kd4 51.Kf4 Kc5 52.Kg5 Kd4 53.Kxh5 Kxe4 54.Kg5 Kd5 55.h5 Ke6 56.Kg6 Kd5 57.h6 Kc4 58.h7 Kb5 59.h8Q Kc6 60.Qf6+ Kc5 61.Qc3+ Kxb6 62.Kg5 Ka6 63.Qb4 b5 64.Qc5 Kb7 65.Qxb5+ Kc7 66.Qxa4 Kb7 67.Qc2 Kb8 68.Qe4 Kc7 69.a4 Kd7 70.Qd4+ Kc6 71.Qa7 Kd6 72.Qa5 Kd7 73.Qc5 Ke8 74.Kf5 Kd7 75.Kg5
30/70  02:23.891   379.462.480  2.643.000  +15.04  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Ke3 Ke5 50.Kf3 Kd4 51.Kf4 Kc5 52.Kg5 Kd4 53.Kxh5 Ke5 54.Kg5 Kxe4 55.h5 Kd4 56.h6 Kc5 57.h7 Kxb6 58.h8Q Kb5 59.Qc3 Ka6 60.Qb4 b5 61.Qc5 Kb7 62.Qxb5+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4 Qxf2+ 48.Kxf2 Ke6 49.Ke3 Ke5 50.Kf3 Ke6 51.Kf4 Kf6 52.e5+ Kf7 53.Kf3 Kf8 54.Ke4 Ke8 55.Kd5 Kf7 56.Kd6 Ke8 57.Kc7 Ke7 58.Kxb7 Kd7 59.Ka7 Ke6 60.b7 Kf5 61.b8Q Ke4 62.e6 Kd4 63.e7
32/74  05:35.469   866.733.493  2.586.000  +15.14  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Ke3 Ke5 50.Kf3 Ke6 51.Kf4 Kf6 52.e5+ Kf7 53.Kf3 Kf8 54.Ke4 Ke8 55.Kd5 Kf7 56.Kd6 Ke8 57.Kc7 Ke7 58.Kxb7 Kd7 59.e6+ Kd6 60.Kc8 Kxe6 61.b7 Kd6 62.b8Q+ Ke6 63.Qb5 Ke7 64.Qe5+ Kf7 65.Qf5+ Ke7 66.Qe5+
32/74  05:45.392   905.538.669  2.624.000  +15.26  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Ke3 Ke5 50.Kf3 Ke6 51.Kf4 Kf6 52.e5+ Kf7 53.Kf3 Kf8 54.Ke4 Ke8 55.Kd5 Kf7 56.Kd6 Ke8 57.Kc7 Ke7 58.Kxb7 Kd7 59.Kb8 Kc6 60.b7 Kd5 61.Ka8 Ke6 62.b8Q Ke7 63.Qb6 Kd7 64.Qd6+ Ke8 65.Qd4 Kf8

Rybka 3:
   6  00:00.203         1.816  116.224  +3.20  46.Qd6+ Kf7 47.Qd5+ Kf6 48.Qxf5+ Qxf5
   7+  00:00.220         3.008  192.512  +3.40  46.Qxf5+
   7  00:00.220         3.100  99.200  +3.40  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3
   8  00:00.220         3.947  126.304  +3.51  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3
   9+  00:00.235         5.629  120.085  +3.71  46.Qxf5+
   9  00:00.235         5.752  122.709  +3.71  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3 Ke6
  10+  00:00.250         8.382  136.240  +3.91  46.Qxf5+
  10  00:00.250         8.723  141.783  +3.70  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3
  11  00:00.298        14.188  132.077  +3.70  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3 Ke6 51.Kf4
  12+  00:00.345        22.590  147.338  +3.90  46.Qxf5+
  12+  00:00.360        22.910  135.606  +4.10  46.Qxf5+
  12  00:00.360        23.750  140.578  +4.46  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3
  13  00:00.438        35.376  144.322  +4.46  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3
  14  00:00.595        56.907  143.176  +4.46  46.Qxf5+ Qxf5 47.e4 Qxf2+ 48.Kxf2 Ke6 49.Kf3 Ke5 50.Ke3
  15+  00:00.939       105.286  143.559  +4.66  46.Qxf5+
  15+  00:00.969       107.547  140.828  +4.86  46.Qxf5+
  15  00:24.844     4.304.212  178.753  +6.34  46.Qxf5+
  16  05:41.439    88.631.938  265.959  +13.35  46.Qxf5+
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: What makes Rybka so strong?

Post by bob »

mcostalba wrote:
bob wrote: Also could be extra work if the scores are not needed because of an early cutoff??
No, you need to score before to sort or pick the best. So scoring of all the moves is unavoidable even if the first picked will cut-off....but you have to know _what_ move is the best to pick.
I don't need to do that. I can try a hash move. No move generation. I can try killer moves before generating non-captures. There are lots of good reasons to not do things that might never need to be done.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: What makes Rybka so strong?

Post by mcostalba »

bob wrote: I don't need to do that. I can try a hash move. No move generation. I can try killer moves before generating non-captures. There are lots of good reasons to not do things that might never need to be done.
While you try TT and killers you even do not generate other moves. Here we are talking of scoring while generating moves or score later. But _when_ you generate moves you have to score them sooner or later, anyhow _before_ to pick the first out of them.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: What makes Rybka so strong?

Post by diep »

Don wrote:
bob wrote:
Don wrote:
bob wrote:
Don wrote:
bob wrote:
Don wrote:
Hart wrote:I don't know if the question is taboo or even appropriate but I ask anyways out of sheer inquisitive curiosity. With the sources of Ippolit/RobboLito, so called "clones" of Rybka 3, are we any closer to answering such questions and if we are is it acceptable to discuss such questions in public or are these discussions to remain in dark corners or behind closed doors?
I don't believe there is anything special in Rybka, it's just the program as a whole that is special. I think you will be disappointed if you believe there is some secret that Vas is keeping in the closet somewhere.

I looked at the sources of IPP and the only thing that stood out to me is that it is probably more selective than most or all programs that are really strong, but I did not see any special mechanism for doing this, just the same type of stuff we are doing anyway. Vas is just doing it better.

Another thing that stands out to me is that it is has an excellent evaluation function. It may be the best evaluation function of any of the programs, yet it is still probably weaker in some areas than some other good programs. I have heard that king safety is one of the weak points, although it is improved over the previous versions.

There is no secret in Rybka that you can just transfer over to your program in a few minutes and then expect to compete with Rybka.


- Don
Someone has pointed out (privately) that there is a subtle singular extension algorithm in the thing that is probably worth something no doubt. I've not looked at it myself, yet, so can't comment on how well that feature works. When a personal email asked questions about specific code and gave the code along with an explanation, it was pretty obvious what it was doing, and it is just another point in favor of an entry in my to-do list being moved up a bit. I plan on re-visiting this again.
I'm not claiming that Rybka doesn't have any little goodies in it, I'm just saying that I don't believe anything in particular is a breakthrough. It is essentially just a very well engineered program.
You have to know I agree with you there. I've said hundreds of times in the past that we have not seen anything "revolutionary" since alpha/beta. It has been a steady path of evolutionary progress, with some jumps that might be a bit bigger than others, but nothing _major_...
Here is what I consider the big "breakthroughs" if you want to call it that:

1. Shanons layout out the basic algorithm
2. stand pat quies search of captures only.
3. check extensions
4. hash tables
5. null move pruning
6. reduction of various sorts.
I'm not sure that #2 was ever not done. I had a q-search as far back as I can remember. It was in chess 4.x in 1974 or so also. Null-move pruning is certainly more than 50 Elo, but reductions really are not if you already have null-move included. Or reductions are more than 50, but then null-move is not, assuming you add reductions first. They are somewhat complementary since they overlap with the same underlying idea of reducing the depth.

I would likely replace 2 above with alpha/beta which wasn't in shannon's paper at all, it came from Newall, Simon and Shaw a few years later.

Iterative deepening is also a pretty good idea, coming from Slate/Atkin of course.

You could easily include other thing such as MVV/LVA, bitboards, square of the pawn, futility pruning and so on but I don't think they are quite as big as the above. Perhaps check extensions is the most controversial, but it was a huge deal when the idea suddenly busted on the scene.

When you use the word "breakthrough" I'm looking for at least 50 ELO or more.

I'm sure someone else would produce a somewhat different list - but this is what stands out to me as the major jumps in computer chess.

- Don





[/list]
When I turn on/off LMR (even after having null move pruning on) I get at least 100 ELO. LMR is powerful for my program.

- Don
That is weird it is so powerful.

What i did do in 1999 is similar to ippolit/rybka and the reductions i used back then are not that far off from what you call LMR now.

each ply i saw back then as 2 units. with a chess specific function i selected which moves to not reduce and tried to limit it. Also bad captures got reduced for example.

Back then search depth was not so big, so the actual plydepth win was far less than the average risk to use it.

Note i'm not using LMR in todays diep, but the technique in itself is not so great positional seen.

I wouldn't call LMR or history pruning or other forms of reductions a big breakthrough. Already long before that i was using back in 1999 the reduction concept, it was obvious others from 80s already had been using it.

Ed Schroder is a good example.

If you'd look in todays chesssoftware you'll soon realize they all use reductions in some other type of form, so there is not 1 generic idea there that really works well, and nearly all of them 'invented' the concept of reductions themselves.

nullmove is a real breakthrough however, especially recursive nullmove, which AFAIK the first one the really apply it well was Frans Morsch. Only after frans morsch won world champs 1995 and shouted out loud that this was because he had invented recursive nullmove, everyone really started to use it bigtime.

The first tournament after world champs 1995 i can't remember many opposing the idea.

There is other real inventions in search that simply do not work for computerchess but might work in other areas of game tree search.

Good examples are multicut (Yngvi Bjornson) and MTD. Both do not work for computerchess, but they are real inventions.

And yes i also invented several algorithms/enhancements that i intend to use in future diep's. A big problem is that no one pays for investing half a year fulltime investigating a new feature, which definitely is needed to get a lot out of it. This whereas others just simply take over what you invent by simply looking in your assembler code, or manage to steal your source code in yet another new manner. That has happened so much in world top of computerchess, and it isn't different in other worlds.

A second problem with search is that it's not the most important thing.

Most people underestimate importance of evaluation function.

If i would equip todays diep evaluation in diep 1998 search, so not the reduction type 1999 search, then that would beat any of todays engines total hands down, if they would be equipped with an evaluation function out of 1998 (really *any* program).

The search depth difference will probably be huge between diep 1998 and a todays engines search at todays hardware. Back in 1998 diep just did do nullmove R=3 , R=2 and R=1 a subset of which as i had posted on the internet later claimed by Ernst A Heinz as adapted nullmove - which is weird after i had posted it to RGCC at the time some on this, already back in 1996 or so. Really a lot of what i did do back then is far more optimized in todays search. Sometimes things also come back for a short while. For example i used to try more moves back then in qsearch, other than just giving check, avoiding check and captures. Not the Said Koudache idea of trying killer/history moves in qsearch, yet a more limited version of that. Amazingly that seems to be popular again today in some engines. Now you probably don't suffer too much from this if you do hard forward pruning last 3.5 ply if your eval is a pawn or so above beta, but the effect is basically that of checking mainline deeper, the rest i consider randomness.

In any case don't ever forget that evaluation functions have to keep up.

The biggest progress of all engines is the evaluation function.

Todays evaluation functions are so so bugfree compared to what was there in the 90s, it's just not normal.

I don't really see most of todays software as really interesting from search viewpoint. Most are just mainline checkers and prune the rest.

Lemma and vision changes always are the most important thing in history, even more than the actual latest standings of tricks.

Sure, diep does have the biggest evaluation function and once bugfixed that will kick of course more butt than tiny evaluation functions. Sure i did invent something in search also and when i put it to work it will give also another 50+ elo. And yes it might result in the strongest engine on the planet, who knows. Yet if i just debug the EXISTING evaluation function a lot and improve it a tad, is that big progress of the field?

I don't think so.

New algorithms might get seen as progress, yet they don't give 'elo' in itself.

The best ideas and lemma changes usually comes from guys who just didn't make it to world champion or best engine, so artificial intelligence folks who were good enough to understand the things that currently mattered in game tree search, but of course by losing time to investigating new algorithms/enhancements they already made sure they couldn't produce the best engine.

Considering that i'd argue one of the more important figures past 5 years in game tree search is Fabien Letouzey as direct or indirectly his ideas in one or another form boosted computer chess and still is busy boosting it. If you just look at his engines source code, you won't find all that however.

In that sense open source overshoots its target completely.

Vincent
Gian-Carlo Pascutto
Posts: 1243
Joined: Sat Dec 13, 2008 7:00 pm

Re: What makes Rybka so strong?

Post by Gian-Carlo Pascutto »

bob wrote: Also could be extra work if the scores are not needed because of an early cutoff??
None of this is done for the first few moves.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: What makes Rybka so strong?

Post by bob »

mcostalba wrote:
bob wrote: I don't need to do that. I can try a hash move. No move generation. I can try killer moves before generating non-captures. There are lots of good reasons to not do things that might never need to be done.
While you try TT and killers you even do not generate other moves. Here we are talking of scoring while generating moves or score later. But _when_ you generate moves you have to score them sooner or later, anyhow _before_ to pick the first out of them.
Not necessarily. Many generate _all_ moves and then first pick out just the captures. You do not need to score non-captures yet as quite often a capture is enough to cause a quick cutoff.
mcostalba
Posts: 2684
Joined: Sat Jun 14, 2008 9:17 pm

Re: What makes Rybka so strong?

Post by mcostalba »

bob wrote: Not necessarily. Many generate _all_ moves and then first pick out just the captures. You do not need to score non-captures yet as quite often a capture is enough to cause a quick cutoff.
In our case "Many" does not refer to any engine we are talking about in this thread ;-)



BTW, I have to admit you are very good at generating "escape" moves :-) :-)