6

Even with all the compute in the world, chess engines cannot compute very deeply. So, they have to make use of pruning heuristics and discard moves from the analysis.

Seems possible that even the best heuristics will mistakenly discard good moves, and conversely go down bad paths that initially look good from a heuristic standpoint.

Have researchers tried to identify when this tends to happen, and if this can be taken advantage of, similar to adversarial examples in Deep Learning? E.g. an expert with deep understanding of a chess engine internals could concoct a series of moves to force the chess engine to make bad moves.

I play chess.com occasionally, and I've noticed something like this happening, where the chess engine will evaluate the same move as exceedingly good, and then as exceedingly bad.

yters
  • 161
  • 3
  • 4
    There are certain engines out there which are supposedly designed to play against Stockfish in particular. Though I haven't heard much about them in the past couple years. It's probably harder now that Stockfish uses a neural net for its evaluation, as opposed to hand-crafted heuristics. – Inertial Ignorance Nov 02 '22 at 21:37
  • I did notice the use of neural networks, which also led to the question about adversarial examples. The imagery deep learning networks are easily fooled by minor image tweaks. I was wondering if the chess engine neural networks are similarly brittle. – yters Nov 02 '22 at 21:42
  • 2
    @yters In general, neural nets that are trained though self-play reinforcement are much more robust against adversarial inputs than supervised models constrained by the size and quality of the annotated datasets on which their learning was based. That said, potential weaknesses can still remain due to the relation between feature encoding and the horizon effect on learning rate. For example, early Alphago-inspired go engines would tend to misjudge [ladders](https://en.wikipedia.org/wiki/Ladder_(Go)), whereas recent stronger engines avoid the problem by encoding the presence/absence of... – Will Nov 03 '22 at 11:33
  • 1
    ...ladders as additional input features (providing the model with new "vocabulary" so to speak). So if I were to look at finding such "exploits", I'd look at (lack of) feature encoding first. – Will Nov 03 '22 at 11:35
  • How would this look like in practice? Would you say an agent that memorizes the games Stockfish loses and then repeats them ad infinitum (only works since chess engines are semi-deterministic) is an adversarial agent? – Allure Nov 09 '22 at 02:14
  • Yes, but I am interested in something more like adversarial strategies. I.e. making moves where the payoff is beyond the chess engine's calculable horizon. – yters Nov 09 '22 at 15:30
  • 1
    https://chess.stackexchange.com/questions/41867/a-possibility-to-beat-a-chess-computer This was actually asked and answered recently, you might be interested. – Allure Apr 20 '23 at 05:16

2 Answers2

5

Yes. Antifish was an attempt in 2018 to train a LC0 style network specifically to beat stockfish. It turns out that even when searching specifically for weaknesses, chess engines are really strong.

Oscar Smith
  • 1,088
  • 7
  • 13
1

The problem with this question is that it's not clear how an adversarial engine would work. In a comment you write:

making moves where the payoff is beyond the chess engine's calculable horizon

But what is "calculable horizon" to you? Let's say you define it as "the engine does not find the refutation after thinking for 10 minutes on a $1000 2023 desktop". Now what if:

  1. Someone lets the engine think for 20 minutes
  2. Someone uses a $2000 desktop

And the engine finds the refutation - is the adversarial engine still adversarial? If yes, then the definition of "adversarial" is very arbitrary. If no, then it's not well-defined in the first place.

Accordingly, the question is too vague to answer.

PS: There are positions where the engine does not find the key move after thinking for a "very long time" (inverted commas because this term is also not well-defined, c.f. the above), but they're rare, so an engine that makes a good move in rare positions at the cost of making not-so-good moves in more common positions will lose elo in self-play.

Allure
  • 25,298
  • 1
  • 65
  • 143
  • Horizon is a parameter for the adversarial engine. It is adversarial against a specific version of a specific chess engine, such as stockfish. Someone did this sort of thing recently for Go. I've also seen specific instances for chess where chess engines fail, due to the horizon problem. – yters May 24 '23 at 15:01
  • I'm not familiar with computer Go, but I'm pretty familiar with computer Chess, and I don't understand how horizon can be a parameter for the adversarial engine. Can you explain? – Allure May 25 '23 at 02:12
  • Tell the adversarial engine the target has enough computational resources to calculate N-ply deep. Or, find situations where pruning is not effective, so N is always small regardless of the chess engine. – yters May 25 '23 at 13:28
  • @yters but N depends on position. And pruning is extremely effective in chess engines, they're virtually unbeatable from the starting position. The positions they misevaluate are few and far between. Maybe people have tried to create adversaries for chess engines (and some of them are linked in a comment), but there is no known way to reliably beat SF/Lc0, not from the starting position. – Allure May 25 '23 at 14:10
  • this answer of yours is the sort of thing I'm asking about. https://chess.stackexchange.com/questions/33098/big-changes-in-engines-evaluation-after-considerable-time/33952#33952 Have people researched ways to find booms for a specific chess engine? Then they could use the boom to beat chess engines that don't calculate far enough. – yters May 26 '23 at 19:01
  • @yters nobody is researching ways to find "booms" for a specific chess engine, then, and I'd be highly skeptical anyone could use such ways to beat chess engines that don't calculate far enough, for reasons described in this answer. – Allure May 26 '23 at 23:43