Need advice about debugging "stuck in warmup" behavior

Hi, I’m working on a 1-parameter model (trying to start small) which is an ODE model with a 10 dimensional state space. The one parameter moves the trajectories around, and likelihood is calculated according to how well a trajectory matches data which are measured for one of the state dimensions. There are 288 data points to be taken into account for the likelihood. I am running Stan via RStan. I’m sure this is all pretty pedestrian.

What I’m seeing is that Stan gets stuck in the warmup phase. The progress messages say 0%, 1%, 2%, very, very slowly advancing. I can print out the values of the sole parameter and it looks like the model is being evaluated over and over for identical or nearly identical values of the parameter. I have tried varying stepsize, stepsize_jitter, adapt_delta, max_treedepth, and warmup; I haven’t yet stumbled across a combination which is materially different.

What are some ideas for debugging or diagnosing what is going on in the warmup phase? I have printed out the parameter so far, and that shows the values are identical or nearly so, which is interesting. What are some other things I can look at? I gather that very small steps are sometimes associated with strong curvature – how could I go about collecting more information about that?

I can post the entire model, it’s not too big, but I would need to do some work on it to make it self-contained. In the meantime if anyone has any advice about things to look at, I would be very grateful.

All the best,
Robert Dodier

1 Like


Can you provide details about

  • the ODE,
  • the measurement (noise),
  • the used ODE solver and
  • the used ODE solver configuration.

There are a few things that can go wrong with ODE models. My first guess would be that the accuracy of the solver is insufficient leading to divergences which in turn may lead to smaller and smaller stepsizes, which in turn may lead to large treedepths, ie a lot (1k) of leapfrog steps(=ODE solves) per warmup iteration.

Have you seen this? Bayesian Model of Planetary Motion: exploring ideas for a modeling workflow when dealing with ordinary differential equations and multimodality | planetary_motion.utf8

Hi Funko, thanks for your advice. The article which you linked has a lot of really useful ideas, I am taking a look at that now. I’ll try to make some headway looking at the results of a Stan run and scratching my head a little. If I can’t get it sorted out (haha, I’m sure that will be the case), I will post more detailed information here as you suggested.

All the best,
Robert Dodier

1 Like

That’s great, the article is a great start.