Gradient Estimation with Discrete Stein Operators
Abstract
Gradient estimation—approximating the gradient of an expectation with respect to the parameters of a distribution—is central to the solution of many machine learning problems.
However, when the distribution is discrete, most common gradient estimators suffer from excessive variance.
To improve the quality of gradient estimation, we introduce a variance reduction technique based on Stein operators for discrete distributions.
We then use this technique to build flexible control variates for the REINFORCE leave-one-out estimator.
Our control variates can be adapted online to minimize variance and do not require extra evaluations of the target function.
In benchmark generative modeling tasks such as training binary variational autoencoders, our gradient estimator achieves substantially lower variance than state-of-the-art estimators with the same number of function evaluations.
Introduction
Modern machine learning relies heavily on gradient methods to optimize the parameters of a learning system.
However, exact gradient computation is often difficult.
For example, in variational inference for training latent variable models [29, 42] and policy gradient algorithms in reinforcement learning [64] the exact gradient features an intractable sum or integral introduced by an expectation under an evolving probability distribution.
To make progress, one resorts to estimating the gradient by drawing samples from that distribution [39, 49].
The two main classes of gradient estimators used in machine learning are the pathwise or reparameterization gradient estimators [29, 46, 57] and the REINFORCE or score function estimators [18, 64].
The pathwise estimators have shown great success in training variational autoencoders [29] but are only applicable to continuous probability distributions.
The REINFORCE estimators are more generalpurpose and easily accommodate discrete distributions but often suffer from excessively high variance.
To improve the quality of REINFORCE estimators, we develop a new variance reduction technique for discrete expectations.
Our method is based upon Stein operators [see, e.g., 1, 54], computable functionals that generate mean-zero functions under a target distribution and provide a natural way of designing control variates (CVs) for stochastic estimation.
We first provide a general recipe for constructing practical Stein operators for discrete distributions (Table 1), generalizing the prior literature [6, 8, 9, 16, 25, 45, 66].
We then develop a gradient estimation framework—RODEO—that augments REINFORCE estimators with mean-zero CVs generated from Stein operators.
Finally, inspired by Double CV [59], we extend our method to develop CVs for REINFORCE leave-one-out estimators [30, 48] to further reduce the variance. [Table]
The benefits of using Stein operators to construct discrete CVs are twofold.
First, the operator structure permits us to learn CVs with a flexible functional form such as those parameterized by neural networks.
Second, since our operators are derived from Markov chains on the discrete support, they naturally incorporate information from neighboring states of the process for variance reduction.
We evaluate RODEO on 15 benchmark tasks, including training binary variational autoencoders (VAEs) with one or more stochastic layers.
In most cases and with the same number of function evaluations, RODEO delivers lower variance and better training objectives than the state-of-the-art gradient estimators DisARM [14, 68], ARMS [13], Double CV [59] [Table] and RELAX [20].
Background
We consider the problem of maximizing the objective function E q η [ f ( x )] with respect to the parameters η of a discrete distribution q η ( x ) .
Throughout the paper we assume f ( x ) is a differentiable function of real-valued inputs x ∈ R d but is only evaluated at a discrete subset X d due to the discreteness of q η . 2 Exact computation of the expectation is typically intractable due to the complex nature of f ( x ) and q η ( x ) .
The standard workaround is to rewrite the gradient as ∇ η E q η [ f ( x )]
=
E q η [ f ( x ) ∇ η log q η ( x )] and employ the Monte Carlo gradient estimator known as the score function or REINFORCE estimator [18, 64]:
[Equation] [Equation]
REINFORCE) Here, b is a constant called the “baseline” introduced to reduce the variance of the estimator by reducing the scaling effect of f ( x ( k ) ) .
Since E q η [ ∇ η log q η ( x )] = 0 , the REINFORCE estimator is unbiased for any choice of b , and the term b ∇ η log q η ( x ) is known as a control variate (CV) [41,
Ch. 8].
The optimal baseline can be estimated using additional function evaluations [7, 44, 63].
A simpler approach is to use moving averages of f from historical evaluations or to train function approximators to mimic those values [37].
When K ≥ 2 , a powerful variant of REINFORCE is obtained by replacing b with the leave-one-out average of function values:
[Equation]
(RLOO) This approach is often called the REINFORCE leave-one-out (RLOO) estimator [30, 47, 48] and was recently observed to have very strong performance in training discrete latent variable models [14, 47].
All the above methods construct a baseline that is independent of the point x ( k ) under consideration, but there are other ways to preserve the unbiasedness of the estimator.
We are free to use a sampledependent baseline b ( x ( k ) ) as long as the expectation c ≜ E q η [ b ( x ( k ) )
∇ η log q η ( x ( k ) )] is easily computed or has a low-variance unbiased estimate.
In this case, we can correct for any bias introduced by b ( x ( k ) ) by adding in this expectation: 1 K (cid:80) Kk =1 ( f ( x ( k ) )
− b ( x ( k ) )) ∇ η log q η ( x ( k ) )
+ c.
For example, b ( x ( k ) ) can be a lower bound or a Taylor expansion of f ( x ( k ) )
Taking this a step further, the Double CV estimator [59] proposed to treat f ( x ( k ) )
− b ( x ( k ) ) as the effective objective function and apply the leave-one-out idea:
[Equation]
The resulting estimator adds two CVs to RLOO: the global CV b k ( x ( k ) ) ∇ η log q η ( x ( k ) ) and the local CV b k ( x ( j ) ) .
Intuitively, b k ( x ( j ) ) is aimed at reducing the variance of the LOO average.
This is motivated by the fact that replacing [Equation]
f [Equation] ) ) with E q η [ f ] in RLOO leads to lower variance [59, Prop 1].
To obtain a tractable correction term c , Titsias and Shi [59] adopt a linear design of b k : b [Equation] for µ [Equation]
E [Equation] [Equation] ] and a coefficient α .
Although the Double CV framework points to a promising new direction for developing better
REINFORCE estimators, one only obtains significant reduction in variance when b k is strongly correlated with f .
This may fail to hold for the above linear b k and a highly nonlinear f , especially in applications like training deep generative models.
In the following two sections, we will introduce a method that allows us to use very flexible CVs while still maintaining a tractable correction term.
Our method enables online adaptation of CVs to minimize gradient variance (similar to RELAX [21]) but does not assume q η has a continuous reparameterization.
We then apply it to generalize the linear CVs in Double CV to very flexible ones such as neural networks.
Moreover, we provide an effective CV design based on surrogate functions that requires no additional evaluation of f compared to RLOO.
Control Variates from Discrete Stein Operators
At the heart of our new estimator is a technique for generating flexible discrete CVs, that is for generating a rich class of functions that have known expectations under a given discrete distribution q .
One way to achieve this is to identify any discrete-time Markov chain ( X ( t ) )
∞ t =0 with stationary distribution q .
Then, the transition matrix P , defined via P xy =
P ( X ( t +1)
=
y | X ( t ) = x ) , satisfies
P ⊤ q = q
and hence
[Equation]
for any integrable function h .
We overload our notation so that, for any suitable matrix A , ( Ah )( x ) ≜ (cid:80) y
A xy h ( y ) .
In other words, for any integrable h , the function ( P − I ) h is a valid CV as it has known mean under q .
Moreover, the linear operator P − I is an example of a Stein operator [1, 54] in the sense that it generates mean-zero functions under q .
In fact, both Stein et al.
[55] and Dellaportas and Kontoyiannis [12] developed CVs of the form ( P − I ) h based on reversible discrete-time Markov chains and linear input functions h ( x ) =
x i .
More generally, Barbour [3] and Henderson [23] observed that if we identify a continuous-time
Markov chain ( X ( t ) )
t ≥ 0 with q as its stationary distribution, then the generator A , defined via
[Equation] satisfies A ⊤ q = 0 and hence E q
[ Ah ] = 0 for all integrable h .
Therefore, A is also a Stein operator suitable for generating CVs.
Moreover, since any discrete-time chain with transition matrix P can be embedded into a continuous-time chain with transition rate matrix
A
= P −
I , this continuous-time construction is strictly more general [56, Ch. 4].
3.1 Discrete Stein operators
We next present several examples of broadly applicable discrete Stein operators (summarized in
Table 1) that can serve as practical defaults.
Gibbs Stein operator The transition kernel of the random-scan Gibbs sampler with stationary distribution q [see, e.g., 17] is
[Equation]
(3) where 1 ( · ) is the indicator function.
The associated Stein operator is
A = P − I with
[Equation]
In the binary variable setting, (4) recovers the operator Bresler and Nagaraj [8], Reinert and Ross [45] used to bound distances between the stationary distributions of Glauber dynamics Markov chains.
Zanella Stein operator Zanella [69] studied continuous-time Markov chains with generator
[Equation]
where N x denotes the transition neighborhood of x and κ is a continuous positive function satisfying κ ( t )
= tκ (1 /t ) .
Conveniently, the neighborhood structure can be arbitrarily sparse.
Moreover, the κ constraint ensures that the chain satisfies detailed balance (i.e., q ( x ) A xy =
q
( y ) A yx ) and hence that
A ⊤ q = 0 .
Hodgkinson et al.
[24] call the associated operator the Zanella Stein operator :
[Equation]
Important special cases include the minimum probability flow [52] (MPF) Stein operator ( κ ( t ) = √ t ) discussed in Barp et al.
[6] and the Barker [4] Stein operator ( κ ( t ) =
t t +1 ).
Birth-death Stein operator Let e 1 , . . .
, e d represent the standard basis vectors on R d .
For any finite-cardinality space, we may index the elements of X
= { s 0 , . . .
, s m − 1 } , let idx ( x i ) return the index of the element that x i represents, and define the increment and decrement operators inc i ( x [Equation]
=
[Equation] + e i ( s ( idx ( x i )+1) mod m − x i ) and dec i ( x ) = x
+ e i ( s ( idx ( x i ) − 1) mod m − x i ) .
Then the product birth-death process [28] on X d with birth rates b i,x = q ( inc i ( x ))
q ( x ) , death rates d i,x = 1 , and generator
[Equation]
has q as a stationary distribution, as A ⊤ q = 0 .
This construction yields the birth-death Stein operator
[Equation]
An analogous operator is available for countably infinite X [24], and Brown and Xia [9], Eichelsbacher and Reinert [16], Holmes [25] used related operators to characterize convergence to discrete target distributions.
Moreover, by substituting h ( x ) = g ( x ) − g ( inc ( x )) in (7), we recover the difference
Stein operator proposed by Yang et al.
[66] without reference to birth-death processes:
[Equation]
Choosing a Stein operator Despite being better-known, the difference and MPF operators often suffer from large variance and numerical instability due to their use of unbounded probability ratios q ( y ) /q
( x ) .
As a result, we recommend the numerically stable Gibbs operator when each component of x is binary or takes on a small number of values.
When x i takes on a large number of values ( m ), the Gibbs operator suffers from linear scaling with m .
In this case, we recommend the Barker operator where a sparse neighborhood structure can be specified, such as N x = { inc i ( x ) , dec i ( x ) for i ∈ [ d ] } .
The Barker operator is numerically stable as its κ ( q ( y ) q ( x ) )
=
q ( y ) q
( x )+ q ( y ) .
Gradient Estimation with Discrete Stein Operators
Recall that REINFORCE estimates the gradient E q η [ f ( x ) ∇ η log q η ( x )] .
Due to the existence of ∇ η log q η ( x ) as a weighting function, we apply a discrete Stein operator to a vector-valued function ˜ h : X → R d per dimension to construct the following estimator with a mean-zero CV:
[Equation]
Ideally, we want to choose the ˜ h
such that A ˜ h
i will be strongly correlated with f ( x ) ∇ η i log q η ( x ) to reduce its variance.
The optimal ˜ h
i is given by the solution of Poisson equation
[Equation]
We could learn a separate ˜ h i per dimension to approximate the solution of (10).
However, this poses a difficult optimization problem that requires simultaneously solving d Poisson equations.
Instead, we will incorporate knowledge about the structure of the solution to simplify the optimization.
To determine a candidate functional form for ˜ h , we consider an “optimal” Markov chain which generates i.i.d.
sample points from q η .
In this case, ( P − I )
˜ h
i becomes E q η [˜ h
i ] − ˜ h
i , and the optimal solution is ˜ h
i = f ∇ η i log q η .
Inspired by this, we consider ˜ h of the form
[Equation]
where we now only need to learn a scalar-valued function h .
Notably, when h exactly equals f and A = P − I for any discrete time Markov chain kernel P , our CV adjustment amounts to
Rao-Blackwellization [41, Sec. 8.7], as we end up replacing f ( x ) ∇ η i log q η ( x ) with its conditional expectation P ( f ∇ η i log q η )( x ) =
E X t +1 | X t = x
[ f ( X t +1 ) ∇ η i log q η ( X t +1 )] .
This yields a guaranteed variance reduction.
Surrogate function design Based on the above reasoning, we can view h as a surrogate for f .
We avoid directly setting h
= f because our Stein operators evaluate h at all neighbors of the sample points, and f can be very expensive to evaluate [see, e.g., 50].
To avoid this problem, we first observe that ˜ h (11) can be made sample-specific, i.e., we can use a different ˜ h k for each sample point x
[Equation]
We then consider the following choices of h k that are informed about f while being cheap to evaluate:
[Equation]
Here y will take on the values of x ( k ) and its neighbors in the Markov chain.
We omit x
( k ) in the sum (13) to ensure that the function h k is independent of x ( k ) and hence that E q η [ 1 K (cid:80)
Kk =
( A ˜ h k )( x ( k ) )]
= 0 .
Moreover, this surrogate function design introduces no additional evaluations of f beyond those required for the usual RLOO estimator.
Also, as observed by Titsias and Shi [59], for many applications, including VAE training, where f has parameters θ learned through gradient-based optimization, {∇ f ( x ( k ) ) }
Kk =1 can be obtained “for free” from the same backpropagation used to compute ∇ θ f θ ( x ( k ) )
(see Algorithm 1).
RODEO We can further improve the estimator by leveraging discrete Stein operators and the above surrogate function design to construct both the global and local CVs in the Double CV framework [59] (see Section 2).
We call our final estimator RODEO for R L O O with D iscrete St E in O perators:
[Equation]
where ˜ h ⋆k
( y ) =
h
⋆k ( y ) ∇ η log q η ( y ) and { h k , h ⋆k }
Kk =1 are scalar-valued functions.
Here, ( Ah j )( x ( j ) ) is a scalar-valued CV introduced to reduce the variance of the leave-one-out baseline 1 K − 1 (cid:80) j ̸ = k f ( x ( j ) ) , while ( A ˜ h ⋆k )
( x ( k ) ) acts as a global CV to further reduce the variance of the gradient estimate.
We adopt the aforementioned design of h (13) and ˜ h (11) for the two CVs.
In Appendix B, we show that the RODEO estimator is unbiased for ∇ η E q η [ f ( x )] when each h k is defined as in (13) and
[Equation]
Optimization with RODEO
In practice, we let the functions H and H ⋆ share a neural network architecture with two output units.
Since the estimator is unbiased, we can optimize the parameters γ of the network in an online fashion to minimize the variance of the estimator (similar to [20]).
Specifically, if we denote the RODEO gradient estimate by g γ ( x (1: K ) ) , then ∇ γ Tr(Var( g γ ( x (1: K ) )))
=
E [ ∇ γ ∥ g γ ( x (1: K ) ) ∥ 22 ] .
In Algorithm 1, we use an unbiased estimate of this hyperparameter gradient, ∇ γ ∥ g γ ( x (1: K ) )
∥ 22 , to update γ after each optimization step of η .
[Table]
Related Work
As we have seen in Section
[Table]
there is a long history of designing CVs for REINFORCE estimators using “baselines” [7, 37, 44, 63].
Recent progress is mostly driven by leave-one-out [30, 38, 47, 48] and sample-dependent baselines [20, 22, 42, 59, 61].
REBAR [61] constructs the baseline through continuous relaxation of the discrete distribution [26, 35] and applies reparameterization gradients to the correction term.
As a result REBAR uses three evaluations of f for each x ( k ) instead of usual single evaluation (see Appendix A for a detailed explanation).
The RELAX [20] estimator generalizes
REBAR by noticing that their continuous relaxation can be replaced with a free-form CV.
However, in order to get strong performance, RELAX still includes the continuous relaxation in their CV and only adds a small deviation to it.
Therefore, RELAX also uses three evaluations of f for each x ( k ) and is usually considered more expensive than other estimators.
An attractive property of the RODEO estimator is that it incorporates information from neighboring states thanks to the Stein operator while avoiding additional costly f evaluations thanks to the learned surrogate functions h k .
Estimators based on analytic local expectation [58, 60] and GO gradients [11] also use neighborhood information but only at the cost of many additional target function evaluations.
In fact, the local expectation gradient [58] can be viewed as a Stein CV adjustment RODEO with a Gibbs Stein operator and the target function f used directly instead of the surrogate h .
The downside of these approaches is that f must be evaluated Kd times per training step instead of K times as in RODEO, a prohibitive cost when f is expensive and d ≥ 200 as in Section 6.
Prior work has also studied variance reduction methods based on sampling without replacement [31] and antithetic sampling [13–15, 67] for gradient estimation.
DisARM [14, 68] was shown to outperform RLOO estimators when K = 2 and ARMS [13] generalizes DisARM to K > 2 .
Stein operators for continuous distributions have also been leveraged for effective variance reduction in a variety of learning tasks [2, 5, 36, 40, 51, 53] including gradient estimation [27, 34].
In particular, the gradient estimator of Liu et al.
[34] is based on the Langevin Stein operator [19] for continuous distributions and coincides with the continuous counterpart of RELAX [20].
In contrast, our approach considers discrete Stein operators for Monte Carlo estimation in discrete distributions with exponentially large state spaces.
Recently, Parmas and Sugiyama [43, App. E.4] used a probability flow perspective to characterize all unbiased gradient estimators satisfying a mild technical condition; our estimators fall into this broad class but were not specifically investigated.
Experiments
Python code replicating all experiments can be found at https://github.com/thjashin/rodeo .
6.1 Training Bernoulli VAEs
Following Dong et al.
[14] and Titsias and Shi [59], we conduct experiments on training variational auto-encoders [29, 46] (VAEs) with Bernoulli latent variables.
VAEs are models with a joint density p θ ( y, x ) , where x is the latent variable and θ denotes model parameters.
They are typically learned through maximizing the evidence lower bound (ELBO)
E q η ( x | y )
[ f ( x )] for an auxiliary inference network q η ( x | y ) and f ( x ) ≜ log p θ ( y, x ) − log q η ( x | y ) .
In our experiments, p ( x ) and q η ( x | y ) are high-dimensional distributions where each dimension of the random variable is an independent
Bernoulli.
Since exact gradient computations are intractable, we will use gradient estimators to learn the parameters η of the inference network.
The VAE architecture and training experimental setup follows Titsias and Shi [59], and details are given in Appendix D. The dimensionality of the latent variable x is d = 200 .
The functions H (13) and H ′ (14) share a neural network architecture with two output units and a single hidden layer with 100 units.
For the numerical stability and variance reasons discussed in Section 3, we use the Gibbs Stein operator (4) as a default choice in our experiments, but we revisit this choice in Section 6.3.
We consider the MNIST [33], Fashion-MNIST [65] and Omniglot [32] datasets using their standard train, validation, and test splits.
We use both binary and continuous VAE outputs ( y ) as in Titsias and
Shi [59].
In the binary output setting, data are dynamically binarized, and the Bernoulli likelihood is used; in the continuous output setting, data are centered between [ − 1 , 1] , and the Gaussian likelihood with learnable diagonal covariance parameters is used.
[Figure]
latent VAEs with 2 or 3 f evaluations per step on binarized MNIST.
K =
In the first set of experiments we focus on the most common setting of K = 2 sample points and compare our variance reduction method to its counterparts including DisARM [14] and
Double CV [59].
Results for RLOO are omitted since it is consistently outperformed by Double
CV [see 59].
Table 2 shows, on all three datasets, RODEO achieves the best training ELBOs.
In
Figure 1 (left), we plot the gradient variance and average training ELBOs against training steps for all estimators on dynamically binarized MNIST.
RODEO outperforms DisARM and Double CV by a large margin in gradient variance.
Next, we consider VAEs with Gaussian likelihoods trained on non-binarized datasets.
In this case the gradient estimates suffer from even higher variance due to the large range of values f ( x ) can take.
The results are plotted in Figure 2.
We see that RODEO has substantially lower variance than
DisARM and Double CV, leading to significant improvements in training ELBOs.
In Appendix
Figure 7, we find that RODEO also consistently yields the best test set performance in all six settings.
K =
In the second set of experiments we compare RELAX [20], which uses three evaluations of f per training step, with RODEO, Double CV, and ARMS [13] for K = 3 .
Figure 1 (right) and
Table 2 demonstrate that RODEO outperforms the three previous methods and generally leads to the lowest variance.
Although RELAX was often observed to have very strong performance in prior work [14, 59], our results in Figure 1 suggest that, for dynamically binarized datasets, much larger gains can be achieved by using the same number of function evaluations in other estimators.
For the experiments mentioned above, we report final training ELBOs in Table 2, test log-likelihood bounds in Appendix Table 4, and binarized MNIST average running time in Appendix Table 5.
For
K = 3 , RODEO has the best final performance in 5 out of 6 tasks and runtime nearly identical to
RELAX.
For K = 2 , RODEO has the best final performance for all tasks and is 1.5 times slower than
Double CV and DisARM.
We attribute the runtime gap to the Gibbs operator (4) which performs 2 d evaluations of the auxiliary functions H and H ′ in (13) and (14).
While this results in some extra cost, the network parameterizing H and H ′ takes only 2-dimensional inputs, produces scalar outputs, and is typically small relative to the VAE model.
As a result, the evaluation of H and H ′ is significantly cheaper than that of f , and its relative contribution to runtime shrinks as the cost of f grows.
6.2 Training hierarchical Bernoulli VAEs
To investigate the performance of RODEO when scaling to hierarchical discrete latent variable models, we follow DisARM [14, 67] to train VAEs with 2/3/4 stochastic layers, each of which consists of
[Figure]
200 Bernoulli variables.
We set K = 2 and compare our estimator with DisARM and Double CV on dynamically binarized MNIST, Fashion-MNIST
[Figure]
and Omniglot.
For each stochastic layer, we use a different CV network which has the same architecture as those in our VAE experiments from the previous section.
More details are presented in Appendix D.
[Figure]
We plot
Figure 3.
The results for other datasets and for 2 and 3 stochastic layers can be found in Appendix E. RODEO generally achieves the best training ELBOs.
One difference we noticed when comparing the variance results with those obtained from single-stochastic-layer VAEs is that these estimators have very different behaviors towards the beginning and the end of training.
For example, in Figure 3, Double CV starts with lower variance than DisARM, but the gap diminishes after around 100K steps, and DisARM start to perform better as the training proceeds.
In contrast, RODEO has the lowest variance in both phases for all datasets save Omniglot, where DisARM overtakes it in the long run.
6.3 Ablation study
Finally, we conduct an ablation study to gain more insight into the impact of each component of
RODEO.
In each experiment we train binary latent VAEs with K = 2 .
Impact of Stein operator Figure 4a explores the impact of RODEO Stein operator choice on non-binarized MNIST.
As expected, the less stable difference (8) and MPF (6) operators lead to significantly higher gradient variances and worse training ELBOs.
In fact, the same operators led to divergent training on binarized MNIST.
The Barker operator (6) with neighborhoods defined by having one differing coordinate yields results very similar to Gibbs (4) as the operators themselves are very similar for binary variables (notice that
[Equation]
Impact of LOO baseline and global and local CVs Figure 4b explores binarized MNIST performance when RODEO is modified to retain a) only the LOO baseline (this is equivalent to standard RLOO), b) only the global CV, c) the LOO baseline + the global CV, or d) the LOO baseline + the
[Figure]
local CV. We observe that the global and local Stein CVs both contribute to variance reduction and have complementary effects.
Moreover, remarkably, the global Stein CV alone outperforms RLOO.
Impact of surrogate functions To tease apart the benefits of our new surrogate functions (13) and the remaining RODEO components, we replace the surrogate function c ϕ ( z ) in RELAX [21] with our surrogates, which only requires a single evaluation of f per x ( k ) (see Appendix A for more details).
Figure 4c compares the performance of RODEO and this modified RELAX on binarized MNIST.
Since the surrogate functions are matched, the consistent improvements over modified RELAX can be attributed to the Stein and double CV components of RODEO.
Conclusions, Limitations, and Future Work
This work tackles the gradient estimation problem for discrete distributions.
We proposed a variance reduction technique which exploits Stein operators to generate control variates for REINFORCE leave-one-out estimators.
Our RODEO estimator does not rely on continuous reparameterization of the distribution, requires no additional function evaluations per sample point, and can be adapted online to learn very flexible control variates parameterized by neural networks.
One potential drawback of our surrogate function constructions (13) and (14) is the need to evaluate an auxiliary function ( H or H ′ ) at K − 1 locations.
This cost can be comfortably borne when H and H ′ are much cheaper to evaluate than f , and, in our experiments with the most common sample sizes, the runtime of RODEO was no worse than that of RELAX.
To obtain a more favorable cost for large K , one could employ alternative surrogates that require only a constant number of auxiliary function evaluations, e.g.,
[Equation]
The runtime of RODEO could also be improved by varying the Stein operator employed.
For example, the Gibbs operator ( Ah )( x ) (4) used in our experiments evaluated its surrogate function h at d neighboring locations of x .
This evaluation complexity could be reduced by subsampling neighbors, resulting in a cheaper but still valid Stein operator, or by employing the numerically stable
Barker operator (6) with fewer neighbors.
Either strategy would introduce a speed-variance trade-off worthy of study in follow-up work.
Finally, we have restricted our focus in this work to differentiable target functions f .
In future work, this limitation could be overcome by designing effective surrogate functions that make no use of derivative information.
Acknowledgments and Disclosure of Funding
We thank Heishiro Kanagawa for suggesting appropriate names for the Barker Stein operator.
A Sample-dependent Baselines in REBAR and RELAX
We start with the REINFORCE estimator with the sample-dependent baseline b k :
[Equation]
REBAR [61] introduces indirect independence on x ( k ) in b k through the continuous reparameterization x
= H ( z ) , z ( k ) ∼ q η ( z | x = x ( k ) ) , where z is a continuous variable and H is an argmax-like thresholding function.
Specifically, b k = f
( σ λ ( z ( k ) )) , where σ λ is a continuous relaxation of H controlled by the parameter λ .
The correction term decomposes into two parts:
[Equation]
Both parts can be estimated with the reparameterization trick [29, 46, 57] which often has low variance.
The RELAX [20] estimator generalizes REBAR by noticing that f ( σ λ ( z )) can be replaced with a free-form differentiable function c ϕ ( z ) .
However, RELAX still relies on parameterizing c ϕ ( z ) as f ( σ λ ( z ))
+ r θ ( z ) to achieve strong performance, as noted in Dong et al.
To form modified RELAX in Section 6.3, we replace b k = c ϕ
( z ( k ) ) with b k = h k ( σ λ ( z ( k ) ))
for h k defined in (13).
B Proof of Unbiasedness of RODEO
Recall our estimator defined in RODEO is  K K (cid:88) k = [( f
[Equation]
To show the unbiasedness [Equation] we compute its expectation under q η as
[Equation]
Since the first term is the desired gradient ∇ η E q η [ f ( x )] and the third term is zero [Equation] it suffices to show that the second term also vanishes.
Using the law of total expectations [Equation] we find for j ̸ = k ,
[Equation]
which completes the proof [Equation]
C Additional Experiments C.1 Wall clock time comparison with RLOO
Besides necessary target function evaluations, the RODEO estimator comes with the additional cost of evaluating the neural network-based H, H ∗ .
Therefore, RODEO is most suited to the problems
[Table]
where evaluating f is very expensive and its cost dominates those of the H
[Table]
H ∗ .
This is often the case in practice.
For example, state-of-the-art variational autoencoders [e
[Table]
g., 62] are often built on expensive neural architectures such as deep residual networks (ResNet).
Here, to demonstrate the practical advantage of our method as the complexity of f grows, we replace the two-layer MLP VAEs used in previous experiments with a ResNet VAE (achitecture shown in Table [Table] while the neural network used by H, H ∗ remains a single-layer MLP with 100 hidden units.
We then compare the wall clock performance of RODEO with RLOO.
The latent variables in this experiment remain binary and have 200 dimensions.
The results are shown in Figure 5.
RODEO achieves better training ELBOs than RLOO in the same amount of time.
In fact, for this VAE architecture, the per-iteration time of RODEO is 25.2ms , which is very close to the 23.1ms of RLOO.
This indicates that the cost of f is significant higher than
H, H ∗ .
[Figure]
C.2 Impact of neural network architectures of surrogate functions
We conduct one more ablation study to investigate the impact of neural network architectures used by H, H ∗ .
Specifically, we replace the single-hidden-layer control variate network used in previous experiments with a two-hidden-layer MLP (each layer has 100 units) and compare their performance on binarized MNIST with K = 2 .
We keep other settings the same as in Section 6.1.
The results are plotted in Figure 6.
We do not observe significant difference between the two versions of RODEO.
D Experimental Details
Our implementation is based on the open-source code of DisARM [14] (Apache license) and Double
CV [59] (MIT license).
Our figures display 1M training steps and our tables report performance after 1M training steps to replicate the experimental settings of DisARM [14].
[Figure]
D.1 Details of VAE experiments
VAEs are models with a joint density p ( y, x )
= p ( y | x ) p ( x ) , where x denotes the latent variable. x is assigned a uniform factorized Bernoulli prior.
The likelihood p θ ( y | x ) is parameterized by the output of a neural network with x as input and parameters θ .
The VAE has two hidden layers with 200 units activated by LeakyReLU with the coefficient 0 . 3 .
To optimize the VAE we use Adam with base learning rate 10 − 4 for non-binarized data and 10 − 3 for dynamically binarized data, except for binarized Fashion-MNIST we decreased the learning rate to 3 × 10 − 4 because otherwise the training is very unstable for all estimators.
We use Adam with the same learning rate 10 − 3 for adapting our control variate network in all experiments.
The batch size is 100 .
The settings of other estimators are kept the same with Titsias and Shi [59].
In the minimum probability flow (MPF) and Barker Stein operator (6), we choose the neighborhood N x to be the states that differ in only one coordinate from x .
Let y ∈
N
x be an element in this neighborhood
such that y i ̸
= x i and y − i = x − i .
For the MPF Stein estimator and the difference Stein estimator (8), the density ratio q ( y ) q ( x ) can be simplified to q ( y i | x − i )
q
( x i | x − i ) .
We further replace it with
[Equation]
to alleviate numerical instability.
The Barker Stein estimator does not suffer from the numerical issue since the coefficient is bounded in the Bernoulli case: q ( y ) q
( x )+ q ( y )
=
q ( y i | x − i ) q ( x i | x − i )
+ q
( y i | x − i )
=
q ( y i | x − i ) .
In our experiments, we find that the difference Stein estimator is highly unstable and may diverge as the iteration proceeds.
D.2 Details of hierarchical VAE experiments
We optimize the hierarchical VAE using Adam with base learning rate 10 − 4 .
Our control variate network is optimized using Adam with learning rate 10 − 3 .
Settings of training multilayer VAEs are kept the same with Dong et al.
[14], except that we do not optimize the prior distribution of the VAE hidden layer and use a larger batch size 100 .
E Additional Results
In this section, we measure test set performance using 100 test points and the marginal log-likelihood bound of Burda et al.
[10], which provides a tighter estimate of marginal log likelihood than the
ELBO.
Throughout, we call this the “test log-likelihood bound.”
[Table]
[Figure]
li hood
[Figure]
ound
[Figure]
N on - b i n a r
i ze d
[Figure]
t
Log
[Figure]
i k
[Figure]
hood
B ound
[Figure]
[Table]
[Table]
[Figure]
[Figure] [Figure]
[Table]
[Figure]
F a s h i onM N I
S T
[Figure]
t
[Figure] [Figure]
F a s h i onM N I
S T
[Figure] [Figure]
N
[Figure]
S
[Figure]
F a s h i onM N I
S T
[Figure]
m
[Figure]
t
[Figure]