Parallelization of Sequential Monte Carlo: sample_smc

Hello everyone,

I am new to PyMC and I am planning to use the SMC sampler, pm.sample_smc, for Bayesian parameter calibration. For example:

pm.sample_smc(draws=1000, chains=1, cores=1)

One attractive feature of SMC methods is that, within each sequential stage, the particles can in principle be evaluated independently. Therefore, likelihood evaluations, weight calculations, and MH mutation steps could theoretically be parallelized across particles.

However, in the default PyMC setup, the forward runs of my model appear to be executed one at a time. This gives me the impression that the particles within a single SMC chain are evaluated sequentially, which creates a significant computational bottleneck for my application.

My question is: does PyMC’s implementation of sample_smc support parallel evaluation of particles within a single SMC chain? If so, how can this be controlled or activated?

From what I have seen so far, the only available parallelization seems to be at the chain level, e.g. by running multiple chains in parallel using chains and cores.

Thanks in advance, and please let me know if any additional information would be helpful.

Not really, it would require changing the internals a bit.

we could at the very list handle the log likelihood as a vectorized function and use multi threading there, but we don’t. The rest of the kernel is just python code.