Annealed importance sampling is a method for directly approximating the partition function . This is especially helpful during evaluation when we want to compare the likelihoods between two models.

Partition Ratios

Note that to compare two models, we can check the ratio of their likelihoods, which is equivalent to

Knowing the ratio of the partition functions is enough to compare models, and if we ever need its actual value, we can find it with

if we knew the ratio and the partition for the other distribution.

Importance Sampling

We can directly find the ratio using ๐Ÿช† Importance Sampling:

Thus, the ratio is

where . If is close to and tractable, the equation above is an effective way to estimate .

Annealing

However, often times is too complex, and thereโ€™s no simple thatโ€™s close enough to offer a good approximation; if most probabilities are off, our sum will be sparse and have high variance.

Annealed importance sampling bridges the gap between and with intermediate distributions where . We begin with a simple distribution and gradually transform it to . Then ratio is then

are hand-designed, usually set as

To sample from them, we define transition functions so that

which can be constructed using any ๐ŸŽฏ Markov Chain Monte Carlo method.

Then, we can sample and

The importance weight of our sample is

With samples and weights , our ratio estimate is