Curriculum

Topic 06 · Content Generation

Generative AI

Generative models learn the distribution of training data and sample from it to create new content—images, text, audio, video. Diffusion, GANs, and autoregressive LLMs dominate the field.

The idea

Three families dominate: GANs pit a generator against a discriminator in a minimax game. VAEs learn a continuous latent space via an encoder-decoder with a KL-divergence regulariser. Diffusion models learn to reverse a gradual noising process, iteratively denoising random Gaussian noise into structured samples.

Diffusion models now dominate image generation (Stable Diffusion, DALL-E 3, Imagen). LLMs are autoregressive—they predict one token at a time conditioned on all previous tokens, essentially modelling P(text) as a product of conditionals.

L(θ) = 𝔼[||ε − εθ(√ᾱₜx₀ + √1−ᾱₜε, t)||²]

Simplified diffusion loss: predict the noise ε from the noisy input at timestep t.

What to hold onto

  • Classifier-Free GuidanceA technique in diffusion that blends conditional and unconditional score predictions. Higher guidance scale → stronger adherence to prompt, lower diversity.
  • TemperatureIn LLMs, sampling temperature scales logits before softmax. Temperature=0 is greedy (argmax); temperature=1 is model distribution; >1 is more random.
  • RLHFReinforcement Learning from Human Feedback fine-tunes LLMs to follow instructions. A reward model trained on human preferences is used as the RL reward signal.

Live: Diffusion Denoising Step Simulator

Drag the timestep slider from $t=1000$ (pure Gaussian noise) to $t=0$ (clean structured latent).

Reverse Langevin Dynamics

Quick answers

What is Generative AI?

Generative AI refers to models that learn the statistical distribution of training data and can generate new samples from that distribution. Key approaches include Diffusion Models (which learn to reverse a noising process), GANs (adversarial generator-discriminator games), and autoregressive LLMs that predict tokens sequentially.

How do diffusion models work?

Diffusion models learn to reverse a forward noising process that gradually adds Gaussian noise to training data over T timesteps. The model is trained to predict the noise at each step, then at inference time it starts from pure noise and iteratively denoises, producing high-quality samples.