Foundation Models · M.Sc. AIS @ UniTN 2026
{name.surname}@unitn.it
University of Trento
Four tools from the last two lectures, and where each one comes back when the model has to draw.
| From | What we had | Here |
|---|---|---|
| Understanding: CLIP | A text encoder whose embeddings live in the same space as images. | It steers Stable Diffusion, and it scores the result (CLIPScore). (Sections 3, 7) |
| Understanding: ViT | An image is a grid of patches, each turned into a token. | Patches of a latent become tokens for a diffusion transformer (DiT, Sora). (Sections 3, 6) |
| Language block: next-token prediction | One loss trains an LLM on any sequence of tokens. | Turn an image into discrete tokens, and the same loss draws it. (Sections 4–5) |
| Training & Alignment: reward models, DPO | Learn what people prefer from pairs “A beats B”. | Human preference scores and win rates for images. (Section 7) |
The model that steers the generator is also often the one that grades it.
Question for the whole lecture: if the text encoder cannot see word order, can the generator draw it, and can the metric notice when it does not?
From one pass (GANs) to many small steps (diffusion), to one token at a time (autoregressive), to one model that reads and draws, to a model you can act in.
Formally, we want to sample from \(p(\text{image} \mid \text{prompt})\): draw one image, and a different plausible one the next time we ask.
Blurry averages and missing variety (mode collapse) are the two classic failures.
You train a network to predict the ball’s position after the fork, with the squared error as the loss. What does it learn to predict?
Predict +1 (or −1)
Expected loss \(= 0.5 \cdot (1-1)^2 + 0.5 \cdot (1-(-1))^2 = \mathbf{2}\)
Predict 0 (the middle)
Expected loss \(= 0.5 \cdot (0-1)^2 + 0.5 \cdot (0-(-1))^2 = \mathbf{1}\), the minimum.
A generator must sample from the distribution; predicting its mean gives one blurry average.
Kingma, D. P. & Welling, M. (2014). Auto-encoding variational Bayes. ICLR.
Goodfellow, I. et al. (2014). Generative adversarial nets. NeurIPS.
We want a generator that is, at the same time:
| VAE | GAN | wanted | |
|---|---|---|---|
| stable to train | ✓ | ✗ | ✓ |
| sharp samples | ✗ | ✓ | ✓ |
| covers all modes (diverse) | ✓ | ✗ | ✓ |
| conditioned on free-form text | hard | hard | ✓ |
Diffusion delivers the first three, and text conditioning comes cheaply on top: the workhorse of modern generation.
Question: with the right parameterisation, can a chain of small denoising steps match GANs on sharpness, and keep a simple, stable loss?
Sohl-Dickstein, J. et al. (2015). Deep unsupervised learning using nonequilibrium thermodynamics. ICML.
Ho, J., Jain, A. & Abbeel, P. (2020). Denoising diffusion probabilistic models. NeurIPS.
Ho, J., Jain, A. & Abbeel, P. (2020). Denoising diffusion probabilistic models. NeurIPS. Eq. 2, 4; Sec. 4. Our rendering with the DDPM schedule.
\[ L_\text{simple} = \mathbb{E}_{x_0,\,\epsilon,\,t}\ \big\lVert\, \epsilon - \epsilon_\theta(x_t, t)\, \big\rVert^2 \]
Training: take a clean image, a random step \(t\), a random noise \(\epsilon\); mix them; ask the network which noise was added. Sampling: start from pure noise and remove a little predicted noise at each of the \(T\) steps.
Ho, J., Jain, A. & Abbeel, P. (2020). Denoising diffusion probabilistic models. NeurIPS. Eq. 14, Algorithms 1–2. Redrawn.
One pixel of a training image, \(x_0 = 0.8\). Sampled noise \(\epsilon = -0.5\). The network predicts \(\hat\epsilon = -0.3\). Same error, two noise levels:
Low noise, \(t = 100\) (\(\sqrt{\bar\alpha} = 0.95\), \(\sqrt{1-\bar\alpha} = 0.32\))
Noisy input: \(x_t = 0.95 \cdot 0.8 + 0.32 \cdot (-0.5) = 0.60\)
Loss: \((\epsilon - \hat\epsilon)^2 = (-0.5 + 0.3)^2 = \mathbf{0.04}\)
Implied clean pixel: \(\hat x_0 = \dfrac{x_t - 0.32\,\hat\epsilon}{0.95} = \mathbf{0.73}\) (true 0.8)
Small noise: a small error in \(\hat\epsilon\) barely moves \(\hat x_0\).
High noise, \(t = 500\) (\(\sqrt{\bar\alpha} = 0.28\), \(\sqrt{1-\bar\alpha} = 0.96\))
Noisy input: \(x_t = 0.28 \cdot 0.8 + 0.96 \cdot (-0.5) = -0.26\)
Loss: \((\epsilon - \hat\epsilon)^2 = (-0.5 + 0.3)^2 = \mathbf{0.04}\)
Implied clean pixel: \(\hat x_0 = \dfrac{x_t - 0.96\,\hat\epsilon}{0.28} = \mathbf{0.12}\) (true 0.8)
Same loss, but the guess of the image is far off: at high noise the network can only guess the average.
Each step is a small regression; the chain of steps, with fresh noise, is a sampler.

| CIFAR-10, unconditional | FID ↓ | IS ↑ |
|---|---|---|
| StyleGAN2 + ADA | 3.26 | 9.74 |
| DDPM (\(L_\text{simple}\)) | 3.17 | 9.46 |
How it’s measured. FID (Fréchet Inception Distance): distance between the feature statistics of real and generated images, lower is better. IS (Inception Score): are the images confidently classified, and into many different classes? Higher is better. Both are explained in Section 7.
Ho, J., Jain, A. & Abbeel, P. (2020). Denoising diffusion probabilistic models. NeurIPS. Fig. 1, Table 1.
Question: can we compress the image once with an autoencoder, and run the expensive diffusion only on the small latent?
Rombach, R. et al. (2022). High-resolution image synthesis with latent diffusion models. CVPR.
Rombach, R. et al. (2022). High-resolution image synthesis with latent diffusion models. CVPR. Redrawn from Fig. 3.

How it’s measured. FID (Section 7): distance between generated and real image features, lower is better. ImageNet numbers with classifier-free guidance (next slides). V100-days: training compute, number of GPUs × days.
Rombach, R. et al. (2022). High-resolution image synthesis with latent diffusion models. CVPR. Fig. 6, Tables 3, 18.
Question: can the diffusion model guide itself, with no extra classifier?
Dhariwal, P. & Nichol, A. (2021). Diffusion models beat GANs on image synthesis. NeurIPS.
Ho, J. & Salimans, T. (2021). Classifier-free diffusion guidance. NeurIPS Workshop on Deep Generative Models and Downstream Applications.
\[ \tilde\epsilon = \epsilon_\theta(x_t,\varnothing) + s\,\big(\epsilon_\theta(x_t,c) - \epsilon_\theta(x_t,\varnothing)\big) \]
Ho, J. & Salimans, T. (2021). Classifier-free diffusion guidance. NeurIPS Workshop on Deep Generative Models and Downstream Applications. Eq. 6, Algorithms 1–2.
One step, a 2-pixel “image” (illustrative numbers). Without the prompt: \(\epsilon_u = (0.20,\ 0.10)\). With the prompt: \(\epsilon_c = (0.50,\ -0.10)\). What the prompt adds: \(\epsilon_c - \epsilon_u = (0.30,\ -0.20)\).
\(s = 1\)
\((0.20, 0.10) + 1 \cdot (0.30, -0.20) = \mathbf{(0.50, -0.10)}\)
Exactly \(\epsilon_c\): no guidance.
\(s = 3\)
\((0.20, 0.10) + 3 \cdot (0.30, -0.20) = \mathbf{(1.10, -0.50)}\)
Three times the prompt’s push.
\(s = 7.5\) (Stable Diffusion default)
\((0.20, 0.10) + 7.5 \cdot (0.30, -0.20) = \mathbf{(2.45, -1.40)}\)
Far beyond anything the model predicted: a step the data never showed.
Class “malamute”, ImageNet 64 × 64. Guidance increases from left (none, \(w = 0\)) to right (\(w = 3\)).
| ImageNet 128 × 128, guidance \(w\) (= \(s - 1\)) | 0 (none) | 0.3 | 1.0 | 4.0 |
|---|---|---|---|---|
| FID ↓ | 7.27 | 2.43 | 7.86 | 21.53 |
| IS ↑ | 82.45 | 158.47 | 297.98 | 421.03 |
More guidance: more typical, more alike images. FID first improves, then worsens; IS keeps rising.
How it’s measured. FID rewards realism and variety, so too much guidance (less variety) hurts it. IS rewards confidently classified images of many classes, so it keeps rising with guidance. Both in Section 7.
Ho, J. & Salimans, T. (2021). Classifier-free diffusion guidance. NeurIPS Workshop on Deep Generative Models and Downstream Applications. Fig. 1, Table 2.
Question: is the U-Net necessary? If we replace it with a plain transformer over latent patches, does generation scale like the rest of the field?
Peebles, W. & Xie, S. (2023). Scalable diffusion models with transformers. ICCV.

How it’s measured. FID-50K on ImageNet 256 × 256 (50,000 samples; Section 7), lower is better. Gflops: billions of floating-point operations for one forward pass of the network.
Peebles, W. & Xie, S. (2023). Scalable diffusion models with transformers. ICCV. Fig. 2, Table 2.
Quantisation: each vector of the encoder’s grid is replaced by the nearest entry of a learned codebook; the image becomes a grid of integers, like word ids. A transformer then models them with the same next-token loss as an LLM.
van den Oord, A., Vinyals, O. & Kavukcuoglu, K. (2017). Neural discrete representation learning. NeurIPS.
Esser, P., Rombach, R. & Ommer, B. (2021). Taming transformers for high-resolution image synthesis. CVPR.
Codebook (2-D for the example): \(e_0 = (0,0)\), \(e_1 = (1,0)\), \(e_2 = (0,1)\), \(e_3 = (1,1)\). Encoder output for one cell: \(z = (0.8, 0.3)\).
1 · nearest code
\(\lVert z - e_0\rVert^2 = 0.64 + 0.09 = 0.73\)
\(\lVert z - e_1\rVert^2 = 0.04 + 0.09 = \mathbf{0.13}\)
\(\lVert z - e_2\rVert^2 = 0.64 + 0.49 = 1.13\)
\(\lVert z - e_3\rVert^2 = 0.04 + 0.49 = 0.53\)
→ token 1; the decoder receives \(e_1 = (1, 0)\).
2 · move the code
Codebook loss: \(\lVert \text{sg}[z] - e_1 \rVert^2 = \mathbf{0.13}\)
sg = stop-gradient: \(z\) is treated as a constant, so only \(e_1\) moves, towards \((0.8, 0.3)\).
3 · commit the encoder
Commitment loss: \(\beta \lVert z - \text{sg}[e_1] \rVert^2 = 0.25 \cdot 0.13 = \mathbf{0.03}\)
Only the encoder moves, towards \(e_1\), so it does not drift away from the codebook. \(\beta = 0.25\) as in VQ-VAE.
van den Oord, A., Vinyals, O. & Kavukcuoglu, K. (2017). Neural discrete representation learning. NeurIPS. Eq. 1–3.
“A portrait photo of a kangaroo wearing an orange hoodie and blue sunglasses standing on the grass in front of the Sydney Opera House holding a sign on the chest that says Welcome Friends!” Left to right: 350M, 750M, 3B, 20B.
MS-COCO zero-shot FID: 14.10 → 10.71 → 8.10 → 7.23. Only the 20B model writes the sign correctly.
How it’s measured. Zero-shot FID on MS-COCO: generate one image per caption of the validation set without training on COCO, compare with the real COCO images (Section 7). Lower is better.
Ramesh, A. et al. (2021). Zero-shot text-to-image generation. ICML. Sec. 2.
Yu, J. et al. (2022). Scaling autoregressive models for content-rich text-to-image generation. TMLR. Fig. 9, Fig. 10, Table 5.
A 1024 × 1024 image. Option A: autoregressive, a tokenizer with downsampling \(f = 16\), one token per forward pass. Option B: latent diffusion with 50 sampling steps.
How many sequential forward passes of the big network does each need?
1 minute, individually.
A: \((1024 / 16)^2 =\) 4,096 passes, one per token. B: 50 passes (100 with classifier-free guidance), each over the whole latent.
| Diffusion | Autoregressive | |
|---|---|---|
| Image is | continuous (pixels or a latent) | discrete tokens from a codebook |
| One sample | 20–1000 denoising steps over the whole image | one forward pass per token, in order |
| Loss | MSE on the noise | next-token cross-entropy |
| Detail | no quantisation loss | the codebook limits fine detail |
| Reuses the LLM toolbox | partly (DiT) | fully: same loss, same code, same scaling |
| Typical systems | Stable Diffusion, DiT, Sora | DALL·E, Parti, Chameleon |
The next section asks: can one model have both, and also read images?
Question: what does the image look like inside such a model: discrete tokens, continuous latents, or both?
Chameleon Team (2024). Chameleon: mixed-modal early-fusion foundation models. arXiv.
Zhou, C. et al. (2025). Transfusion: predict the next token and diffuse images with one multi-modal model. ICLR.
Wu, C. et al. (2025). Janus: decoupling visual encoding for unified multimodal understanding and generation. CVPR.
Text tokens (blue) are predicted one by one; the image patches between <BOI> and <EOI> (red) are denoised. Against a Chameleon-style model trained by the authors on the same data (7B, 0.5T tokens):
| 7B, 0.5T tokens | COCO FID ↓ | compute needed to match Chameleon’s FID |
|---|---|---|
| Chameleon-style (discrete VQ tokens) | 29.6 | 1× |
| Transfusion (continuous patches, diffusion loss) | 16.8 | ≈ 1/34 |
How it’s measured. FID on MS-COCO captions (Section 7), lower is better. Parity FLOP ratio: the fraction of Chameleon’s training compute at which Transfusion reaches the same score (0.029 for FID).
Zhou, C. et al. (2025). Transfusion: predict the next token and diffuse images with one multi-modal model. ICLR. Fig. 1, Table 3.
Ablation: same 1.3B model, same data; only the visual encoders and the training tasks change.
| Janus 1.3B, ablation | trained on | POPE ↑ | MMBench ↑ | COCO FID ↓ |
|---|---|---|---|---|
| one shared VQ tokenizer | both | 60.1 | 35.0 | 8.72 |
| SigLIP + VQ (Janus) | both | 87.0 | 69.4 | 8.53 |
| SigLIP only | understanding | 85.9 | 70.6 | – |
| VQ only | generation | – | – | 8.92 |
Decoupled ≈ the specialists on both sides. Text-to-image: GenEval 0.61, vs SDXL 0.55.
How it’s measured. POPE: yes/no questions “is there a [object]?”, accuracy, catches hallucinated objects (Understanding lecture). MMBench: multiple-choice questions over 20 abilities, accuracy. COCO FID: realism of generated images (Section 7). GenEval: fraction of generated images that contain exactly the requested objects, counts, colours and positions (Section 7).
Wu, C. et al. (2025). Janus: decoupling visual encoding for unified multimodal understanding and generation. CVPR. Tables 3, 5.
A world model predicts what the world will look like next given an action. A video generator only has to produce a plausible clip; a world model must respond to what you do.
Ha, D. & Schmidhuber, J. (2018). Recurrent world models facilitate policy evolution. NeurIPS.
A model that looks physically right in a clip is not yet a simulator: you cannot act in it, and nobody measured its physics.
Brooks, T. et al. (2024). Video generation models as world simulators. OpenAI technical report.
Question: can a model learn what the actions are and what they do from unlabelled video alone, and then let you play?
Bruce, J. et al. (2024). Genie: generative interactive environments. ICML.
Bruce, J. et al. (2024). Genie: generative interactive environments. ICML. Redrawn from Fig. 2, 7.

Never trained on sketches or photos, yet the character moves. A 2.5B Genie trained on robot videos (no actions) learns consistent latent actions such as “down”, “up”, “left”.
Bruce, J. et al. (2024). Genie: generative interactive environments. ICML. Fig. 9, 12.
Assran, M. et al. (2025). V-JEPA 2: self-supervised video models enable understanding, prediction and planning. arXiv. Redrawn from Fig. 7; Tables 2, 3.
| Model | Year | Size | Weights | Used for |
|---|---|---|---|---|
| Genie (DeepMind) | 2024 | 11B | ✗ | 2D platformer worlds from video |
| Sora / Sora 2 (OpenAI) | 2024 / 25 | undisclosed | ✗ (API shut down 2026) | text-to-video |
| Genie 3 (DeepMind) | 2025 | undisclosed | ✗ (research preview) | real-time 720p worlds |
| Oasis (Decart & Etched) | 2024 | 500M | ✓ MIT | real-time playable Minecraft-like game |
| Muse / WHAM (Microsoft) | 2025 | 1.6B | ✓ research-only licence | gameplay ideation |
| V-JEPA 2 (Meta) | 2025 | 1B encoder + 300M predictor | ✓ | robot planning |
| Cosmos Predict 1–2.5 (NVIDIA) | 2025 | 2–14B | ✓ NVIDIA Open Model License | physical-AI simulation |
The open-weight frontier is physical AI and games. Real-time interactive models are kept small (0.5–1.6B) to reach the frame rate.
Kanervisto, A. et al. (2025). World and human action models towards gameplay ideation. Nature. · NVIDIA (2025). Cosmos world foundation model platform for physical AI. arXiv.
Decart & Etched (2024). Oasis: a universe in a transformer. Blog and model card. · Parker-Holder, J. & Fruchter, S. (2025). Genie 3: a new frontier for world models. Google DeepMind blog.
Mode 3 is the bridge to the VLA lecture: the world model becomes the simulator a robot policy plans in.
| Question | Metric: what it measures | Needs | |
|---|---|---|---|
| Do the images look like the real data? | FID ↓: distance between feature statistics | real images, ≥ 10K samples | → coming up |
| Is each image recognisable, the set varied? | Inception Score ↑ | no real images | → coming up |
| Quality or missing variety? | Precision / Recall ↑ | real images | → coming up |
| Does it match the prompt? | CLIPScore ↑, GenEval ↑ | prompts only | → coming up |
| Do people prefer it? | win rate, Elo; learned preference scores | human votes | → coming up |
| Does the video move right? | FVD ↓ | real videos | → coming up |
Compute. Embed real and generated images with Inception-v3 (2048-d features); fit a Gaussian to each set, then measure the distance between them:
\[ \text{FID} = \underbrace{\lVert \mu_r - \mu_g \rVert^2}_{\text{means: is the average image right?}} + \underbrace{\mathrm{Tr}\!\left(\Sigma_r + \Sigma_g - 2(\Sigma_r \Sigma_g)^{1/2}\right)}_{\text{covariances: same spread \& correlations?}} \]
Measures. How close the real and generated feature distributions are: fidelity and diversity in one number. Lower = better.
✓ grows steadily with noise, blur and other corruptions (unlike IS); one number; the field standard. ✗ assumes Gaussian features; depends on the number of samples (standard: 50K); Inception is an ImageNet classifier, so FID can improve without better images; ignores the prompt.
Heusel, M. et al. (2017). GANs trained by a two time-scale update rule converge to a local Nash equilibrium. NeurIPS. Eq. 6, Fig. 3.
Chong, M. J. & Forsyth, D. (2020). Effectively unbiased FID and Inception Score and where to find them. CVPR.
Kynkäänniemi, T. et al. (2023). The role of ImageNet classes in Fréchet Inception Distance. ICLR.
In one dimension FID is \((\mu_r - \mu_g)^2 + (\sigma_r - \sigma_g)^2\). Real data: \(\mu = 0\), \(\sigma = 1\). Which generator is best? What does the score tell you about what went wrong?
C is the worst (0.81). A and B tie at 0.25, for completely different reasons: one number cannot tell too narrow from shifted.
Compute. Run each generated image through an Inception classifier and ask two things at once: is this image recognisable, and is the whole set varied?
\[ \text{IS} = \exp\!\Big( \mathbb{E}_x\, \mathrm{KL}\big(\underbrace{p(y\mid x)}_{\text{per image: sharp?}}\,\Vert\,\underbrace{p(y)}_{\text{overall: diverse?}}\big) \Big) \]
Measures. “Recognisable objects, and many kinds of them.” It never looks at real images. Higher = better.
✓ needs no real data; cheap; historic baseline. ✗ only meaningful for ImageNet-like classes; blind to variety within a class; easy to game; no text alignment.
Salimans, T. et al. (2016). Improved techniques for training GANs. NeurIPS.
✓ says whether the problem is quality or missing variety. ✗ depends on the feature extractor and on \(k\); outliers inflate the regions (Density & Coverage fix this).
Kynkäänniemi, T. et al. (2019). Improved precision and recall metric for assessing generative models. NeurIPS. Sec. 2.
Naeem, M. F. et al. (2020). Reliable fidelity and diversity metrics for generative models. ICML.
Compute. Embed the image and the prompt with CLIP; take the cosine similarity, clip negatives to 0, rescale:
\[ \text{CLIPScore} = w\cdot\max\!\big(\cos(E_\text{img},\,E_\text{txt}),\,0\big),\qquad w = 2.5 \]
\(w = 2.5\) only stretches the observed cosines (roughly 0 to 0.4) towards \([0, 1]\). Born for captioning (score a caption against its image, with no reference captions), reused for text-to-image.
Measures. How well the image matches the prompt, as CLIP sees it. Higher = better.
✓ needs no reference image or caption; fast; the default for prompt adherence. ✗ inherits CLIP’s blind spots: counting, positions, which attribute goes with which object (the opening warning).
Hessel, J. et al. (2021). CLIPScore: a reference-free evaluation metric for image captioning. EMNLP. Sec. 3.
Compute. Prompts built from COCO object names, in six tasks. An object detector finds the objects in each generated image; positions come from the boxes, colours from CLIP on a crop. An image scores 1 only if everything in the prompt is right.
| Single object | Two objects | Counting | Colours | Position | Attribute binding | Overall | |
|---|---|---|---|---|---|---|---|
| SD v1.5 | 0.97 | 0.38 | 0.35 | 0.76 | 0.04 | 0.06 | 0.43 |
| SD v2.1 | 0.98 | 0.51 | 0.44 | 0.85 | 0.07 | 0.17 | 0.50 |
| SDXL | 0.98 | 0.74 | 0.39 | 0.85 | 0.15 | 0.23 | 0.55 |
| IF-XL | 0.97 | 0.74 | 0.66 | 0.81 | 0.13 | 0.35 | 0.61 |
How it’s measured. Fraction of images judged correct, per task (e.g. position: “a dog left of a cup”; attribute binding: “a red car and a blue bench”); Overall = mean of the six. Higher is better. Detector: Mask2Former trained on COCO.
Ghosh, D., Hajishirzi, H. & Schmidt, L. (2023). GenEval: an object-focused framework for evaluating text-to-image alignment. NeurIPS Datasets & Benchmarks. Table 2.
Idea. Skip the proxies and ask people. “Rate this image 1–10” is noisy and drifts between raters, so we ask the easy question: which of these two is better?
Compute. Same prompt, an image from model A and one from model B; a person picks the winner. Repeat over many prompts, people and pairs, then aggregate:
Learned stand-ins. Train a model to predict the human vote, as the reward model of the alignment lecture: ImageReward (137K expert comparisons), PickScore (500K+ choices by real users), HPSv2 (798K choices).
✓ captures what automatic metrics miss: aesthetics, realism, prompt correctness at once. ✗ expensive, slow, noisy, prompt-set dependent; learned stand-ins can be hacked like any reward model.
Xu, J. et al. (2023). ImageReward: learning and evaluating human preferences for text-to-image generation. NeurIPS.
Kirstain, Y. et al. (2023). Pick-a-Pic: an open dataset of user preferences for text-to-image generation. NeurIPS.
Wu, X. et al. (2023). Human preference score v2: a solid benchmark for evaluating human preferences of text-to-image synthesis. arXiv.
Idea. FID scores single images. Run it on a video and it judges each frame on its own, so a clip that flickers, jumps, or moves unnaturally can still look fine to it. FVD scores whole clips, so the motion counts too.
Compute. Same formula as FID; only the feature extractor changes. FVD reads a short clip with I3D, a network trained to recognise actions in videos (Kinetics-400), whose features capture movement as well as appearance:
\[ \text{FVD} = \underbrace{\lVert \mu_r - \mu_g \rVert^2}_{\text{average clip: right look and motion?}} + \underbrace{\mathrm{Tr}\!\left(\Sigma_r + \Sigma_g - 2(\Sigma_r \Sigma_g)^{1/2}\right)}_{\text{same spread of clips?}} \]
Measures. How good each frame looks and whether the motion across frames is plausible. Lower = better.
✓ the standard for video; penalises temporal artefacts FID cannot see. ✗ sensitive to how clips are sampled (frame rate, offsets) and resized; I3D features weigh per-frame look more than motion; inherits FID’s Gaussian assumption.
Unterthiner, T. et al. (2018). Towards accurate generative models of video: a new metric & challenges. arXiv. Sec. 4, Table 1.
Skorokhodov, I., Tulyakov, S. & Elhoseiny, M. (2022). StyleGAN-V: a continuous video generator with the price, image quality and perks of StyleGAN2. CVPR. App. C.
Ge, S. et al. (2024). On the content bias in Fréchet video distance. CVPR.
| Metric | Sees | Misses |
|---|---|---|
| FID | how far the generated features are from the real ones | the prompt; what went wrong |
| IS | recognisable objects of many classes | real data; variety within a class |
| Precision / Recall | quality and coverage, separately | the prompt; aesthetics |
| CLIPScore | broad prompt alignment | counting, positions, word order |
| GenEval | objects, counts, colours, positions | style, realism |
| Human preference | overall preference | it is expensive, noisy, prompt-set dependent |
No single metric captures generation quality. Report one for realism, one for diversity, one for prompt adherence, and check with people.
diffusers librarydiffusers (Hugging Face) is to diffusion models what transformers is to LLMs: a pipeline object bundles the text encoder, the denoiser, the VAE decoder and the sampler (the scheduler), and pipe(prompt) runs the whole chain of the LDM slide.
from_pretrained(...) downloads the weights of every component.num_inference_steps: how many denoising steps the sampler takes (50 by default); training still uses \(T = 1000\) noise levels.guidance_scale: the \(s\) of classifier-free guidance.import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ.get("VLLM_BASE_URL", "http://LAB-HOST:8000/v1"), # the lab vLLM endpoint
api_key=os.environ.get("VLLM_API_KEY", "EMPTY"),
)
msg = [{"role": "user", "content":
"Expand into a vivid text-to-image prompt, one sentence: 'an astronaut and a horse'."}]
prompt = client.chat.completions.create(
model="Qwen/Qwen2.5-VL-7B-Instruct", messages=msg, max_tokens=80
).choices[0].message.content
print(prompt)import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5", # SD v1.5: CLIP text encoder + U-Net + VAE
torch_dtype=torch.float16
).to("cuda")
for s in [1.0, 3.0, 7.5, 15.0]: # s = 1: no guidance; 7.5: the default
g = torch.Generator("cuda").manual_seed(0) # same starting noise x_T for every s
image = pipe(prompt, guidance_scale=s, num_inference_steps=30, generator=g).images[0]
image.save(f"out_s{s}.png")Predict before running: which \(s\) gives the most faithful image? The most varied? The most “over-cooked”?
| Family | How it samples | What it gives | What it struggles with |
|---|---|---|---|
| VAE / GAN | one pass | fast; sharp (GAN) | blur (VAE); instability, mode collapse (GAN) |
| Diffusion | many small denoising steps | sharp and diverse; guidance as a dial | slow sampling; prompt binding through CLIP |
| Autoregressive | one token at a time | the LLM toolbox, unchanged | thousands of sequential steps; codebook detail |
| Unified | text tokens + image tokens or latents | read and draw in one model | the two tasks compete for the same weights |
| World models | next frame given an action | an environment to act and plan in | long-horizon consistency, physics |
The CLIP question from the start: the text encoder steers, CLIPScore grades: check binding with something that is not CLIP.
Exit ticket: one prompt you expect a text-to-image model to get wrong, and why.
Next: with all this power, what about bias, safety and responsibility?
M.Sc. AIS · Foundation Models · Fall 2026