L.38Part 6 / Images
Contents

Close Relatives

Diffusion models conquered the world by their stability, but they are not the only machines able to create new images from past examples — and they certainly were not the first. Three great generative families try to reach the same mountain peak. What deeply distinguishes them can be measured precisely: how winding the road is, how many steps of computation it calls for, and how sure they are of not collapsing along the way.

Key terms: adversarial network (GAN) flow matching diversity coverage (mode coverage) mode collapse

The same target, completely different philosophies

All three great approaches attempt the same thing: to receive a handful of random noise and turn it into a coherent shape that could very well have belonged to the real data of the world. All start from the same raw material — pure chance — and all must be judged by the same two great questions: how convincing are the samples produced, and how much of the richness of the whole data set do they manage to cover?

Our testing ground remains the same elegant spiral from the lesson on diffusion, with its six hundred points. We shall train each of the three methods in turn, on this very page, following their intimate differences of character.

The forger and the expert: adversarial networks (GAN)

The oldest and most spectacular of the three methods is the adversarial network (GAN). It stages a captivating duel between two rival networks: the forger (the generator) and the art detective (the discriminator). The forger starts from noise and tries to manufacture a plausible point; the detective receives now a genuine point from the spiral, now a fabricated one, and tries to say without fail which is which.

The two train in a merciless competition: every mistake of the detective teaches it to be more vigilant, and every unmasking forces the forger to become more refined. This struggle has a unique feature the other methods envy: generation happens instantly, in a single pass through the network! There are no intermediate steps, no gradual developing and nothing to repeat.

Hairpins and the straight line: diffusion vs flow matching

Diffusion, as we explored it in detail, refuses the leap in one piece: it cleans the noise with Benedictine patience, in tens or hundreds of small steps, adding and subtracting dust at every turn. It is a winding road of hairpin bends, guided by a curved field of forces.

The newest of the approaches — which has become the foundation of the latest leading models in the industry — is flow matching (Flow Matching). It asks a disarmingly simple question: “if we want to travel from a point of noise to a real point in the data, why take complicated, curving detours? Why not draw a perfectly straight line between the noise and the image?”.

The flow network learns the constant speed at which we must move along these straight lines. At generation, the computer starts from noise and advances straight, with a firm step, along the indicated trajectory. Because the path is straight and predictable, it can be covered in far fewer steps without losing fidelity.

The three, trained here

The panels train independently, through their own buttons. Diffusion and flow learn in a few seconds, while the adversarial pair calls for more patience, because at every iteration two rival networks have to be kept in step.

Speed on the clock: how many steps are really needed?

Once a network has been trained, we can ask it to draw with different budgets of time: from just 2 or 5 quick steps to 20 or 50 meticulous ones. The table compares the performance of diffusion and of flow at different sampling speeds.

Quality, by number of steps

Coverage measures how many of the 24 sectors of the spiral the generated points manage to reach. It shows whether the model masters the whole diversity of the shape or only one comfortable corner. A method that generates only a few beautiful points, but obsessively crowded in the same place (the phenomenon of mode collapse), is like a painter who has learned to paint one apple impeccably and refuses to draw anything else. True generative intelligence calls for complete coverage.

Three paths to the same peak: stability versus speed

The adversarial network hides a great secret, which a single lucky attempt does not reveal: it is terribly unstable in training. If you train it again, starting from other numerical values, it may reach a splendid shape or it may collapse catastrophically, sticking at a dead point where it draws only meaningless scribbles.

Press the button below to train new GAN pairs and watch the variation in the results: uncertainty is the price paid for the leap in a single step.

The same method, other starts

Here is the complete picture of the three mountain paths to the same peak: the route along the sharp ridge (the GAN), which is the shortest and most direct, but with a huge risk of falling; the route of wide hairpin bends (Diffusion), long and patient, but entirely free of unpleasant surprises; and the straight, cleared and efficient road (Flow Matching), cut expressly to join safety with speed.

This comparison explains the history of recent years: for a long time GANs were the only ones capable of sharp images, and researchers endured their caprices. Then diffusion conquered the world because it worked every time, with no unexpected failures. And today flow matching offers the best of both worlds: straight, stable and fast trajectories.

With this overview our journey through the universe of images ends. In the next part of the course we shall no longer look at text and image as two separate worlds but bring them together in a single common space of thought.