JTT94 / diffusion_schrodinger_bridge

PyTorch Implementation of DSB for Score Based Generative Modeling. Experiments managed using Hydra.
MIT License
146 stars 16 forks source link

Need help understanding Equation (4) #3

Closed binarydaddy closed 1 year ago

binarydaddy commented 1 year ago

Hello, thank you for sharing great work. If possible, could you explain how you derived equation (4)?

Thank you.

JTT94 commented 1 year ago

This is a very heuristic justification.

By Bayes' rule: $p_{k|k+1}(xk|x{k+1}) = p{k+1|k}(x{k+1}|x_k) \exp [\log p_k(xk) - \log p{k+1}(x_{k+1})]$

For small step size, $\log p_k(xk) \approx \log p{k+1}(xk)$ Then by Taylor expansion $\log p{k+1}(xk) \approx \log p{k+1}(x{k+1}) + \nabla \log p{k+1}(x_{k+1})(xk-x{k+1})$

So $\log p_k(xk) - \log p{k+1}(x{k+1}) \approx \nabla \log p{k+1}(x_{k+1})(xk-x{k+1})$.

$p{k+1|k}(x{k+1}|xk) \propto \exp[-\frac{1}{2} \frac{||x{k+1}-(x_k+\gamma f(x_k)||^2}{2\gamma}]=\exp[-\frac{1}{2} \frac{|| xk -(x{k+1}-\gamma f(x_k))||^2}{2\gamma}]$

Hence, ignoring $x{k+1}$ terms in constant of proportionality: $p{k|k+1}(xk|x{k+1}) =p{k+1|k}(x{k+1}|x_k) \exp [\log p_k(xk) - \log p{k+1}(x_{k+1})] \approx \propto \exp[-\frac{1}{2} \frac{|| xk -(x{k+1}-\gamma f(x_k))||^2}{2\gamma} + \frac{1}{4 \gamma} 4 \gamma xk \nabla \log p{k+1}(x_{k+1})]$

$\propto \exp[-\frac{1}{2} \frac{|| xk -(x{k+1}-\gamma f(xk)+2 \gamma \nabla \log p{k+1}(x_{k+1})||^2}{2\gamma} ]$

Finally $f(xk) \approx f(x{k+1})$ for small step size.