{"action":"closed","issue":{"url":"https://api.github.com/repos/stan-dev/stan/issues/39","labels_url":"https://api.github.com/repos/stan-dev/stan/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/stan-dev/stan/issues/39/comments","events_url":"https://api.github.com/repos/stan-dev/stan/issues/39/events","html_url":"https://github.com/stan-dev/stan/issues/39","id":14152563,"number":39,"title":"Parallel Tempering in multiple threads?","user":{"login":"dlakelan","id":4332910,"avatar_url":"https://avatars.githubusercontent.com/u/4332910?v=3","gravatar_id":"","url":"https://api.github.com/users/dlakelan","html_url":"https://github.com/dlakelan","followers_url":"https://api.github.com/users/dlakelan/followers","following_url":"https://api.github.com/users/dlakelan/following{/other_user}","gists_url":"https://api.github.com/users/dlakelan/gists{/gist_id}","starred_url":"https://api.github.com/users/dlakelan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlakelan/subscriptions","organizations_url":"https://api.github.com/users/dlakelan/orgs","repos_url":"https://api.github.com/users/dlakelan/repos","events_url":"https://api.github.com/users/dlakelan/events{/privacy}","received_events_url":"https://api.github.com/users/dlakelan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/stan-dev/stan/labels/Feature","name":"Feature","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/stan-dev/stan/milestones/2","html_url":"https://github.com/stan-dev/stan/milestones/Future","labels_url":"https://api.github.com/repos/stan-dev/stan/milestones/2/labels","id":341383,"number":2,"title":"Future","description":"For tasks and features not scheduled for the next release.","creator":{"login":"bob-carpenter","id":3383807,"avatar_url":"https://avatars.githubusercontent.com/u/3383807?v=3","gravatar_id":"","url":"https://api.github.com/users/bob-carpenter","html_url":"https://github.com/bob-carpenter","followers_url":"https://api.github.com/users/bob-carpenter/followers","following_url":"https://api.github.com/users/bob-carpenter/following{/other_user}","gists_url":"https://api.github.com/users/bob-carpenter/gists{/gist_id}","starred_url":"https://api.github.com/users/bob-carpenter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bob-carpenter/subscriptions","organizations_url":"https://api.github.com/users/bob-carpenter/orgs","repos_url":"https://api.github.com/users/bob-carpenter/repos","events_url":"https://api.github.com/users/bob-carpenter/events{/privacy}","received_events_url":"https://api.github.com/users/bob-carpenter/received_events","type":"User","site_admin":false},"open_issues":173,"closed_issues":1,"state":"open","created_at":"2013-05-24T19:02:14Z","updated_at":"2015-03-17T15:37:59Z","due_on":null,"closed_at":null},"comments":13,"created_at":"2013-05-09T16:02:19Z","updated_at":"2015-03-17T15:37:59Z","closed_at":"2015-03-17T15:37:59Z","body":"I left a comment on Gelman's blog about this but I realized this is the best place to keep track of feature requests. Here's a copy of that request:\r\n\r\nSpeaking of mixing, Geyer’s parallel tempering seems like a pretty useful technique. Any chance of including it into Stan so that Stan will run NUTS on 2 or 3 additional tempered posterior densities, with the tempering coefficients given as an array or something? If you do switching with lowish probability then the chains may be mostly able to run in parallel threads on multiple cores without a lot of synchronization overhead and this could be a fantastic way to improve exploration of the space at basically no wall-clock-time cost.\r\n\r\nSpecifically, I imagine something like the following method:\r\n\r\nYou set up your N temperatures, maybe something like\r\n\r\nstan_parallel_temps <- [1.25,1.5,3]; ## you always need 1 to be first, so perhaps it's better to just declare the additional temps and let stan put 1 at the front of this list on its own.\r\n\r\nduring warmup Stan estimates the average length between U turns in the untempered distribution internally. It then chooses a number N at random exponentially distributed (or maybe gamma distributed or with a distribution the user specifies in the model file) with mean equal to some constant times this average inter-u-turn length (ceiling to the nearest int).\r\n\r\nAll the chains then run N steps and synchronize on a thread semaphore so that when all the high temp threads are done with N steps the temp 1 thread can proceed. It proceeds by choosing a random adjacent pair of temperatures and attempting an exchange between those states, and then generating a new N and setting all the threads back to work to do N HMC timesteps.\r\n\r\nin this scheme you most of the time complete several HMC trajectories before trying to exchange, so you don't disrupt the NUTS sampler too much, but then you have several tempered distributions running in parallel, and feeding your untempered simulation new regions of space so you may be able to explore space more readily. And as I said, with several cores your wall clock overhead is only due to the synchronization, which shouldn't be too bad."}}