TensoriumInterview preparation
← Home

Core concepts · 62 topics

A guided path through the ideas behind modern LLMs.

Read the stages in order: how text becomes a prediction, what happens inside the Transformer block, how a model learns, then serving, scale, and post-training. Every topic names what to know first, then gives the intuition, the math with concrete numbers, the common misconception, and a self-check. Already comfortable with the basics? Switch to By area and jump straight to a topic.

New to machine learning? Start here instead.

These topics work best as a refresher; they assume ideas like probability and loss. Begin with three short beginner lessons (tokens, embeddings, next-token prediction), then the visual walkthrough for attention and the Transformer.

Finish line: You can explain how text becomes a prediction and what training does to improve that prediction.

Topic 59 of 62 · Wider ML toolkit

Diffusion vs GAN

Medium

How do diffusion models and GANs learn to generate samples, and what are their core trade-offs?

Why this mattersDiffusion replaces an unstable adversarial game with supervised denoising at sampled noise levels, shifting the engineering trade-off to iterative sampling latency.

1 · Start with the intuition

A GAN frames generation as a two-player minimax game: a generator maps random noise to an image in a single forward pass, while a discriminator tries to tell real images from generated ones. A diffusion model removes the adversarial game entirely: it defines a fixed forward process that gradually corrupts training images with Gaussian noise, and trains a single denoiser network with a simple supervised regression loss to predict the added noise at any corruption level t. At generation time, starting from pure Gaussian noise, a sampler calls that denoiser repeatedly to step back toward a clean sample.

2 · How the mechanism works

Mechanism step 1 of 3 · no question to answer

Corrupt in closed form

Sample a timestep t and noise ε ~ N(0, I), and form xₜ = √ᾱₜ x₀ + √(1 − ᾱₜ) ε in one step.

Next, we will look at: Train by noise regression. Move on when this operation makes sense.

Visualizing the behavior

Two different training signals

G(z)xₜε̂target εz ~ N(0, I)Generator GDiscriminator Dreal vs fakeadversarial lossreal xdata x₀add noisesample t, εDenoiser εθinput (xₜ, t)‖ε − ε̂‖²regression loss
Top: the GAN generator learns only through a moving, learned critic. Bottom: the diffusion denoiser gets a fixed supervised target, the exact noise that was added, at a randomly sampled noise level.

DDPM linear schedule (β: 1e-4 → 0.02, T = 1000)

Derived (approx.)
00.5102505007501000timestep tcoefficient
  • signal √ᾱₜ
  • noise √(1 − ᾱₜ)
xₜ = √ᾱₜ·x₀ + √(1 − ᾱₜ)·ε. By t ≈ 500 the input is mostly noise; by t = 1000 it is essentially pure noise, which is where sampling starts. Values are approximate.