Title: RECURRENT HIERARCHICAL TOPIC-GUIDED NEURAL LANGUAGE MODELS

Abstract: To simultaneously capture syntax and global semantics from a text corpus, we propose a new larger-context recurrent neural network (RNN) based language model, which extracts recurrent hierarchical semantic structure via a dynamic deep topic model to guide natural language generation. Moving beyond a conventional RNN based language model that ignores long-range word dependencies and sentence order, the proposed model captures not only intra-sentence word dependencies, but also temporal transitions between sentences and inter-sentence topic dependences. For inference, we develop a hybrid of stochastic-gradient MCMC and recurrent autoencoding variational Bayes. Experimental results on a variety of real-world text corpora demonstrate that the proposed model not only outperforms state-ofthe-art larger-context RNN-based language models, but also learns interpretable recurrent multilayer topics and generates diverse sentences and paragraphs that are syntactically correct and semantically coherent.

1. INTRODUCTION:

Both topic and language models are widely used for text analysis. Topic models, such as latent Dirichlet allocation (LDA) (Blei et al., 2003; Griffiths & Steyvers, 2004; Hoffman et al., 2013) and its nonparametric Bayesian generalizations (Teh et al., 2006; Zhou & Carin, 2015) , are well suited to extract document-level word concurrence patterns into latent topics from a text corpus. Their modeling power has been further enhanced by introducing multilayer deep representation (Srivastava et al., 2013; Mnih & Gregor, 2014; Gan et al., 2015; Zhou et al., 2016; Zhao et al., 2018; Zhang et al., 2018) . While having semantically meaningful latent representation, they typically treat each document as a bag of words (BoW), ignoring word order (Griffiths et al., 2004; Wallach, 2006) . Language models have become key components of various natural language processing (NLP) tasks, such as text summarization (Rush et al., 2015; Gehrmann et al., 2018) , speech recognition (Mikolov et al., 2010; Graves et al., 2013) , machine translation (Sutskever et al., 2014; Cho et al., 2014) , and image captioning (Vinyals et al., 2015; Mao et al., 2015; Xu et al., 2015; Gan et al., 2017; Rennie et al., 2017) . The primary purpose of a language model is to capture the distribution of a word sequence, commonly with a recurrent neural network (RNN) (Mikolov et al., 2011; Graves, 2013) or a Transformer based neural network (Vaswani et al., 2017; Dai et al., 2019; Devlin et al., 2019; Radford et al., 2018; 2019) . In this paper, we focus on improving RNN-based language models that often have much fewer parameters and are easier to perform end-to-end training.

While RNN-based language models do not ignore word order, they often assume that the sentences of a document are independent to each other. This simplifies the modeling task to independently assigning probabilities to individual sentences, ignoring their orders and document context (Tian & Cho, 2016) . Such language models may consequently fail to capture the long-range dependencies and global semantic meaning of a document (Dieng et al., 2017; Wang et al., 2018) . To relax the sentence independence assumption in language modeling, Tian & Cho (2016) propose larger-context language models that model the context of a sentence by representing its preceding sentences as either a single or a sequence of BoW vectors, which are then fed directly into the sentence modeling RNN. An alternative approach attracting significant recent interest is leveraging topic models to improve RNN-based language models. Mikolov & Zweig (2012) use pre-trained topic model features as an additional input to the RNN hidden states and/or output. Dieng et al. (2017) ; Ahn et al. (2017) combine the predicted word distributions, given by both a topic model and a language model, under variational autoencoder (Kingma & Welling, 2013) . Lau et al. (2017) introduce an attention based convolutional neural network to extract semantic topics, which are used to extend the RNN cell. Wang et al. (2018) learn the global semantic coherence of a document via a neural topic model and use the learned latent topics to build a mixture-of-experts language model. Wang et al. (2019) further specify a Gaussian mixture model as the prior of the latent code in variational autoencoder, where each mixture component corresponds to a topic.

While clearly improving the performance of the end task, these existing topic-guided methods still have clear limitations. For example, they only utilize shallow topic models with only a single stochastic hidden layer in their data generation process. Note several neural topic models use deep neural networks to construct their variational encoders, but still use shallow generative models (decoders) (Miao et al., 2017; Srivastava & Sutton, 2017) . Another key limitation lies in ignoring the sentence order, as they treat each document as a bag of sentences. Thus once the topic weight vector learned from the document context is given, the task is often reduced to independently assigning probabilities to individual sentences (Lau et al., 2017; Wang et al., 2018; 2019) .

In this paper, as depicted in Fig. 1 , we propose to use recurrent gamma belief network (rGBN) to guide a stacked RNN for language modeling. We refer to the model as rGBN-RNN, which integrates rGBN (Guo et al., 2018) , a deep recurrent topic model, and stacked RNN (Graves, 2013; Chung et al., 2017) , a neural language model, into a novel larger-context RNN-based language model. It simultaneously learns a deep recurrent topic model, extracting document-level multi-layer word concurrence patterns and sequential topic weight vectors for sentences, and an expressive language model, capturing both short-and long-range word sequential dependencies. For inference, we equip rGBN-RNN (decoder) with a novel variational recurrent inference network (encoder), and train it end-to-end by maximizing the evidence lower bound (ELBO). Different from the stacked RNN based language model in Chung et al. (2017) , which relies on three types of customized training operations (UPDATE, COPY, FLUSH) to extract multi-scale structures, the language model in rGBN-RNN learns such structures purely under the guidance of the temporally and hierarchically connected stochastic layers of rGBN. The effectiveness of rGBN-RNN as a new larger-context language model is demonstrated both quantitatively, with perplexity and BLEU scores, and qualitatively, with interpretable latent structures and randomly generated sentences and paragraphs. Notably, rGBN-RNN can generate a paragraph consisting of a sequence of semantically coherent sentences.

2. RECURRENT HIERARCHICAL TOPIC-GUIDED LANGUAGE MODEL:

Denote a document of J sentences as D = (S 1 , S 2 , . . . , S J ), where S j = (y j,1 , . . . , y j,Tj ) consists of T j words from a vocabulary of size V . Conventional statistical language models often only focus on the word sequence within a sentence. Assuming that the sentences of a document are independent to each other, they often define P (D) ≈ J j=1 P (S j ) = J j=1 Tj t=2 p (y j,t | y j,<t ) p (y j,1 ) . RNN based neural language models define the conditional probability of each word y j,t given all the previous words y j,<t within the sentence S j , through the softmax function of a hidden state h j,t , as

EQUATION

where f (•) is a non-linear function typically defined as an RNN cell, such as long short-term memory (LSTM) (Hochreiter & Schmidhuber, 1997) and gated recurrent unit (GRU) (Cho et al., 2014) .

These RNN-based statistical language models are typically applied only at the word level, without exploiting the document context, and hence often fail to capture long-range dependencies. While Dieng et al. (2017); Lau et al. (2017) ; Wang et al. (2018; 2019) remedy the issue by guiding the language model with a topic model, they still treat a document as a bag of sentences, ignoring the order of sentences, and lack the ability to extract hierarchical and recurrent topic structures.

We introduce rGBN-RNN, as depicted in Fig. 1 (a), as a new larger-context language model. It consists of two key components: (i) a hierarchical recurrent topic model (rGBN), and (ii) a stacked RNN based language model. We use rGBN to capture both global semantics across documents and long-range inter-sentence dependencies within a document, and use the language model to learn the local syntactic relationships between the words within a sentence. Similar to Lau et al. (2017) ; Wang et al. (2018) , we represent a document as a sequence of sentence-context pairs as

({S 1 , d 1 }, . . . , {S J , d J })

, where d j ∈ Z Vc + summarizes the document excluding S j , specifically (S 1 , ..., S j-1 , S j+1 , ..., S J ), into a BoW count vector, with V c as the size of the vocabulary excluding stop words. Note a naive way is to treat each sentence as a document, use a dynamic topic model

3 1 j   j d 1 j d , t j x  1 j , t j y 1 LSTM word Word embedding 2 LSTM word 2 , j t h 1 , j t h 1 , j t a 2 , j t a  2 j 3 LSTM word 3 , j t h 3 g 3 , j t a  2 j (a) (b) 2 1 j   1 1 j    3 j  2 j  1 j 2 g 1 g 1 : j J  1 : j t T  Language Model Language Model Language Model 2 RNN sent 3 1 j   2 1 j   1 1 j   1 j d 1 j d j d j d  3 j  2 j  1 j 3 RNN sent 1 RNN sent 2 RNN sent 3 RNN sent 1 RNN sent 1 : j J  Language Model (c) (a) 3 1 j   j d 1 j d , t j x  1 j , t j y 1 LSTM word Word embedding 2 LSTM word 2 , j t h 1 , j t h 1 , j t a 2 , j t a  2 j 3 LSTM word 3 , j t h 3 g 3 , j t a  3 j (a) (b) 2 1 j   1 1 j    3 j  2 j  1 j 2 g 1 g 1 : j J  1 : j t T  Language Model Language Model Language Model 2 RNN sent 3 1 j   2 1 j   1 1 j   1 j d 1 j d j d j d  3 j  2 j  1 j 3 RNN sent 1 RNN sent 2 RNN sent 3 RNN sent 1 RNN sent 1 : j J  Language Model (c) (b) 3 1 j   j d 1 j d , t j x  1 j , t j y 1 LSTM word Word embedding 2 LSTM word 2 , j t h 1 , j t h 1 , j t a 2 , j t a  2 j 3 LSTM word 3 , j t h 3 g 3 , j t a  2 j (a) (b) 2 1 j   1 1 j    3 j  2 j  1 j 2 g 1 g 1 : j J  1 : j t T  Language Model Language Model Language Model 2 RNN sent 3 1 j   2 1 j   1 1 j   1 j d 1 j d j d j d  3 j  2 j  1 j 3 RNN sent 1 RNN sent 2 RNN sent 3 RNN sent 1 RNN sent 1 : j J  Language Model (c) (c) Figure 1: (a)

The generative model of a three-hidden-layer rGBN-RNN, where the bottom part is the deep recurrent topic model (rGBN), document contexts of consecutive sentences are used as observed data, and upper is the language model. (b) Overview of the language model component, where input xj,t denotes the tth word in jth sentence of a document, xj,t = yj,t-1, h l j,t is the hidden state of the stacked RNN at time step t, and θ l j is the topic weight vector of sentence j at layer l. (c) The overall architecture of the proposed model, including the decoder (rGBN and language model) and encoder (variational recurrent inference), where the red arrows denote the inference of latent topic weight vectors, black ones the data generation. (Blei & Lafferty, 2006) to capture the temporal dependencies of the latent topic-weight vectors, which is fed to the RNN to model the word sequence of the corresponding sentence. However, the sentences are often too short to be well modeled by a topic model. In our setting, as d j summarizes the document-level context of S j , it is in general sufficiently long for topic modeling. Note during testing, we redefine d j as the BoW vector summarizing only the preceding sentences, i.e., S 1:j-1 , which will be further clarified when presenting experimental results.

2.1. HIERARCHICAL RECURRENT TOPIC MODEL:

Shown in Fig. 1 (a) , to model the time-varying sentence-context count vectors d j in document D, the generative process of the rGBN component, from the top to bottom hidden layers, is expressed as

EQUATION

where θ l j ∈ R K l + denotes the gamma distributed topic weight vectors of sentence j at layer l, Π l ∈ R K l ×K l + the transition matrix of layer l that captures cross-topic temporal dependencies,

Φ l ∈ R K l-1 ×K l +

the loading matrix at layer l, K l the number of topics of layer l, and τ 0 ∈ R + a scaling hyperparameter. At j = 1, θ l 1 ∼ Gam Φ l+1 θ l+1 1 , τ 0 for l = 1, . . . , L -1 and θ L 1 ∼ Gam (ν, τ 0 ), where ν = 1 K L . Finally, Dirichlet priors are placed on the columns of Π l and Φ l , i.e., π l k and φ l k , which not only makes the latent representation more identifiable and interpretable, but also facilitates inference. The count vector d j can be factorized into the product of Φ 1 and θ 1 j under the Poisson likelihood. The shape parameters of θ l j ∈ R K l + can be factorized into the sum of Φ l+1 θ l+1 j , capturing inter-layer hierarchical dependence, and Π l θ l j-1 , capturing intra-layer temporal dependence. rGBN not only captures the document-level word occurrence patterns inside the training text corpus, but also the sequential dependencies of the sentences inside a document. Note ignoring the recurrent structure, rGBN will reduce to the gamma belief network (GBN) of Zhou et al. (2016) , which can be considered as a multi-stochastic-layer deep generalization of LDA (Cong et al., 2017a) . If ignoring its hierarchical structure (i.e., L = 1), rGBN reduces to Poisson-gamma dynamical systems (Schein et al., 2016) . We refer to the rGBN-RNN without its recurrent structure as GBN-RNN, which no longer models sequential sentence dependencies; see Appendix A for more details.

2.2. LANGUAGE MODEL:

Different from a conventional RNN-based language model, which predicts the next word only using the preceding words within the sentence, we integrate the hierarchical recurrent topic weight vectors θ l j into the language model to predict the word sequence in the jth sentence. Our proposed language model is built upon the stacked RNN proposed in Graves (2013) ; Chung et al. (2017) , but with the help of rGBN, it no longer requires specialized training heuristics to extract multi-scale structures. As shown in Fig. 1 (b), to generate y j,t , the t th token of sentence j in a document, we construct the hidden states h l j,t of the language model, from the bottom to top layers, as

EQUATION

where LSTM l word denotes the word-level LSTM at layer l, W e ∈ R V are word embeddings to be learned, and x j,t = y j,t-1 . Note a l j,t denotes the coupling vector, which combines the temporal topic weight vectors θ l j and hidden output of the word-level LSTM h l j,t-1 at each time step t.

Following Lau et al. ( 2017), a gating unit similar to GRU (Cho et al., 2014) combines θ l j of sentence j with its hidden state h l j,t of word-level LSTM at layer l and time t as a l j,t = g l h l j,t , θ l j . We defer the details on g l to Appendix B. Denote W o as a weight matrix with V rows and a 1:L j,t as the concatenation of a l j,t across all layers; different from (1), the conditional probability of y j,t becomes

EQUATION

There are two main reasons for combining all the latent representations a 1:L j,t for language modeling. First, the latent representations exhibit different statistical properties at different stochastic layers of rGBN-RNN, and hence are combined together to enhance their representation power. Second, having "skip connections" from all hidden layers to the output one makes it easier to train the proposed network, reducing the number of processing steps between the bottom of the network and the top and hence mitigating the "vanishing gradient" problem (Graves, 2013) .

To sum up, as depicted in Fig. 1 (a), the topic weight vector θ l j of sentence j quantifies the topic usage of its document context d j at layer l. It is further used as an additional feature of the language model to guide the word generation inside sentence j, as shown in Fig. 1 (b) . It is clear that rGBN-RNN has two temporal structures: a deep recurrent topic model to extract the temporal topic weight vectors from the sequential document contexts, and a language model to estimate the probability of each sentence given its corresponding hierarchical topic weight vector. Characterizing the word-sentencedocument hierarchy to incorporate both intra-and inter-sentence information, rGBN-RNN learns more coherent and interpretable topics and increases the generative power of the language model. Distinct from existing topic-guided language models, the temporally related hierarchical topics of rGBN exhibit different statistical properties across layers, which better guides language model to improve its language generation ability.

2.3. MODEL LIKELIHOOD AND INFERENCE:

For rGBN-RNN, given {Φ l , Π l } L l=1 , the marginal likelihood of the sequence of sentence-context pairs ({s 1 , d 1 }, . . . , {s J , d J }) of document D is defined as

EQUATION

where e l j := Φ l+1 θ l+1 j + Π l θ l j-1 . The inference task is to learn the parameters of both the topic model and language model components. One naive solution is to alternate the training between these two components in each iteration: First, the topic model is trained using a sampling based iterative algorithm provided in Guo et al. (2018) ; Second, the language model is trained with maximum likelihood estimation under a standard cross-entropy loss. While this naive solution can utilize readily available inference algorithms for both rGBN and the language model, it may suffer from stability and convergence issues. Moreover, the need to perform a sampling based iterative algorithm for rGBN inside each iteration limits the scalability of the model for both training and testing.

Algorithm 1 Hybrid SG-MCMC and recurrent autoencoding variational inference for rGBN-RNN.

Set mini-batch size m and the number of layer L Initialize encoder and neural language model parameter parameter Ω, and topic model parameter

{Φ l , Π l } L l=1 . for iter = 1, 2, • • • do

Randomly select a mini-batch of m documents consisting of J sentences to form a subset X = {di,1:J , si,1:J } m i=1 ; Draw random noise l i,j m,J,L i=1,j=1,l=1 from uniform distribution; Calculate ∇ Ω L Ω, Φ l , Π l ; X, l i,j according to (6), and update Ω; Sample θ l i,j from ( 7) and ( 8) via Ω to update {Π l } L l=1 and {Φ l } L l=1 , will be described in Appendix C; end for

To this end, we introduce a variational recurrent inference network (encoder) to learn the latent temporal topic weight vectors

θ 1:L 1:J . Denoting Q = J j=1 L l=1 q(θ l j | d ≤j )

, the ELBO of the log marginal likelihood shown in (5) can be constructed as

L = J j=1 E Q ln p d j | Φ 1 θ 1 j + Tj t=1 ln p y j,t | y j,<t , θ 1:L j - J j=1 L l=1 E Q ln q(θ l j | d ≤j )

p(θ l j | e l j ,τ0) , (6) which unites both the terms that are primarily responsible for training the recurrent hierarchical topic model component, and terms for training the neural language model component. Similar to Zhang et al. (2018) , we define q(θ l j | d ≤j ) = Weibull(k l j , λ l j ), a random sample from which can be obtained by transforming standard uniform variables l j as

EQUATION

To capture the temporal dependencies between the topic weight vectors, both k l j and λ l j , from the bottom to top layers, can be expressed as

EQUATION

where h s,0 j = d j , h s,l 0 = 0, RNN l sent denotes the sentence-level recurrent encoder at layer l implemented with a basic RNN cell, capturing the sequential relationship between sentences within a document, h s,l j denotes the hidden state of RNN l sent , and superscript s in h s,l j denotes "sentencelevel RNN" used to distinguish the hidden state of language model in (3) . Note both f l k and f l λ are nonlinear functions mapping state h s,l j to the parameters of θ l j , implemented with f (x) = ln(1 + exp(Wx + b)).

Rather than finding a point estimate of the global parameters {Φ l , Π l } L l=1 of the rGBN, we adopt a hybrid inference algorithm by combining TLASGR-MCMC described in Cong et al. (2017a) ; Zhang et al. (2018) and our proposed recurrent variational inference network. In other words, the global parameters {Φ l , Π l } L l=1 can be sampled with TLASGR-MCMC, while the parameters of the language model and variational recurrent inference network, denoted by Ω, can be updated via stochastic gradient descent (SGD) by maximizing the ELBO in (6). We describe a hybrid variational/sampling inference for rGBN-RNN in Algorithm 1 and provide more details about sampling {Φ l , Π l } L l=1 with TLASGR-MCMC in Appendix C. We defer the details on model complexity to Appendix E.

To sum up, as shown in Fig. 1(c ), the proposed rGBN-RNN works with a recurrent variational autoencoder inference framework, which takes the document context of the jth sentence within a document as input and learns hierarchical topic weight vectors θ 1:L j that evolve sequentially with j. The learned topic vectors in different layer are then used to reconstruct the document context input and as an additional feature for the language model to generate the jth sentence.

3. EXPERIMENTAL RESULTS:

We consider three publicly available corpora, including APNEWS, IMDB, and BNC. The links, preprocessing steps, and summary statistics for them are deferred to Appendix D. We consider a recurrent variational inference network for rGBN-RNN to infer θ l j , as shown in Fig. 1 (c), whose number of hidden units in (8) are set the same as the number of topics in the corresponding layer.

Following Lau et al. (2017) , word embeddings are pre-trained 300-dimension word2vec Google News vectors (https://code.google.com/archive/p/word2vec/). Dropout with a rate of 0.4 is used to the input of the stacked-RNN at each layer, i.e., a l j,t or W e [x j,t ] in (3). The gradients are clipped if the norm of the parameter vector exceeds 5. We use the Adam optimizer (Kingma & Ba, 2015) with learning rate 10 -3 . The length of an input sentence is fixed to 30. We set the mini-batch size as 8, number of training epochs as 5, and scaling hyperparameter τ 0 as 1. Code in TensorFlow is provided.

3.1. QUANTITATIVE COMPARISON:

Perplexity: For fair comparison, we use standard language model perplexity as the evaluation metric, by considering the following baselines: (i) a standard LSTM language model (Hochreiter & Schmidhuber, 1997) ; (ii) LCLM (Tian & Cho, 2016) , a larger-context language model that incorporates context from preceding sentences, which are treated as a bag of words; (iii) a standard LSTM language model incorporating the topic information of a separately trained LDA (LDA+LSTM); (iv) Topic-RNN (Dieng et al., 2017) , a hybrid model rescoring the prediction of the next word by incorporating the topic information through a linear transformation; (v) TDLM (Lau et al., 2017), a joint learning framework which learns a convolutional based topic model and a language model simultaneously. (vi) TCNLM (Wang et al., 2018) , which extracts the global semantic coherence of a document via a neural topic model, with the probability of each learned latent topic further adopted to build a mixture-of-experts language model; (vii) TGVAE (Wang et al., 2019) , combining a variational auto-encoder based neural sequence model with a neural topic model; (viii) GBN-RNN, a simplified rGBN-RNN that removes the recurrent structure of its rGBN component.

For rGBN-RNN, to ensure the information about the words in the jth sentence to be predicted is not leaking through the sequential document context vectors at the testing stage, the input d j in (8) only summarizes the preceding sentences S <j . For GBN-RNN, following TDLM (Lau et al., 2017) and TCNLM (Wang et al., 2018) , all the sentences in a document, excluding the one being predicted, are used to obtain the BoW document context. As shown in Table 1 , rGBN-RNN outperforms all baselines, and the trend of improvement continues as its number of layers increases, indicating the effectiveness of assimilating recurrent hierarchical topic information. rGBN-RNN consistently outperforms GBN-RNN, suggesting the benefits of exploiting the sequential dependencies of the sentence-contexts for language modeling. Moreover, comparing Table 1 and Table 4 of Appendix E suggests rGBN-RNN, with its hierarchical and temporal topical guidance, achieves better performance with fewer parameters than comparable RNN-based baselines.

Note that for language modeling, there has been significant recent interest in replacing RNNs with Transformer (Vaswani et al., 2017) , which consists of stacked multi-head self-attention modules, and its variants (Dai et al., 2019; Devlin et al., 2019; Radford et al., 2018; 2019) . While Transformer based language models have been shown to be powerful in various natural language processing tasks, they often have significantly more parameters, require much more training data, and take much longer to train than RNN-based language models. For example, Transformer-XL with 12L and that with 24L (Dai et al., 2019) , which improve Transformer to capture longer-range dependencies, have 41M and 277M parameters, respectively, while the proposed rGBN-RNN with three stochastic hidden layers has as few as 7.3M parameters, as shown in Table 4 , when used for language modeling. From a structural point-of-view, we consider the proposed rGBN-RNN as complementary to rather than competing with Transformer based language models, and consider replacing RNN with Transformer to construct rGBN guided Transformer as a promising future extension.

BLEU: Following Wang et al. (2019) , we use test-BLEU to evaluate the quality of generated sentences with a set of real test sentences as the reference, and self-BLEU to evaluate the diversity of the generated sentences (Zhu et al., 2018) . Given the global parameters of the deep recurrent topic model (rGBN) and language model, we can generate the sentences by following the data generation process of rGBN-RNN: we first generate topic weight vectors θ L j randomly and then downward propagate it through the rGBN as in (2) to generate θ <L j . By assimilating the random draw topic weight vectors with the hidden states of the language model in each layer depicted in (3), we generate a corresponding sentence, where we start from a zero hidden state at each layer in the language model, and sample words sequentially until the end-of-the-sentence symbol is generated. Comparisons of the BLEU scores between different methods are shown in Fig. 2 , using the benchmark tool in Texygen (Zhu et al., 2018) ; We show below BLEU-3 and BLEU-4 for BNC and defer the analogous plots for IMDB and APNEWS to Appendix G and H. Note we set the validation dataset as the ground-truth. For all datasets, it is clear that rGBN-RNN yields both higher test-BLEU and lower self-BLEU scores than related methods do, indicating the stacked-RNN based language model in rGBN-RNN generalizes well and does not suffer from mode collapse (i.e., low diversity).

3.2. QUALITATIVE ANALYSIS:

Hierarchical structure of language model: In Fig. 3 , we visualize the hierarchical multi-scale structures learned with the language model of rGBN-RNN and that of GBN-RNN, by visualizing the L 2 -norm of the hidden states in each layer, while reading a sentence from the APNEWS validation set as "the service employee international union asked why cme group needs tax relief when it is making huge amounts of money?" As shown in Fig. 3 (a), in the bottom hidden layer (h1), the L 2 norm sequence varies quickly from word to word, except within short phrases such "service employee", "international union," and "tax relief," suggesting layer h1 is in charge of capturing short-term local dependencies. By contrast, in the top hidden layer (h3), the L 2 norm sequence varies slowly and exhibits semantic/syntactic meaningful long segments, such as "service employee international union," "asked why cme group needs tax relief," "when it is," and "making huge amounts of," suggesting that layer h3 is in charge of capturing long-range dependencies. Therefore, the language model in rGBN-RNN can allow more specific information to transmit through lower layers, while allowing more general higher level information to transmit through higher layers. Our proposed model have the ability to learn hierarchical structure of the sequence, despite without designing the multiscale RNNs on purpose like Chung et al. (2017) . We also visualize the language model of GBN-RNN in Fig. 3(b) ; with much less smoothly time-evolved deeper layers, GBN-RNN fails to utilize its stacked RNN structure as effectively as rGBN-RNN does. This suggests that the language model is much better trained in rGBN-RNN than in GBN-RNN for capturing long-range temporal dependencies, which helps explain why rGBN-RNN exhibits clearly boosted BLEU scores in comparison to GBN-RNN.

Hierarchical topics: We present an example topic hierarchy inferred by a three-layer rGBN-RNN from APNEWS. In Fig. 4 , we select a large-weighted topic at the top hidden layer and move down the network to include any lower-layer topics connected to their ancestors with sufficiently large weights. Horizontal arrows link temporally related topics at the same layer, while top-down arrows link hierarchically related topics across layers. For example, topic 48 of layer 3 on "budget, lawmakers, gov., revenue," is related not only in hierarchy to topic 57 on "lawmakers, pay, proposal, legislation" and topic 60 of the lower layer on "budget, gov., revenue, vote, costs, mayor," but also in time to topic 35 of the same layer on "democratic, taxes, proposed, future, state." Highly interpretable hierarchical relationships between the topics at different layers, and temporal relationships between the topics at the same layer are captured by rGBN-RNN, and the topics are often quite specific semantically at the bottom layer while becoming increasingly more general when moving upwards.

Sentence generation under topic guidance: Given the learned rGBN-RNN, we can sample the sentences both conditioning on a single topic of a certain layer and on a combination of the topics from different layers. Shown in the dotted-line boxes in Fig. 4 , most of the generated sentences conditioned on a single topic or a combination of topics are highly related to the given topics in terms of their semantical meanings but not necessarily in key words, indicating the language model is successfully guided by the recurrent hierarchical topics. These observations suggest that rGBN-RNN has successfully captured syntax and global semantics simultaneously for natural language generation.

Sentence/paragraph generation conditioning on a paragraph: Given the GBN-RNN and rGBN-RNN learned on APNEWS, we further present the generated sentences conditioning on a paragraph, as shown in Fig. 5 . To randomly generate sentences, we encode the paragraph into a hierarchical latent representation and then feed it into the stacked-RNN. Besides, we can generate a paragraph with rGBN-RNN, using its recurrent inference network to encode the paragraph into a dynamic hierarchical latent representation, which is fed into the language model to predict the word sequence Document Generated Sentences with GBN-RNN Generated Sentences with rGBN-RNN the proposal would also give lawmakers with more money to protect public safety , he said . the proposal , which was introduced in the house on a vote on wednesday , has already passed the senate floor to the house . Generated temporal Sentences with rGBN-RNN (Paragraph) the senate sponsor (…) , a house committee last week removed photo ids issued by public colleges and universities from the measure sponsored by republican rep. susan lynn , who said she agreed with the change . the house approved the bill on a 65-30 vote on monday evening . but republican sen. bill ketron in a statement noted that the upper chamber overwhelmingly rejected efforts to take student ids out of the bill when it passed 21-8 earlier this month . ketron said he would take the bill to conference committee if needed .

if the house and senate agree , it will be the first time they 'll have to seek their first meeting . the city commission voted last week to approve the law , which would have allowed the council to approve the new bill . senate president pro tem joe scarnati said the governor 's office has never resolved the deadline for a vote in the house . the proposal is a new measure version of the bill to enact a senate committee to approve the emergency manager 's emergency license . the house gave the bill to six weeks of testimony , but the vote now goes to the full house for consideration . jackson signed his paperwork wednesday with the legislature .the proposal would also give lawmakers with more money to protect public safety , he said . "a spokesman for the federal department of public safety says it has been selected for a special meeting for the state senate to investigate his proposed law . a new state house committee has voted to approve a measure to let idaho join a national plan to ban private school systems at public schools . the campaign also launched a website at the university of california , irvine , which are studying the current proposal . in each sentence of the input paragraph. It is clear that both the proposed GBN-RNN and rGBN-RNN can successfully capture the key textual information of the input paragraph, and generate diverse realistic sentences. Interestingly, the rGBN-RNN can generate semantically coherent paragraphs, incorporating contextual information both within and beyond the sentences. Note that with the topics that extract the document-level word cooccurrence patterns, our proposed models can generate semantically-meaningful words, which may not exist in the original document.

4. CONCLUSION:

We propose a recurrent gamma belief network (rGBN) guided neural language modeling framework, a novel method to learn a language model and a deep recurrent topic model simultaneously. For scalable inference, we develop hybrid SG-MCMC and recurrent autoencoding variational inference, allowing efficient end-to-end training. Experiments results conducted on real world corpora demonstrate that the proposed models outperform a variety of shallow-topic-model-guided neural language models, and effectively generate the sentences from the designated multi-level topics or noise, while inferring interpretable hierarchical latent topic structure of document and hierarchical multiscale structures of sequences. For future work, we plan to extend the proposed models to specific natural language processing tasks, such as machine translation, image paragraph captioning, and text summarization. Another promising extension is to replace the stacked-RNN in rGBN-RNN with Transformer, i.e., constructing an rGBN guided Transformer as a new larger-context neural language model.

A THE GBN-RNN:

GBN-RNN: {y 1:T , d} denotes a sentence-context pair, where d ∈ Z Vc + represents the document-level context as a word frequency count vector, the vth element of which counts the number of times the vth word in the vocabulary appears in the document excluding sentence y 1:T . The hierarchical model of a L-hidden-layer GBN, from top to bottom, is expressed as

EQUATION

The stacked-RNN based language model described in (3) is also used in GBN-RNN.

Statistical inference: To infer GBN-RNN, we consider a hybrid of stochastic gradient MCMC (Welling & Teh, 2011; Patterson & Teh, 2013; Li et al., 2015; Ma et al., 2015; Cong et al., 2017a) , used for the GBN topics φ l k , and auto-encoding variational inference (Kingma & Welling, 2013; Rezende et al., 2014) , used for the parameters of both the inference network (encoder) and RNN. More specifically, GBN-RNN generalizes Weibull hybrid auto-encoding inference (WHAI) of Zhang et al. (2018) : it uses a deterministic-downward-stochastic-upward inference network to encode the bag-of-words representation of d into the latent topic-weight variables θ l across all hidden layers, which are fed into not only GBN to reconstruct d, but also a stacked RNN in language model, as shown in (3), to predict the word sequence in y 1:T . The topics φ l k can be sampled with topic-layeradaptive stochastic gradient Riemannian (TLASGR) MCMC, whose details can be found in Cong et al. (2017a) ; Zhang et al. (2018) , omitted here for brevity. Given the sampled topics φ l k , the joint marginal likelihood of {y 1:T , d} is defined as

p y 1:T , d | {Φ l } l = p d | Φ 1 θ 1 T t=1 p y t | y 1:t-1 , θ 1:L L l=1 p θ l | Φ l+1 θ l+1 d θ 1:L . (10)

For efficient inference, an inference network as Q = L l=1 q(θ l | d, Φ l+1 θ l+1 ) is used to provide a ELBO of the log joint marginal likelihood as

L(y 1:T , d) = E Q ln p d | Φ 1 θ 1 + T t=1 ln p y t | y 1:t-1 , θ 1:L - L l=1 E Q ln q(θ l | d,Φ l+1 θ l+1 ) p(θ l | Φ l+1 θ l+1 )

(11) and the training is performed by maximizing E pdata(y 1:T ,d) [L(y 1:T , d)]; following Zhang et al. (2018) , we define q(θ l | d, Φ l+1 , θ l+1 ) = Weibull(k l + Φ l+1 θ l+1 , λ l ), where both k l and λ l are deterministically transformed from d using neural networks. Distinct from a usual variational auto-encoder whose inference network has a pure bottom-up structure, the inference network here has a determisticupward-stoachstic-downward ladder structure (Zhang et al., 2018) .

B THE COUPLING VECTOR:

Following Lau et al. (2017) , the a l j,t = g l h l j,t , θ l j can be implemented with a gating unit similar to a GRU (Cho et al., 2014) , describe as

EQUATION

C SGMCMC FOR RGBN-RNN:

To allow for scalable inference, we apply the topic-layer-adaptive stochastic gradient Riemannian (TLASGR) MCMC algorithm described in Cong et al. (2017a) ; Zhang et al. (2018) , which can be used to sample simplex-constrained global parameters Cong et al. (2017b) in a mini-batch based manner. It improves its sampling efficiency via the use of the Fisher information matrix (FIM)

is the written portion of the British National Corpus (Consortium, 2007) . Following the preprocessing steps in Lau et al. ( 2017), we tokenize words and sentences using Stanford CoreNLP (Klein & Manning, 2003) , lowercase all word tokens, and filter out word tokens that occur less than 10 times.

For the topic model, we additionally exclude stopwords2 and the top 0.1% most frequent words. All these corpora are partitioned into training, validation, and testing sets, whose summary statistics are provided in Table 2 of the Appendix. 8). The language model component is parameterized by LSTM l word in (3) and the coupling vectors g l described in Appendix B. We summarize in Table 3 the complexity of rGBN-RNN (ignoring all bias terms), where V denotes the vocabulary size of the language model, E the dimension of word embedding vectors, V c the size of the vocabulary of the topic model that excludes stop words, H w l the number of hidden units of the word-level LSTM at layer l (stacked-RNN language model), H s l the number of hidden units of the sentence-level RNN at layer l (variational recurrent inference network), and K l the number of topics at layer l.

Table 4 further compares the number of parameters between various RNN-based language models, where we follow the convention to ignore the word embedding layers. Some models in Table 1 are not included here, because we could not find sufficient information from their corresponding papers or code to accurately calculate the number of model parameters. Note when used for language generation at the testing stage, rGBN-RNN no longer needs its topics {Φ l }, whose parameters are hence not counted. Note the number of parameters of the topic model component is often dominated by that of the language model component. 

in (3) g l in B Φ l in (2) Π l in (2) RNN l sent in (8) f l k in (8) f l λ in (8) Layer1 O(4 × (E + H w 1 ) × H w 1 ) O(3 × (K 1 + H w 1 ) × H w 1 ) O(V c × K 1 ) O(K 1 × K 1 ) O((V c + H s 1 ) × H s 1 ) O(H s 1 ) O(K 1 × H s 1 ) Layer2 O(4 × (H w 1 + H w 2 ) × H w 2 ) O(3 × (K 2 + H w 2 ) × H w 2 ) O(K 1 × K 2 ) O(K 2 × K 2 ) O((H s 1 + H s 2 ) × H s 2 ) O(H s 2 ) O(K 2 × H s 2 ) Layer3 O(4 × (H w 2 + H w 3 ) × H w 3 ) O(3 × (K 3 + H w 3 ) × H w 3 ) O(K 2 × K 3 ) O(K 3 × K 3 ) O((H s 2 + H s 3 ) × H s 3 ) O(H s 3 ) O(K 3 × H s 3 )

3. generated sentence::

we are all convinced that the wife and husband agree to go to the police academy to try and save the day .

29 generated sentence: i must say this is a very well constructed film , and to my name , the music , as also as an adventure movie .

this movie is a horrible bad movie ! overall i just rented it with me and mad again ! 1 generated sentence: for an a small studio feature film , i feel this was a script just a tad too horror revolving around men raping women and locals . 10 generated sentence: the broadway , singing , the acting , the utter lack of thrill , refuses for you if you want it to make fun of it .

13 generated sentence: i hope that someone in the world can make it through , say , the actors and the budget greatness of solondz movie .

13-1-26 generated sentence: the plot and the acting were all so horrible and the script was overly melodramatic .

13-1-3 generated sentence::

the educational situation for the debates , to the right as to the implementation of the student attitudes , and to the interests of all existing social services to decide .

13-10-29 generated sentence::

the story is very interesting , and the movie is well crafted , it runs a couple of years and that 's what it 's all about .

13-10-21 generated sentence: nothing in this movie makes sense in the beginning , and the script for this movie is so ridiculous . 12 times kind series making bit found budget world a good example of the poor would be lodge with the educated counsellor if the lea have no regional governors .

how we get to know what the need is for the <unk> to consider in considering that our right to think of the crucial outcome which we were to give account of the public and civil society .

15 generated sentence: the advance of the educational survey on agreement highlighted these principles and many of the other major obstacles to effective compliance .

15-8-7 generated sentence: the school was found into the property exchanges for further subsistence changes , or the existence of a deduction of added discontent with the prime minister .

15-8-86 generated sentence: the educational situation for the debates , to the right as to the implementation of the student attitudes , and to the interests of all existing social services to decide .

15-73-21 generated sentence::

this election is said to have been contested of the high islam that dragged the government on the peril of the old janata alliance and generally seen onesixth of voters in the european .

15-73-28 generated sentence: the second part of the aid is to demonstrate that the practical strategy of the association is to be negotiated by the general secretary of the government .

the school is considering what the society thinks it is .

on the reforms such as the extent to which the administration might have been divided by the recent enactment of the alarm it had entrusted staff at all politicians to allow a legal order on it .

as a civil cabinet for the present processing authority at the national assembly , described the reforms as not an opportunity to compel the sovereign to appreciate .

28 generated sentence: the government was to continue to attempt to establish a meeting with france , but it in turn of its motivation must be lost away . Left panel is BLEU-3 and right is BLEU-4, and a better BLEU score would fall within the lower right corner, where black point represents mean value and circles with different colors denote the elliptical surface of probability of BLEU in a two-dimensional space.

:

https://ibm.ent.box.com/s/ls61p8ovc1y87w45oa02zink2zl7l6z4

We use Mallet's stopword list: https://github.com/mimno/Mallet/tree/master/stoplists.

Figures and Tables:

Figure 2: BLEU scores of different methods for BNC. x-axis denotes test-BLEU, y-axis self-BLEU, and a better BLEU score would fall within the lower right corner.

Figure 4: Topics and their temporal trajectories inferred by a three-hidden-layer rGBN-RNN from the APNEWS dataset, and the generated sentences under topic guidance (best viewed in color). Top words of each topic at layer 3, 2, 1 are shown in orange, yellow and blue boxes respectively, and each sentence is shown in a dotted line box labeled with the corresponding topic index. Sentences generated with a combination of topics in different layers are at the bottom of the figure.

Figure 5: Examples of generated sentences and paragraph conditioned on a document from APNEWS (green denotes novel words, blue the key words in document and generated sentences.)

Figure 6: Topics and their temporal trajectories inferred by a three-hidden-layer rGBN-RNN from the IMDB dataset, and the generated sentences under topic guidance (best viewed in color). Top words of each topic are shown in orange, yellow and blue box, and each sentence is shown in a dotted line box labeled with the corresponding topic index. Sentences generated with a combination of topics in different layers are at the bottom of the figure.

Figure 7: Topics and their temporal trajectories inferred by a three-hidden-layer rGBN-RNN from the BNC dataset, and the generated sentences under topic guidance (best viewed in color). Top words of each topic are shown in orange, yellow and blue box, and each sentence is shown in a dotted line box labeled with the corresponding topic index. Sentences generated with a combination of topics in different layers are at the bottom of the figure.

Figure 8: BLEU scores of different methods for IMDB. x-axis denotes test-BLEU, and y-axis self-BLEU. Left panel is BLEU-3 and right is BLEU-4, and a better BLEU score would fall within the lower right corner, where black point represents mean value and circles with different colors denote the elliptical surface of probability of BLEU in a two-dimensional space.

Comparison of perplexity on three different datasets.

Table content: <table><tr><td>Model</td><td>LSTM Size</td><td>Topic Size</td><td colspan="2">Perplexity APNEWS IMDB</td><td>BNC</td></tr><tr><td>LCLM (Tian &amp; Cho, 2016)</td><td>600 900-900</td><td>--</td><td>54.18 50.63</td><td>67.78 67.86</td><td>96.50 87.77</td></tr><tr><td>LDA+LSTM (Lau et al., 2017)</td><td>600 900-900</td><td>100 100</td><td>55.52 50.75</td><td>69.64 63.04</td><td>96.50 87.77</td></tr><tr><td>TopicRNN (Dieng et al., 2017)</td><td>600 900-900</td><td>100 100</td><td>54.54 50.24</td><td>67.83 61.59</td><td>93.57 84.62</td></tr><tr><td>TDLM (Lau et al., 2017)</td><td>600 900-900</td><td>100 100</td><td>52.75 48.97</td><td>63.45 59.04</td><td>85.99 81.83</td></tr><tr><td>TCNLM (Wang et al., 2018)</td><td>600 900-900</td><td>100 100</td><td>52.63 47.81</td><td>62.64 56.38</td><td>86.44 80.14</td></tr><tr><td>TGVAE (Wang et al., 2019)</td><td>600</td><td>50</td><td>48.73</td><td>57.11</td><td>87.86</td></tr><tr><td/><td>600</td><td>-</td><td>64.13</td><td>72.14</td><td>102.89</td></tr><tr><td>basic-LSTM (Hochreiter &amp; Schmidhuber, 1997)</td><td>900-900</td><td>-</td><td>58.89</td><td>66.47</td><td>94.23</td></tr><tr><td/><td>900-900-900</td><td>-</td><td>60.13</td><td>65.16</td><td>95.73</td></tr><tr><td/><td>600</td><td>100</td><td>47.42</td><td>57.01</td><td>86.39</td></tr><tr><td>GBN-RNN</td><td>600-512</td><td>100-80</td><td>44.64</td><td>55.42</td><td>82.95</td></tr><tr><td/><td colspan="2">600-512-256 100-80-50</td><td>44.35</td><td>54.53</td><td>80.25</td></tr><tr><td/><td>600</td><td>100</td><td>46.35</td><td>55.76</td><td>81.94</td></tr><tr><td>rGBN-RNN</td><td>600-512</td><td>100-80</td><td>43.26</td><td>53.82</td><td>80.25</td></tr><tr><td/><td colspan="2">600-512-256 100-80-50</td><td>42.71</td><td>51.36</td><td>79.13</td></tr></table>

Summary statistics for the datasets. RNN consists of both language model and topic model components. For the topic model component, there are the global parameters of rGBN (decoder), including {Φ l , Π l } L

Table content: <table><tr><td>Dataset</td><td>Vocubalry LM TM</td><td colspan="3">Training Docs Sents Tokens</td><td>Docs</td><td>Validation Sents</td><td>Tokens</td><td>Docs</td><td>Testing Sents</td><td>Tokens</td></tr><tr><td colspan="2">APNEWS 34231 32169</td><td>50K</td><td>0.8M</td><td>15M</td><td>2K</td><td>33K</td><td>0.6M</td><td>2K</td><td>32K</td><td>0.6M</td></tr><tr><td>IMDB</td><td>36009 34925</td><td>75K</td><td>1.1M</td><td>20M</td><td colspan="2">12.5K 0.18M</td><td>0.3M</td><td colspan="2">12.5K 0.18M</td><td>0.3M</td></tr><tr><td>BNC</td><td>43703 41552</td><td>15K</td><td>1M</td><td>18M</td><td>1K</td><td>57K</td><td>1M</td><td>1K</td><td>66K</td><td>1M</td></tr><tr><td colspan="4">E COMPLEXITY OF RGBN-RNN</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td colspan="11">The proposed rGBN-l=1</td></tr><tr><td colspan="11">in (2) , and the parameters of the variational recurrent inference network (encoder), consisting of</td></tr><tr><td colspan="2">RNN l sent , f l k , and f l λ in (</td><td/><td/><td/><td/><td/><td/><td/><td/><td/></tr></table>

Complexity of the three-layer rGBN-RNN.

Table content: <table><tr><td>Component</td><td>Language Model</td><td>Topic Model</td></tr><tr><td>Param</td><td>LSTM l word</td><td/></tr></table>

Comparison of the number of parameters of different models when used for language generation.

Table content: <table><tr><td>Model</td><td>LSTM Size</td><td>Topic Size</td><td colspan="3"># LM Param #TM Param # All Param</td></tr><tr><td>TDLM (Lau et al., 2017)</td><td>600 900-900</td><td>100 100</td><td>3.35M 13.38M</td><td>0.019M 0.019M</td><td>3.37M 13.40M</td></tr><tr><td/><td>600</td><td>-</td><td>2.16M</td><td>-</td><td>2.16M</td></tr><tr><td>basic-LSTM (Hochreiter &amp; Schmidhuber, 1997)</td><td>900-900</td><td>-</td><td>10.80M</td><td>-</td><td>10.80M</td></tr><tr><td/><td>900-900-900</td><td>-</td><td>17.68M</td><td>-</td><td>17.68M</td></tr><tr><td/><td>600</td><td>100</td><td>3.40M</td><td>0.02M</td><td>3.42M</td></tr><tr><td>GBN-RNN</td><td>600-512</td><td>100-80</td><td>6.50M</td><td>0.04M</td><td>6.54M</td></tr><tr><td/><td colspan="2">600-512-256 100-80-50</td><td>7.20M</td><td>0.05M</td><td>7.25M</td></tr><tr><td/><td>600</td><td>100</td><td>3.40M</td><td>0.03M</td><td>3.43M</td></tr><tr><td>rGBN-RNN</td><td>600-512</td><td>100-80</td><td>6.50M</td><td>0.06M</td><td>6.56M</td></tr><tr><td/><td colspan="2">600-512-256 100-80-50</td><td>7.20M</td><td>0.07M</td><td>7.27M</td></tr></table>

Peer review (iclr2020):
The paper proposes deep recurrent topic model guided language modeling using a stacked RNN, and uses a novel variational recurrent inference network to learn the parameters. The proposed model can capture the dependence across the sentences in language generation though the recurrent latent topics. Moreover, the deep rGBN architecture provides Gamma distributed topic topic weight vectors which can be associated with every layer of the stacked RNN generating the sentence. The parameters of both the hierarchical recurrent topic model and language model are learnt using a hybrid inference algorithm combining variational inference to estimate language model and inference network parameters and MCMC to infer rGBN parameters. The effectiveness of the proposed model on the language modeling task is demonstrated on 3 datasets using Perplexity and BLEU score. The paper also provides a visual representation of the topics and their temporal trajectories. The proposed model extends previous approaches on topic guided language modeling by using deep rGBN model. Though the novelty of the model is limited, learning and inference with the proposed model is non-trivial. Further, the paper show an improvement in performance on language modeling using the proposed approach over SOTA approaches, demonstrating the significance of the proposed approach. Though the paper is relatively well written, it would have been good to explain some points on architecture and inference. It would have been better to provide the rationale behind some architectural decisions like associating 	heta^1 and g^1 as against g^3. Related to this, Figure 1 has a typo where 	heta^2 is associated with g^3. An explanation on combining all the latent representation in the RNN model used for language modeling will be helpful, though this is motivated by previous approaches. A proper explanation the TLASGR-MCMC approach for sampling from the posterior of rGBN parameters is missing in the main paper. It would be good to provide some details of this in the main paper. Experimental section compares the proposed approach against many SOTA approaches for the language modeling task. It would have been good to provide a quantitive evaluation of the topic modeling task also in addition to demonstrating them qualitatively.