Optimal Scaling for Locally Balanced Proposals in Discrete Spaces
Abstract
Optimal scaling has been well studied for Metropolis-Hastings (M-H) algorithms in continuous spaces, but a similar understanding has been lacking in discrete spaces.
Recently, a family of locally balanced proposals (LBP) for discrete spaces has been proved to be asymptotically optimal, but the question of optimal scaling has remained open.
In this paper, we establish, for the first time, that the efficiency of M-H in discrete spaces can also be characterized by an asymptotic acceptance rate that is independent of the target distribution.
Moreover, we verify, both theoretically and empirically, that the optimal acceptance rates for LBP and random walk Metropolis (RWM) are 0 .
574 and 0 .
respectively.
These results also help establish that LBP is asymptotically O ( N 23 ) more efficient than RWM with respect to model dimension N .
Knowledge of the optimal acceptance rate allows one to automatically tune the neighborhood size of a proposal distribution in a discrete space, directly analogous to step-size control in continuous spaces.
We demonstrate empirically that such adaptive M-H sampling can robustly improve sampling in a variety of target distributions in discrete spaces, including training deep energy based models.
Introduction
The Markov Chain Monte Carlo (MCMC) algorithm is one of the most widely used methods for sampling from intractable distributions (Robert & Casella, 2013).
An important class of MCMC algorithms is Metropolis-Hastings (M-H)
(Metropolis et al., 1953; Hastings, 1970) where new states are generated from a proposal distribution followed by a M-H test.
The efficiency for M-H algorithms depends critically on the proposal distribution.
For example, gradient based methods, such as the Metropolis Adjusted Langevin Algorithm (MALA)
(Rossky et al., 1978), Hamiltonian Monte Carlo (HMC) (Neal et al., 2011), and their variants Girolami & Calderhead (2011); Hoffman et al. (2014) substantially improve the performance of M-H algorithms in theory and in practice, compared to naive Random Walk Metropolis (RWM), by leveraging gradient information to guide the proposal distribution (Roberts & Rosenthal, 2001).
Despite many advances, progress in gradient based methods has generally focused on continuous spaces.
However, Zanella (2020) recently proposed a general framework of locally balanced proposals (LBP) for discrete spaces, where a proposal distribution is designed to utilize probability changes between states.
Subsequently, Grathwohl et al. (2021) accelerated the sampler by using gradient information to approximate the probability change.
In empirical evaluations, similar to gradient based samplers in continuous spaces, LBP significantly outperforms RWM and other samplers in discrete spaces.
However, both Zanella (2020) and Grathwohl et al. (2021) constrain the proposal distribution to lie within a 1-Hamming ball; i.e., only one site of the state variable is allowed to change per M-H step.
Such a restricted update reduces the efficiency of the sampler.
Sun et al.
(2021) noticed this problem and modified the proposal distribution to allow multiple sites to be changed per M-H step.
Although such larger updates significantly improve efficiency, Sun et al. (2021) do not show how to determine the update size, leaving the number of sites updated in an M-H step as a hyperparameter to tune.
In continuous spaces, the scale of the proposal distribution is known to be a critical hyperparameter for obtaining an efficient M-H sampler.
For example, consider a Gaussian proposal N ( x, σ 2 ) for modifying a current state x with scale σ .
If σ is too small, the Markov chain will converge slowly since its increments will be small.
Conversely, if σ is too large, the M-H test will reject too high a proportion of proposed updates.
A significant literature has studied optimal scaling for gradient based methods in continuous spaces (Gelman et al., 1997; Roberts & Rosenthal, 1998, 2001; Beskos et al., 2013), showing that the optimal scaling can be adaptively tuned w.r.t.
the acceptance rate, independent of the target distribution.
Such results suggest a direction for solving the optimal scaling problem for LBP.
However, the underlying techniques for approximating a diffusion process cannot be directly applied to LBP given its discrete nature.
In this work, we consider an asymptotic analysis as the dimension of the discrete model, N , converges to infinity.
Starting with a product distribution, we prove that the asymptotic efficiency of LBP in discrete spaces is 2 R Φ( − 12 λ 1 R 32 /N ) with an asymptotic acceptance rate of 2Φ( − 12 λ 1 R 32 /N ) , where the scale R represents the number of sites to update per M-H step.
Therefore, the asymptotically optimal scale of the proposal distribution is R
=
O
( N 23 ) with an asymptotically optimal acceptance rate of 0 . 574 , independent of the target distribution.
Moreover, for RWM in a discrete space, we show that the asymptotic efficiency and acceptance rate are 2 R Φ( − 12 λ 2 R 12 ) and 2Φ( − 12 λ 2 R 12 ) , respectively.
Hence, the asymptotically optimal scale is O (1) and the asymptotically optimal acceptance rate is 0 . 234 for RWM.
By comparing LBP and RWM at their respective optimal scales, it can be determined that LBP is O ( N 23 ) more efficient than RWM.
These asymptotically optimal acceptance rates are robust in the following respects.
First, although the initial derivation is established w.r.t.
product distributions, the result can be expanded to more general distributions.
Second, the efficiency is not sensitive around the optimal acceptance rate.
For example, whereas 0 . 574 is the optimal acceptance rate for LBP, the algorithm retains high efficiency for acceptance rates between 0 . 5 and 0 .
Based on these observations, we propose an adaptive LBP (ALBP) algorithm that automatically tunes the update scale to suit the target distribution.
We validate these theoretical findings in a series of empirical simulations on the Bernoulli model, the
Ising model, factorized hidden Markov models (FHMM) and restricted Boltzmann machines (RBM).
The experimental outcomes comport with the theory.
Moreover, we demonstrate that ALBP can automatically find near optimal scales for these distributions.
We also use ALBP to train deep energy based models (EBMs), finding that it reduces the MCMC steps needed in contrastive divergence training (Hinton, 2002; Tieleman & Hinton, 2009), significantly improving the efficiency of the overall training procedure.
Background
Metropolis-Hastings Algorithm Let π denote the target distribution.
Given a current state x ( n ) , a
M-H sampler draws a candidate state y from a proposal distribution q ( x ( n ) , y ) .
Then, with probability min (cid:110) 1 , π ( y ) q ( y,x ( n ) )
π ( x ( n ) )
q ( x ( n ) ,y ) (cid:111)
the proposed state is accepted and x ( n +1)
=
y ; otherwise, x ( n +1) =
x ( n ) .
In this way, the detailed balance condition is satisfied and the M-H sampler generates a Markov chain x 0 , x 1 , ... that has π as its stationary distribution.
Locally Balanced Proposal .
The locally balanced proposal (LBP) is a special case of the pointwise informed proposal (PIP), which is a class of M-H algorithms for discrete spaces (Zanella, 2020) using the proposal distribution Q g ( x, y )
∝ g ( π ( y ) /π
( x )) such that g is a scalar weight function.
Zanella (2020) shows that the family of locally balancing functions G = { g : R + → R + , g ( t ) =
tg ( 1 t ) , ∀ t > 0 } (e.g. g ( t ) = √ t or t t +1 ) is asymptotically optimal for PIP.
Hence, PIP with a locally balanced function for its weight function is referred to as LBP.
Despite having good proposal quality, PIP requires the weight g ( π ( z ) /π ( x )) to be calculated for all candidate states z in the neighborhood of x , which results in its high computational cost.
Grathwohl et al.
(2021) propose to estimate the probability change by leveraging the gradient, improving the scalability of LBP.
Locally Balanced Proposal with Auxiliary Path .
Sun et al.
(2021) generalize LBP by introducing an auxiliary path sampler, which allows multiple sites to be updated per M-H step.
In particular, Sun et al.
(2021) sequentially selects the update indices without replacement, and uses these indices as auxiliary variables to keep the proposal distribution tractable while preserving the detailed balance condition.
Although this can achieve significant improvements in empirical performance, Sun et al. (2021) manually tune the update size per M-H step, and leave the optimal scale problem open.
Main Result 3.1 Problem Statement
We establish asymptotic limit theorems for two M-H algorithms in discrete spaces: the locally balanced proposal (LBP) and random walk Metropolis (RWM).
Following previous work (Gelman et al., 1997; Roberts & Rosenthal, 1998; Beskos et al., 2013; Vogrinc et al., 2022), we conduct our analysis on a product probability measure π .
In particular, for a state space X
= { 0 , 1 } N , we consider a factored target distribution
[Equation]
where each site is assumed to have a sufficiently large probability for being both 0 and 1 ; that is, for a fixed ϵ ∈ (0 , 14 ) , we assume the target distribution belongs to:
[Equation]
where we denote a ∧ b = min { a, b } .
To measure the efficiency of the sampler, an ergodic estimate varies with the objective function considered.
Alternatively, we use a natural progress estimate: the expected jump distance (EJD).
Denote P θ as the transition kernel, d ( x, y ) as the Hamming distance between x and y .
For a M-H sampler parameterized by θ , its expected jump distance ρ ( θ ) and corresponding expected acceptance rate a ( θ ) are
[Equation]
In continuous space, the limit of sampling process is a diffusion process, whose efficiency is determined by the expected squared jump distance (ESJD)
(Roberts & Rosenthal, 2001).
In discrete space, the limit of the sampling process is a jump process, whose velocity is characterized by the EJD. Hence, EJD is the correct metric to measure the efficiency in discrete space; see more details in Appendix B.1.
3.2 Locally Balanced Proposal
We consider the M-H sampler LBP- R , where R refers to flipping R indices in each M-H step.
Given a current state x , LBP-R calculates the weight w j for flipping index j as in PIP.
Since we are considering a binary target distribution of the form (1), we have
[Equation]
where g is a locally balanced function.
Following Sun et al. (2021), LBP-R select indices u r with probability P ( u r = j ) ∝ w j sequentially for r = 1 , ..., R , without replacement.
The new state y is obtained by flipping indices u 1: R of x .
If we consider u as an auxiliary variable, the accept rate A ( x, y, u ) in the M-H acceptance test can be written as
[Equation]
Ri = r w ui ( x ) , where W ( x, u ) =
N (cid:88) i =
w i −
R (cid:88) r = w u r (5)
From theorem 1 in Sun et al.
(2021), the auxiliary sampler LBP-R satisfies detailed balance.
A M-H step of LBP-R is summarized in Algorithm 1.
3.3 Optimal Scaling for Locally Balanced Proposal
We are now ready to state the first asymptotic theorem.
Theorem 3.1.
For arbitrary sequence of target distributions { π ( N ) } ∞ N =1 ⊂ P ϵ , the M-H sampler
LBP-R with a locally balanced weight function g obtains the following, if R =
⌊ lN 23 ⌋ ,
[Equation]
where Φ is the c.d.f.
of standard normal distribution and λ 1 only depends on π ( N )
[Equation]
[Equation]
The definition of λ 1 in (7) explains the motivation of restricting the target distributions in (2).
In fact, introducing the ϵ gives upper and lower bounds of λ 1 .
When all p j are arbitrarily close to 12 , ( w j (0) − w j (1)) 2 in numerator will be zero, so is λ 1 .
As a result, the acceptance rate will always be 1 .
Else, when all p j are arbitrarily close to 0 or 1 , E x [ 1 N (cid:80)
Ni =
1 w i ( x i )] in denominator will be zero, and λ 1 will be infinity.
As a result, the acceptance rate will always be 0 .
So, we have to make the mild assumption in (2) to assure the following asymptotic result holds.
A more detailed discussion about ϵ is given in Appendix B.2.
Corollary 3.2.
The optimal choice of scale for R = lN 23 is obtained when the expected acceptance rate is 0 .
574 , independent of the target distribution.
Proof.
When R = lN 23 , denote z = λ 2 3 1 l , we have:
[Equation]
It means the optimal value of z is independent of the target distribution π ( N ) .
As Φ is known, we can numerically solve z = 1 . 081 , and the corresponding expected acceptance rate is a = 0 .
3.4 Proof of Theorem [-3.
-]3.
Denote the current state as x and a new state proposed in LBP-R as y .
Consider the acceptance rate
A ( x, y, u ) in (5).
Using the fact that, if index j is not flipped then w j ( y ) =
w j ( x ) , we have:
[Equation]
where (9) takes advantage of the property of a locally balanced function.
Hence, the acceptance rate
A ( x, y, u ) can be simplified to:
[Equation]
From the definition in (5), we have W ( x, u ) =
W ( y, u ) .
Denote i
∧
j = min { i, j } and i ∨ j = max { i, j } , we have the following approximation:
Lemma 3.3.
Define W = E x,u [ W ( x, u )] .
We have: lim N
[Equation]
( A + B ) = 0 , where
[Equation]
To analyze A and B , we reverse the order of x and u .
In particular, instead of first sampling x ∼ π ( x ) , then sampling u ∼ p ( x | u ) , we use a reversed order where we first determine the indices u , then the values of x u , and finally the values of x − u .
Lemma 3.4.
The joint distribution p ( x, u ) =
π ( x ) p ( u | x ) can be decomposed in the following form:
[Equation]
Denote j / ∈ u 1: r − 1 represents j ̸ = u
i for i = 1 , ..., r − 1 , the conditional probabilities are
[Equation]
With the conditional distribution in Lemma 3.4, we are able to give a concentration property of the term B and show it is safe to ignore:
Lemma 3.5.
With a probability larger than 1 − O (exp( − N 12 )) , B = O (cid:0) N − 112 (cid:1) .
For term A , we use martingale central limit theorem with convergence rate (Haeusler, 1988) to bound the Kolmogorov-Smirnov statistic.
Lemma 3.6.
When R = lN 23 , λ 1 defined as (7) , we have:
[Equation]
By (16), the expectation w.r.t.
A asymptotically equals to the expectation on N ( µ, σ 2 ) .
The final step to prove Theorem 3.1 is to exploit a property of the normal distribution.
Lemma 3.7.
If Z ∼ N ( µ, σ 2 ) , then we have:
[Equation]
where Φ is the c.d.f.
of the standard normal distribution.
By Lemma 3.6, 3.7, we have the expectation of (10), which is the expected accept rate, equals to:
[Equation]
3.5 Optimal Scaling for Random Walk Metropolis
We denote the Random Walk Metropolis in discrete space as RWM- R , where R refers to flipping
R indices in each M-H step.
Under the Bernoulli distribution, a site is more likely to stay at high probability position, so if we randomly flip a site, it is more likely to decrease its probability.
That is, intuitively, the acceptance rate will decrease exponentially as the scale R increases.
Consequently, the optimal scale for RWM- R should be O (1) .
Though this is not a rigorous proof, the constant scaling indicates that it will be hard to directly prove an asymptotic theorem for RWM- R .
To address this difficulty, we first restrict our target distribution to a smaller class of Bernoulli distributions
P ( β ) ϵ ⊂ P ϵ , which is formally defined as follows.
For a fixed ϵ ∈ (0 , 14 ) and a fixed β > 0 , define
[Equation]
When N is large, each p j will be very close to 12 .
In this way, the acceptance rate will not drop too fast when R is increased, and a non-constant R will be permitted.
This enables us to prove:
Theorem 3.8.
For arbitrary sequence of target distributions { π ( N ) } ∞ N =1 ⊂ P ( β ) ϵ , the M-H sampler
RWM-R obtains the following, if R = lN 2 β ,
[Equation]
where Φ is the c.d.f.
of the standard normal distribution and λ 2 only depends on π ( N ) .
[Equation]
Corollary 3.9.
The optimal scale R = lN 2 β is obtained when the expected acceptance rate is 0.234, independent of the target distribution.
The rate in Corollary 3.9 is proved for arbitrary β > 0 .
If we let β decrease to 0 , at β = {+
+} the optimal scale for RWM- R is O (1) while the optimal acceptance rate is 0 .
Also, we can notice that P ( β ) ϵ converges to P ϵ when β decrease to
and we are able to show the optimal scale of RWM in P ϵ is
O (1) , see details in Appendix B.3.
However, this limit is not mathematically rigorous, because
Theorem 3.8 and Corollary 3.9 only hold asymptotically, such that a smaller β requires a larger N .
Hence, when β decreases to 0 , N must approach infinity to satisfy the asymptotic theorem.
Although there is this minor gap in the analysis, the conclusion nevertheless aligns very well with different target distributions in the experiment section.
Adaptive Algorithm
Given knowledge of the optimal acceptance rate, one can design an adaptive algorithm that automatically tunes the scale of the M-H samplers.
For this purpose, we use stochastic optimization Andrieu & Thoms (2008); Robbins & Monro (1951) to adjust the scaling parameter R t to ensure that the statistic A t = a t − δ approaches 0 , where a t is the acceptance probability for iteration t and δ is the target acceptance rate ( 0 . 574 for LBP and 0 . 234 for RWM).
According to Theorem 3.1 and Theorem 3.8, the acceptance rate is a decreasing function of the scaling R t .
Hence, we use the update rule:
[Equation]
(22) with step size η t = 1 .
We follow common practice and adapt the tunable MCMC parameters during a warmup phase before freezing them thereafter Gelman et al.
The computational cost for (22) is ignorable comparing the total cost of a M-H step.
The algorithm boxes for ALBP and ARWM are given in Appendix C. More advanced implementations are possible, but it is out of the focus in the paper.
We observe below that this simple approach is able to maintain the sampler robustly near the optimal acceptance rate.
Related Work
Informed proposals for Metropolis-Hastings (M-H) algorithms have been extensively studied for continuous spaces (Robert & Casella, 2013).
The most famous algorithms are the Metropolis-adjusted Langevin algorithm (MALA) (Rossky et al., 1978) and Hamiltonian Monte Carlo (HMC) (Neal et al., 2011). MALA, HMC, and their variants (Girolami & Calderhead, 2011; Hoffman et al., 2014; Welling & Teh, 2011; Titsias & Dellaportas, 2019; Hirt et al., 2021; Hoffman et al., 2021;
Hird et al., 2020; Livingstone & Zanella, 2019) use the gradient of the target distribution to guide the proposal distribution toward high probability regions, which brings substantial improvements in sampling efficiency compared to uninformed methods, such as random walk Metropolis (RWM) (Metropolis et al., 1953).
Informed proposals have also demonstrated recent success in discrete spaces.
Zanella (2020) first gives a formal definition of the pointwise informed proposal (PIP) for discrete spaces, then proves that locally balanced proposals (LBP), using a family of locally balanced functions as the weight function in PIP, are asymptotically optimal for PIP.
Following this work, Power & Goldman (2019) extended the framework to Markov jump processes and introduced non-reversible heuristics to accelerate sampling.
Sansone (2021) parameterize the locally balanced function and tune it by minimizing a mutual information.
Grathwohl et al. (2021) give a more scalable version of LBP for differentiable target distributions by estimating the probability change through the gradient.
Despite strong empirical results, the LBP method of Zanella (2020) only flips one bit per M-H step, since PIP has to restrict the proposal distribution to a small neighborhood, e.g. a 1-Hamming ball, due to its computational cost.
Sun et al.
(2021) generalize LBP to flip multiple bits in a single M-H step, gaining significant improvement in sampling efficiency.
However, the scaling of the proposal distribution in Sun et al. (2021) was manually tuned and the optimal scaling problem was left open.
For continuous spaces, the optimal scaling problem for informed proposals has been well studied.
A significant literature has already shown that the scale can be tuned with respect to the optimal acceptance rate (Roberts & Rosenthal, 2001), e.g. 0.234 for RWM (Gelman et al., 1997), 0.574 for MALA Roberts & Rosenthal (1998), 0.651 for HMC Beskos et al. (2013), and 0.574 for Barker (Vogrinc et al., 2022), by decreasing the scale so that the Markov chain converges to a diffusion process.
However, such a technique is not directly applicable to LBP given its discrete nature.
Roberts (1998) make an initial attempt on discrete space, however it assumes all dimensions satisfy independent, identical Bernoulli distribution.
In this work, we have established for the first time the optimal scale for LBP and RWM in discrete spaces.
Experiments
The effectiveness of LBP has been extensively demonstrated in previous work, e.g. Zanella (2020); Grathwohl et al.
; Sun et al. (2021), in comparison to other M-H samplers for discrete spaces, such as RWM, Gibbs sampling, the Hamming Ball sampler (Titsias & Yau, 2017), and continuous relaxation based methods Zhang et al. ; Pakman & Paninski (2013); Nishimura et al. Han et al.
Therefore, we focus on simulating LBP- R , with weight function g ( t ) =
t t +1 , and RWM- R to validate our theoretical findings.
More experiments, including different weight functions and comparison between "with" and "without" replacement versions of LBP are given in Appendix D.
Throughout the experiment section, we will use the gradient approximation (Grathwohl et al., 2021).
That is to say, we estimate the change in probability of flipping index i is estimated by: ˜
[-exp((
-][Equation]
i ) [Equation] ∇ log π ( x )) i )
For the Bernoulli distribution, this is still exact and does not hinder the justification of the theoretical results.
For more complex models, this approximation makes the algorithms significantly more efficient.
In particular, the gradient approximation only requires two calls of the probability function and two calls of the gradient function.
Consequently, LBP with gradient approximation will take about twice time per update compared to RWM.
In our experiments, we observe that LBP and GWG takes 1 . 2 ± 0 .
2 and 1 .
1 ± 0 .
1 more time per update, respectively, than RWM, across all target distributions.
We therefore omit reporting the detailed run time for each method.
6.1 Sampling from different target distributions
We consider four target distributions: the Bernoulli distribution, the Ising model, the factorial hidden
Markov model (FHMM), and the restricted Boltzmann machine (RBM).
For each model, we consider three configurations: C1, C [Figure] and C3 for smooth, moderate, and sharp target distributions.
To obtain performance curves, we first simulate LBP- 1 and RWM- 1 for an initial acceptance rate a max .
Then, we adopt a max − 0 .
02 , ..., a max − 0 .
02 k , ... as a target acceptance rate.
For each rate, we use the adaptive sampler to obtain an estimated scale R [Figure] with which we simulate 100 chains and calculate the final real acceptance rate and efficiency.
In this way, we collect abundant data points to characterize the relationship between acceptance rate and efficiency to facilitate the following analyses
[Figure] [Figure]
Bernoulli Distribution .
We validate our theoretical results on Bernoulli distribution.
The probability mass function is given in (1).
For each configuration, we simulate on domains with three dimensionalities: N = 100 , 800 , 6400 .
The scatter plot for N = 800 is reported in Figure 1.
We also estimate λ in (7) and (21) and plot the theoretical efficiency curve in (5) and (20).
From Figure 1, we can see that the simulation results align well with the theoretically predicted curves, and the optimal efficiencies were achieved at 0 .
574 for LBP and 0 .
234 for RWM for all configurations.
Ising Model .
The Ising model (Ising, 1924) is a classical model in physics defined on a p × p square lattice graph ( V p , E p ) (details in Appendix D.2).
For each configuration, we simulate on three sizes p = 20 , 50 , 100 .
We report the results for p = 50 in Figure 2.
For LBP, the optimal efficiencies are achieved at around 0 .
5 , which is slightly less than 0 .
574 , although these values are close.
Thus we can say that the asymptotically optimal acceptance rate for LBP still applies to the Ising model.
For RWM, 0 . 234 perfectly matches the acceptance rate where the optimal efficiencies are obtained.
Factorial Hidden Markov Model .
The FHMM (Ghahramani & Jordan, 1995) uses latent variables x ∈ X = { 0 , 1 } L × K to characterize time series data y ∈ R L (details in Appendix D.3).
Given y , we sample the hidden variables x from the posterior π ( x ) = p ( x | y ) .
For each configuration, we simulate in three sizes L = 200 , 1000 , 4000 .
We report the results for L = 1000 in Figure 3.
One can observe that these results match the theoretical predictions very well.
[Figure] [Figure]
Restricted Boltzmann Machine .
A RBM (Smolensky, 1986) is a bipartite latent-variable model that defines a distribution over binary data x ∈ { 0 , 1 } N and latent data z ∈ { 0 , 1 } h (details in Appendix D.4).
We train an RBM on the MNIST dataset using contrastive divergence (Hinton, 2002) and sample observable variables x .
We report the results in Figure 4.
For LBP, although RBM is much more complex than a product distribution, its efficiency versus acceptance rate curves still match the theoretical predictions very well.
For RWM, even using R = 1 will result in acceptance rates less than 0 .
234 for all configurations.
Although we cannot check what the optimal value is, we [Figure] still observe that efficiency is an increasing function of the acceptance rate when the acceptance rate is less than 0 .
234 , as predicted by the theory.
Optimal Scaling and Efficiency .
We examine how optimal scaling R for LBP, RWM and their relative efficiency ratio grow w.r.t.
the model dimension N .
In figure 5, we can see that both the optimal scaling and efficiency ratio are linear in log-log plot and the slopes are close to 23 across
Bernoulli, Ising [Figure] and FHMM.
The results matches the theories that the optimal scaling R
=
O
( N 23 ) for LBP, R = O (1) for RWM, and the relative efficiency ratio LBP over RWM is O ( N 23 )
[Table]
[Table]
6.2 Adaptive Sampling
We have validated the theoretical findings regarding the optimal acceptance rates on various distributions.
In this section, we examine the performance of the adaptive sampler.
In addition to the expected jump distance (EJD), we also report the effective sample size (ESS) 2 .
We compare the adaptive sampler ALBP, ARWM with their single step version LBP-1, RWM-
[Table]
and grid search version GLBP, GRWM, where we tune the scaling R by grid search.
We give the sampling results on Bernoulli model, Ising model, FHMM, and RBM with medium size and configuration C2 in table 1.
More results are given in Appendix D. We can see that the adaptive samplers are significantly more efficient than single step samplers, especially for LBP.
Also, the adaptive samplers can robustly achieve almost the same performance comparing to using grid search to find the optimal scaling.
6.3 Training Deep Energy Based Models
Learning an EBM is a challenge task.
Given data sampled from a true distribution π , we maximize the likelihood of the target distribution π θ ( x ) ∝ e − f θ ( x ) parameterized by θ .
The gradient estimation requires samples from the current model, which is typically obtained via MCMC.
The speed of training an EBM is determined by how fast a MCMC algorithm can obtain a good estimate of the second expectation.
[Figure]
We evaluate adaptive samplers by learning deep EBMs.
Following the setting in Grathwohl et al. (2021), we train deep EBMs parameterized by Residual Networks (He et al., 2016) on small binary image datasets using PCD (Tieleman & Hinton, 2009) with a replay buffer (Du & Mordatch, 2019).
We compare two single step samplers and two adaptive samplers, where LBP b uses g ( t ) =
t t +1 as weight function and LBP s uses g ( t ) = √ t as weight function.
When we allow them to run enough iterations in PCD, they are able to train EBMs in same good quality.
To measure the efficiency of these samplers, we compare the minimum number of M-H steps needed in PCD in table 2.
We can see that adaptive samplers only need one half or even one fifth iterations compare to single step samplers.
We also present long-run samples from our trained models via ALBP s in Figure 6.
Dataset
LBP
[Table]
Discussion
In this paper, we have addressed the optimal scaling problem for the locally balanced proposal (LBP) in (Sun et al., 2021).
We verified, both theoretically and empirically, that the asymptotically optimal acceptance rate for LBP is 0 . 574 , independent of the target distribution.
Moreover, knowledge of the optimal acceptance rate allows one to adaptively tune the neighborhood size for a proposal distribution in a discrete space.
We verified the theoretical findings on a diverse set of distributions, and demonstrated that adaptive LBP can improve sampling efficiency for learning deep EBMs.
We believe there is considerable room for future work that builds on these results.
For theoretical investigation, the theory established under a strong assumption that the target distribution is a product distribution, despite the results applies very well to more complicated distributions.
We believe the results still hold under a weaker assumption that the target distribution has no phase transition.
We also believe it is possible to design a HMC style sampler for discrete spaces in the framework of Sun et al. by using LBP as a block for the auxiliary path.
For empirical investigation, many real-world problems involve probability models of discrete structured data, such as syntax trees for natural language processing (Tai et al., 2015), program synthesis (Dai et al., 2020), and graphical models for molecules (Gilmer et al., 2017).
Efficient discrete samplers should be able to accelerate both learning and inference with such models.
Acknowledgement
We thank Vladimir Koltchinskii, Pengcheng Yin, Matthew D. Hoffman, and three anonymous reviewers for their helpful comments to improve the manuscript.
Dale Schuurmans gratefully acknowledges the support of a Canada CIFAR AI Chair, NSERC and Amii.
Checklist
The checklist follows the references.
Please read the checklist guidelines carefully for information on how to answer these questions.
For each question, change the default [TODO] to [Yes] , [No] , or [N/A] .
You are strongly encouraged to include a justification to your answer , either by referencing the appropriate section of your paper or providing a brief inline description.
For example:
• Did you include the license to the code and datasets?
[Yes] See https://github.com/ ha0ransun/LBP_Scale.git .
• Did you include the license to the code and datasets?
[Yes]
Please do not modify the questions and only use the provided macros for your answers.
Note that the
Checklist section does not count towards the page limit.
In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] See Section(c)
Did you discuss any potential negative societal impacts of your work?
[No] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] (b) Did you include complete proofs of all theoretical results?
[Yes] See Appendix A 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] See supplemental material (b) Did you specify all the training details (e
g., data splits, hyperparameters, how they were chosen)?
[Yes] (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[N/A] (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[N/A]
The work does not use existing assets.
(b) Did you mention the license of the assets?
[N/A] (c) Did you include any new assets either in the supplemental material or as a URL?
[Yes] Codebase is included in supplemental materials.
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating?
[N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A]
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]
A Complete Proof A.1 A concentration of W ( x, u )
Lemma A.1.
Define W = E x,u [ W ( x, u )] .
We have:
[Equation]
23) where C 2 is an absolute constant that only depends on the scalar ϵ in (2) .
Proof.
Define a martingale M n , n = 0 , 1 , ..., N + R .
We let M
=
When n ≤ N , it has independent increment
[Equation]
[Equation]
For n > N , it is defined as
[Equation]
26) where i / ∈ u 1: r − 1 means i ̸
=
u j for j = 1 , ..., r − 1 .
Since p i are controlled by ϵ in (2), we can find a uniform bound
[Equation]
For 1 ≤ n ≤ N , we have
[Equation]
For 1 ≤ r ≤ R , we have
[Equation]
[Equation]
Hence, we can apply the Azuma-Hoeffding inequality:
[Equation]
Thus we prove the lemma.
The lemma indicates with high probability, for arbitrary δ >[-
-]
[Equation]
One observation of the proof is that, the concentration holds for arbitrary 0 ≤ R ≤ N .
For example, when R = N , W ( x, u ) ≡ W ≡ 0 , the concentration is still valid.
A.2 Lemma 3.
Proof.
Using Taylor’s series, we have
[Equation]
Using Lemma A.1 and the property W ( x, u )
=
W ( y, u ) , with high probability, the first order term becomes to:
[Equation]
Similarly, with high probability
[Equation]
the second order term becomes to:
[Equation]
Since R = lN 23 , denote i ∧ j = min { i, j } , i ∨ j = max { i, j } , with high probability, we have
[Equation]
Select 0 < δ < 112 , and the corresponding t = N δ , we have, for large enough N , the above equation does not hold with probability exponentially small, and the term o ( N 112 − δ ) can be ignored.
Hence we prove the weak convergence.
A.3 Proof for Lemma 3.
Proof.
The distribution p ( u r | u 1: r − 1 ) can be approximated using the following tricks.
First, using lemma A.1, with high probability, we have:
[Equation]
Derive the similar result for P ( u r = j | u 1: r − 1 ) .
Since we have R = lN 32 , for arbitrary 1 ≤ r ≤ R , we have W has the same order as N .
Using the property of locally balanced function, where p i w i (1) =
(1 − p i )
w i (0) , we have
[Equation]
Then, we use the identity:
[Equation]
hence [Equation] we have for the first step u 1 :
[Equation]
[Equation]
Recursively use this trick, for 1 ≤ r ≤ R = lN 23 we have:
[Equation]
Next [Equation] we calculate the conditional probability for x .
To simplify the notation
[Equation] we denote P ( x j = 1 | u, u r = j, x u 1: j − 1 ) to represented index j is selected at step u r [Equation] and not been selected in all previous steps u 1 , ..., u r − 1 .
Also, we denote
[Equation] [Equation]
In this way [Equation] the conditional probability for x can be written as
[Equation]
Since R = lN
[Equation]
according to lemma A.
[Equation]
with high probability we have:
[Equation]
Using this approximation
[Equation]
we have:
[Equation]
Thus we prove the lemma
[Equation]
A.4 A Property for the conditional distribution of u
The following result shows that marginal distribution for u 1 is a good approximation of the conditional distribution.
Proposition A.2.
For N large enough, the conditional distribution for u r = j given u 1: r − 1 can be approximated by the marginal distribution of u[-
-]
[Equation]
A.5 Proof for Lemma 3.
Proof.
We first calculate its expectation using the conditional distribution derived in lemma [Equation]
To simplify the notation, we denote δ w ( i ) =
w u i
[Equation]
0) − w u i
[Equation]
1) for i = 1 , ..., R and
[Equation]
for i, j = 1 , ..., R [Equation] and k, l = 0 , 1 .
Then we have
[Equation]
[Equation]
The remaining expectation is with respect to u .
From proposition A.2, we know that the conditional expectation of u i can be estimated via the marginal distribution of u 1 .
In fact, when R = lN
[Equation]
we have:
[Equation]
and similarly, we have:
[Equation]
Using these properties
[Equation]
we have
[Equation]
Hence
[Equation]
we prove that
[Equation]
The expectation of the B (12) is small.
To show it is save to ignore, we will prove the concentration property.
Consider a function of x and u :
[Equation]
where y is obtained by flipping indices u of x .
For changing x , we have:
[Equation]
where c j = 0 if j / ∈ u or c j = O ( R 2 N 2 ) if there exists r and u r = j .
For chaning u , we have
[Equation]
[Equation]
where d i =
O ( R 2 N 2 ) for i = 1 , ..., R .
By McDiarmid’s inequality, we have:
[Equation]
Hence, F ( x, u ) will concentrate to its expectation at scale O
( R 52 /N 74 ) .
Since R = lN 23 , with probability larger than 1 − O (exp( − N 12 )) , B = O ( N − 112 ) .
A.6 Lemma 3.
Proof.
To show that A weakly converges to a normal distribution, we use martingale central limit theorem.
Define a martingale M n , for n = 0 , 1 , ..., 2 R .
When n ≤ R , we let the process M n =and the filter F n as the σ -algebra determined by u 1 , ..., u n .
For R + 1 ≤ R + n ≤ 2 R , define
[Equation]
We first estimate the mean of the increment using the conditional probability derived in lemma 3.4.
If n ≤ R , the mean is obviously 0 , else
[Equation]
Then we estimate the variance of M n − M n − 1 .
We start with estimating the 2nd moment
[Equation]
Then
[Equation]
we are able to calculate the variance:
[Equation]
We calculate the value of its mean µ and variance σ 2 .
[Equation]
Define µ 1 = E
[ w u 1 (1) + w u 1 (0)] .
For the first part in µ , using proposition A.2, we have
[Equation]
Define σ 21 =
E
[( w u 1 (0) − w u 1 (1)) 2 ] , From lemma 3.4, we have
[Equation]
for the second term in µ , we have
[Equation]
[Equation]
for the variance σ 2 , we have:
[Equation]
[Equation]
Finally, we will decouple R with W .
Specifically:
[Equation]
Combine everything together, we have
[Equation]
[Equation]
Since R = lN 23 , we have the sum of the conditional variance is O (1) and the reminder is o (1) .
For a martingale, we need to check one more step.
We know | M n − M n − 1 | = 0 for n ≤ R .
For n + R > R , we have:
[Equation]
112) is uniformly bounded by a constant independent of N and R .
We denote
[Equation]
[Equation]
Then we can rewrite:
[Equation] [Equation]
[Equation]
By martingale central limit theorem, we have that:
[Equation]
Furthermore, we use the convergence rate in Haeusler (1988), we have:
[Equation]
Then we have the probability
[Equation]
where
[Equation]
where C δ is an absolute constant that only depends on δ .
We select δ = 12 , we have:
[Equation]
Since we consider R = lN [Equation] we prove the lemma.
A.7 Proof of Lemma 3.
Proof.
Assume Z ∼ N ( µ, σ 2 ) , then we have:
[Equation]
Specially, when µ = − 12 σ 2 , we have:
[Equation]
A.8 Proof for Theorem 3.
Proof.
In RWM-R, the proposal distribution is uniform, hence we only need to consider the probability ratio in the acceptance rate.
Given current state x and the picked indices u , the proposed state y is obtained by flipping indices u of x .
The acceptance rate is:
[Equation]
Define the martingale M n , n = 1 , ..., 2 R .
For r = 1 , ..., R , we have M r = 0 and the filtration F r is determined by the σ -algebra of u 1 , ..., u R .
For R + 1 ≤ R + n ≤ 2 R , we have:
[Equation]
Hence, for n ≤ R , the increment is 0 .
For n + R > R , denote the mean of the increment is :
[Equation]
the variance of the increment is:
[Equation]
When N is large [Equation] we have p u n − 1
= O ( N − β )
[Equation]
hence
[Equation]
is negative twice of the corresponding mean.
Since the indices u are uniformly picked, the conditional distribution of u r is:
[Equation]
Hence, we have the mean is
[Equation]
Similarly, we have the variance is:
[Equation]
When R =
O
( N 2 β ), the variance is at a constant order.
For a martingale, we also need to check the increments are uniformly bounded.
When n ≤ R , the increment is always 0 .
When R + 1 ≤
R + n ≤ 2 R , we have:
[Equation]
where C ( ϵ ) is a constant only determined by ϵ .
Hence, by martingale central limit theorem [Equation] we have the distribution of M 2 R converges to a normal distribution.
Denote
[Equation]
Then we can rewrite:
[Equation]
Denote
[Equation]
Rr = [Equation]
1 − 2 x u r ) log p ur 1 − p ur .
By martingale central limit theorem, we have
[Equation]
Furthermore, using the convergence rate in Haeusler (1988), we have:
[Equation]
[Equation]
Then we have the probability
[Equation]
[Equation] where [Equation]
[Equation]
where C δ is an absolute constant that only depends on δ .
We select δ = 12 , we have:
[Equation]
Hence, the expectation w.r.t.
(cid:80)
Rr =1 (1 − 2 x u r ) log p ur 1 − p ur converges to the expectation w.r.t.
[Equation]
Using lemma 3.7, we have the acceptance rate converges to:
[Equation]
In RWM-R, the distance between the current state x and the proposed state y is always d ( x, y )
=
R , hence we have:
[Equation] [Equation]
When R = ω ( N 2 β ) , we can give a concentration property.
Since the selection of u r is a martingale, we can apply Azuma-Hoeffding inequality:
[Equation]
Hence, When N is sufficiently large, with probability larger than 1 − O (exp( − 2 t 2 R 12 /N β )) , we have:
[Equation]
For C > 0 independent with N, R .
A.9 Proof for Corollary 3.
Proof.
When R =
O
( N 2 β ) , denote z =
Rλ 22 /N 2 β
[Equation]
[Equation]
which means the optimal value of z is independent of the target distribution.
As Φ is known, we can numerically solve z = 5 . 673 .
Hence the corresponding expected acceptance rate a = 0 .
234 , independent with the target distribution, and the efficiency is Θ( N 2 β ) .
When R = ω ( N 2 β ) , with probability 1 − O (exp( − 2 R/N β )) , the acceptance rate decrease exponentially fast, rendering o (1) jump distance.
For the remaining probability O (exp( − 2 R/N β )) , assuming all proposals are accepted, the efficiency is still bounded by:
[Equation]
Hence, optimal efficiency is achieved when R =
O ( N 2 β ) .
B Discussion B.1 Expected Jump Distance as the Metric to Tune the Scale
In this section, we want to convince the reader that the expected jump distance (EJD) is the correct metric to evaluate the efficiency for samplers in discrete space.
To simplify the derivation, we consider the distribution
[Equation]
We can notice that, compared to the target distributions considered in the main text (1), we assume the target distribution is identical in each dimension.
Let the LBP chain, with R = lN 23 , being denoted as { x (1) , x (2) , ... } .
Since all dimensions are identical, we only need to focus on the first dimension.
Denote w 1 = g
( π 1 ( x 1 =0)
π 1 ( x 1 =1) ) and w 0 = g
( π 1 ( x 1 =1) π 1 ( x 1 =0) ) .
From Lemma.
A.1, we can see that:
[Equation]
That’s to say, the probability ratio of x 1 = 0 and x 1 = 1 being flipped equals to their weight ratio.
Then we compare the acceptance rate in M-H test.
From the proof of the main theorem 3.1, we know the acceptance rate is determined by the term A defined in (11)
[Equation]
We can see that, when the first dimension is flipped in proposal, the difference of A is O ( N − 13 ) for x 1 = 0 and x 1 = 1 .
As a result, we have:
[Equation]
Now, we consider the one-dimensional process Z Nt = x 1 ( ⌊ tN 13 ⌋ ) .
The identical assumption implies that, the frequency for a site, for example the first dimension, being selected is lN − 13 .
We can easily see that when N is large enough, Z Nt converges to a jump process Z t , whose generator we denote.
[Equation]
From the derivation above, we know that
[Equation]
= [Equation] Since the sketch of proof above shows that the ratio is independent with the parameter l , we have the following important decomposition
[Equation]
where Q ( p ) is a matrix only depends on p and the locally balanced function g selected, and λ ( l ) is a scalar only depends on the parameter l .
Since Q ( p ) only depends on the target distribution, for any test functions f ( · ) , the inverse autocorrelation of the jump process is proportional to λ ( l ) .
When we tune l , the coefficient λ ( l )
= l · 2Φ( − λ 1 l 32 ) is the multiplication of the proposal frequency and the acceptance rate.
The value λ 1 is defined in (7).
As a jump process, we don’t have to analytically compute the value of λ ( l ) , as λ ( l ) is proportional to the expected jump distance (EJD).
So, we can tune l by maximizing the EJD, without having to know the formulation of the target distribution.
Remark 1: The jump process in discrete space is different from the diffusion process in continuous space.
For diffusion process, its velocity is characterized by the ESJD.
But for jump process, its
[Table]
N
[Table]
[Table]
velocity is characterized by the EJD.
That’s why Langevin algorithms tunes the step size via ESJD (Roberts & Rosenthal, 1998), but our LBP tunes the path length via EJD.
Remark 2: To simplify the derivation, we assume that the target distributions have identical marginals.
For target distributions with non-identical marginal distribution, different dimensions i = 1 , ..., N can have different velocity
λ i ( l ) .
But the sampling process will still converge to jump process, and we shall still use EJD to measure the efficiency.
B.2 The Choice of ϵ and the Optimal Acceptance Rate
The convergence of (6) does not depend on the value of ϵ in (2).
Based on the proof above, we can know (6) converges at the rate O ( N − 112 ) .
But the convergence of the optimal acceptance rate depends on the ϵ .
We can first consider two extreme cases for intuition.
When all p i are close to 1 2 , λ 1 in (7) will be close to 0 and the optimal acceptance rate will be close to 1 ; when all p i are close to 0 or 1 , λ 1 in (7) will be close to ∞ and the optimal acceptance rate will be close to 0 .
Hence, the main purpose to use fixed ϵ is to give upper and lower bounds for λ 1 in (7), such that the optimal acceptance rate can converge to 0 .
574 as in Corollary 3.2.
Next, we discuss how does the model dimension N in (1) needed in terms of ϵ to make sure the optimal convergence to 0 .
When all p i have the extreme value determined by ϵ , using locally balanced function g ( t ) = √ t , we can consider the following two situations:
• All | p i − 0 .
5 | = ϵ → 0 .
Then we have: λ 21 = (cid:80) Ni
=1 (cid:112) ϵ
[Equation]
When the expected acceptance is 0 . 574 , we need λ 1 l
=
O ( ϵl 32 ) equals to a constant, which means l has the same order as ϵ − 23 .
Since we have R = lN 23 ≤ N , we need ϵ − 23 =
O ( N 13 ) .
As a result, we requires ϵ − 1 =
O ( N 12 ) , which basically means we need N ≥ ϵ − 2 to have the optimal acceptance rate converges to 0 .
• All 0 .
5 − | p i − 0 .
5 | = ϵ → 0 .
We have:
[Equation]
When the expected acceptance is 0 . 574 , we need λ 1 l
=
O
( ϵ − 1 l 32 ) equals to a constant, which means l has the same order as ϵ 23 .
Since we have R = lN 23 ≥ 1 , we have l − {+
+} =
O ( N 23 ) .
As a result, we requires ϵ − 1 =
O ( N − 1 ) , which basically means we need N ≥ ϵ −to have the optimal acceptance rate converges to 0 .
So, both situations show that we need N increase with ϵ to make sure the optimal acceptance rate converges.
In the main text, we assume ϵ is a constant and it guarantees Corollary 3.2 holds.
We conduct extra numerical simulations to verify our results.
To simplify the experiments, we assume all dimensions have the same configurations: p i = p .
We report the size of N needed to guarantee that the optimal acceptance rate is 0 .
574 in Table 3 and Table 4.
B.3 Optimal Scale of RWM
When we assume the target distribution belongs to (2), the derivation of the optimal acceptance rate 0 . 234 is no longer valid.
But we can still show the optimal scale is R =
O (1) by proving the acceptance rate decreasing exponentially fast.
In particular, assume we use R = lN β in RWM.
Then the acceptance rate can be written as:
[Equation]
Consider the martingale M j , j = 0 , 1 , ..., R , such that M 0 = 0 and
[Equation]
By assumption in (2), we know that
[Equation]
And we have
[Equation]
By Azuma-Hoeffding lemma, we have
[Equation]
For β > 0 , R increases to infinity when N → ∞ .
In this case, log A ′ concentrates to a value
T ≤ R · 2 ϵ log 1 − 2 ϵ 1+2 ϵ and A ′ decreases exponentially fast.
Hence, the optimal scaling of RWM is
O (1) .
C Adaptive Algorithm
We give the algorithm box for ALBP:
Algorithm 2: do 7:
9: end
Obtain y by flipping indices u 1 , ..., u R of x ( t ) .
Compute acceptance rate A =
A ( x ( t ) , y, u ) .
12: if rand(0,1) <
A then 13:
14: else 15:
16: end 17: if t T warmup then 18:
←
19: end 20: end for
We give the algorithm box for ARWM:
acceptance x t y,
A then 10: t
11: else 12:
13: end if 14: then 15:
R t +1 ← R t
+ ( A − 0 . 234) .
16: end if 17: end for
D Experiment Details
We consider five samplers:
• RWM: random walk Metropolis • GWG( √ t ): LBP with replacement, same as algorithm 1 except for skipping line 5, weight function g ( t ) = √ t • LBP( √ t ): LBP given in algorithm 1, weight function g ( t ) = √ t • GWG( t t +1 ):
LBP with replacement, same as algorithm 1 except for skipping line 5, weight function g ( t ) =
t t + • LBP
t t +1 ): LBP given in algorithm 1, weight function g ( t ) =
t t +
For each sampler, we first start simulating with R = 1 to get an initial acceptance rate a max .
Then we adopt a max − 0 .
02 , a max − 0 .
04 , ..., a max − 0 .
02 k as the target acceptance rate, until a max − 0 .
02 k < 0 .
For each target acceptance rate a target , we use our adaptive sampler to get an estimated scaling R target .
Then we simulate 100 chains with scaling R target to get the expected acceptance rate, expected jump distance, effective sample size ( a, d, e ) .
To measure the performance of the adaptive sampler, we compare three versions for each sampler above.
In particular, for sampler X we have
• X-1, represents fixed scaling R = 1 version of the sampler.
• AX, represents the adaptive version of the sampler, whose target acceptance rate is selected as 0 .
234 for RWM, and 0 .
574 for else. • GX, represents the grid search version of the sampler, where we always use the best results among all simulations for different target acceptance rates we mentioned above
D.1 Simulation on Bernoulli Model
The density function for Bernoulli distribution is:
[Equation]
We consider three configurations
• C1: p i is independently, uniformly sampled from [0 . 25 , 0 .
• C2: p i is independently, uniformly sampled from [0 . 15 , 0 . 85] .
• C3: p i is independently, uniformly sampled from [0 . 05 , 0 . 95] .
For each configuration, we simulate on three sizes:
• N = 100 , sample Markov chain x 1:10000 , use x 1:5000 for burn in, use x 5001:10000 to estimate expected acceptance rate, expected jump distance, effective sample size. • N = 800 , sample Markov chain x
1:40000 , use x 1:20000 for burn in, use x 20001:40000 to estimate expected acceptance rate, expected jump distance, effective sample size. • N = 6400 , sample Markov chain x
1:100000 , use x 1:50000 for burn in, use x 50001:100000 to estimate expected acceptance rate, expected jump distance, effective sample size.
We give the scatter plot of ( a, d ) and ( a, r ) in figure 7.
And we examine the performance of our adaptive algorithm in table 5 and table 6.
D.2 Simulation on Ising Model
Ising model is a classic model in physics defined on a p × p square lattice graph ( V p , E p ) .
That’s to say, the nodes are indexed by { 1 , ..., p } 2 and an edge (( i, j ) , ( k, l )) exists if and only if one of the following condition holds:
[Figure]
x p e c t e d
J u m p
D
i s t a
[Figure]
c
[Figure]
i v
[Figure]
m
[Figure] [Figure]
[Figure]
E x p e c t e d
J u m p
D
i s t a n c e
[Figure]
v
[Figure]
m
[Figure]
l
[Figure]
i z
[Figure]
i v [Figure] i [Figure]
[Equation] = k,
[Equation]
The state space is X = {− 1 , 1 } V p and the target distribution is defined as:
[Equation]
Following Zanella (2020)
[Figure]
we consider three configurations
• C1: α v is independently and uniformly sampled from ( − 0 .
4) if ( v 1 − p 2 ) 2 +( v 2 − p 2 ) [-
 ≤p-]2 ≤ p 2 2 , else α v is independently and uniformly sampled from ( − 0 . ; λ = 0 .
• C2: α v is independently and uniformly sampled from ( − 0 .
3 , 0 . 6) if ( v 1 − p 2 ) 2 +( v 2 − p 2 ) 2 ≤ p 2 2 , else α v is independently and uniformly sampled from ( − 0 .
; λ = 0 .
• C3: α v is independently and uniformly sampled from ( − 0 . 4 , 0 .
8) if ( v 1 − p 2 ) 2 +( v 2 − p 2 ) 2 ≤ p 2 2 , else α v is independently and uniformly sampled from ( − 0 . 8 , 0 . 4) ; λ = 0 .
For each configuration, we simulate on three sizes:
[Table] [Table]
+1 )- 27.
ALBP [Table] [Table] [Table]
GLBP( [Table] [Table] [Table]
[Table] [Table] [Table] [Table]
[Table]
GWG
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
[Table]
LBP
[Table]
[Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
ALBP
[Table]
[Table]
[Table]
[Table] [Table] [Table] [Table]
GLBP
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
[Table] [Table] [Table] • p = 20 , sample Markov chain x 1:10000 , use x 1:5000 for burn in, use x 5001:10000 to estimate expected acceptance rate, expected jump distance, effective sample size.
• p = 50 , sample Markov chain x
1:40000 , use x 1:20000 for burn in, use x 20001:40000 to estimate expected acceptance rate, expected jump distance, effective sample size.
• p = 100 , sample Markov chain x 1:100000 , use x 1:50000 for burn in, use x 50001:100000 to estimate expected acceptance rate, expected jump distance, effective sample size.
We give the scatter plot of ( a, d ) and ( a, r ) in figure 8.
And we examine the performance of our adaptive algorithm in table 8 and table 9. [Table] [Table]
D.3 Simulation on FHMM
FHMM uses latent variables x ∈ X = { 0 , 1 } L × K to characterize time series data y ∈ R L .
Denote p ( x ) as the prior for hidden variables x , and p ( y | x ) for the likelihood: p ( x ) =
L (cid:89) l = p ( x l, 1 ) K (cid:89) k = p ( x l
[Equation]
Specifically, we have p ( x l, 1 ) = 0 .
1 , p ( x l,k = x l,k − 1 | x l,k − 1 )
= 0 .
8 independently ∀ l = 1 , ..., L and ∀ k
= 2 , ..., K .
And we have all entries in W and b are independent Gaussian random variables.
We sample latent variables x and sample y ∼ p ( y | x ) .
Then we simulate our samplers to sample the latent variables x from the posterior π ( x ) = p ( x | y ) .
We consider three configurations
[Figure]
x p e c t e d
J u m p
[Figure]
i s
[Figure]
a
[Figure] [Figure]
[Figure] [Figure]
c d
[Figure] [Figure]
i z
[Figure]
x
[Figure]
e c t e d
J u m p
D
i s t a n c e
[Figure]
c t i v e
S a
[Figure]
p l
[Figure]
S i z
[Figure]
• C1: σ 2 =• C2: σ 2 =• C3:
σ 2 = 0 .
For each configuration, we simulate on three sizes:
• L = 200 , K = 5 , sample Markov chain x 1:10000 , use x 1:5000 for burn in, use x 5001:10000 to estimate expected acceptance rate, expected jump distance, effective sample size.
• L = 1000 , K = 5 , sample Markov chain x
1:40000 , use x 1:20000 for burn in, use x 20001: to estimate expected acceptance rate, expected jump distance, effective sample size.
• L = 4000 , K = 5 , [-
-]sample Markov chain x
1:100000 , use x 1:50000 for burn in, use x 50001:100000 to estimate expected acceptance rate, expected jump distance, effective sample size.
We give the scatter plot of ( a, d ) and ( a, r ) in figure 9.
And we examine the performance of our adaptive algorithm in table 11 and table 12.
[Table] [Table]
LBP( t t +1 )- 36.
ALBP( t t +1 ) 37.
GLBP( t t +1 ) 37.
GWG( √ t )- 29.
AGWG( √ t ) 30. GGWG( √ t ) 30.
LBP( √ t )- 36.
ALBP( √ t ) 37.
GLBP( √ t ) 36.
RBM is a bipartite latent-variable model, defining a distribution over binary data x ∈ { 0 , 1 } N and latent data z ∈ { 0 , 1 } h . Given parameters W ∈ R h × N , b ∈ R N , c ∈ R h , the distribution of observable variables x is obtained by marginalizing the latent variables z :
[Equation] We train the RBM on MNIST dataset using contrastive divergence (Hinton, 2002) in three configurations • C1: h =• C2: h =• C3:
h =
[Figure]
E x p e c t e d
J u m p
D
i s t a
[Figure]
c t i
[Figure]
l
[Figure]
S i z
[Figure]
[Figure]
[Figure]
x
[Figure]
e c t e d
J
[Figure]
t a
[Figure]
c
[Figure]
ff e c t i v e
S a m p l e S i z
[Figure]
x p e c t e d
J u m p
D
i s t a n c e
[Figure]
ff e c t i v e
S a m p l e S
i z e
[Figure]
For each configuration, we sample Markov chain x 1:40000 , use x 1:20000 for burn in, use x 20001: to estimate expected acceptance rate, expected jump distance, effective sample size.
We give the scatter plot of ( a, d ) and ( a, r ) in figure 10.
And we examine the performance of our adaptive algorithm in table 14 and table 15. [Table] [Table] [Figure]
[Table]
[Figure]
J u m
[Table]
D i s t a n c e
[Figure]
Size
[Table]
Sampler
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
LBP
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
ALBP
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table] [Table]
[Table]
t t
[Table]
[Table] [Table]
[Table]
GLBP
[Table]
t t +1 ) 29.
[Table]
[Table] [Table]
√ t )-
[Table]
AGWG
[Table]
√ t ) 5.
[Table]
GGWG
[Table]
t ) 5.
LBP( √ t )- 1.
ALBP
[Table]
√ t ) 11.
GLBP
[Table]
√ t )
[Table] [Table]
[Table]
GWG( √ t )- 109.
AGWG( √ t ) 94.
GGWG( √ t ) 96.
LBP( √ t )- 116.
ALBP( √ t ) 120.
GLBP( √ t ) 118.