Speed up the model: how large is a model large enough to benefit from using GPU?

By the way you don’t need to wrap everything in deterministics, only if you need those values afterwards. It will save on memory/computation.

You might benefit from changing how you compute gammaMu_c, but as you commented it might not be trivial.

Otherwise it looks fine, but the fact you get divergences could mean bad priors/ challenging model. I would focus on fixing that before worrying about speedup. As you would still be getting invalid samples, just faster.