AI Hero Club

Diffusion Models and Flow Matching · Lesson 1

Marked Complete by You0 / 8

Saved in this browser only. Marking a lesson complete does not mean the project has passed verification.

Lesson Outline 7 subsections
Course Contents 8 lessons
Full course plan.
Diffusion Models and Flow Matching / Learning Plan ↗

LESSON 01 / 8Suggested study 150 minutes

Probability Objectives, Mixtures and Noise Paths

If a random generator draws four clusters, how can we tell whether it learned their internal distributions rather than four centers?

3 Questions for This Lesson
  • Define 2D generation target, density and sampling protocol
  • Convergence between the torque of the mixed distribution and the separate linear bridge
  • Design complementary indicators using pattern collapse and rectangular matching reverses
Course Project ZIP ↓

This Lesson's Deliverable: Define Generation as a Verifiable Distribution

The course is aimed at a pair of real figures, not an image. One sample writing vector x=(x 1, x2), the two coordinates can be understood as horizontal and vertical positions on the plane. Our task is not to find a comfortable spot, but rather to create a random program that would bring large volumes of output on the plane close to the four Gaussian bars previously designated. This scale allows the theoretical mean value, variation, density and sampling errors to be calculated, and also prevents the error generator from hiding behind beautiful images. The network that was being trained had only a few thousand parameters on which to claim to have achieved a large image diffusion model.

The preparatory knowledge needed is vector plus minus, lead and limited probability. The probability density p(x) is a partial depiction of the probability of a small area: the probability for the region A is for the A integral p(x), not for a point ' s density directly. The probability for a single point in a continuous distribution is usually zero, even if the density is high. In the standard 2-D normal N(0,I) we use, I is a two-by-two-unit matrix with two coordinates independent, zero-average, one variant; These conditions have to be checked separately and cannot be considered satisfied by the mere sight of “Random”.

1. Constructing the Target Distribution from Latent Classes

Dispersal variable K At four numbers, the probability is one quarter. The corresponding centre is minus two, minus two, minus two, minus two, minus two, minus two. K Independent standard 2D normal, inner standard deviation 0.3. The target sample is defined as X Here's the upper case. X represents a random vector, lower case x indicates the value taken; a standard deviation is considered, and the squares enter the coordinate deviation. The sample is selected by category and then disturbed, not the average of four centres at the same time.

p1(x)=14∑k=1412πσ2exp⁡ ⁣(−∥x−μk∥22σ2)p_1(x)=\frac14\sum_{k=1}^{4}\frac{1}{2\pi\sigma^2}\exp\!\left(-\frac{\|x-\mu_k\|^2}{2\sigma^2}\right)
Each two dimensions is divided into one, weight and one, so the mixed density is standardized.

The following column provides a preview of the current model: Zero Hours is a standard normal for easy sampling and One Time is a target data. This course describes the separated DDPM step with another subscript j, which indicates a step from the data to the noise, and does not allow the two directions to be exchanged directly. The square of the density Central European formula is equal to the sum of the two coordinates; the two-dimensional alignment constant is a two-dimensional square, so that the square root constant of one-dimensional cannot be misused. The constant may not change some ratios but may cause density and seemingly loss of the correct unit.

The mixed model has an important calculation distinction: the mean value at the time of the given category is easily known, but when the category is hidden, the probability of the observation point belonging to the range is recalculated. The probability of these later categories is later called responsibility. Points located between the two compartments cannot be strictly assigned to precise expectations claimed after the recent episode; the centre has recently been only some sort of evaluation division, not Bayes. This distinction will appear directly in chapter V’s interpretation speed field.

Example 1: Means and Covariances of Four Clusters

The first coordinates of the four centres are negative two, negative two, positive two, positive two, zero; the second coordinates are also zero, so... E [X] =( 0, 0 ) then divide the U.N.A.: the U.S.A.'s difference is 2 I=0.09I, the Centre itself has an average of four μkmkt. Each diagonal item is four, the cross-sections are positive four, negative four, negative four, positive four, and zero. 4.09I. The two coordinates are irrelevant; the case is actually independent because of the central symbol, but “A zero-percent gap must be independent.” Not generally.

An independent inspection may directly extend a square of a coordinates: E [(μ_K,₁+σξ₁)²] = E [μ_K,₁²] +2σE [μ_K,₁ξ₁] +σ²E [ξ₁²] The intermediate cross-section disappears because it is independent and with an average noise value of zero, with the remaining four plus zero nine. If you add the standard deviation of zero-three to four-point-three directly, you add the different volumes to the order. If you add the four blocks to zero and then noise to the centre, it is only zero-nine, and it is replaced by another distribution.

2. Sampleable Noise and Probability Paths

X0 is the standard 2-D normal, and X1 is the above-mentioned mix of data, with clear independence of the two endpoints. Defines the intermediate random vector X_t=(1−t)X 0+tX1, t in the range zero to one. This is a linear interpolation between random endpoints; each trajectories are drawn in a straight line, but the intermediate distribution of all tracks changes shapes. The subsequent determination of the constant decoupled equations defined by the neural network does not necessarily represent these sampling lines, and the link between the two requires conditions that cannot be asserted directly from the illustration.

E[Xt]=0,Cov⁡(Xt)=((1−t)2+4.09t2)I\mathbb E[X_t]=0,\qquad \operatorname{Cov}(X_t)=\big((1-t)^2+4.09t^2\big)I
The cross-coordination gap is zero when the endpoint is independent; this formula describes the second order of the margin distribution.

Writing this path does not require a training network, nor does it mean that data are already generated from noise. We use the real end point X1 when X_t is constructed; only X0 is used to generate and one target sample cannot be secretly placed into the updated formula. The task of the training is to transform local monitoring that can be constructed when the true end point is accessed into a field that relies solely on current state and time. This information is available at borders throughout the course: training labels can contain real data and sampling functions cannot access future answers.

Example 2: Intermediate Distributions Need Not Become More Dispersed

At t=0.25, the single coordinate difference was 0:75 squared plus 4:09 squared plus 0:05 squared, i.e. 0:565,565 squared, equal to zero:81,125 squared and smaller than the beginning one. t=0.5 was 0:25 plus 1:0225 squared, equal to 1:225. The first square reduction did not violate the task of moving from noise to a wider target, since independent point plugs tended to shrink noise at an early stage. The minimum value is present in the guide − 2 (1−t)+8.18t = 0, or t=1/5.09; it is available for a return period of about 0:835.

This case also provides a test of failure: if the code is written sqrt(1−t) X₀+ sqrt(t) X1, the difference will be one plus three and nine times t, and you will get another path. The endpoints, like the endpoints, have different intermediate monitoring and speed. Just checking. t=0 、 t=1 If you can't find such a mistake, you should at least add an internal moment to the test. We won't. “Peer Same” Sneak it. “The training is the same.”, the subsequent speed target must guide the actual path.

3. Why Means and Covariances Are Not Enough for Validation

The total output zero program has the correct theoretical average, but it loses all models. A N(0,4.09I) program has even the same mean and co-opts, but it fills four data centres with a lot of probability that they would not otherwise have. There is also one programme, for example, to export four centres without any inner noise; it covers four areas, but it presses the continuum into four points. Three errors remind us to check pattern quality, regional shape and inner width, respectively, and not to replace the entire distribution with an indicator.

The project will record the nearest centre square distance. The average of the distance in the target is about the sum of two coordinates, namely 0:18; here “NYO”, because very few samples that cross the center divide are distributed to another set. The output center process is zero-distance and not better. This indicator should not always be as small as possible to compare the difference with the target. The project also records the quality of the pattern, the proportion of the group and the multiple directions of the projection distance so that the indicators are complementary to the blind spot.

The limited sample itself fluctuates. If an independent n sample is taken, the standard difference in the average single coordinate sample is sqrt(4.09/n), so n=100 is about zero-two and n=10000 is about zero-two. It cannot be determined immediately if the mean value is not properly zero; similarly, many random seeds are displayed only at the closest point to zero and do not prove algorithm stability. The solver will be fixed with a single initial noise, and independently generated validation points will be used when training is generalized.

For a given model, the number of independent samples falling into the model is almost equal to two counts. When the target ratio is one quarter, the standard deviation is estimated by a 16-fold sample at the bottom of the root; about zero point zero nine six at two thousand forty-eight points. The four models are not counted separately because their sum and fixed are sample numbers. Therefore, it is not possible to interpret four separate and seemingly reasonable error zones directly into a calibrated joint letter conclusion; the course is based on full reports and does not falsify unexecuted statistical certifications.

Standalone ProgramThe standard library is used only to test the solver and the wrong path, and does not depend on subsequent projects.
from math import sqrt
means=[(-2,-2),(-2,2),(2,-2),(2,2)]
assert sum(x for x,y in means)==0
assert sum(x*y for x,y in means)==0
variance=4+0.3**2
t=0.25
path_variance=(1-t)**2+t*t*variance
assert abs(path_variance-0.818125)<1e-12
wrong_variance=(1-t)+t*variance
assert abs(path_variance-wrong_variance)>0.1
print(variance,path_variance,sqrt(variance/10000))

Exercise: Separate Distributions, Paths, and Validation

TRY IT YOURSELF

Practice one-to-one-to-one-to-the-mixed weight.

If only two centres ( − 2, 0), (2, 0) are retained, the weight shall be one quarter and three quarters, and the sum within it is still 0.09I, and the average shall be equal to the difference between the agreement.

Hint 1
The center average is first sought by the new weight and then the center square is reduced by a second order.
Hint 2
At the end of the box, 0.09I is added; the centre ' s deviation from the new average can be weighted to double-drawn the equals four.
Compare with the Solution
First average, with a negative two-by-four plus two-quarters plus two-quarters plus three-quarters plus one and a zero-coordinate. The second-order rule of the horizontal centre is still four, minus a mean square one, and receives a three-point difference; the inner difference is three-point nine. The vertical center remains unchanged, with a zero-point difference. The cross-line is zero, so the difference is three-point-nine and one-point-nine. Moving the four-point-nine directly to this question will miss the equal-weight square after the change in weight. This solution can be double-weighted by three-point and one-point deviation for each.

TRY IT YOURSELF

Practice the path of the two-bit peer when it is relevant

If the same standard normal Z is used simultaneously as X0 = Z, X1 = 2Z, calculate the t=1/2 time difference and explain why a stand-alone endpoint formula cannot be used.

Hint 1
The two endpoints share the same Z, and first directly organize the plug value to Z multiples.
Hint 2
And use the caps. Cov(X0,X1); the same margin distribution does not represent the joint distribution independence.
Compare with the Solution
This time, a Z is worth 1.5 times the value of a Z, with a single coordinates difference of 2:25. If you apply the separate formula wrongly, it will be zero two-five times one plus two and five times four, and one-two-five. The missing item is two-five times five times five times Cov(X₀,X₁), while the other side is two, so the endpoint coupling approach is exactly two-two and five.

TRY IT YOURSELF

Triple design failure check.

Each indicates which indicators are most likely to be found when total output is zero, only four centres are exported. Why does the distance between a true sample and another true sample not have to be zero?

Hint 1
Each of the three bad generators is examined separately for which statistics are kept and what information is missing.
Hint 2
Disaggregate the mean/collaborative variance, mode quality, inner width, isolation from projection distance; true limited sample distance should be used as a noise baseline.
Compare with the Solution
The total output zero-formula difference is zero and almost all fall far from the centre; the four center atomic distribution pattern is correct, but the center square distance is recently zero, below the target of about one eight, and the projection distribution lacks inner width; the tectonic match can be checked by mean values and the confluence, but it produces a large number of points between modes, so that the scale and projection distance should be exposed. Two batches of true samples, although they come from the same distribution, have different experience distributions, are sorted and post-projected coordinates do not match each item, so the limit range is usually greater than zero. Truth should not be forged as an accurate zero.

CHECK YOUR UNDERSTANDING

Check Your Understanding

Answer first, then open the explanation to check your reasoning. These questions help reveal gaps in understanding; independent implementation and transfer require separate evaluation.

1. Could density values be considered as a direct probability for a continuous point?

Show ExplanationThe probability of continuity is derived from the points, and the single point usually has a zero probability.
2. What's the difference between the target single coordinates?

Show ExplanationThe center is four plus zero nine.
3. What's the speed label for the separate linear bridge?

Show ExplanationFor t orientation, the end point is fixed in the condition trajectory.
4. Zero nearest central distance proves correct?

Show ExplanationThe goal also contains non-zero cluster changes.

Manual completion records your progress; it does not certify your project.