google-research / torchsde

Differentiable SDE solvers with GPU support and efficient sensitivity analysis.
Apache License 2.0
1.51k stars 194 forks source link

Learned SDE is quite smooth #113

Closed wangyixu14 closed 2 years ago

wangyixu14 commented 2 years ago

Hi,

I am trying to modify the latent_sde_lorenz example to learn an SDE from a simple 2-dimension noise data. The code works well but the only problem is that the learned SDE will always generate quite smooth samples. image

I'd like the learned SDE to show the same amount of stochasticity as the data, any idea how to deal with this? Is there any parameter that needs to be tuned?

patrick-kidger commented 2 years ago

This is a known problem with latent SDEs -- the diffusion is always a bit too small. I think this could be mitigated by tweaking the training objective (probably the reconstruction loss encourages small diffusions), or by additionally training wrt a discriminator (see Neural SDEs as Infinite-Dimensional GANs). To my knowledge no-one has really tried this, or tried working out the details though.

lxuechen commented 2 years ago

Have you tried increasing the penalty on the path-space KL?

The prior diffusion is unlikely to collapse, since it's forced to match multiple posterior diffusions approximately, simultaneously.

wangyixu14 commented 2 years ago

This is a known problem with latent SDEs -- the diffusion is always a bit too small. I think this could be mitigated by tweaking the training objective (probably the reconstruction loss encourages small diffusions), or by additionally training wrt a discriminator (see Neural SDEs as Infinite-Dimensional GANs). To my knowledge no-one has really tried this, or tried working out the details though.

Thanks for the reply. I am trying to adjust some loss functions.

Have you tried increasing the penalty on the path-space KL?

The prior diffusion is unlikely to collapse, since it's forced to match multiple posterior diffusions approximately, simultaneously.

Thank you, so which loss should I increase log_pxs or logqp0 + logqp_path?

lxuechen commented 2 years ago

I'm referring to the logqp_path part.

wangyixu14 commented 2 years ago

I'm referring to the logqp_path part.

Yes, it helps! Thank you guys for the timely reply. I am closing this issue.

lxuechen commented 2 years ago

I'm referring to the logqp_path part.

Yes, it helps! Thank you guys for the timely reply. I am closing this issue.

Awesome! Feel free to reopen if/when you have follow-up questions.

patrick-kidger commented 8 months ago

This is really cool to see -- thank you for sharing! Honestly, "better neural SDEs" is still an open research topic. I would love to see more work like yours in this space. :)