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

Performance hints #2416

Open
torfjelde opened this issue Dec 4, 2024 · 0 comments
Open

Performance hints #2416

torfjelde opened this issue Dec 4, 2024 · 0 comments

Comments

@torfjelde
Copy link
Member

We should have decent ways to inform the user of certain simple things they can do to improve the performance of their model.

For example, in #2396, it is suggested that we should maybe warn a user if they use a forward-mode AD backend on a model with more than, say, 20 parameters. This is ofc a nuanced issue, as not all AD backends support the same (sub)set of Julia.

However, we could maybe hide some of these suggestions behind a function, e.g. performance_hints(model) or something, which prints out certain suggestions to how to improve a model / warns the user of typical patterns that have performance impacts.

Again, it'll be difficult to make this perfect, but if accompanied with good docs (ref: #2415), this could work well.

Example of things we could put in such a performnace_hints method:

  1. Usage of reverse-mode AD backend when dimensionality is "high".
  2. Using DynamicPPL.check_model_and_trace we could also analyse the ~ statements to check if there's anything going on there, e.g. x[i] ~ Normal() in a loop instead of x ~ filldist(Normal(), n).
  3. More?

Longer term, we could probably make use of JET.jl to inspect more things, e.g. are allocations happening in the model, etc.

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

1 participant