Thomas Piacentini
← Workshop
← All concepts

Recover a signal

Concept 1 / 7

Change concept
01 · Diffusion in latent space

Diffusion in latent space

A model can learn to remove noise gradually to recover structure.

Your turn

1
0.8 × x₀1.60.6 × ε0.6+= 2.2
InputTransformationResult

Add2.2

Corruption is xₜ=.8×2+.6ε; this scalar calculation does not generate an image.

Build
Final result · noisy signal xₜ2.2

Understand the calculation, step by step

A diffusion model learns to reverse progressive corruption. Stable Diffusion denoises mostly in latent space before decoding into an image. Our two-mode lab has an analytically known denoiser; it illustrates steps but runs neither a trained U-Net nor Stable Diffusion. This chapter isolates mathematical components.

Add noise

x₀=2 ; ᾱ=0.64 ; xₜ=0.8×2+0.6ε

Check my understanding

For Noise ε = 2, what is the value of « noisy signal xₜ » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

02 · From text to conditioning

From text to conditioning

Text becomes a numerical representation that guides denoising.

Your turn

2
Token(2 ; 1)Position(0.1 ; 0.2)+(2.1 ; 1.2)
InputTransformationResult

Add componentwise(2.1 ; 1.2)

The final representation still has two components; token ID is not multiplied by a vector.

Build
Final result · first input component2.1

Understand the calculation, step by step

A CLIP tokenizer produces identifiers and an encoder turns the sequence into text representations. The historical demonstration has a limited context length, not a universal diffusion-model limit. Conditioning guides the noise network rather than specifying pixel locations. Compare descriptions differing in one word.

Sum embeddings

token=(x,1), position=(0.1,0.2) ; input=token+position

Check my understanding

For Token first component = 3, what is the value of « first input component » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

03 · Noise network, time and attention

Noise network, time and attention

The network uses noise, timestep and text to propose a correction.

Your turn

2
x11x22x33× 0.250.25× 0.51× 0.250.75Σ = 2
InputTransformationResult

Combine contributions2

The weighted sum is 1+.5c. This symmetric kernel avoids a convolution/correlation distinction in this example.

Build
Final result · convolution response2

Understand the calculation, step by step

The network predicts noise from noisy latent, timestep and text. A U-Net combines convolutions, resolution changes and cross-level connections; attention can integrate text. Weights are learned from data, not rebuilt per image. A convolution sees a neighbourhood; this exercise isolates filtering rather than simulating a complete U-Net.

Local convolution

neighbourhood=(1,c,3), kernel=(0.25,0.5,0.25) ; response=1+0.5c

Check my understanding

For Central pixel c = 3, what is the value of « convolution response » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

04 · Guidance and trade-offs

Guidance and trade-offs

Guidance adjusts text influence on predicted noise, trading off diversity.

Your turn

2
ε∅ = 11s × (εtexte − ε∅)2+= 3εtexte = 2
InputTransformationResult

Add to unconditional3

Guided noise is 1+s. Increasing s does not guarantee better quality.

Build
Final result · Guided noise prediction3

Understand the calculation, step by step

Guidance combines predictions: ε̂=ε̂empty+s(ε̂text−ε̂empty). At s=0 it uses the empty-text branch; at s=1 the conditioned branch. Larger s can improve text adherence while reducing diversity or introducing artifacts. It acts on predicted noise, not directly on words or final pixels.

Classifier-free guidance

unconditional ε=1 ; text ε=2 ; guided ε=1+s(2−1)

Check my understanding

For Scale s = 3, what is the value of « guided noise » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

05 · Noise, clean signal and scheduler

Noise, clean signal and scheduler

Estimating noise lets you reconstruct clean signal and prepare the next step.

Your turn

1
xₜ2.20.6 × ε̂0.6−= 2÷ 0.8
InputTransformationResult

Recover clean scale2

Dividing by .8 gives the clean-signal estimate; this is not a full scheduler transition.

Build
Final result · Estimated clean signal2

Understand the calculation, step by step

Corruption is xₜ=√ᾱₜx₀+√(1−ᾱₜ)ε. Predicted ε̂ gives x̂₀=(xₜ−√(1−ᾱₜ)ε̂)/√ᾱₜ. A scheduler determines the next timestep transition; repeatedly subtracting identical noise is insufficient. DDPM and DDIM can use different transitions. More steps do not automatically fix an inadequate model.

Estimate the clean signal

xₜ=2.2 ; ᾱ=0.64 ; x̂₀=(2.2−0.6ε̂)/0.8

Check my understanding

For Predicted noise ε̂ = 2, what is the value of « estimated clean signal » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

06 · Decode the latent

Decode the latent

A decoder turns a compact internal representation into a more detailed output.

Your turn

1
z1z2zz−1D1(z)1D2(z)2D3(z)0
InputTransformationResult

A three-component output(1 ; 2 ; 0)

Decoding changes dimension. It is not merely pixel resizing.

Build
Final result · first decoded component1

Understand the calculation, step by step

A learned decoder transforms compact latent into image. The original narrative calls this “upscaling”; mathematically it decodes rather than merely resizing pixels. Our miniature affine function makes latent and output spaces distinct; it represents neither a trained VAE nor its real scaling factors.

Miniature latent decoder

toy decoder D(z)=(z,2z,z−1) ; first component= z

Check my understanding

For Latent coordinate z = 2, what is the value of « first decoded component » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

07 · Compare prompts, seeds and steps

Compare prompts, seeds and steps

To understand a setting, keep other conditions fixed and compare multiple trials.

Your turn

2
ε∅ = 11s × (εtexte − ε∅)2+= 3εtexte = 2
InputTransformationResult

Add to unconditional3

Guided noise is 1+s. Increasing s does not guarantee better quality.

Build
Final result · Guided noise prediction3

Understand the calculation, step by step

A seed fixes initial noise within a given implementation. Compare texts with that seed and other settings fixed, changing one word. Determinism also depends on model and computation. The original uses prepared examples; local notes do not automatically import its images. Robotic actions additionally require demonstrations, constraints and feedback control.

Classifier-free guidance

unconditional ε=1 ; text ε=2 ; guided ε=1+s(2−1)

Check my understanding

For Scale s = 3, what is the value of « guided noise » ?

Keep a thought in my notebook
Read the source and go further

The extended record combines confirmed reading, interaction, correct answer and a note of at least 40 characters. You can continue at any time.

Take this further

atomsh / lab