Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding likelihood evaluation #35

Open
mickelliu opened this issue Apr 17, 2023 · 5 comments
Open

Question regarding likelihood evaluation #35

mickelliu opened this issue Apr 17, 2023 · 5 comments

Comments

@mickelliu
Copy link

Hi Cheng,

Congrads on your impactful works.

I'm pretty new to this field and want to know if evaluating the negative log-likelihood $(-\log P_\theta ( x_0 | c ) )$ really makes sense to you. I want to compute the exact likelihood of an image being sampled from the denoising process parameterized by $\theta$. I was wondering if this is possible with an ODE solver like DPM-solver.

Thanks.

@LuChengTHU
Copy link
Owner

Hi @mickelliu ,
what is the dimension of your image? And what do you want to do with your likelihood?

DPM-Solver can also improve the computation speed for evaluating likelihood, but it cannot ensure it is a valid likelihood if the solver does not converge.

@mickelliu
Copy link
Author

Thanks for you reply!

Hi @mickelliu , what is the dimension of your image?

I'm testing on 512x512 images but I am running stable diffusion v-1-5 which has a latent dimension of 64x64.

And what do you want to do with your likelihood?

I want to estimate the likelihood of generating a bad sample so I can try to minimize it. Or letting people to select between two samples, and award the model for generating good samples relative to the preference score. I'm not sure if there's any other way to do it

DPM-Solver can also improve the computation speed for evaluating likelihood, but it cannot ensure it is a valid likelihood if the solver does not converge.

I actually have very little idea about how to evaluate exact likelihood using the DPM-solver. And I think this paper by Song Yang (Eq. 39) is the only paper that explicitly tells us how to compute the exact log-likehood out of every diffusion papers i have read.

Best,

Mickel

@mickelliu
Copy link
Author

Is it easy to derive a differential form (with dx and dt) of the DPM-solver's equation?

@LuChengTHU
Copy link
Owner

Hi @mickelliu ,

I think in such case, you can easily combine DPM-Solver with likelihood solver. The basic idea is that the likelihood of diffusion ODEs can be solved by a D+1 dimension ODE as following:

dx / dt = f(x, t) (it is the diffusion ODE that dpm-solver solves)
d logp / dt = -tr(\nabla f(x,t))

and then (x, logp(x)) is a D+1 dim variable, which follows the above ODE. (In fact, such theory is firstly proposed by "Neural Ordinary Differential Equations".

You can use dpm-solver to approximate the solution, but you need to write another update rule for approximate d logp / dt.

Nevertheless, I will add a feature to dpm-solver to support likelihood computation :)

@mickelliu
Copy link
Author

Nevertheless, I will add a feature to dpm-solver to support likelihood computation

Thanks for your response, and apologize for the delayed reply.

This would be a very nice addition, but I am curious to know how to do it efficiently. To my knowledge, I think you would have to compute or at least approximate the second-order gradient (d_nabla/d_theta_unet) anyway, and this could be extremely inefficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants