Chess Engine Online

How an Engine Decides a Sacrifice Works

Engines were historically bad at sacrifices and are now good at them. What changed, what the evaluation is weighing, and when to still distrust the verdict.

· 3 min read

For most of computer chess history, sacrifices were the clearest weakness. An engine counted material accurately and compensation poorly, so it would decline a sound sacrifice and accept an unsound one, and strong human players used this to beat programs that outcalculated them.

That gap has largely closed, and understanding why explains what the evaluation is now weighing.

What compensation consists of

When material goes and the position stays good, something is paying for it. Engines measure the same things a strong player would, though without naming them:

  • King exposure. The single largest term, and the reason most successful sacrifices are aimed at a king.
  • Development lead, counted as pieces on useful squares while the opponent's sit at home.
  • Open lines created toward something worth attacking.
  • Time, in the specific sense that the defender must respond rather than proceed with their own plan.
  • Structural damage that outlasts the attack, which is what makes a sacrifice sound even when the attack fails.

The old failure was that these were separate additive terms, and compensation is not additive. An open file matters enormously when the king is exposed and hardly at all when it is not. A network learns that interaction; a table of bonuses could not express it.

The test the engine is really running

An evaluation after a sacrifice is a claim that across the lines it searched, the defender never gets to consolidate. That is what compensation means concretely: every defensive attempt runs into something.

This is why the verdict is so sensitive to depth. A sacrifice looking excellent at depth 14 and poor at depth 22 usually means the search found a defensive resource, and the resource is almost always one of three things:

Defence What it does
A counter-sacrifice returning material Buys off the attack, leaving a level endgame
A king walk to an unexpected square The attack was aimed where the king no longer is
An in-between move Interposes a threat, gaining the tempo the defence needed

Human attackers miss the counter-sacrifice most often. Giving material back is not in the attacking mindset, and it is the most common way a beautiful sacrifice turns out to be nothing.

When to still distrust the verdict

Two situations.

A large, stable evaluation for the defender in a position that is unpleasant to hold. The engine is right that the defence holds; it has no view on whether a human will find eight consecutive only-moves. Against a person, a sacrifice the engine calls unsound may still be the best practical decision, and this is a real difference between correct and useful.

An evaluation that has not stabilised. In sharp sacrificial positions the number can move by a pawn between consecutive depths for a long time. Reading it before it settles is reading an unfinished calculation, and sacrifices produce exactly the tree shape where that takes longest to resolve.

Using it on your own games

When you sacrificed and it did not work, the productive question is not what you should have played instead. It is which of the three defences above refuted it, because that is the one you will keep missing.

When you declined a sacrifice and the engine says it was sound, play the attacking line out and count how many only-moves it required. If the answer is one or two, you missed something you should have found. If it is six, you made a reasonable practical decision and the engine is describing a different game than the one you were playing.

Common questions

Are chess engines good at judging sacrifices now?
Far better than they were. Neural evaluation improved assessments of long-term compensation specifically, which was the historic weakness. A modern engine saying a piece sacrifice gives full compensation is usually right, where the same claim from a 2005 engine was frequently wrong.
Why does the engine reject my sacrifice that looks winning?
Most often because it has found a defensive move you did not consider, frequently a counter-sacrifice returning the material to defuse the attack. Play out the engine's defence and the refutation is normally visible within five moves.

Try it on your own position

The analysis board runs the same engine in your browser, free. The app adds what a web page cannot: reading a position straight from a photograph, saved boards, and analysis with no connection.

Download Chess Engine for Stockfish on the App StoreGet Chess Engine for Stockfish on Google Play

Related