Recurrent neural network grammars (RNNG) are generative models of language which jointly model syntax and surface structure by incrementally generating a syntax tree and sentence in a top-down, left-to-right order. Supervised RNNGs achieve strong language modeling and parsing performance, but require an annotated corpus of parse trees. In this work, we experiment with unsupervised learning of RNNGs. Since directly marginal-izing over the space of latent trees is intractable, we instead apply amortized variational inference. To maximize the evidence lower bound, we develop an inference network parameterized as a neural CRF constituency parser. On language modeling, unsupervised RNNGs perform as well their supervised counterparts on benchmarks in English and Chinese. On constituency grammar induction, they are competitive with recent neural language models that induce tree structures from words through attention mechanisms. 1 Introduction Recurrent neural network grammars (RNNGs) (Dyer et al., 2016) model sentences by first generating a nested, hierarchical syntactic structure which is used to construct a context representation to be conditioned upon for upcoming words. Supervised RNNGs have been shown to outperform standard sequential language models, achieve excellent results on parsing (Dyer et al., 2016; Kuncoro et al., 2017), better encode syntactic properties of language (Kuncoro et al., 2018), and correlate with electrophysiological responses in the human brain (Hale et al., 2018). However, these all require annotated syntactic trees for training. In this work, we explore unsupervised learning of recurrent neural network grammars for language modeling and grammar induction. Work done while the first author was an intern at DeepMind. Code available at https://github.com/harvardnlp/urnng The standard setup for unsupervised structure learning is to define a generative model p  ( x , z ) over observed data x (e.g. sentence) and unobserved structure z (e.g. parse tree, part-of-speech sequence), and maximize the log marginal likelihood log p  ( x ) = log (cid:80) z p  ( x , z ) . Successful approaches to unsupervised parsing have made strong conditional independence assumptions (e.g. context-freeness) and employed auxiliary objectives (Klein and Manning, 2002) or priors (John-son et al., 2007). These strategies imbue the learning process with inductive biases that guide the model to discover meaningful structures while allowing tractable algorithms for marginalization; however, they come at the expense of language modeling performance, particularly compared to sequential neural models that make no independence assumptions. Like RNN language models, RNNGs make no independence assumptions. Instead they encode structural bias through operations that compose linguistic constituents. The lack of independence assumptions contributes to the strong language modeling performance of RNNGs, but make unsupervised learning challenging. First, marginalization is intractable. Second, the biases imposed by the RNNG are relatively weak compared to those imposed by models like PCFGs. There is little pressure for non-trivial tree structure to emerge during unsupervised RNNG (URNNG) learning. In this work, we explore a technique for handling intractable marginalization while also injecting inductive bias. Specifically we employ amortized variational inference (Kingma and Welling, 2014; Rezende et al., 2014; Mnih and Gregor, 2014) with a structured inference network. Variational inference lets us tractably optimize a lower bound on the log marginal likelihood, while employing a structured inference network encourages non-trivial structure. In particular, a conditional random field (CRF) constituency parser (Finkel et al., 2008; Durrett and Klein, 2015), which makes significant independence assumptions, acts as a guide on the generative model to learn meaningful trees through regularizing the posterior (Ganchev et al., 2010). We experiment with URNNGs on English and Chinese and observe that they perform well as language models compared to their supervised counterparts and standard neural LMs. In terms of grammar induction, they are competitive with recently-proposed neural architectures that discover tree-like structures through gated attention (Shen et al., 2018). Our results, along with other recent work on joint language modeling/structure learning with deep networks (Shen et al., 2018, 2019; Wiseman et al., 2018; Kawakami et al., 2018), suggest that it is possible learn generative models of language that model the underlying data well (i.e. assign high likelihood to held-out data) and at the same time induce meaningful linguistic structure. We use x = [ x 1 , . . . , x T ] to denote a sentence of length T , and z  ZT to denote an unlabeled binary parse tree over a sequence of length T , represented as a a binary vector of length 2 T  1 . Here 0 and 1 correspond to SHIFT and REDUCE actions, explained below. 1 Figure 1 presents an overview of our approach. An RNNG defines a joint probability distribution p  ( x , z ) over sentences x and parse trees z . We consider a simplified version of the original RNNG (Dyer et al., 2016) by ignoring constituent labels and only considering binary trees. The RNNG utilizes an RNN to parameterize a stack data structure (Dyer et al., 2015) of partially-completed constituents to incrementally build the parse tree while generating terminals. Using the current stack representation, the model samples an action ( SHIFT or REDUCE ): SHIFT generates a terminal symbol, i.e. word, and shifts it onto the stack, 2 REDUCE pops the last two elements off the stack, composes them, and shifts the composed 1 The cardinality of ZT  { 0 , 1 } 2 T  1 is given by the ( T  1) -th Catalan number, |Z T | = (2 T  2)! T !( T  1)! 2 A better name for SHIFT would be GENERATE (as in Dyer et al. (2016)), but we use SHIFT to emphasize similarity with the shift-reduce parsing. Formally, let S = [( 0 , 0 )] be the initial stack. Each item of the stack will be a pair, where the first element is the hidden state of the stack LSTM, and the second element is an input vector, described below. We use top( S ) to refer to the top pair in the stack. The push and pop operations are de-fined imperatively in the usual way. At each time step, the next action z t ( SHIFT or REDUCE ) is sampled from a Bernoulli distribution parameterized in terms of the current stack representation. Letting ( h prev , g prev ) = top( S ) , we have z t  Bernoulli( p t ) , p t =  ( w (cid:62) h prev + b ) . Subsequent generation depend on z t :  If z t = 0 ( SHIFT ), the model first generates a terminal symbol via sampling from a categorical distribution whose parameters come from an affine transformation and a softmax, x  softmax( Wh prev + b ) . Then the generated terminal is shifted onto the stack using a stack LSTM, h next = LSTM( e x , h prev ) , push( S, ( h next , e x )) , where e x is the word embedding for x . If z t = 1 ( REDUCE ), we pop the last two elements off the stack, ( h r , g r ) = pop( S ) , ( h l , g l ) = pop( S ) , and obtain a new representation that combines the left/right constituent representations using a tree LSTM (Tai et al., 2015; Zhu et al., 2015), g new = TreeLSTM( g l , g r ) . Note that we use g l and g r to obtain the new representation instead of h l and h r . 3 We then update the stack using g new , ( h prev , g prev ) = top( S ) , h new = LSTM( g new , h prev ) , push( S, ( h new , g new )) . The generation process continues until an end-of-sentence symbol is generated. The parameters  of the generative model are w , b, W , b , and the parameters of the stack/tree LSTMs. For a sentence x = [ x 1 , . . . , x T ] of length T , the binary parse tree is given by the binary vector z = [ z 1 , . . . , z 2 T  1 ] . 4 The joint log likelihood decomposes as a sum of terminal/action log likelihoods, log p  ( x , z ) = T (cid:88) t =1 log p  ( x t | x <t , z <n ( t ) ) (cid:124) (cid:123)(cid:122) (cid:125) log p  ( x | z ) + 2 T  1 (cid:88) j =1 log p  ( z j | x <m ( j ) , z <j ) (cid:124) (cid:123)(cid:122) (cid:125) log p  ( z | x < z ) , (1) where z <n ( t ) refers to all actions before generating the t -th word, and similarly x <m ( j ) refers to all words generated before taking the j -th action. For brevity, from here on we will use log p  ( x | z ) to refer to the first term (terminal log likelihood) and log p  ( z | x < z ) to refer to the second term (action log likelihood) in the above decomposition. 5 3 The update equations for the tree LSTM (and the stack LSTM) also involve cell states in addition to the hidden states. To reduce notational clutter we do not explicitly show the cell states and instead subsume them into g . If one (or both) of the inputs to the tree LSTM is a word embedding, the associated cell state is taken to be zero. See Tai et al. (2015) for the exact parameterization. 4 As it stands, the support of z is { 0 , 1 } 2 T  1 , all binary vectors of length 2 T  1 . To restrict our distribution to ZT (binary vectors which describe valid trees), we constrain z t to be valid at each time step, which amounts to deterministically choosing z t = 0 ( SHIFT ) if there are fewer than two elements (not counting the initial zero tuple) on the stack. 5 The action log likelihood is the sum of log conditional priors, which is obviously different from the unconditional log prior log p  ( z ) = log (cid:80) x p  ( x , z ) . In the supervised case where ground-truth z is available, we can straightforwardly perform gradient-based optimization to maximize the joint log likelihood log p  ( x , z ) . In the unsupervised case, the standard approach is to maximize the log marginal likelihood, log p  ( x ) = log (cid:88) z (cid:48) Z T p  ( x , z (cid:48) ) . However this summation is intractable because z t fully depends on all previous actions [ z 1 , . . . , z t  1 ] . Even if this summation were tractable, it is not clear that meaningful latent structures would emerge given the lack of explicit independence assumptions in the RNNG (e.g. it is clearly not context-free). We handle these issues with amortized variational inference. Amortized variational inference (Kingma and Welling, 2014) defines a trainable inference network  that parameterizes q  ( z | x ) , a variational posterior distribution, in this case over parse trees z given the sentence x . This distribution is used to form an evidence lower bound (ELBO) on the log marginal likelihood, ELBO( ,  ; x ) = E q  ( z | x ) (cid:20) log p  ( x , z ) q  ( z | x ) (cid:21) . We maximize the ELBO with respect to both model parameters  and inference network parameters  . The ELBO is still intractable to calculate exactly, but this formulation will allow us to obtain unbiased gradient estimators based on Monte Carlo sampling. Thus,  is trained to match the variational posterior q  ( z | x ) to the true posterior p  ( z | x ) , but  is also trained to match the true posterior to the variational posterior. Indeed, there is some evidence to suggest that generative models trained with amortized variational inference (i.e. variational autoencoders) learn posterior distributions that are close to the variational family (Cremer et al., 2018). We can use this to our advantage with an inference network that injects inductive bias. We propose to do this by using a context-free model for the inference network, in particular, a neural CRF parser (Durrett and Klein, 2015). This choice can seen as a form of posterior regularization that limits posterior flexibility of the overly powerful RNNG generative model. The parameterization of span scores is similar to recent works (Wang and Chang, 2016; Stern et al., 2017; Kitaev and Klein, 2018): we add position embeddings to word embeddings and run a bidirectional LSTM over the input representations to obtain the forward [  h 1 , . . . ,  h T ] and backward [  h 1 , . . . ,  h T ] hidden states. The score s ij  R for a constituent spanning x i to x j is given by, s ij = MLP([  h j +1   h i ;  h i  1   h j ]) . Letting B be the binary matrix representation of a tree ( B ij = 1 means there is a constituent spanning x i and x j ), the CRF parser defines a distribution over binary trees via the Gibbs distribution, q  ( B | x ) = 1 ZT ( x ) exp (cid:16) (cid:88) i  j B ij s ij (cid:17) , where ZT ( x ) is the partition function, ZT ( x ) = (cid:88) B (cid:48) B T exp (cid:16) (cid:88) i  j B (cid:48) ij s ij (cid:17) , and  denotes the parameters of the inference network (i.e. the bidirectional LSTM and the MLP). Calculating ZT ( x ) requires a summation over an exponentially-sized set BT  { 0 , 1 } T  T , the set of all binary trees over a length T sequence. However we can perform the summation in O ( T 3 ) using the inside algorithm (Baker, 1979), shown in 6 While it has a similar goal, this formulation differs the from posterior regularization as formulated by Ganchev et al. (2010), which constrains the distributional family via linear constraints on posterior expectations. In our case, the conditional independence assumptions in the CRF lead to a curved exponential family where the vector of natural parameters has fewer dimensions than the vector of sufficient statistics of the full exponential family. This curved exponential family is a subset of the marginal polytope of the full exponential family, but it is an intersection of both linear and nonlinear manifolds, and therefore cannot be characterized through linear constraints over posterior expectations. 7 In preliminary experiments, we also attempted to learn latent trees with a transition-based parser (which does not make explicit independence assumptions) that looks at the entire sentence. However we found that under this setup, the inference network degenerated into a local minimum whereby it always generated left-branching trees despite various optimization strategies. Williams et al. (2018) observe a similar phenomenon in the context of learning latent trees for classification tasks. However Li et al. (2019) find that it is possible use a transition-based parser as the inference network for dependency grammar induction, if the inference network is constrained via posterior regularization (Ganchev et al., 2010) based on universal syntactic rules (Naseem et al., 2010). Algorithm 1. This computation is itself differentiable and amenable to gradient-based optimization. Finally, letting f : BT  ZT be the bijection between the binary tree matrix representation and a sequence of SHIFT / REDUCE actions, the inference network defines a distribution over ZT via q  ( z | x ) (cid:44) q  ( f  1 ( z ) | x ) . the ELBO, A Monte Carlo estimate for the gradient with respect to  is   ELBO( ,  ; x )  1 KK (cid:88) k =1   log p  ( x , z ( k ) ) , with samples z (1) , . . . , z ( K ) from q  ( z | x ) . E q  ( z | x ) [log p  ( x , z )] + H [ q  ( z | x )] , where H [ q  ( z | x )] = E q  ( z | x ) [  log q  ( z | x )] is the entropy of the variational posterior. Sampling uses the intermediate values calculated during the inside algorithm to sample split points recursively (Goodman, 1998; Finkel et al., 2006), as shown in Algorithm 2. The gradient with respect to  involves two parts. The entropy term H [ q  ( z | x )] can be calculated exactly in O ( T 3 ) , again using the intermediate values from the inside algorithm (see Algorithm 3). 8 Since each step of this dynamic program is differentiable, we can obtain the gradient   H [ q  ( z | x )] using automatic differentation. 9 An estimator for the gradient with respect to E q  ( z | x ) [log p  ( x , z )] is obtained via the score function gradient estimator (Glynn, 1987; Williams, 1992),   E q  ( z | x ) [log p  ( x , z )] = E q  ( z | x ) [log p  ( x , z )   log q  ( z | x )]  1 KK (cid:88) k =1 log p  ( x , z ( k ) )   log q  ( z ( k ) | x ) . 8 We adapt the algorithm for calculating tree entropy in PCFGs from Hwa (2000) to the CRF case. 9   H [ q  ( z | x )] can also be computed using the insideoutside algorithm and a second-order expectation semiring (Li and Eisner, 2009), which has the same asymptotic runtime complexity but generally better constants. The above estimator is unbiased but typically suffers from high variance. To reduce variance, we use a control variate derived from an average of the other samples' joint likelihoods (Mnih and Rezende, 2016), yielding the following estimator, 1 KK (cid:88) k =1 (log p  ( x , z ( k ) )  r ( k ) )   log q  ( z ( k ) | x ) , where r ( k ) = 1 K  1 (cid:80) j (cid:54) = k log p  ( x , z ( j ) ) . This control variate worked better than alternatives such as estimates of baselines from an auxiliary network (Mnih and Gregor, 2014; Deng et al., 2018) or a language model (Yin et al., 2018). For English we use the Penn Treebank (Marcus et al., 1993, PTB) with splits and preprocessing from Dyer et al. (2016) which retains punctuation and replaces singleton words with Berkeley parser's mapping rules, resulting in a vocabulary of 23,815 word types. 10 Notably this is much larger than the standard PTB LM setup from Mikolov et al. (2010) which uses 10K types. 11 Also different from the LM setup, we model each sentence separately instead of carrying information across sentence boundaries, as the RNNG is a generative model of sentences. Hence our perplexity numbers are not comparable to the PTB LM results (Melis et al., 2018; Merity et al., 2018; Yang et al., 2018). corpus (Chelba et al., 2013). We randomly sample 1M sentences for training and 2K sentences for validation/test, and limit the vocabulary to 30K word types. While still a subset of the full corpus (which has 30M sentences), this dataset is two orders of magnitude larger than PTB. Experiments on Chinese utilize version 5.1 of the Chinese Penn Treebank (CTB) (Xue et al., 2005), with the same splits as in Chen and Manning (2014). Singleton words are replaced with a single (cid:104) UNK (cid:105) token, resulting in a vocabulary of 17,489 word types. 3.2 Training and Hyperparameters The stack LSTM has two layers with input/hidden size equal to 650 and dropout of 0.5. The tree LSTM also has 650 units. The inference network uses a one-layer bidirectional LSTM with 256 hidden units, and the MLP (to produce span scores s ij for i  j ) has a single hidden layer with a ReLU nonlinearity followed by layer normalization (Ba et al., 2016) and dropout of 0.5. We share word embeddings between the generative model and the inference network, and also tie weights between the input/output word embeddings (Press and Wolf, 2016). Optimization of the model itself required standard techniques for avoiding posterior collapse in VAEs. 12 We warm-up the ELBO objective by linearly annealing (per batch) the weight on the conditional prior log p  ( z | x < z ) and the entropy H [ q  ( z | x )] from 0 to 1 over the first two epochs (see equation (1) for definition of log p  ( z | x < z ) ). This is analogous to KL-annealing in VAEs with continuous latent variables (Bowman et al., 2016; Snderby et al., 2016). We train for 18 epochs (enough for convergence for all models) with a batch size of 16 and K = 8 samples for the Monte Carlo gradient estimators. The generative model is optimized with SGD with learning rate equal to 1, 12 Posterior collapse in our context means that q  ( z | x ) always produced trivial (always left or right branching) trees. except for the affine layer that produces a distribution over the actions, which has learning rate 0.1. Gradients of the generative model are clipped at 5. The inference network is optimized with Adam (Kingma and Ba, 2015) with learning rate 0.0001,  1 = 0 . 9 ,  2 = 0 . 999 , and gradient clipping at 1. As Adam converges significantly faster than SGD (even with a much lower learning rate), we stop training the inference network after the first two epochs. Initial model parameters are sampled from U [  0 . 1 , 0 . 1] . The learning rate starts decaying by a factor of 2 each epoch after the first epoch at which validation performance does not improve, but this learning rate decay is not triggered for the first eight epochs to ensure adequate training. We use the same hyperparameters/training setup for both PTB and CTB. For experiments on (the subset of) the one billion word corpus, we use a smaller dropout rate of 0.1. The baseline RNNLM also uses the smaller dropout rate. All models are trained with an end-of-sentence token, but for perplexity calculation these tokens are not counted to be comparable to prior work (Dyer et al., 2016; Kuncoro et al., 2017; Buys and Blunsom, 2018). To be more precise, the inference network does not make use of the end-of-sentence token to produce parse trees, but the generative model is trained to generate the end-of-sentence token after the final REDUCE operation. We compare the unsupervised RNNG (URNNG) against several baselines: (1) RNNLM, a standard RNN language model whose size is the same as URNNG's stack LSTM; (2) Parsing Reading Predict Network (PRPN) (Shen et al., 2018), a neural language model that uses gated attention layers to embed soft tree-like structures into a neural network (and among the current state-of-the-art in grammar induction from words on the full cor-pus); (3) RNNG with trivial trees (left branching, right branching, random); (4) supervised RNNG trained on unlabeled, binarized gold trees. 13 Note that the supervised RNNG also trains a discriminative parser q  ( z | x ) (alongside the generative model p  ( x , z ) ) in order to sample parse forests for perplexity evaluation (i.e. importance sam-pling). This discriminative parser has the same ar-13 We use right branching binarizationMatsuzaki et al. (2005) find that differences between various binarization schemes have marginal impact. Our supervised RNNG therefore differs the original RNNG, which trains on non-binarized trees and does not ignore constituent labels. chitecture as URNNG's inference network. For all models, we perform early stopping based on validation perplexity. Table 1 shows perplexity for the different models on PTB/CTB. As a language model URNNG outperforms an RNNLM and is competitive with the supervised RNNG. 14 The left branching baseline performs poorly, implying that the strong performance of URNNG/RNNG is not simply due to the additional depth afforded by the tree LSTM composition function (a left branching tree, which always performs REDUCE when possible, is the deepest model). The right branching baseline is essentially equivalent to an RNNLM and hence performs similarly. We found PRPN with default hyperparameters (which obtains a perplexity of 62.0 in the PTB setup from Mikolov et al. (2010)) to not perform well, but tuning hyperparameters improves performance. 15 The supervised RNNG performs well as a language model, despite being trained on the joint (rather than marginal) likelihood objective. 16 This indicates that explicit 14 For RNNG and URNNG we estimate the log marginal likelihood (and hence, perplexity) with K = 1000 importance-weighted samples, log p  ( x )  log (cid:16) 1 K (cid:80) Kk =1 log p ( x , z ( k ) ) q  ( z ( k ) | x ) (cid:17) . During evaluation only, we also flatten q  ( z | x ) by dividing span scores s ij by a temperature term 2 . 0 before feeding it to the CRF. 15 Using the code from https://github.com/yikangshen/ PRPN, we tuned model size, initialization, dropout, learning rate, and use of batch normalization. 16 RNNG is trained to maximize log p  ( x , z ) while URNNG is trained to maximize (a lower bound on) the language modeling objective log p  ( x ) . modeling of syntax helps generalization even with richly-parameterized neural models. Encouraged by these observations, we also experiment with a hybrid approach where we train a supervised RNNG first and continue fine-tuning the model (including the inference network) on the URNNG objective (RNNG  URNNG in Table 1). 17 This approach results in nontrivial perplexity improvements, and suggests that it is potentially possible to improve language models with supervision on parsed data. In Figure 2 we show perplexity by sentence length. We find that a standard language model (RNNLM) is better at modeling short sentences, but underperforms models that explicitly take into account structure (RNNG/URNNG) when the sentence length is greater than 10. Table 2 (top) compares our results against prior work on this version of the PTB, and Table 2 (bot-tom) shows the results on a 1M sentence subset of the one billion word corpus, which is two orders of magnitude larger than PTB. On this larger dataset URNNG still improves upon the RNNLM. We also trained an RNNG (and RNNG  URNNG) on this dataset by parsing the training set with the self-attentive parser from Kitaev and Klein (2018). 18 These models improve upon the RNNLM but not the URNNG, potentially highlighting the limitations of using predicted trees for supervising RNNGs. Table 1 also shows the F 1 scores for grammar induction. Note that we induce latent trees directly from words on the full dataset. 19 For RNNG/URNNG we obtain the highest scoring 17 We fine-tune for 10 epochs and use a smaller learning rate of 0.1 for the generative model. 18 To parse the training set we use the benepar en2 model from https://github.com/nikitakit/self-attentive-parser, which obtains an F 1 score of 95.17 on the PTB test set. 19 Past work on grammar induction usually train/evaluate on short sentences and also assume access to gold POS tags (Klein and Manning, 2002; Smith and Eisner, 2004; Bod, 2006). However more recent works do train directly words (Jin et al., 2018; Shen et al., 2018; Drozdov et al., 2019). tree from q  ( z | x ) through the Viterbi inside (i.e. CKY) algorithm. We calculate unlabeled F 1 using evalb , which ignores punctuation and discards trivial spans (width-one and sentence spans). 20 Since we compare F 1 against the original, non-binarized trees (per convention), F 1 scores of models using oracle binarized trees constitute the upper bounds. We confirm the replication study of Htut et al. (2018) and find that PRPN is a strong model for grammar induction. URNNG performs on par with PRPN on English but PRPN does better on Chinese; both outperform right branching baselines. Table 3 further analyzes the learned trees and shows the F 1 score of URNNG trees against 20 Available at https://nlp.cs.nyu.edu/evalb/. We evaluate with COLLINS.prm parameter file and LABELED option equal to 0. We observe that the setup for grammar induction varies widely across different papers: lexicalized vs. unlex-icalized; use of punctuation vs. not; separation of train/test sets; counting sentence-level spans for evaluation vs. ignoring them; use of additional data; length cutoff for training/evaluation; corpus-level F 1 vs. sentence-level F 1 ; and, more. In our survey of twenty or so papers, almost no two papers were identical in their setup. Such variation makes it difficult to meaningfully compare models across papers. Hence, we report grammar induction results mainly for the models and baselines considered in the present work. other trees (left), and the recall of URNNG/PRPN trees against ground truth constituents (right). We find that trees induced by URNNG and PRPN are quite different; URNNG is more sensitive to SBAR and VP, while PRPN is better at identifying NP. While left as future work, this naturally suggests a hybrid approach wherein the intersection of constituents from URNNG and PRPN is used to create a corpus of partially annotated trees, which can be used to guide another model, e.g. via posterior regularization (Ganchev et al., 2010) or semi-supervision (Hwa, 1999). Finally, Table 4 compares our results using the same evaluation setup as in Drozdov et al. (2019), which differs considerably from our setup. Table 5 shows some standard metrics related to the learned generative model/inference network. The reconstruction perplexity based on E q  ( z | x ) [log p  ( x | z )] is much lower than regular perplexity, and further, the Kullback-Leibler divergence between the conditional prior and the variational posterior, given by E q  ( z | x ) (cid:20) log q  ( z | x ) p  ( z | x < z ) (cid:21) , PTB CTB RNNG URNNG RNNG URNNG PPL 88.7 90.6 193.1 195.7 Recon. is highly nonzero. (See equation (1) for definitions of log p  ( x | z ) and log p  ( z | x < z ) ). This indicates that the latent space is being used in a meaningful way and that there is no posterior collapse (Bowman et al., 2016). As expected, the entropy of the variational posterior is much lower than the entropy of the conditional prior, but there is still some uncertainty in the posterior. 4.4 Syntactic Evaluation We perform a syntactic evaluation of the different models based on the setup from Marvin and Linzen (2018): the model is given two minimally different sentences, one grammatical and one ungrammatical, and must identify the grammatical sentence by assigning it higher probability. 21 Table 6 shows the accuracy results. Overall the supervised RNNG significantly outperforms the other models, indicating opportunities for further work in unsupervised modeling. While the URNNG does slightly outperform an RNNLM, the distribution of errors made from both models are similar, and thus it is not clear whether the out-performance is simply due to better perplexity or learning different structural biases. There are several limitations to our approach. For one, the URNNG takes considerably more time/memory to train than a standard language model due to the O ( T 3 ) dynamic program in the inference network, multiple samples to obtain low-variance gradient estimators, and dynamic computation graphs that make efficient batching 21 We modify the publicly available dataset from https:// github.com/BeckyMarvin/LM syneval to only keep sentence pairs that did not have any unknown words with respect to our vocabulary, resulting in 80K sentence pairs for evaluation. nontrivial. The model is sensitive to hyperparameters and required various optimization strategies (e.g. separate optimizers for the inference network and the generative model) to avoid posterior collapse. Finally, the URNNG also seemed to rely heavily on punctuation to identify constituents and we were unable to improve upon a right-branching baseline when training the URNNG on a version of PTB where punctuation is removed. 22 5 Related Work There has been much work on incorporating tree structures into deep models for syntax-aware language modeling, both for unconditional (Emami and Jelinek, 2005; Buys and Blunsom, 2015; Dyer et al., 2016) and conditional (Yin and Neubig, 2017; Alvarez-Melis and Jaakkola, 2017; Rabi-novich et al., 2017; Aharoni and Goldberg, 2017; Eriguchi et al., 2017; Wang et al., 2018; Gu et al., 2018) cases. These approaches generally rely on annotated parse trees during training and maximizes the joint likelihood of sentence-tree pairs. Prior work on combining language modeling and unsupervised tree learning typically embed soft, tree-like structures as hidden layers of a deep network (Cho et al., 2014; Chung et al., 2017; Shen et al., 2018, 2019). In contrast, Buys and Blun-som (2018) make Markov assumptions and perform exact marginalization over latent dependency 22 Many prior works that induce trees directly from words often employ additional heuristics based on punctuation (Seginer, 2007; Ponvert et al., 2011; Spitkovsky et al., 2013; Parikh et al., 2014), as punctuation (e.g. comma) is usually a reliable signal for start/end of constituent spans. The URNNG still has to learn to rely on punctuation, similar to recent works such as depth-bounded PCFGs (Jin et al., 2018) and DIORA (Drozdov et al., 2019). In contrast, PRPN (Shen et al., 2018) and Ordered Neurons (Shen et al., 2019) induce trees by directly training on corpus without punctuation. We also reiterate that punctuation is used during training but ignored during evaluation (except in Table 4). trees. Our work is also related to the recent line of work on learning latent trees as part of a deep model through supervision on other tasks, typically via differentiable structured hidden layers (Kim et al., 2017; Bradbury and Socher, 2017; Liu and Lapata, 2018; Tran and Bisk, 2018; Peng et al., 2018; Niculae et al., 2018; Liu et al., 2018), policy gradient-based approaches (Yogatama et al., 2017; Williams et al., 2018; Havrylov et al., 2019), or differentiable relaxations (Choi et al., 2018; Maillard and Clark, 2018). The variational approximation uses amortized inference (Kingma and Welling, 2014; Mnih and Gregor, 2014; Rezende et al., 2014), in which an inference network is used to obtain the variational posterior for each observed x . Since our inference network is structured (i.e., a CRF), it is also related to CRF autoencoders (Ammar et al., 2014) and structured VAEs (Johnson et al., 2016; Krish-nan et al., 2017), which have been used previously for unsupervised (Cai et al., 2017; Drozdov et al., 2019; Li et al., 2019) and semi-supervised (Yin et al., 2018; Corro and Titov, 2019) parsing. It is an open question as to whether explicit modeling of syntax significantly helps neural models. Strubell et al. (2018) find that supervising intermediate attention layers with syntactic heads improves semantic role labeling, while Shi et al. (2018) observe that for text classification, syntactic trees only have marginal impact. Our work suggests that at least for language modeling, incorporating syntax either via explicit supervision or as latent variables does provide useful inductive biases and improves performance. Finally, in modeling child language acquisition, the complex interaction of the parser and the grammatical knowledge being acquired is the object of much investigation (Trueswell and Gleitman, 2007); our work shows that apparently grammatical constraints can emerge from the interaction of a constrained parser and a more general grammar learner, which is an intriguing but underexplored hypothesis for explaining human linguistic biases. We thank the members of the DeepMind language team for helpful feedback. YK is supported by a Google Fellowship. AR is supported by NSF Career 1845664.
abstain abstain method method objective abstain abstain abstain abstain abstain objective abstain other abstain abstain abstain abstain abstain abstain abstain abstain objective method method abstain result abstain result method abstain method abstain method abstain other abstain abstain abstain abstain abstain method abstain abstain abstain abstain abstain other abstain abstain abstain abstain abstain other abstain abstain abstain abstain abstain abstain method abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain method abstain abstain other abstain other abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain abstain abstain method abstain result abstain abstain result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain result abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain other abstain abstain abstain abstain result result result abstain abstain abstain abstain abstain result other abstain abstain abstain abstain abstain result abstain other abstain result abstain abstain result abstain result abstain abstain abstain other abstain abstain abstain abstain abstain abstain abstain abstain abstain other abstain abstain result other abstain abstain other abstain abstain abstain abstain other abstain other abstain abstain result result other other other