Pigeons.jl icon indicating copy to clipboard operation
Pigeons.jl copied to clipboard

Ideas for using ensemble explorers

Open astrozot opened this issue 3 months ago • 3 comments

Following another issue #370 , I have been thinking (and struggling) a little to understand how to implement local ensemble explorers. Specifically, I was thinking of Goodman & Weare’s affine invariant explorer (popularized by emcee in Python), possibly with the simple dimensional scaling proposed in https://arxiv.org/pdf/2505.02987.

My problem is how to deal with an ensemble of explorers (the so-called "walkers") at the same temperature. Originally, I thought that I could just use, as a state of each replica, the various states of the various walkers: in other words, the state would be, instead of a vector with the parameters, a matrix, with each column representing the parameter vector for each walker. This works nicely and the local exploration can be carried out fairly easily by implementing the step! function appropriately.

The real problem, however, happens during the global exploration phase and associated chain swaps. The issue here is that I do not have a single state, but several ones associated with the various walkers. Therefore, the usual trick of swapping temperatures instead of states seems to fail, as it could well happen that I want to swap only a subsets of the walkers between two chains. Do you have any idea or suggestion regarding this?

One (probably sub-optimal) solution could be to swap the entire set of walkers. My problem is how to compute the associated log_potential. Intuitively, I would take the average of the log_potentials of the various walkers for comparison: that would be equivalent to take their geometric mean in the linear space (something that sounds better than taking the simple sum of the log_potentials, equivalent to the products of the potentials). However, I have no strong theoretical reason proceed that way (I would need to check that the detailed-balance equation holds...), but again perhaps you can give some suggestions in this respect.

astrozot avatar Oct 02 '25 15:10 astrozot

Apologies for the delay!

Good point, I had not foreseen this issue with swap. Indeed swapping as a block could be an option, but this would severely affect the acceptance rate so I would recommend against it.

Another approach is to pair up walkers and make swap decision a single pair of walkers at the time. This is loosely related to the Swendsen and Wang 'Replica mixing' proposed in their 1986 paper, and to the "Parallel parallel tempering" scheme outlined in section 5.3 of our JRSSB 2021 paper. But with the important difference in your case that the exploration kernel shares information across the different walkers.

Doing so would involve creating a new communicate! implementation. In the one-process case it would not be too bad and would be a good route for prototyping/research code. The distributed version would require a bit more thoughts. One route would be to create a new swap graph and tempering.

alexandrebouchard avatar Oct 23 '25 19:10 alexandrebouchard

If you want some potential inspiration. Doing pt with ensemble samplers was popular in Astro a few years ago with the package ptemcee on GitHub and sort of described here https://arxiv.org/abs/1501.05823 did this exact thing.

I also have some private c++ code that does exactly these kind of ensemble moves with temperature swapping. If it's useful I can dig up what we did and see if it at all reasonable. I think we didn't swap temps but states, so that does make things simpler.

ptiede avatar Oct 23 '25 22:10 ptiede

Ack looking closer you probably know all of this already! Sorry for the noise!

ptiede avatar Oct 23 '25 22:10 ptiede