Generative Vision: GANs & VAEs

generator

The generator is the "artist" half of a GAN: feed it a vector of random numbers and it paints an image. It never sees the training images directly; its only feedback is the discriminator's verdict on its fakes. So it learns, purely from "you got caught" versus "you fooled me" signals, to transform meaningless noise into images that match the data. The random input is what lets it produce variety — different noise vectors give different images.

The generator is a function G mapping a latent vector z (drawn from a fixed simple prior p(z), typically N(0, I)) to an image. Architecturally it upsamples from a low-spatial-resolution, high-channel tensor to a full-resolution image — classically via transposed (fractionally-strided) convolutions as in DCGAN, or via upsample-then-convolve blocks — with batch or instance normalization, ReLU/LeakyReLU activations, and a tanh output layer. It is trained to maximize the discriminator's mistake on its outputs, and crucially it learns the data distribution implicitly: there is no explicit likelihood, only the adversarial signal back-propagated through D into G.

There is a subtlety in the objective. The textbook generator loss minimizes log(1 − D(G(z))), but early in training D(G(z)) is near 0 (fakes are obviously fake), where that loss is flat and its gradient vanishes — the generator cannot learn. The standard fix is the non-saturating loss: instead maximize log D(G(z)), which gives strong gradients exactly when the generator is losing badly. During generator updates the discriminator's weights are frozen (and vice versa); only G's gradients are applied. Modern generators add conditioning inputs (class labels, text, source images) and style-based control (StyleGAN's mapping network and AdaIN).

Generator capacity and the noise dimension bound the diversity it can express, but the binding constraint is usually the training game, not capacity — a generator can have ample capacity yet still suffer mode collapse and emit only a few image types because that locally fools the discriminator. Output range matters too: pair a tanh-bounded generator (outputs in [−1, 1]) with correspondingly scaled real images.

Also called
generator networkG