What is Generative AI?
GANs, VAEs, diffusion, and LLMs — what makes each one generative, and when each one is the right architecture. The shift from recognising to creating.
Every model you have built so far maps input to label. Generative models learn the data distribution itself — then sample from it to create new data that never existed.
Sections 5 through 9 covered discriminative models — they draw a boundary between classes. Given an image, predict "kurta" or "jeans." Given a sentence, predict "positive" or "negative." The model learns P(label | data) — the probability of a label given the data. It never learns what data looks like, only how to classify it.
Generative models learn P(data) — the probability distribution of the data itself. A model that has learned P(data) for fashion images can answer: "what does a typical denim jacket look like?" and then generate one. It can synthesise new jacket images that are statistically indistinguishable from real ones — because it has learned the underlying distribution, not just the boundary between categories.
Why does this matter in practice? Shopify uses generative models to create product variations — same design, different colours — without photographing each one. DoorDash uses them to generate synthetic training data for rare dish categories with few real photos. Stripe uses LLMs (the largest generative models) to draft merchant communications. Every use case involves creating new content from a learned distribution.
A discriminative model is a critic — shown a painting, they say "Monet" or "Picasso." They have learned boundaries between styles but cannot paint. A generative model is an artist — they have studied thousands of Monet paintings so deeply that they can create a new painting that looks authentically Monet, even though that exact painting never existed.
The critic learns P(style | painting). The artist learns P(painting) in Monet's style — the full distribution of what Monet paintings look like — and samples from it. That is the fundamental difference.
Four generative model families — what each one does and how
Latent space — the compressed representation all generative models share
Every generative model learns to compress data into a lower-dimensional latent space and decode from it. A 224×224 RGB image has 150,528 dimensions. A well-trained VAE compresses this to 128 or 256 latent dimensions that capture all meaningful variation — colour scheme, shape, texture, style — while discarding irrelevant pixel-level noise. The latent space is a map of the data distribution.
Nearby points in latent space correspond to similar images. You can interpolate between two points and get a smooth transition between two images. You can add and subtract directions: the famous example from Word2Vec — king − man + woman ≈ queen — works in image latent spaces too: kurta_latent + blue_colour_vector ≈ blue_kurta_latent. This is what makes latent spaces useful for creative applications.
This only works cleanly in VAE latent spaces — GANs have unstructured spaces
FID, IS, and CLIP score — evaluating generative models
You cannot use accuracy to evaluate a generative model — there is no correct answer. How do you measure whether a generated image is "good"? Three metrics are standard: Fréchet Inception Distance (FID) measures how similar the distribution of generated images is to real images. Inception Score (IS) measures diversity and quality together. CLIP score measures how well an image matches a text description.
Distance between real and generated image distributions in InceptionV3 feature space
exp(E[KL(p(y|x) || p(y))]) — measures diversity across classes and confidence per image
Cosine similarity between CLIP image embedding and CLIP text embedding
Which generative model for which task — a practical framework
The jobs built on top of generative AI — and how they actually divide the work
Almost nobody at a normal company trains a generative model from scratch anymore — that is the job of a handful of labs with enormous compute budgets. What has exploded instead is the layer of roles built on top of foundation models: people who take a pretrained GPT, LLaMA, or Stable Diffusion checkpoint and turn it into a working product feature. Three roles show up again and again in job postings, and interviewers expect you to know which one you are actually being hired for.
The build-versus-buy decision behind all three roles is usually the first real conversation on a generative AI project. Do you call an API (fastest to ship, most expensive per call, zero infrastructure), fine-tune an open model (slower to ship, cheaper at volume, requires ML engineering time), or pretrain something new (a decision that, realistically, only a small number of companies on Earth should ever make)?
Five things people get wrong about generative AI
Underneath, it is still the same machinery covered throughout this track — gradient descent, backpropagation, loss functions, the dot products from Module 05. What actually changes is the training objective (learning P(data) instead of P(label given data)) and the scale (billions of parameters instead of thousands). A transformer-based LLM and a logistic regression model are trained with the same core optimisation loop; generative models did not throw out the fundamentals, they scaled them up and pointed them at a different target.
The mechanical claim is true — the training objective really is next-token prediction, nothing more exotic than that. But 'just' undersells what emerges from doing that at enormous scale: multi-step reasoning, following novel instructions never seen in training, writing working code — none of these were explicitly supervised, they emerged from scaling the same simple objective. At the same time, 'it's just autocomplete' gets used to wave away real capability limits, like hallucination, as if naming the mechanism settles what the system can reliably be trusted to do. Both the dismissal and the hype skip past the same nuance: the training objective is simple, the resulting behaviour is not fully predictable from that simplicity alone.
Hallucination is a structural consequence of how these models generate text, not a stray bug in an otherwise correct implementation. An LLM samples from a learned probability distribution over what token is likely to come next — it is producing what is statistically plausible, not looking up what is verified true, because it has no built-in fact store to check against. Even a model trained flawlessly on its objective will occasionally produce a fluent, confident, wrong statement when nothing grounds the answer in a retrieved or verified source. Retrieval-augmented generation, tool use, and citations reduce the problem by giving the model something to ground against — they do not eliminate it, because the underlying generation mechanism never changes.
Both come from exactly the same sampling process — drawing the next token from a learned probability distribution, with temperature controlling how much the model deviates from its single most likely choice. What we call 'creative' is ungrounded generation in a context where that is desired (a poem, a brainstormed idea); what we call 'hallucination' is the identical mechanism in a context where groundedness was expected (a factual claim, a citation). A model that could never generate anything ungrounded would also be incapable of genuine creative generation — the tension is inherent to sampling, not a separate failure mode that can be independently switched off.
Task fit dominates raw scale far more often than marketing suggests. A GAN still wins for latency-sensitive single-pass image generation that a diffusion model's multi-step denoising cannot match. A VAE's smooth latent space is still the right tool for anomaly detection and molecule generation, tasks where a GAN or diffusion model's strengths are irrelevant. A small model fine-tuned on a narrow task routinely beats a much larger general-purpose one on that task, at a fraction of the latency and cost. 'Generative AI' names a family of architectures, not one model — picking the wrong family for your constraints is a common, avoidable mistake.
Generative AI — 5 questions interviewers actually ask
A discriminative model learns P(label given data) directly — it models the decision boundary and nothing about how the data itself was produced. A generative model learns P(data), or the joint P(data, label), the full distribution the data came from, which lets you sample new data from it. Worth adding unprompted: some classic generative models, like Naive Bayes, are still used for classification — they learn P(data given label) for each class and use Bayes' rule to get a decision at inference time. That shows 'generative' describes what the model represents, not necessarily how it gets used at prediction time.
It means the model defines, or approximates, a probability distribution over the data (or over data conditioned on some input), and 'generating' something means drawing a sample from that distribution. The output is not retrieved from storage or copied from training data — it is a fresh draw from a learned distribution, which is why the same prompt or noise vector can produce different outputs on different runs, and why evaluating these models requires distributional metrics like FID instead of accuracy against one correct answer.
GANs pit a generator against a discriminator in an adversarial game and produce sharp images in a single forward pass, but training is unstable and prone to mode collapse. VAEs encode data to a regularised probability distribution and decode back, optimising the ELBO — reconstruction plus a KL term — giving stable training and a smooth latent space at the cost of blurrier outputs. Diffusion models learn to reverse a gradual noising process, generating through many small denoising steps, trading slow inference for the best image quality and diversity available today. LLMs autoregressively predict the next token given everything before it, and generation is repeated sampling from that predicted distribution one token at a time.
They hallucinate because generation is sampling from a learned distribution over plausible next tokens, not a lookup against verified facts — there is no ground truth store the model consults before answering. Grounding techniques (retrieval-augmented generation, tool use, requiring citations, RLHF calibration toward saying 'I don't know') substantially reduce the rate in practice. But being honest about the mechanism: none of these fully fix it, because the underlying generation process — sampling the statistically likely continuation — never changes. The realistic framing in an interview is 'substantially mitigated, not eliminated.'
Start from modality and constraints, not from whatever is trending. Text generation almost always means an LLM. Open-ended image generation from a text prompt means diffusion. A latency-critical, single-pass image task (a live filter, a real-time avatar) points toward a GAN because diffusion's iterative denoising is too slow for that budget. Anomaly detection or a task that needs a smooth, interpolatable latent space points toward a VAE. Layered on top of all of that is the build-vs-buy question from earlier in this module: whether prompting an existing API, fine-tuning an open model, or — almost never — pretraining from scratch is the right level of investment for the constraint you are actually solving for.
You understand the generative landscape. Next: the adversarial game that started it all.
This module introduced all four families at a high level. The next four modules go deep on each one in turn. Module 61 builds a GAN from scratch — generator, discriminator, the adversarial training loop, and why training is so unstable. Understanding GANs first builds the intuition that makes VAEs, diffusion, and LLMs click into place.
Two networks in adversarial competition. Mode collapse, training instability, Wasserstein distance — the honest account of what makes GANs hard to train.
🎯 Key Takeaways
- ✓Discriminative models learn P(label | data) — they classify. Generative models learn P(data) — the full data distribution — and can sample new data from it. This shift from recognising to creating is the core of generative AI.
- ✓Four generative model families: GANs (adversarial training, sharpest images, unstable), VAEs (smooth latent space, stable training, blurry outputs), Diffusion models (best quality and diversity, slow inference, powers Stable Diffusion), LLMs (autoregressive text generation, emergent capabilities, powers GPT and Claude).
- ✓All generative models share a key concept: the latent space — a compressed lower-dimensional representation of the data distribution. Nearby points in latent space correspond to similar outputs. You can interpolate, add, and subtract direction vectors to control generation.
- ✓The reparameterisation trick is what makes VAE training work: instead of sampling z directly (which breaks gradients), sample epsilon ~ N(0,I) and compute z = mean + std × epsilon. This makes the sampling operation differentiable so gradients can flow through the encoder.
- ✓Evaluate generative models with FID (lower = better, measures distribution similarity to real data), IS (higher = better, measures quality and diversity), and CLIP score (higher = better, measures text-image alignment). Never use accuracy — there is no single correct output.
- ✓Architecture selection: LLMs for any text task, Diffusion for text-to-image and image editing, GANs for fast single-pass image synthesis, VAEs for anomaly detection and structured latent space applications. Diffusion has overtaken GANs for image quality; LLMs have overtaken rule-based systems for text.
Discussion
0Have a better approach? Found something outdated? Share it — your knowledge helps everyone learning here.