hr-studioAI · 04
A computational design primer · GANs

Two networks, and neither has seen the answer

One invents; one judges. The inventor has never been shown a single real example — it learns entirely from how badly it is caught. The judge learns entirely from how badly it is fooled. Between two networks that each understand nothing, a third thing appears: the ability to make something that has never existed but belongs.

Scroll — watch them fight
i.

A forger and a critic, locked in a room

One network has never seen the real thing. It takes a handful of random numbers and paints something. The other network sees real examples and forgeries, mixed, and must say which is which.

Neither is told what "real" means. The forger learns only from the critic's mistakes; the critic learns only from the forger's improvements. They are each other's entire education, and the training signal is nothing but disagreement.

Grey points are real. Orange points are invented. The background is what the critic currently believes: warm where it smells a fake, pale where it is fooled.

Training live · grey real · orange forged
ii.

The loss that kills the forger

Goodfellow's original paper wrote the forger's goal the obvious way: make the critic's "fake" score as low as possible. It does not work, and the reason is a lesson about gradients rather than about art.

Once the critic is confident — once it says "fake, certainly" — that score is pinned near zero and it stops changing. A flat score has no slope, and a forger with no slope has no idea which way to move. The stronger the critic, the deader the signal. The same paper supplies the fix in a footnote: have the forger maximise the chance of being called real instead. Mathematically almost the same objective. Numerically, the difference between learning and not.

Switch the loss and turn the critic up. One of these two survives.

Same networks · different objective
iii.

Now make it draw

Swap the two output numbers for sixty-four — an 8×8 tile of greys. Nothing else about the networks changes. The forger still takes noise and paints; the critic still guesses.

The real set is four patterns: a bar, a beam, stripes, a chequer. The forger has never been shown a rule, an edge, or a symmetry — only whether it got caught. Watch the tiles resolve out of static.

And then count how many of the four it actually bothers to learn.

Top: the real four · below: forged, live
iv.

When one trick is enough

The forger's job is not to reproduce the data. It is to fool the critic — and those are not the same thing. If one pattern works, the safest move is to paint it again. And again. It abandons the rest of your vocabulary and keeps the trick that pays. This is mode collapse, and it is the reason GAN outputs so often look samey.

The cure is to let the critic see a whole batch at once and measure its variety. A tray of identical forgeries is now trivially detectable, so being boring becomes expensive.

Two forgers below, trained side by side on the same four patterns. Only one of them is being punished for repeating itself.

Patterns reached, over training
v.

The pattern studio

Draw your own tiles. Two, four, six — whatever vocabulary you want the forger to learn. Then let the pair of networks fight over them, and watch a machine that has never seen a pattern in its life work out what yours have in common.

The strip along the bottom is a walk through the forger's imagination: a straight line in its noise space, decoded. Where it crosses between two of your tiles, you can see it trying to invent something in between.

Draw a tile · Add it · watch it learn
Two networks, neither of which knows what a pattern is, and between them a thing that can draw one. Nothing was ever explained to either of them.