improved-diffusion icon indicating copy to clipboard operation
improved-diffusion copied to clipboard

The meaning of the scaling factor 0.5 in sampling from p(xt-1|xt)

Open zihaozou opened this issue 3 years ago • 2 comments

I noticed a scaling factor of 0.5 when sampling from p(xt-1|xt). I tried to find the definition of this 0.5 on the paper but failed. Is there any special factor behind this 0.5? would the performance be different without this factor?

https://github.com/openai/improved-diffusion/blob/783b6740edb79fdb7d063250db2c51cc9545dcd1/improved_diffusion/gaussian_diffusion.py#L386

zihaozou avatar Nov 15 '22 06:11 zihaozou

@zihaozou Looks to be an optimisation since: log(x^0.5) = 0.5 * log(x)

where x is the variance. So, taking the square root (i.e., x^0.5) gives us standard deviation.

xenova avatar Jan 12 '23 09:01 xenova

th.exp(0.5 * out["log_variance"]) is Standard deviation

zibingo avatar Dec 05 '23 13:12 zibingo