Skip to main content

The model lab · Part 4

How do AI models generate images?

Meet Doodle-64R. You can ask it to draw a 3 or an E, and it builds the picture by running the classifier backward.

Doodle-64R

Model card
Type
Single-layer image generator (the Doodle-64 classifier run in reverse)
Parameters
64: the same one weight per pixel that Doodle-64 learned
Layers
1 (1 target choice → 64 pixel probabilities)
Input
1 choice: draw a "3" or draw an "E"
Output
64 pixels, each sampled from its own ink probability

Frontier image generators turn a prompt into a probability for millions of pixels and sample a picture. Doodle-64R does the same trick with 64 pixels and two prompts.

Ask the model to draw

You can choose a target and the model will draw it for you. This is the classifier from the last lab, run backward. There it read a drawing and named the letter. Here it takes the letter and produces a drawing.

Low creativity draws the same clean shape every time. Higher creativity lets each pixel wander, so the drawing gets noisier and less certain. Real image generators call this same dial the temperature.

The drawing the model made

Every pixel was decided on its own. The model never stored a picture of a 3. It rebuilt one from 64 weights, one coin flip per pixel.

15 of 64 pixels inked

Now read it back with Doodle-64
3
The classifier reads this drawing as a "3" with 86% confidence. The generator and the classifier share one set of weights, so what one draws the other recognizes.

Why each pixel chose ink or blank

Before the coin flip, every pixel holds a probability of ink. Blue pixels are almost certain to fill in for a 3. Faint pixels are almost certain to stay blank. The drawing above is one roll of these 64 dice.

High chance of ink: the 3 shape uses this pixelLow chance of ink: the other letter owns this pixel

How this generator works

The classifier and the generator are one model pointed two ways. The classifier takes 64 pixels and produces one answer. The generator takes one answer and produces 64 pixels. It reads the same 64 weights to do it.

A pixel whose weight votes for the letter you asked for is almost certain to fill in. A pixel whose weight votes for the other letter is almost certain to stay empty. The bars both letters draw sit in the middle, so a generated 3 and a generated E share them.

The coin flip is the important part. Because each pixel is sampled, the model can draw many different versions of the same letter from one request. A real image generator does the same thing at a giant scale. It turns your prompt into a probability for millions of pixels, then samples them into a picture nobody drew before.

Meet Doodle-64R

Doodle-64R is the classifier from the last lab turned around. Doodle-64 reads a drawing and names the letter. Doodle-64R takes the letter and produces a drawing. The R stands for reverse, because it runs the very same 64 weights the other direction.

This is the first model in our lab that generates instead of recognizing, which makes it the vision cousin of Parrot-43. A classifier answers a question about an image you gave it. A generator answers with an image it made. Below you can pick a target and watch the model build one for you.

A generator is a classifier in reverse

Here is the whole idea. A classifier takes 64 pixels and produces one answer. A generator takes one answer and produces 64 pixels. Both readings use the same weights, so you can walk them in either direction.

Doodle-64 learned that a pixel on the right curve votes for a 3 and a pixel on the left edge votes for an E. Doodle-64R reads those same votes as instructions. If you ask for a 3, every pixel that votes for a 3 fills in, and every pixel that votes for an E stays blank. The bars both letters share fill in either way, which is why a generated 3 and a generated E have the same top, middle, and bottom.

Every pixel is a coin flip

The model never stored a picture of a 3 to copy. It holds one probability of ink for each of the 64 pixels, and it flips a weighted coin for every one. A pixel that belongs to the shape you asked for comes up ink almost every time. A pixel that belongs to the other letter comes up blank almost every time.

The probability grid in the demo shows those 64 coins before they are flipped. Bright pixels are nearly certain to fill in. Faint pixels are nearly certain to stay empty. The drawing above it is one roll of all 64 at once.

Why the same drawing is never quite the same

Because each pixel is a separate coin flip, the same request gives a slightly different drawing every time. You can press generate again and watch the shape shift while staying a clear 3. That variety is the point of a generator. One prompt can produce many pictures.

The creativity slider is the dial behind that variety. At low creativity the coins are heavily loaded, so the model draws the same clean shape again and again. As you raise it, every coin drifts toward a fair 50/50, the drawing picks up noise, and the letter gets harder to read. Real image generators call this same dial the .

This is how real image models work

A tool like DALL-E, Midjourney, or Stable Diffusion is this demo grown enormous. It turns your prompt into a probability for millions of pixels, then samples them into a picture nobody has drawn before. The weights are learned from billions of images instead of set by two reference shapes, and the sampling runs in many careful steps instead of one. The core move is the same: a probability per pixel, then a roll of the dice.

You can prove the two directions share one brain right in the demo. Whatever Doodle-64R draws, feed it back and Doodle-64 reads it as the same letter. The model that writes and the model that reads are one set of weights, pointed two ways.

Try it yourself

Choose a 3 or an E and press generate again a few times to see how much one letter can vary. Then push the creativity slider up and watch the drawing dissolve into noise as every pixel loses its certainty. Keep an eye on the read-back panel, where the classifier names each drawing the generator makes.

Next up: How do neural networks recognize digits?