No jobs
Core 9 min 4 of 4

The 0.18215 nobody explains

A constant that exists so the noise schedule sees the variance it was designed for — and a division whose absence produces an image rather than an error.

What this repairs

Copying the scaling factor from a reference implementation without knowing it exists to put latents at unit variance, which the noise schedule assumes.

Every latent-diffusion implementation multiplies by 0.182150.18215 after encoding and divides by it before decoding, and almost none of them say why. It is not a tuning constant and it was not searched for. It is a measurement:

σ    5.49,1σ=0.18215,\sigma \;\approx\; 5.49, \qquad \frac{1}{\sigma} = 0.18215,

where σ\sigma is the component-wise standard deviation of the raw latents this autoencoder produces on its training data. The factor exists to put the latents at roughly unit variance, and the reason that matters is the previous topic's first formula.

What an unscaled latent does to the schedule

  1. xt=αˉtx0+1αˉtε,εN(0,I)x_t = \sqrt{\bar{\alpha}_t}\,x_0 + \sqrt{1-\bar{\alpha}_t}\,\varepsilon, \qquad \varepsilon \sim \mathcal{N}(0, I)

    The forward process, unchanged. The noise term has unit variance by definition — that is not negotiable, it is what ε means — so the balance between the two terms is decided entirely by the scale of x₀.

  2. SNReff(t)=αˉtσ21αˉt=σ2SNR(t)\mathrm{SNR}_{\text{eff}}(t) = \frac{\bar{\alpha}_t\,\sigma^{2}}{1-\bar{\alpha}_t} = \sigma^{2}\,\mathrm{SNR}(t)

    Feed in data of standard deviation σ instead of 1 and every signal-to-noise ratio on the schedule is multiplied by σ². The schedule was designed against the left-hand side and is being handed the right-hand one.

  3. σ2=5.492=30.1\sigma^{2} = 5.49^{2} = 30.1

    And that factor is thirty. Not a rounding matter: the noise level the schedule believes it is applying at any timestep is thirty times more destructive than the one the data actually experiences.

  4. SNReff=1    αˉ=11+σ2=0.0321    t=816 (textbook)\mathrm{SNR}_{\text{eff}} = 1 \;\Longleftrightarrow\; \bar{\alpha} = \frac{1}{1+\sigma^{2}} = 0.0321 \;\Longleftrightarrow\; t = 816 \text{ (textbook)}

    Which moves the halfway point of the noise from t = 354 to t = 816 on the textbook curve, and from t = 337 to t = 752 on the rescaled curve the model actually trains on — the ᾱ threshold is the same 0.0321 either way, and only the timestep that reaches it moves. Four fifths of the training chain would sit in the high-signal regime, the model would almost never see genuinely destroyed data, and its first sampler steps — which start from pure noise — would be the ones it had least practice at.

  5. x00.18215x0    SNReff=SNRx_0 \leftarrow 0.18215\,x_0 \;\Longrightarrow\; \mathrm{SNR}_{\text{eff}} = \mathrm{SNR}

    One multiply, and the schedule means what it says again. The constant is not about the decoder, the encoder or the image — it is about making the second argument of the forward process the size the first argument assumes.

Check yourself

Your decoded images all come out high-contrast and clipped, and the effect is identical at 5 steps and at 100. Diffusion problem or convention problem?

Show answer

Convention, and the step-count invariance is what says so. Anything wrong with the sampler or the model changes when you change the integration; a scale error between the latent and the decoder is applied once at the end and does not.

Confirm it without touching the model. Take a real image, encode it, decode it immediately, and see whether the round trip is clipped too — if it is, the bug is in your encode/decode plumbing rather than anywhere near diffusion. Then check the arithmetic directly: measure the standard deviation of the tensor you are handing the decoder. Scaled latents run around 11 ; if you are seeing something near 55 , you skipped the division.

Euler View - ML Experiment Monitor