AIQ AIQ
Generative AI · Lesson 3.2.3

Teaching "Generative AI" to Architect mode (ages 15–18)

Part of the Generative AI lesson guide. Teaching a different grade? 🌈 Explorer (5–7) · 🔧 Builder (8–10) · 💻 Hacker (11–14)

Hook & Warm-Up

No mascot, no soft framing — treat this like the opening of a technical lecture. Read the app's hook line as a direct statement of what's about to be examined:

"ChatGPT predicts text word by word. DALL-E turns noise into images. Both are generative AI. Let's examine the architectures behind AI content creation."

Open with a harder framing question than the hook itself poses: "Both of these are called 'generative AI,' but they're trained with completely different objective functions, on completely different processes. What does it even mean to call them the same category of technology?" Let students sit with this — there isn't a clean one-line answer, and that's the point. The honest answer, which the lesson builds toward, is that "generative AI" is a family defined by output (they all produce new content matching a learned distribution) rather than by one shared mechanism — and by the end of class students should be able to name at least three mechanisms in that family precisely.

Note for context, without dwelling on it: not every image generator uses the same lineage. Diffusion models (Stable Diffusion, and the engines behind Midjourney and current DALL-E versions) dominate today, but Generative Adversarial Networks (GANs) came first historically and are still relevant for understanding the field's development and for certain fast-generation use cases. This lesson covers all three major mechanisms — autoregressive text generation, diffusion, and adversarial generation — as distinct technical lineages, not variations on one idea.

Main Activity

Treat the app's three scenes as headings for a technical walkthrough that goes one level deeper than Hacker mode — this age band should leave able to state actual training objectives, not just mechanisms.

Text generation — causal language modeling: A GPT-style model's training objective is causal (autoregressive) next-token prediction, maximizing log-likelihood — for every position in a training sequence, the model is trained to assign as much probability as possible to the token that actually came next, and is penalized (via cross-entropy loss) for spreading probability elsewhere. This is fundamentally different from an earlier alternative called masked language modeling (used by models like BERT), where random tokens are hidden anywhere in a sentence and the model fills them in using context from both directions — that's useful for understanding text, but it's not built to generate text one token at a time the way a causal model is. It's worth being precise here if a student brings up BERT or a masked model: they're both "language models," but only the causal, autoregressive kind is the generative mechanism this lesson is about.

Image generation — diffusion, guidance, and latent space: A diffusion model is trained on a forward process that progressively adds Gaussian noise to real images across many steps, and a neural network (commonly a U-Net or a transformer-based denoiser) is trained to predict the noise that was added at each step — equivalent, under the relevant math, to estimating the score function (the gradient of the log-probability of the data) at that noise level. Generation reverses this: start from pure noise and repeatedly subtract the predicted noise, recovering a sample from the learned image distribution. Two refinements are worth naming precisely, because both are direct quiz content: classifier-free guidance steers generation toward the text prompt by training the same network both with and without the text conditioning (randomly dropping the prompt during training), then at generation time computing both a conditional and an unconditional prediction and extrapolating from the unconditional toward the conditional by a guidance scale — amplifying prompt adherence beyond what plain conditioning alone would produce, at the cost of some diversity and realism if pushed too far. Latent diffusion (the approach behind Stable Diffusion) runs this entire denoising process not on raw pixels but inside a much smaller, compressed latent space produced by a separately trained autoencoder — reducing the dimensionality the denoising network has to work with, which is primarily what makes it computationally practical to run on consumer hardware rather than requiring a data-center-scale model for every image.

Adversarial generation — GANs: A GAN trains a generator network and a discriminator network in a minimax game: the generator tries to produce samples the discriminator can't distinguish from real training data, and the discriminator is simultaneously trained to maximize its accuracy at telling them apart. Unlike a diffusion model, a trained GAN generator produces a full sample in a single forward pass rather than through many iterative refinement steps — a genuine engineering tradeoff (GANs are typically faster to sample from; diffusion models have generally proven easier to train stably and now dominate most state-of-the-art image systems). Worth naming explicitly if a student asks why GANs fell out of favor: adversarial training is notoriously unstable — a common failure mode called mode collapse happens when the generator discovers a small handful of outputs that reliably fool the current discriminator and produces those repeatedly instead of the full diversity of the training data, and getting the two networks to improve in balance rather than one overpowering the other requires careful tuning.

The alignment problem: Bring this in explicitly as its own topic, since it's this age band's quiz content and it's the piece that connects the technical material to policy and ethics. None of the objectives above — predict the next token, denoise an image, fool a discriminator — has anything to do with producing outputs that are honest, safe, or aligned with what a user actually wants. Alignment is the separate, additional problem of getting a model's behavior to conform to human values and intentions, typically addressed after the base training described above through techniques like instruction tuning and reinforcement learning from human feedback (RLHF), where human raters' preferences are used to further adjust the model's outputs. Emphasize that alignment is an open, actively researched problem, not a solved feature — a model can be technically excellent at its training objective while still being poorly aligned with what a user actually needs from it.

Discussion

Quiz Walkthrough

Classifier-free guidance in diffusion models works by... (Using a separate classifier / Interpolating between conditional and unconditional generation to amplify prompt adherence / Classifying outputs / Removing classifiers)
Interpolating between conditional and unconditional generation to amplify prompt adherence. The same model is trained with and without the text prompt; at generation time, extrapolating from the "no prompt" prediction toward the "with prompt" prediction pushes the output to follow the prompt more strongly than ordinary conditioning would on its own — without needing a separate trained classifier at all, which is what the older "classifier guidance" approach required.
The training objective for GPT models is... (Causal (autoregressive) next-token prediction maximizing log-likelihood / Image generation / Question answering / Masked language modeling)
Causal (autoregressive) next-token prediction maximizing log-likelihood. Every training example is turned into "predict this next token given everything before it," repeated across the whole sequence — distinct from masked language modeling (like BERT), which fills in hidden tokens using context from both directions and isn't built for left-to-right generation.
Latent diffusion (Stable Diffusion) operates in latent space rather than pixel space primarily for... (Less training data / Better quality / Simpler architecture / Computational efficiency — reducing the dimensionality of the denoising process)
Computational efficiency — reducing the dimensionality of the denoising process. Running the many iterative denoising steps on a small compressed representation instead of full-resolution pixels is what makes it practical to train and run these models without data-center-scale compute for every single image.
The alignment problem in generative AI refers to... (Image alignment / Aligning GPUs / Ensuring model behavior conforms to human values and intentions / Text alignment)
Ensuring model behavior conforms to human values and intentions. A model can be objectively excellent at its base training objective — next-token prediction, denoising, adversarial generation — while still producing outputs that are unsafe, dishonest, or simply not what the user actually wanted; alignment is the separate, ongoing effort to close that gap.

Wrap-Up & Extension

Close with: "Every mechanism you learned today — next-token prediction, denoising diffusion, adversarial training — optimizes a mathematical objective that has nothing to do with truth, safety, or intention. Fluent, convincing output is what a well-optimized version of any of these objectives looks like. Alignment, copyright law, and misinformation policy all exist because the raw objective function was never enough on its own — and all three are still unresolved, active problems you're old enough to actually follow as they develop, not just be told about after they're settled."

Extension activity — Case Study Presentation: Have students individually or in pairs research one current, real, and specific case involving generative AI — a copyright lawsuit against an AI company, a documented deepfake incident and its consequences, or a publicized AI alignment failure (a model behaving in an unintended or harmful way despite passing its training objective). Each presents a five-minute summary to the class covering: what mechanism from today's lesson was involved, what specifically went wrong or is being disputed, and what a plausible technical or policy fix might look like. Require they cite where they found their information and note whether the case is still legally or technically unresolved. This extends the 10–15 minute core lesson into a full period and connects the architecture-level material directly to the live policy debates it feeds into.

← Lesson overview ← Neural Networks (Architect) AI in Healthcare (Architect) →