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
Allow user to disable unnecessary model evaluations after #2202 #2215
Comments
Can we simply pass an additional argument to the |
For HMC, this is per MCMC proposal instead of per leapfrog iteration, right? |
Technically possible, but this will be very invasive as it requires propagating kwargs through sooo much of the Turing.jl code base. I started out doing this in an attempt to add this and then just gave up because it got so unwieldy. |
I am checking out the |
Exactly:) |
After #2202 we will perform one additional evaluation per MCMC iteration than before.
In most use-cases we and users encounter in practice, this is negligible compared to the inference itself, e.g. when using NUTS, but in some cases it can be a significant increase in computational cost.
Unfortunately this is necessary to support "all" possible models and stealthy bugs causing incorrect results in some cases, e.g. see referenced issues in #2202. But IMO we should also provide the user a way to turn this off, as it is not required for most models encountered in practice.
One simple way of doing this is to let the user tell Turing.jl that "hey, this model is 'static' (in some sense), so perform optimizations where you can". At the moment, this would have to be done by the user manually, e.g. by setting a variable attached to the
Model
itself telling us that it has static support, etc., which is not ideal, but I don't really see a way around it in the near future (long-term we can definitely do better, e.g. analyze the IR in the model).I'm of the opinion that adding something like this now is worth it, because I know I would personally be annoyed if I'm forced to perform redundant operations when my model does not require it, without an easy way to turn it off. But I know there are other opinions floating around regarding this.
Thoughts? @devmotion @yebai @sunxd3
The text was updated successfully, but these errors were encountered: