Redundant computations with multilevel models and Slice sampler

I am not sure Aesara caches results when shared variables are not updated. It was more of a guess. What you have in mind may require compiling multiple separate Aesara functions and orchestrate them together in your custom Python sampler.