Skip to content
← Generative AI
Q23

Vanilla GAN architecture and information flow

GANArchitectureVanilla GAN
Discuss the architecture of a vanilla GAN in detail. Explain the Generator and Discriminator networks, their information flow, and the objective function associated with the architecture.

What's actually being asked

A detailed walkthrough of the vanilla (original, fully-connected/conv) GAN's two sub-networks, how information flows through them, and the associated objective function.

Answer

Generator network

Takes a latent noise vector z ~ p_z (e.g., 100-D, sampled from N(0,I) or U(−1,1)) as its only input. In the original (Goodfellow et al.) formulation this is a multi-layer perceptron with ReLU hidden layers and a sigmoid/tanh output; in the common image-generation variants it's a stack of transposed-convolution ("deconv") layers that progressively upsample a small spatial map into a full-resolution image, with batch normalization and ReLU between layers and a tanh at the output to match a [-1,1] pixel range. Output: x_fake = G(z), same shape as a real data sample.

Discriminator network

Takes a data-shaped sample — either a real x or a fake G(z) — and squeezes it down to a single scalar. Vanilla version: MLP with LeakyReLU hidden layers; image version: stack of (strided) convolution layers with LeakyReLU, downsampling spatially, flattened and passed through a final fully-connected layer with a sigmoid activation, giving D(·) ∈ (0,1) — interpreted as "the probability this input is a real sample."

Information flow

z → G → x_fake, then {x_fake, x_real} → D → D(x_fake), D(x_real). Information flows in one direction on the forward pass (noise → generated sample → classification), and the resulting scalar losses flow back along the same path in reverse on the backward pass — D's gradient updates its own weights directly, and G's gradient has to pass through D's weights (without updating them) to reach G's own parameters. The diagram above shows exactly this: noise feeds the generator, its output and a genuine real image both feed the discriminator, and the discriminator collapses either input down to a single real/fake probability.

Critically, G and D never exchange information except through this scalar probability and its gradient — G has no direct access to real data at all, and D has no access to z.

Objective function

min_G max_D V(D,G) = 𝔼_{x∼p_data}[log D(x)] + 𝔼_{z∼p_z}[log(1 − D(G(z)))]

  • D is trained to maximize V(D,G): push D(x)→1 on real samples and D(G(z))→0 on fakes — standard binary cross-entropy classification, just applied to two different sample sources.
  • G is trained to minimize the same V(D,G) — since the real-data term doesn't involve G at all, this is equivalent to minimizing 𝔼_{z}[log(1−D(G(z)))]. In practice, the non-saturating variant is used instead: G maximizes 𝔼_z[log D(G(z))], which gives much stronger gradients when D is confidently rejecting G's (still-poor) early samples, avoiding the vanishing-gradient problem of the original formulation.
  • At the (theoretical) global optimum of this minimax game, p_G = p_data and D(x) = 0.5 everywhere — D genuinely can no longer tell real from fake.

Why "vanilla"

This architecture is called vanilla precisely because it has none of the later add-ons — no class conditioning (cGAN), no progressive growing or style-based latent injection (StyleGAN), no architectural tricks for training stability beyond the basic conv/FC stack described above. It's the baseline every GAN variant is compared against.

Exam tip

When asked for "architecture in detail," explicitly separate the two networks' layer types and activation functions (don't just say "generator makes fakes, discriminator checks them") — the layer-level detail (batchnorm placement, LeakyReLU in D, tanh output in G) is what separates a full-marks answer from a one-paragraph summary.

ARCHITECTUREhow the pieces talk
6 components. Noise vector z to Generator network; Generator network to Generated image (upsample); Generated image to Discriminator network; Real image to Discriminator network; Discriminator network to P(real) output (sigmoid).Noise vector zGenerator networkGenerated imageReal imageDiscriminator networkP(real) outputupsamplesigmoid