01

A puzzle for computers

Solving a jigsaw puzzle is a classic challenge for computers. A program must decide which pieces fit together, using both their shapes and the picture printed on them. Researchers have studied automated puzzle solving for decades, and the problem is related to real tasks such as reassembling broken pottery or torn documents.

02

Tabs and blanks

Most jigsaw pieces have edges with tabs that stick out and blanks that curve in. Two pieces fit only if a tab on one matches a blank on the other in size and shape. Edge pieces have one straight side, and corner pieces have two.

03

The blue sky problem

Large areas of a puzzle, such as sky or sea, may be almost the same colour everywhere. Pieces from these areas look very similar. People solving puzzles know these sections are the hardest, because colour gives little help and they must rely on shape.

04

A colour shortcut

A model trained mainly on pairs from colourful parts of a picture might learn that matching colours along an edge means two pieces fit. In most cases this works. But in a blue sky region, almost every pair matches in colour, so the model would wrongly predict many fits.

05

Tempting mismatches

To test properly, a test set should include many pairs of pieces from the same blue region whose shapes do not fit. These are called hard negatives: examples that look similar to correct answers but are wrong. They reveal whether the model truly checks shape.

06

Measuring two things

A fair evaluation measures how often the model correctly identifies real fits and how often it wrongly accepts non-fits. A model that accepts every same-colour pair might find all the true fits but also accept many wrong ones. Both kinds of error matter for solving the puzzle.

07

Combining clues

A good solver combines several clues: the shape of tabs and blanks, the continuity of colour and texture across the edge, and lines or patterns that continue from one piece to the next. In uniform areas, shape becomes the main clue, so the model must give it enough weight.

08

Beyond puzzles

Similar problems arise in archaeology, where fragments of pottery or frescoes are reassembled, and in forensic work, where shredded documents are reconstructed. In these tasks, matching shapes and surface details together is essential, and hard negative examples help test the methods.

09

Building the dataset

Creating a test set of tempting mismatches is straightforward with a real puzzle: photograph pieces from a uniform region and record which edges actually fit by assembling them. The true fits come from the finished puzzle, providing reliable labels.

10

Testing with care

The NIST AI Risk Management Framework encourages testing AI systems with challenging cases, not just typical ones. Hard negatives are a simple and effective way to do this.

11

Puzzle shapes vary

Not all jigsaw pieces follow the same pattern. Some puzzles use irregular shapes, whimsy pieces cut like animals, or pieces with very similar tabs throughout. A model trained on one cutting style should be tested on others, because the shapes it learned to match may differ. Photographing pieces from directly above also helps compare edges accurately.

12

Edges first

Many people start a puzzle with the straight-edged border pieces, which are easy to identify.

13

Counting the possibilities

In a 1,000-piece puzzle, the number of possible pairs is enormous, so good shape filtering saves time.

14

Sky gradients

Real skies often shade gradually from deep blue to pale blue, which gives a faint clue.

15

Try the arithmetic

If a test includes 100 same-colour pairs, of which only 10 truly fit, a model that accepts every pair would be right about the 10 fits but wrong about the other 90, an error rate of 90 per cent on the non-fits.

16

The idea to take away

Two blue sky pieces can look alike even when they cannot fit. Building a test set with these tempting mismatches makes success depend on shape compatibility as well as colour continuity.

FOLLOW THE EVIDENCE

Sources & further reading

Figures in the example are illustrative. Photograph: original AI-generated illustration (Adobe Firefly), created for this story. Reference organisations do not endorse this website.