Could a modern chess engine on a Pentium have defeated Kasparov in 1996?

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

Title: Could a modern chess engine on a Pentium have defeated Kasparov in 1996? 标题:1996年的奔腾处理器能否运行现代国际象棋引擎击败卡斯帕罗夫?

On February 10th, 1996, a computer program (IBM’s Deep Blue) defeated the reigning chess champion (Garry Kasparov) in a game of chess for the first time. Deep Blue would go on to lose the match, but a year later, would get its revenge in a 3.5-2.5 rematch. 1996年2月10日,一个计算机程序(IBM的“深蓝”)首次在国际象棋比赛中击败了当时的国际象棋冠军加里·卡斯帕罗夫。深蓝最终输掉了那场比赛,但在一年后的重赛中以3.5比2.5的比分成功复仇。

In order to achieve this feat, IBM spent several million dollars on research and development building a special-purpose computer specifically for this purpose. Deep Blue itself (the victorious, upgraded version) was powered by 30 P2SC processors each running at roughly 120 MHz, and (most importantly) 480 custom VLSI chess co-processors used to perform chess-specific operations like move generation and position evaluation. When it was built, Deep Blue was the 259th most powerful supercomputer in the world, and could analyze over 200 million chess positions per second. 为了实现这一壮举,IBM投入了数百万美元进行研发,专门建造了一台用于此目的的专用计算机。深蓝本身(即获胜的升级版本)由30个主频约为120 MHz的P2SC处理器驱动,最重要的是,它还配备了480个定制的VLSI国际象棋协处理器,用于执行诸如走法生成和局面评估等国际象棋专项操作。在建造之时,深蓝是世界上排名第259位的超级计算机,每秒可以分析超过2亿个国际象棋局面。

But was Deep Blue necessary to beat Kasparov? Or could we have gotten away with an off-the-shelf 1996 desktop running a smarter chess engine? 但击败卡斯帕罗夫真的需要“深蓝”吗?还是说我们本可以使用一台1996年的现成台式机,运行一个更聪明的国际象棋引擎来做到这一点?

As it turns out, we could easily have beaten Kasparov without building Deep Blue, using only commodity hardware, and it (almost certainly) wouldn’t have even been close. I know this because, as I write this very sentence, I have sitting next to me a 200 MHz Intel Pentium Pro (released exactly 31 years ago---November 1st, 1995) with 64MB of RAM running a custom port of Stockfish that plays at an estimated Elo of 3300 ± 87 at classical time controls---far beyond the strength of any human, or indeed Kasparov’s Elo of just under 2800. But wait, there’s more! I’ve hooked this machine up to the internet with a Realtek RTL8139C Ethernet card, so you can play it below! 事实证明,我们完全可以在不建造“深蓝”的情况下,仅使用商用硬件轻松击败卡斯帕罗夫,而且这(几乎可以肯定)甚至不会是一场势均力敌的较量。我知道这一点,因为就在我写下这句话时,我身边放着一台200 MHz的英特尔奔腾Pro(发布于31年前的1995年11月1日),它拥有64MB内存,运行着一个定制移植版的Stockfish引擎。在古典时限下,它的预估Elo等级分为3300 ± 87,远超任何人类的实力,也远超卡斯帕罗夫不到2800的Elo等级分。不仅如此!我还通过一张Realtek RTL8139C以太网卡将这台机器连接到了互联网,你可以在下方与它对弈!

There are three ways to get stronger at chess: you can analyze more moves, analyze better moves, or analyze moves better. Famously, humans improve by doing the latter two: the average chess grandmaster during a classical game will analyze roughly the same number of moves as an amateur player, but they analyze only the most critical moves and do a better job with that analysis. Chess engines like Stockfish, running on silicon instead of our human brains, dominate us at the first of these and analyze millions of positions per second. And because there’s not that much room for micro-optimizations on modern engines that will let a given CPU process more positions per second, most progress in chess AI also tends to follow how humans improve and finds better methods for selecting moves and analyzing boards. 提升国际象棋水平有三种途径:分析更多的走法、分析更好的走法,或者更好地分析走法。众所周知,人类是通过后两种方式进步的:普通国际象棋特级大师在古典比赛中分析的走法数量与业余棋手大致相同,但他们只分析最关键的走法,并且在分析质量上做得更好。像Stockfish这样的国际象棋引擎,运行在硅片而非人类大脑上,在第一种途径上占据绝对优势,每秒能分析数百万个局面。由于现代引擎在微优化方面提升CPU每秒处理局面数的能力空间有限,国际象棋人工智能的大部分进步也倾向于遵循人类的进步方式,即寻找更好的走法选择和局面分析方法。

Skill in chess is measured by an Elo score. A difference of 200 Elo means that you should expect the stronger player to win three out of every four games, and multiplicatively from there: a 400 Elo gap corresponds to a 90% expected score and a 1000 Elo gap gives a 99.7% expected score. The best chess engines that you could run on commodity 1996 hardware were rated roughly 2300 Elo. Deep Blue was rated 2700. In contrast, modern Stockfish is rated closer to 3700. 国际象棋的技能水平通过Elo等级分来衡量。200分的Elo差距意味着较强的一方在四局比赛中预计能赢三局,以此类推:400分的差距对应90%的预期得分,而1000分的差距则对应99.7%的预期得分。1996年能在商用硬件上运行的最佳国际象棋引擎的等级分约为2300分。“深蓝”的等级分为2700分。相比之下,现代Stockfish的等级分接近3700分。

This raises the question: how much of the advantage of a modern chess engine comes down to the fact that a modern desktop computer is extremely fast, and how much of the advantage comes down to the fact that we’ve just gotten better at programming chess engines? As it turns out, the majority of the Elo gains (+720 of the +1335 gained) can be attributed to better programming, and not better hardware. 这就引出了一个问题:现代国际象棋引擎的优势有多少归功于现代台式机极快的速度,又有多少归功于我们在编程引擎方面变得更强了?事实证明,大部分Elo分数的提升(在增加的1335分中占了720分)应归功于更好的编程,而非更好的硬件。

To test this, I ran two experiments. The first experiment uses Crafty, a competitive engine from 1996 whose source code is now available. On my Pentium Pro, the 1996 build of Crafty version 11.13 has an Elo of 1999 ± 90 at 1 second per move, and 2383 ± 77 at 10 seconds per move. On modern hardware (a Ryzen 7) this engine’s Elo jumps massively to 2614 ± 97 at the same 1 second per move. But if I take this engine and slowly start to add all the knowledge we have about how to design better chess engines---adding modern search algorithms like fail-soft, LMR, correction history; adding better quiescence methods; and adding neural-net evals (NNUE)---then you can increase the Elo up to 2718 ± 34 on the Pentium Pro at 1 second per move, and 2974 ± 74 at 10 seconds per move. 为了验证这一点,我进行了两项实验。第一个实验使用了1996年的一款竞技引擎Crafty,其源代码现已公开。在我的奔腾Pro上,1996年构建的Crafty 11.13版本在每步1秒的时限下Elo为1999 ± 90,在每步10秒下为2383 ± 77。在现代硬件(Ryzen 7)上,该引擎在同样的每步1秒时限下,Elo大幅跃升至2614 ± 97。但如果我采用这个引擎,并逐步加入我们现在所掌握的关于如何设计更好引擎的知识——例如加入fail-soft、LMR、修正历史等现代搜索算法,加入更好的静止搜索方法,以及加入神经网络评估(NNUE)——那么在奔腾Pro上,每步1秒时限下的Elo可以提升至2718 ± 34,每步10秒下可达2974 ± 74。

In the second experiment I go somewhat further: instead of trying to update Crafty, let’s just try to get Stockfish---the best chess engine today---running on 1996 hardware and see how it does. This takes some work and is mainly a matter of rewriting the code so that it uses 32-bit arithmetic (a PPro is a 32-bit machine) and doesn’t use more than 64MB of RAM. This naive port has an Elo of roughly 2496 ± 64 at 1 second per move (2940 ± 76 at 10 seconds per move). But we can do better! A modern Stockfish engine is designed to run on a modern CPU. By making a number of adjustments to the algorithm and tuning it to the Pentium, we can increase its Elo to 2846 ± 35 at 1 second per move, 3109 ± 79 at 10 seconds per move, and 3180 ± 80 at 30 seconds per move. 在第二个实验中,我更进一步:不再尝试更新Crafty,而是直接尝试让当今最强的国际象棋引擎Stockfish在1996年的硬件上运行,看看效果如何。这需要一些工作,主要是重写代码,使其使用32位算术(奔腾Pro是32位机器)且内存占用不超过64MB。这个简单的移植版本在每步1秒时限下的Elo约为2496 ± 64(每步10秒下为2940 ± 76)。但我们可以做得更好!现代Stockfish引擎是为现代CPU设计的。通过对算法进行一系列调整并针对奔腾处理器进行优化,我们可以将其在每步1秒时限下的Elo提升至2846 ± 35,每步10秒下提升至3109 ± 79,每步30秒下提升至3180 ± 80。

The most concise way to summarize all of the above is just to have them play a match of 100 games against each other. And when I do this, I find that a modern chess engine running on a 1996 Pentium Pro wins 78, draws 17, and loses 5 games against the 1996 Crafty engine running on modern hardware. 总结上述所有内容最简洁的方法,就是让他们进行一场100局的对弈。当我这样做时,我发现运行在1996年奔腾Pro上的现代国际象棋引擎,在与运行在现代硬件上的1996年Crafty引擎对弈时,取得了78胜、17平、5负的战绩。

The remainder of this article provides the details. 本文的其余部分将提供详细信息。

There’s not much to say about the hardware, to be honest. I bought a used (“vintage” said the listing; I feel old.) desktop PC with standard period-appropriate h 老实说,关于硬件没什么可说的。我买了一台二手的(清单上写着“复古”;我感觉自己老了。)台式电脑,配备了当时标准的……