Distributional Reinforcement Learning for Energy-Based Sequential Models

12/18/2019 ∙ by Tetiana Parshakova, et al. ∙ NAVER LABS Corp. Stanford University 0

Global Autoregressive Models (GAMs) are a recent proposal [Parshakova et al., CoNLL 2019] for exploiting global properties of sequences for data-efficient learning of seq2seq models. In the first phase of training, an Energy-Based model (EBM) over sequences is derived. This EBM has high representational power, but is unnormalized and cannot be directly exploited for sampling. To address this issue [Parshakova et al., CoNLL 2019] proposes a distillation technique, which can only be applied under limited conditions. By relating this problem to Policy Gradient techniques in RL, but in a distributional rather than optimization perspective, we propose a general approach applicable to any sequential EBM. Its effectiveness is illustrated on GAM-based experiments.



There are no comments yet.


page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

The mainstream autoregressive sequence models [6, 22, 5, 24]) form a subclass of sequential energy-based models (sequential EBMs) [10]. While the former are locally normalized and easy to train and sample from, the latter allow global constraints, greater expressivity, and potentially better sample efficiency, but lead to unnormalized distributions and are more difficult to use for inference and evaluation. We exploit a recently introducaked class of energy-based models, Global Autoregressive Models (GAMs) [15], which combine a locally normalized component (that is, a first, standard, autoregressive model, denoted ) with a global component and use these to explore some core research questions about sequential EBMs, focussing our experiments on synthetic data for which we can directly control experimental conditions. We dissociate the (relatively easy) task of learning from the available data an energy-based representation (Training-1), from the more challenging task of exploiting that representation to produce samples or evaluations (Training-2).

In this paper, we provide a short self-contained introduction to GAMs and to their two-stage training procedure. However our main focus is about Training-2. For that task [15] proposed a Distillation technique to project the Energy-Based representation (denoted by ) obtained at the end of Training-1 into a final autoregressive model (denoted ), with better test perplexity than the initial , but this technique was limited to cases where it was possible to sample from at training time. One key observation of the current submission is that Training-2, considered as the general problem of deriving an autoregressive model from an energy-based model (not necessarily obtained through Training-1) has strong similarities with the training of policies in Reinforcement Learning (RL), but in a distributional rather than in an optimization perspective as in standard RL. We then propose a distributional variant of the Policy Gradient technique (Distributional Policy Gradient: DPG) which has wider applicability than distillation. We conduct GAM-based experiments to compare this technique with distillation, in synthetic data conditions where distillation is feasible, and show that DPG works as well as distillation. In both cases, in small data conditions, the policies (aka autoregressive) models obtained at the end of the process are very similar and show strong perplexity reduction over the standard autoregressive models.

Section 2 provides an overview of GAMs. Section 3 explains the training procedure, with focus on EBMs and relations to RL. Section 4 presents experiments and results. For space reasons we use the Supplementary Material (Sup. Mat.) to provide some details and to discuss related work.

2 Model

2.1 Background

Autoregressive models (AMs)

These are currently the standard for neural seq2seq processing, with such representatives as RNN/LSTMs [6, 22], ConvS2S [5], Transformer [24]). Formally, they are defined though a distribution , where is a target sequence to be generated, and is a context, with , and where each

is a normalized conditional probability over the next symbol of the sequence, computed by a neural network (NN) with parameters

. The local normalization of the incremental probabilities implies the overall normalization of the distribution . In RL terminology, AMs can also be seen as policies where actions are symbols and states are sequence prefixes.

Energy-Based Models (EBMs)

EBMs are a generic class of models, characterized by an energy function computed by a neural network parametrized by [10]

. Equivalently, they can be seen as directly defining a potential (an unnormalized probability distribution)

, and indirectly the normalized distribution

, with . Here we will identify an EBM with its potential (the form) and be concerned exclusively with sequential EBMs, that is, the case where is a sequence.

2.2 GAMs

We employ a specific class of sequential EBMs, Global Autoregressive Models (GAMs), which we summarize here (for details please see [15]). GAMs exploit both local autoregressive properties as well as global properties of the sequence . A GAM is an unnormalized potential over

, parametrized by a vector

, which is the product of two factors:


Here the factor is an autoregressive model for generating in the context , parametrized by . The factor on the other hand, is a log-linear potential [8], where is a vector of predefined real features of the pair , which is combined by a scalar product with a real vector of the same dimension, computed by a network parametrized by . The normalized distribution associated with the GAM is , where .

The motivations for GAMs are as follows. The first factor guarantees that the GAM will have at least the same effectiveness as standard autoregressive models to model the local, incremental, aspects of sequential data.The second factor can be seen as providing a “modulation” on the first one. While we could have chosen any energy-based potential for that factor, the log-linear form has several advantages. First, the features

provide prior knowledge to the model by drawing its attention to potentially useful global sequence properties that may be difficult for the AM component to discover on its own. Second, log-linear models enjoy the following important property: at maximum likelihood, the features expectations according to the model and to the data are equal (“moment matching” property).

In our experiments, we focus on a simple unconditional (language modelling) version of GAMs, of the form:


where the autoregressive factor is first learnt on the training dataset of sequences and then kept fixed, and where the parameter vector is then trained on top of , also on . We denote by the normalized distribution associated with .

3 Training


Figure 1: Two-stage training. At the end of the process, we compare the perplexities of and on test data: vs. .

We assume that we are given a training data set (resp. a validation set , a test set ) of sequences , and a finite collection of real-valued feature functions . The GAM training procedure then is performed in two stages (see Fig. 1).

3.1 Training-1: from data to energy-based representation

This phase consists in training by max-likelihood (ML) on . We start by training an AM (our initial policy) on , in the standard way. We then fit the log-linear weight vector to the data. In order to do that, we denote by the log-likelihood of the data, and perform SGD over by observing that (2) implies:


where (resp.

) denotes the expectation (aka moment) of the feature vector relative to the data (resp. to the model). The first moment can be directly computed from the data, but the second moment requires more effort. The most direct way for estimating

would be to produce a random sample from and to compute the mean of over this sample. In general, when starting from an unnormalized as here, obtaining samples from can be difficult. One approach consists in applying a Monte-Carlo sampling technique, such as Rejection Sampling (rs) [18], and this is one of two techniques that can be applied in the experimental conditions both of [15] and of this paper. However rejection sampling is feasible only in situations where reasonable upper-bounds of the ratio (for a proposal distribution) can be derived.111More sophisticated MCMC sampling techniques with broader applicability exist [18], but they are typically difficult to control and slow to converge. This is why [15] proposes another technique of wider applicability, Self-Normalized Importance Sampling (snis) [14, y._bengio_adaptive_2008].This technique directly estimates the expectation without requiring samples from .

3.2 Training-2: from energy-based representation to distributional policy

The output of the previous stage is an unnormalized EBM, which allows us to compute the potential of any given , but not directly to compute the partition function nor the normalized distribution or to sample from it.222In our discussion of Training-2, to stress the generality of the techniques employed, we will use to denote any EBM potential over sequences, and , with , to denote the associated normalized distribution. Whether is obtained or not through Training-1 in a GAM-style approach is irrelevant to this discussion. In RL terms, the score can be seen as a reward. The standard RL-as-optimization view would lead us to search for a way to maximize the expectation of this reward, in other words for a policy with , which would tend to concentrate all its mass on a few sequences.

By contrast, our RL-as-sampling (distributional) view consists in trying to find a policy that approximates the distribution as closely as possible, in terms of cross-entropy . We are thus trying to solve , with . We have:


We can apply (4) for SGD optimization, using different approaches.

The simplest approach, Distillation, can be employed in situations where we are able to draw, in reasonable training time, a large number of samples from . We can then exploit (4) directly to update , which is in fact equivalent to performing a standard supervised log-likelihood SGD training on the set . This is the approach to Training-2 taken in [15], using rejection sampling at training time for obtaining the samples, and then training on these samples to obtain a final AM

which can be used for efficient sampling at test time and for evaluation. The advantage of this approach is that supervised training of this sort is very succesful for standard autoregressive models, with good stability and convergence properties, and an efficient use of the training data through epoch iteration.

333Epoch iteration might actually be seen as a form of “experience replay”, to borrow RL terminology [11]. However, the big disadvantage is its limited applicability, due to restrictive conditions for rejection sampling, as explained earlier.

A central contribution of the present paper is to propose another class of approaches, which does not involve sampling from , and which relates to standard techniques in RL. We can rewrite the last formula of (4) as:


This formula is very close to the vanilla formulation (aka REINFORCE [25]), we have a reward and we try to maximize the expectation . It can be shown [23] that . Thus, in the RL case, an SGD step consists in sampling from and computing , while the SGD step in (5) only differs by replacing by .444The constant factor can be ignored here: during SGD, it has the effect of rescaling the learning rate. We will refer to the approach (5) through the name Distributional Policy Gradient (on-policy version) or DPG (“on-policy” because the sampling is done according to the same policy that is being learnt).

An off-policy variant DPG of (5) is also possible. Here we assume that we are given some fixed proposal distribution and we write:


Here the sampling policy is different from the policy being learnt, and the formula (6) represents a form of Importance Sampling, with the proposal, typically chosen to be an approximation to .

We did some initial experiments with DPG, but found that the method had difficulty converging, probably due in part to the instability induced by the constant change of sampling distribution (namely ). A similar phenomenon is well documented in the case of the vanilla Policy Gradient in standard RL, and techniques such as TRPO [20] or PPO [21] have been developed to control the rate of change of the sampling distribution. In order to avoid such instability, we decided to focus on DPG, based on Algorithm 1 below.

1:, initial policy
3:for each iteration do
4:     for each episode do
5:          sample from
7:     if  is superior to  then
Algorithm 1  DPG

In this algorithm, we suppose that we have as input a potential function , and an initial proposal distribution ; in the case of GAMs, we take and a good is provided by . We then iterate the collection of episodes sampled with the same (line 4), and perform SGD updates (line 5) according to (6) ( is the learning rate). We do update the proposal at certain times (line 7), but only based on the condition that the current is superior to in terms of perplexity measured on the validation set , thus ensuring a certain stability of the proposal.

This algorithm worked much better than the DPG version, and we retained it as our implementation of DPG in all our experiments.

4 Experiments

In order to assess the validity of our approach, we perform experiments under controllable conditions based on synthetic binary sequences. Our setup is similar to that of [15]. We generate datasets of binary sequences according to a underlying process

. This process produces random “white noise” binary strings with fixed length

that are filtered according to whether they contain a specific, fixed, substring (“motif") anywhere inside the sequence. The interest of such a process is that one can efficiently generate datasets (by implementing the filtering process through a probabilistic finite-state automaton) and also directly compute the theoretical entropy (perplexity) of the process (see [15]). Also, [15] observed that could be well approximated by a standard autoregressive model when the training dataset was large.

In these experiments, we employed a GAM architecture according to (2), using a fixed set of five binary features555We also did experiments involving two continuous features ( and ) assessing length, see A.4 in Sup. Mat.: one feature corresponding to the presence/absence of the motif in the candidate sequence, and four “distractor” features with no (or little) predictive value for the validity of the candidate sequence (this feature set, using [15] notation, is denoted in the figures by the mask ). We vary the motifs used, the size of the training set , and the seeds employed.

Our implementation is based on PyTorch

[16], with policies (i.e. autoregressive models and ) implemented as LSTM models over the vocabulary , with each token represented as a one-hot vector.

The specific experimental setup that we use, due to the nature of the features (binary features or length features ), permits to perform Training-2 through distillation (the method used in [15]). In these experiments, we want to confirm that the more generally applicable DPG method works equally well. We do so by varying the training dataset size and by computing the test perplexity (cross-entropy) of the obtained at the end of Training-1 + Training-2, and then checking that both distillation and DPG lower this perplexity relative to that of the initial , under small data conditions (data efficiency). But we also confirm that in Training-2, both distillation and DPG are able to almost perfectly approximate the EBM obtained at the end of Training-1 (that is, to approximate the associated normalized ); in other words, when is able to model the accurately (which depends on both the quality of the initial and on the ability of the features to fit the underlying process), then DPG is able to produce a that accurately represents .

Overall Training: Distillation vs. DPG

Figure 2: Distillation vs. DPG

We consider a situation where Training-1 is done through snis, but Training-2 is done either through Distillation or through DPG (i.e. DPG). Figure 2 illustrates this case. Here the motif, feature vector, and seed are fixed, but the training size varies from to ) (the size of the test set is fixed at ).

The solid lines represent the cross entropies of the final relative to the test set, with the scale located on the left side of the figure, while the dashed lines are the frequencies of the motif (computed on strings sampled from ) with the corresponding scale on the right. We distinguish two versions of Training-2, one based on distillation (distill), the other on DPG (dpg).

First consider the points above , and the solid lines: for both distill and dpg, we have : is more data efficient than the initial AM . For smaller data conditions, the tendency is even stronger, while larger lead to an initial which is already very good, and on which the two-stage training cannot improve.

Similar conclusions hold for the motif frequencies of compared to : in small data conditions, the motif is much more frequently present when using .

Finally, comparing distill and dpg, we see that the performances are very comparable, in this case with a slight advantage of distill over dpg in perplexities but the reverse in motif frequencies.

Effectiveness of DPG in approximating

To emphasize the performance of DPG in Training-2 (that is, its effectiveness at finding a distributional policy for an EBM representation ), independently of the quality of Training-1), we considered two alternatives for . The first one took , the energy-based model obtained from Training-1. In our specific experimental conditions, we were able to accurately estimate (via importance sampling) the partition function and therefore to compute the cross entropy , and to compare it with : they were extremely close. We confirmed that finding by considering an alternative where was defined a priori in such a way that we could compute and exactly, observing the same behavior. Details are provided in Sup. Mat. A.3.


Table 1: Statistics over: , , .


In Table 1 we compute the means of ratios of different quantities across experiments with different motifs, features and seeds: , , . In all cases Training-1 is performed using snis.

These statistics confirm the tendencies illustrated in the previous plots. Namely, when increases the test cross entropy gets closer to the theoretical one . Also outperforms in small conditions of for the two modes of Training-2: the columns and show that the models approximate the true process more closely than the initial in settings with . Similar conclusions can be drawn when comparing the motif frequencies of and . Further, according to data in columns and , we see that DPG and distillation have comparable efficiency for obtaining the final policy. DPG gives rise to a policy that has better motif frequency but slightly worse cross-entropy than the one from distillation.

5 Conclusion

Motivated by the GAM formalism for learning sequential models,666The limitation to sequential EBMs is not as serious as it seems. Many objects can be decomposed into sequences of actions, and EBMs over such objects could then be handled in similar ways to those proposed here. we proposed some RL-inspired techniques for obtaining distributional policies approximating the normalized distribution associated with an energy-based model over sequences. We took some first experimental steps, in controlled synthetic conditions, for confirming that these techniques were working.

While the main algorithm (DPG) proposed here for computing distributional policies is generic in the sense that it only requires a potential and a proposal , the fact that GAMs intrinsically enclose an autoregressive policy that can be used to initialize such a proposal is an important advantage. It should also be observed that the division of work in GAMs between Training-1 and Training-2 helps clarifying a distinction that should be made about training sequential EBMs from data. [15] already observed that training the representation could be much easier than extracting an autoregressive model from it.777There are some extreme situations where the obtained at the end of Training-1 can perfectly represent the true underlying process, but no policy has a chance to approximate . This can happen with features associated with complex filters (e.g. of a cryptographic nature) used for generating the data, which can be easily detected as useful during Training-1, but cannot feasibly be projected back onto incremental policies. If we think in the terms of the current paper, we can further observe that while Training-2 has direct connections to RL (exploiting a given reward to obtain a policy), Training-1 has some similarities to Inverse RL [19, 12]: deriving a reward from the training data, here purely inside a max-likelihood approach. Trying to combine the two aspects in one direct algorithm would only blur the true nature of the problem.

The move from the standard optimization view of RL and the sampling (aka distributional) view advocated here is a natural one. Optimization can be seen as an extreme case of sampling with a low temperature, and the approach to distributional policies developped in our Algorithm 1 might be a way for developing stable algorithms for standard RL purposes (a related approach is proposed in [13]).

Our importation of policy gradient from standard RL to the distributional view only scratches the surface, and another promising line of research would be to adapt methods for local credit assignment, such as actor-critic techniques, to the problem of sampling from an energy-based model.


Thanks to Tomi Silander and Hady Elsahar for discussions and feedback.


  • [1] Daniel Andor, Chris Alberti, David Weiss, Aliaksei Severyn, Alessandro Presta, Kuzman Ganchev, Slav Petrov, and Michael Collins. Globally normalized transition-based neural networks. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2442–2452, Berlin, Germany, August 2016. Association for Computational Linguistics.
  • [2] Dzmitry Bahdanau, Philemon Brakel, Kelvin Xu, Anirudh Goyal, Ryan Lowe, Joelle Pineau, Aaron Courville, and Yoshua Bengio. An Actor-Critic Algorithm for Sequence Prediction. (2015):1–17, 2016.
  • [3] David Belanger and Andrew McCallum. Structured prediction energy networks. In

    Proceedings of the 33rd International Conference on International Conference on Machine Learning - Volume 48

    , ICML’16, pages 983–992. JMLR.org, 2016.
  • [4] Marc G. Bellemare, Will Dabney, and Rémi Munos. A Distributional Perspective on Reinforcement Learning. arXiv:1707.06887 [cs, stat], July 2017. arXiv: 1707.06887.
  • [5] Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional sequence to sequence learning. CoRR, 2017. cite arxiv:1705.03122.
  • [6] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
  • [7] Natasha Jaques, Shixiang Gu, Dzmitry Bahdanau, Jose Miguel Hernandez Lobato, Richard E. Turner, and Doug Eck.

    Tuning recurrent neural networks with reinforcement learning.

  • [8] Tony Jebara.

    Log-Linear Models, Logistic Regression and Conditional Random Fields, 2013.

  • [9] Taesup Kim and Yoshua Bengio. Deep directed generative models with energy-based probability estimation. CoRR, abs/1606.03439, 2016.
  • [10] Yann LeCun, Sumit Chopra, Raia Hadsell, Marc’Aurelio Ranzato, and Fu Jie Huang. A Tutorial on Energy-Based Learning. Predicting Structured Data, pages 191–246, 2006.
  • [11] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
  • [12] Andrew Y. Ng and Stuart J. Russell. Algorithms for inverse reinforcement learning. In Proceedings of the Seventeenth International Conference on Machine Learning, ICML ’00, pages 663–670, San Francisco, CA, USA, 2000. Morgan Kaufmann Publishers Inc.
  • [13] Mohammad Norouzi, Samy Bengio, Zhifeng Chen, Navdeep Jaitly, Mike Schuster, Yonghui Wu, and Dale Schuurmans. Reward augmented maximum likelihood for neural structured prediction. In Proceedings of the 30th International Conference on Neural Information Processing Systems, NIPS’16, pages 1731–1739, USA, 2016. Curran Associates Inc.
  • [14] Art Owen. Adaptive Importance Sampling (slides). 2017.
  • [15] Tetiana Parshakova, Jean-Marc Andreoli, and Marc Dymetman. Global Autoregressive Models for Data-Efficient Sequence Learning. In CoNLL 2019, Hong Kong, November 2019.
  • [16] Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NIPS Autodiff Workshop, 2017.
  • [17] Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. In 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016.
  • [18] Christian P. Robert and George Casella. Monte Carlo Statistical Methods (Springer Texts in Statistics). Springer-Verlag, Berlin, Heidelberg, 2005.
  • [19] Stuart Russell. Learning agents for uncertain environments (extended abstract). In

    Proceedings of the Eleventh Annual Conference on Computational Learning Theory

    , COLT’ 98, pages 101–103, New York, NY, USA, 1998. ACM.
  • [20] John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pages 1889–1897, 2015.
  • [21] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint: 1707.06347, 2017.
  • [22] Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pages 3104–3112, 2014.
  • [23] Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. The MIT Press, second edition, 2018.
  • [24] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, 4-9 December 2017, Long Beach, CA, USA, pages 6000–6010, 2017.
  • [25] Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. In Machine Learning, pages 229–256, 1992.
  • [26] Y. Bengio and J. S. Senecal. Adaptive Importance Sampling to Accelerate Training of a Neural Probabilistic Language Model. Ieee Transactions on Neural Networks, 19(4):713–722, 2008.

Appendix A Supplementary Material

a.1 Related Work

GAMs have been introduced in [15]. While that paper already proposes the division of training in two stages, it only considers a distillation method, of limited application, for Training-2. It mentions a possible relation with RL as future work, but does not elaborate, while this is a central focus of the present submission.

Global and Energy-Based approaches to neural seq2seq models have been considered in several works. Among those, [1] consider transition-based neural networks, and contrast local to global normalization of decision sequences, showing how the global approach avoids the label bias problem for tasks such as tagging or parsing. Contrarily to us, they focus on inference as maximization, for instance finding the best sequence of tags for a sequence of words. [3] address a similar class of problems (multi-labelling problems such as sequence tagging), employing an energy-based generalization of CRFs, also focussing on inference as optimization. [9], similar to us, consider probabilistic generative processes defined through an energy-based model. Their focus is on the generation of non-sequential objects, using GAN-type binary discriminators to train the energy representation on the available data. They do not exploit connections to RL.

Reinforcement Learning approaches for seq2seq problems have also been studied in many works. Among those, [17]

use an hybrid loss function to interpolate between perplexity (aka cross-entropy) training and reward optimization, with the reward being defined by evaluation measures (such as BLEU in machine translation) differing from perplexity.


, still in a RL-as-optimization framework, and with similar objectives, exploit an actor-critic method, where the critic (value function) helps the actor (policy) by reducing variance.

[7] and [13] attempt to combine log-likelihood (aka perplexity) and reward-based training in a more integrated way. In the first paper the rewards are directly defined by a priori scores on the quality of the output, which can be computed not only at training time but also at test time. In the second paper, the way in which the rewards are integrated is done by exploiting a probabilistic formulation of rewards close to ours, but used in a different way, in particular without our notion of proposal distribution and with no explicit connection to energy-based modelling. In all these cases, the focus is on inference as optimization, not inference as sampling as in the present submission.

Finally, [4] use a different notion of “distributional RL" from ours. During policy evaluation, they replace evaluation of the mean return from a state by the evaluation of the full distribution over returns from that state, and define a Bellman operator for such distribution. Their goal is still to find a policy in the standard (optimization) sense, but with better robustness and stability properties.

a.2 Rejection Sampling vs. SNIS in Training-1

Training-1 consists in training the model on . This is done by first training on in the standard way (by cross-entropy) and then by training by SGD with the formula:


The main difficulty then consists in computing an estimate of the model moments . In experiments, [15] compares two Monte-Carlo approaches [18] for addressing this problem: (i) Rejection Sampling (rs), using as the proposal distribution and (ii) Self-Normalized Importance Sampling (snis) [26], also using as the proposal.

Rejection sampling is performed as follows. We use as the proposal, and as the unnormalized target distribution; for any specific , because our features are binary, we can easily upper-bound the ratio by a number ; we then sample from , compute the ratio , and accept with probability . The accepted samples are unbiased samples from and can be used to estimate model moments.

Snis also uses the proposal distribution , but does not require an upper-bound, and is directly oriented towards the computation of expectations. In this case, we sample a number of points from , compute “importance ratios” , and estimate through . The estimate is biased for a given , but consistent (that is, it converges to the true for ).

In the experiments with DPG in the main text, we only considered cases where Training-1 is done through snis. This made sense, as both snis and DPG are motivated by situations in which sampling techniques such as rejection sampling do not work. 888It is also interesting to note that both snis and DPGuse importance sampling as the underlying technique.

Fig. 3 compares snis with rs (using only distillation as the Training-2 technique). It can be seen that both techniques produce very similar results.

Figure 3: snis vs. rs for Training-1. In Training-2, only distillation was used.

a.3 Effectiveness of DPG in approximating : details

To emphasize the performance of DPG in Training-2 (that is, its effectiveness at finding a distributional policy for an EBM representation ), independently of the quality of Training-1), we considered two alternatives for (see Figure 4). The first one took , the energy-based model obtained from Training-1 (the conditions were the same as in Figure 3, but we only considered snis for Training-1). For these specific experimental conditions, we were able to accurately estimate (via importance sampling) the partition function and therefore to compute the cross entropy , represented by the points labelled p_lambda in the figure. We could then verify that the policy obtained from by DPG (line dpg pl) was very close to these points. We then considered a second alternative for , namely , with being the white-noise process filtered by a binary predicate checking for the presence of the motif; in other words is an unnormalized version of the true underlying process . We then applied dpg to this obtaining the policy represented by the line wn_dpg pl and we could also verify that this line was very close to the line corresponding to (shown as true in the figure, but almost hidden by the other line).

Figure 4: DPG vs.

a.4 Beyond Binary Features in Training-1: Length

While the emphasis of the current paper is on Training-2 and its relationship with distributional policies in RL, we also wanted to go beyond one of the limiting assumptions of [15], namely its reliance on binary features only: e.g., presence of a substring, value of the first bit, etc. We wanted to confirm that GAMs can be applied continuous features as well, and in fact to features that have a strong inter-dependence. We also wanted to consider features that relied on weaker prior knowledge than the presence of specific motifs.

To do that, we considered an additional length feature with two components, namely denoted as and denoted as .

We note that the moments of these two features correspond to sufficient statistics for the normal distribution, and roughly speaking GAMs are obtained by matching moments of the given dataset .

We were then able during Training-1 to learn the corresponding parameters using either without modification or with a modification for computing the upper bound (since the two components are inter-dependent).

However, we noticed that the performance of two training setups (distillation and DPG) was rather similar whether the length feature was on or off (see Figure 5). We speculate that in order to see the impact of the length feature, the strings in should be longer so that the original AM would be weaker in characterizing the length.

Figure 5: DPG vs Distillation with length feature on (top) or off (bottom).