Control the generated result.
Train a shape-conditioned flow and compare guidance, validity and coverage at equal sampling work.
By the end: Trace the conditioning signal and guidance arithmetic, distinguish validity from diversity, and explain why a request is not a hard constraint.
Start with something concrete.
A generator returns the same perfect circle point every time. Predict which quality check would reveal that it is a poor source of varied drawings.
Try the interactive model ↓Which result can coexist with 24 valid generated points?
Change one thing. Watch what follows.
- Train the conditional model in 25-update batches.
- Freeze a model and compare strengths zero, one and four at the same seed.
- Inspect the unconditional, conditional and mixed velocity for one step.
- Compare final valid counts with angular-sector coverage and residuals.
- Repeat with a different shape and seed; keep failure cases.
- Capture and export evidence with a stated validity and diversity requirement.
Loading this browser experiment…
A request is another model input
Suppose a drawing tool should place dots around a circle or a square. A useful generator must follow the requested shape while still covering different parts of it. Producing the same valid dot every time would satisfy a boundary check but make a poor drawing tool. Predict which metric would catch that failure before running the lab.
A condition is information supplied to steer generation. Here it is a shape label represented by two numbers: circle [1, 0], square [0, 1]. These are categorical indicators, not a claim that a square is twice a circle. The network receives these numbers alongside position and time. Its output is a two-coordinate velocity, as in the previous flow lesson.
The data are original synthetic boundaries, with 32 training points per shape. Development points lie halfway between their training angles, giving another 32 distinct points per shape. Angles are uniformly spaced; square points are not uniform in perimeter distance. The circle has radius one and the square has sides at coordinates −1 and 1. This is a point generator conditioned on two labels, not a model that understands arbitrary text or draws complete images.
Teach both labelled and unlabelled prediction
Each update pairs Gaussian source points with training targets and constructs intermediate points along straight paths. The target velocity is destination minus source. A 402-parameter network with two hidden layers of sixteen tanh units learns this velocity by squared error. Gradients are simultaneous, and Adam updates include moment correction and norm clipping.
On each example, a random draw drops the label with probability 0.25. A dropped label becomes [0, 0]; the velocity target is unchanged. The same network therefore practices prediction with a known shape and prediction without knowing the shape. This is a learned unconditional branch, not a separately programmed default shape. The loss includes both kinds of examples. Repeated fixed development measurements are useful for debugging, but are not an independent final test.
Guidance mixes two predictions
At generation time we can evaluate the model twice at the same position and time: once without a label and once with the requested label. Let vᵤ be the unconditional velocity, v꜀ the conditional velocity and s the guidance strength. The lab uses:
Read this as “start at the unconditional prediction and move s times the difference toward the conditional prediction.” If vᵤ = [0.2, 0.1], v꜀ = [0.6, −0.1] and s = 2, the difference is [0.4, −0.2] and the guided velocity is [1.0, −0.3]. With a time step of 1/16, add [0.0625, −0.01875] to the point. The lab exposes this arithmetic for the first sampled point.
Strength zero uses the unconditional field, strength one uses the conditional field, and strengths above one extrapolate beyond it. A larger number is not a stronger correctness guarantee. It can amplify model errors and move samples away from the requested boundary. This flow-velocity experiment adapts the conditional/unconditional mixing idea associated with classifier-free guidance; it is not the diffusion score model from the original paper, nor a proof of an exact guided distribution.
Compare at equal work
Freeze one trained model. Every run starts with 24 Gaussian points and uses 16 Euler steps. For transparency, both predictions are computed at every point and step even when strength zero or one could be optimized to use only one. Thus every complete run spends 24 × 16 × 2 = 768 individual field evaluations. Identical seeds create identical starting clouds. Keep the frozen weights and seed the same while varying strength, then repeat on another seed.
The plot uses fixed axes and reports off-screen samples without clamping them. The mean boundary residual and valid-point count measure adherence to the requested shape. Angular-sector coverage asks how many of eight directions contain at least one valid sample. Compare both: 24 identical valid points have perfect validity but only one covered sector. Even eight covered sectors do not establish balanced frequencies, a uniform boundary distribution or useful diversity for another application.
For the circle, residual is the absolute difference between radius and one. For the square it is the absolute difference between the largest absolute coordinate and one. The square measure describes a band in the maximum-coordinate norm; at corners it is not Euclidean distance. The teaching validity tolerance is 0.15. It is an explicit application contract, not a universal quality threshold.
A condition is not a hard constraint
Requesting a shape changes predictions; it does not force the output onto the boundary. A separate verifier can reject invalid samples. Rejection then changes the output distribution and may require more generation work to obtain the same number of accepted points. Projecting points onto the boundary also changes the algorithm and can disguise a weak generator. Neither rejection nor projection is silently applied here.
For a guided experiment, train a model and capture the same shape and seed at strengths 0, 1 and 4. Explain validity, sector coverage and failures using numbers, then repeat the comparison on another seed. For implementation practice, independently reproduce the guidance arithmetic and test that strengths zero and one recover the corresponding branches. Count field evaluations, including any additional retries. For a decision brief, specify an acceptable failure rate and diversity requirement, and explain when an explicit verifier or human review would still be needed.
The lesson’s questions are practice checks. Captures and notes are not independent project assessment or authenticated evidence of implementation. Human review and learner pilots remain pending. Return to flow integration for numerical-step error, or inspect the expanded catalog for the remaining generative objectives and project.
Strong guidance produces more invalid square points. What follows?
Take this idea with you.
Conditioning supplies information; guidance changes how predictions are combined. Check validity, coverage and work separately, and use explicit verification when a constraint must hold.