Quiz: drifting
Before this unit: Diffusion priors for inverse problems (previous unit); Day 41: Modern deep learning; Day 39: Variational autoencoders; Day 5: Deconvolution.
See also: Day 28: Ising model and Markov random fields; Day 35: Gaussian mixtures.
Short questions on the drifting field, coverage and the one-pass generator. Try each on paper first, then open the answer. The drift of a generated point is V = (weighted mean of the nearby real points) − (weighted mean of the nearby other generated points), with weights e^{-\text{distance}/\tau} normalised to sum to 1.
Q1. A generated point sits in a region with many real points and no other generated points nearby. Which way does it drift? And a point in a crowd of generated points with no real points nearby?
Which of the two weighted means is close to the point, and which is far?
The first is pulled towards the real points (the pull wins). The second is pushed out of the crowd, away from the other generated points (the push wins). The drift moves generated points from where they are too many to where they are missing.
Q2. You switch off the push and keep only the pull. What does every point do, and what do you get after many steps?
You have met this algorithm on the Gaussian mixtures day.
Mean shift: every point climbs to the nearest peak of the density of the real points. All points end on a few spots (in the demo: 200 points on three spots, coverage 0.05). A mode finder, not a sampler.
Q3. Real points at 0 and 2, one generated point at 0.5. With \tau = 0.25 the pull is -0.46; with \tau = 1 it is +0.04. Explain the difference in one sentence.
How much weight does the far point get in each case?
With a small \tau only the nearest real point (0) counts, so the point is pulled to it; with \tau = 1 the far point at 2 still has a quarter of the weight, and the weighted mean (0.54) is almost the point itself.
Q4. The drift is (nearly) zero at every generated sample. Does that prove that the generator has learned the data distribution?
Where is V evaluated during training? Think of all samples at the centre of a ring of real points.
No. V = 0 follows from a perfect match, but not the other way round in general: training only sees V at the samples. All samples at the centre of a ring feel no drift. With a small \tau, a mode far away from all samples is invisible, and its loss can be small while the mode is missing (the coding exercise: 14 % instead of 25 % in one mode).
Q5. Real points on a line at 0, 1, 2, 3 and 10, balls of radius = distance to the nearest other real point. Synthetic points at 1.2 and 9. What is the coverage?
The radii are 1, 1, 1, 1 and 7.
1.2 lies in the balls of 1 (distance 0.2) and 2 (0.8), not in that of 0 (1.2 > 1); 9 lies in the ball of 10 (1 ≤ 7). Real points 1, 2 and 10 are covered: 3/5 = 0.6.
Q6. Why does dataset distillation by drifting need augmented views when the synthetic set is small (10 images per class)?
What is “the weighted mean of the other generated points” when there are only a few, all far away?
With few points, the push is the distance to a few far neighbours: large and not local, so the points are driven apart and settle beside the data (demo: 20 points cover 0.09, less than 20 random real points). With several views per point, each point has its own nearby negatives and the field becomes local again (0.31). In the image paper, removing augmentation collapses every result.
Q7. In the generator’s loss \|f(\varepsilon) - \text{stopgrad}(f(\varepsilon) + V)\|^2, what does the stop-gradient do, and what is the gradient with respect to the output?
Treat the target as a label.
It freezes the target f(\varepsilon) + V: the field is computed once and not differentiated. The loss is then an ordinary regression; its gradient with respect to the output is -2V, so a gradient step moves every output a little along its drift.
Q8. A diffusion model and a drifting generator give images of similar quality. Which is faster at making 10,000 images, and which might cost more to train?
Where does each method do its iterating?
Drifting: one pass per image instead of tens. Its training step is costlier: the field needs the distances from every sample to many positives and negatives (in feature space, at several temperatures). The iteration moved from sampling to training.
Q9. How is drifting different from a GAN, given that both make an image in one pass and both compare generated with real samples?
What decides the direction in which a sample should move?
In a GAN a second network (the discriminator) learns that direction, in a game that can oscillate or collapse. In drifting the direction is a fixed formula (two kernel-weighted means), and training is a plain regression on fixed targets: no second network, no game.