In constituency parsing, refining coarse syntactic categories of treebank grammars (Charniak, 1996) into fine-grained subtypes has been proven effective in improving parsing results. Previous approaches to refining syntactic categories use tree annotations (Johnson, 1998), lexicalization (Charniak, 2000; Collins, 2003), or linguistically motivated category splitting (Klein and Manning, 2003). Matsuzaki et al. (2005)
introduce latent variable grammars, in which each syntactic category (represented by a nonterminal) is split into a fixed number of subtypes and a discrete latent variable is used to indicate the subtype of the nonterminal when it appears in a specific parse tree. Since the latent variables are not observable in treebanks, the grammar is learned using expectation-maximization.Petrov et al. (2006) present a split-merge approach to learning latent variable grammars, which hierarchically splits each nonterminal and merges ineffective splits. Petrov and Klein (2008b) further allow a nonterminal to have different splits in different production rules, which results in a more compact grammar.
Recently, neural approaches become very popular in natural language processing (NLP). An important technique in neural approaches to NLP is to represent discrete symbols such as words and syntactic categories with continuous vectors or embeddings. Since the distances between such vector representations often reflect the similarity between the corresponding symbols, this technique facilitates more informed smoothing in learning functions of symbols (e.g., the probability of a production rule). In addition, what a symbol represents may subtly depend on its context, and a continuous vector representation has the potential of representing each instance of the symbol in a more precise manner. For constituency parsing, recursive neural networksSocher et al. (2011) and their extensions such as compositional vector grammars Socher et al. (2013) can be seen as representing nonterminals in a context-free grammar with continuous vectors. However, exact inference in these models is intractable.
In this paper, we introduce latent vector grammars (LVeGs), a novel framework of grammars with fine-grained nonterminal subtypes. A LVeG associates each nonterminal with a continuous vector space that represents the set of (infinitely many) subtypes of the nonterminal. For each instance of a nonterminal that appears in a parse tree, its subtype is represented by a latent vector. For each production rule over nonterminals, a non-negative continuous function specifies the weight of any fine-grained production rule over subtypes of the nonterminals. Compared with latent variable grammars which assume a small fixed number of subtypes for each nonterminal, LVeGs assume an unlimited number of subtypes and are potentially more expressive. By having weight functions of varying smoothness for different production rules, LVeGs can also control the level of subtype granularity for different productions, which has been shown to improve the parsing accuracy Petrov and Klein (2008b). In addition, similarity between subtypes of a nonterminal can be naturally modeled by the distance between the corresponding vectors, so by using continuous and smooth weight functions we can ensure that similar subtypes will have similar syntactic behaviors.
We further present Gaussian Mixture LVeGs (GM-LVeGs), a special case of LVeGs that uses mixtures of Gaussian distributions as the weight functions of fine-grained production rules. A major advantage of GM-LVeGs is that the partition function and the expectations of fine-grained production rules can be computed using an extension of the inside-outside algorithm. This makes it possible to efficiently compute the gradients during discriminative learning of GM-LVeGs. We evaluate GM-LVeGs on part-of-speech tagging and constituency parsing on a variety of languages and corpora and show that GM-LVeGs achieve competitive results.
It shall be noted that many modern state-of-the-art constituency parsers predict how likely a constituent is based on not only local information (such as the production rules used in composing the constituent), but also contextual information of the constituent. For example, the neural CRF parser Durrett and Klein (2015) looks at the words before and after the constituent; and RNNG Dyer et al. (2016) looks at the constituents that are already predicted (in the stack) and the words that are not processed (in the buffer). In this paper, however, we choose to focus on the basic framework and algorithms of LVeGs and leave the incorporation of contextual information for future work. We believe that by laying a solid foundation for LVeGs, our work can pave the way for many interesting extensions of LVeGs in the future.
2 Latent Vector Grammars
A latent vector grammar (LVeG) considers subtypes of nonterminals as continuous vectors and associates each nonterminal with a latent vector space representing the set of its subtypes. For each production rule, the LVeG defines a weight function over the subtypes of the nonterminal involved in the production rule. In this way, it models the space of refinements of the production rule.
2.1 Model Definition
A latent vector grammar is defined as a 5-tuple , where is a finite set of nonterminal symbols, is the start symbol, is a finite set of terminal symbols such that , is a set production rules of the form where and , is a set of rule weight functions indexed by production rules in (to be defined below). In the following discussion, we consider in the Chomsky normal form (CNF) for clarity of presentation. However, it is straightforward to extend our formulation to the general case.
Unless otherwise specified, we always use capital letters for nonterminal symbols and use bold lowercase letters for their subtypes. Note that subtypes are represented by continuous vectors. For a production rule of the form , its weight function is . For a production rule of the form where , its weight function is . The weight functions should be non-negative, continuous and smooth, and hence fine-grained production rules of similar subtypes of a nonterminal would have similar weight assignments. Rule weights can be normalized such that
, which leads to a probabilistic context-free grammar (PCFG). Whether the weights are normalized or not leads to different model classes and accordingly different estimation methods. However, the two model classes are proven equivalent bySmith and Johnson (2007).
2.2 Relation to Other Models
Latent variable grammars (LVGs) (Matsuzaki et al., 2005; Petrov et al., 2006) associate each nonterminal with a discrete latent variable, which is used to indicate the subtype of the nonterminal when it appears in a parse tree. Through nonterminal-splitting and the expectation-maximization algorithm, fine-grained production rules can be automatically induced from a treebank.
We show that LVGs can be seen as a special case of LVeGs. Specifically, we can use one-hot vectors in LVeGs to represent latent variables in LVGs and define weight functions in LVeGs accordingly. Consider a production rule . In a LVG, each nonterminal is split into a number of subtypes. Suppose , , and are split into , , and subtypes respectively. is the -th subtype of , is the -th subtype of , and is the -th subtype of . is a fine-grained production rule of , where , , and
. The probabilities of all the fine-grained production rules can be represented by a rank-3 tensor. To cast the LVG as a LVeG, we require that the latent vectors in the LVeG must be one-hot vectors. We achieve this by defining weight functions that output zero if any of the input vectors is not one-hot. Specifically, we define the weight function of the production rule as:
where is the Dirac delta function, , , are one-hot vectors (which are zero everywhere with the exception of a single 1 at the -th index of , the -th index of , and the -th index of ) and is multiplied sequentially by , , and .
Compared with LVGs, LVeGs have the following advantages. While a LVG contains a finite, typically small number of subtypes for each nonterminal, a LVeG uses a continuous space to represent an infinite number of subtypes. When equipped with weight functions of sufficient complexity, LVeGs can represent more fine-grained syntactic categories and production rules than LVGs. By controlling the complexity and smoothness of the weight functions, a LVeG is also capable of representing any level of subtype granularity. Importantly, this allows us to change the level of subtype granularity for the same nonterminal in different production rules, which is similar to multi-scale grammars (Petrov and Klein, 2008b). In addition, with a continuous space of subtypes in a LVeG, similarity between subtypes can be naturally modeled by their distance in the space and can be automatically learned from data. Consequently, with continuous and smooth weight functions, fine-grained production rules over similar subtypes would have similar weights in LVeGs, eliminating the need for the extra smoothing steps that are necessary in training LVGs.
Compositional vector grammars (CVGs) (Socher et al., 2013), an extension of recursive neural networks (RNNs) Socher et al. (2011), can also be seen as a special case of LVeGs. For a production rule , a CVG can be interpreted as specifying its weight function in the following way. First, a neural network indexed by and is used to compute a parent vector . Next, the score of the parent vector is computed using a base PCFG and a vector :
where is the rule probability from the base PCFG. Then, the weight function of the production rule is defined as:
This form of weight functions in CVGs leads to point estimation of latent vectors in a parse tree, i.e., for each nonterminal in a given parse tree, only one subtype in the whole subtype space would lead to a non-zero weight of the parse. In addition, different parse trees of the same substring typically lead to different point estimations of the subtype vector at the root nonterminal. Consequently, CVGs cannot use dynamic programming for inference and hence have to resort to greedy search or beam search.
3 Gaussian Mixture LVeGs
A major challenge in applying LVeGs to parsing is that it is impossible to enumerate the infinite number of subtypes. Previous work such as CVGs resorts to point estimation and greedy search. In this section we present Gaussian Mixture LVeGs (GM-LVeGs), which use mixtures of Gaussian distributions as the weight functions in LVeGs. Because Gaussian mixtures have the nice property of being closed under product, summation, and marginalization, we can compute the partition function and the expectations of fine-grained production rules using dynamic programming. This in turn makes efficient learning and parsing possible.
In a GM-LVeG, the weight function of a production rule is defined as a Gaussian mixture containing mixture components:
where is the concatenation of the latent vectors of the nonterminals in , which denotes a fine-grained production rule of . is the -th mixture weight (the mixture weights do not necessarily sum up to 1), is the -th Gaussian distribution parameterized by mean and covariance matrix , and is the number of mixture components, which can be different for different production rules. Below we write as for brevity. Given a production rule of the form , the GM-LVeG expects and , where is the dimension of the vectors . We use the same dimension for all the subtype vectors.
For the sake of computational efficiency, we use diagonal or spherical Gaussian distributions, whose covariance matrices are diagonal, so that the inverse of covariance matrices in Equation 15–16 can be computed in linear time. A spherical Gaussian has a diagonal covariance matrix where all the diagonal elements are equal, so it has fewer free parameters than a diagonal Gaussian and results in faster learning and parsing. We empirically find that spherical Gaussians lead to slightly better balance between the efficiency and the parsing accuracy than diagonal Gaussians.
The goal of parsing is to find the most probable parse tree with unrefined nonterminals for a sentence of words . This is formally defined as:
where denotes the set of parse trees with unrefined nonterminals for . In a PCFG, can be found using dynamic programming such as the CYK algorithm. However, parsing becomes intractable with LVeGs, and even with LVGs, the special case of LVeGs.
A common practice in parsing with LVGs is to use max-rule parsing Petrov et al. (2006); Petrov and Klein (2007). The basic idea of max-rule parsing is to decompose the posteriors over parses into the posteriors over production rules approximately. This requires calculating the expected counts of unrefined production rules in parsing the input sentence. Since Gaussian mixtures are closed under product, summation, and marginalization, in GM-LVeGs the expected counts can be calculated using the inside-outside algorithm in the following way. Given a sentence , we first calculate the inside score and outside score for a nonterminal over a span using Equation 6 and Equation 1 in Table 1 respectively. Note that both and are mixtures of Gaussian distributions of the subtype vector . Next, using Equation 8 in Table 1, we calculate the score (), where represents a production rule with nonterminals , , and spanning words , , and respectively in the sentence . Then the expected count (or posterior) of is calculated as:
where is the inside score for the start symbol spanning the whole sentence . After calculating all the expected counts, we can use the Max-Rule-Product algorithm (Petrov and Klein, 2007) for parsing, which returns a parse with the highest probability that all the production rules are correct. Its objective function is given by
where ranges over all the 4-tuples in the parse tree . This objective function can be efficiently solved by dynamic programming such as the CYK algorithm.
Although the time complexity of the inside-outside algorithm with GM-LVeGs is polynomial in the sentence length and the nonterminal number, in practice the algorithm is still slow because the number of Gaussian components in the inside and outside scores increases dramatically with the recursion depth. To speed up the computation, we prune Gaussian components in the inside and outside scores using the following technique. Suppose we have a minimum pruning threshold and a maximum pruning threshold . Given an inside or outside score with Gaussian components, if , then we do not prune any Gaussian component; otherwise, we compute ( is a constant) and keep only components with the largest mixture weights.
In addition to component pruning, we also employ two constituent pruning techniques to reduce the search space during parsing. The first technique is used by Petrov et al. (2006)
. Before parsing a sentence with a GM-LVeG, we run the inside-outside algorithm with the treebank grammar and calculate the posterior probability of every nonterminal spanning every substring. Then a nonterminal would be pruned from a span if its posterior probability is below a pre-specified threshold. When parsing with GM-LVeGs, we only consider the unpruned nonterminals for each span.
The second constituent pruning technique is similar to the one used by Socher et al. (2013). Note that for a strong constituency parser such as the Berkeley parser (Petrov and Klein, 2007), the constituents in the top 200 best parses of a sentence can cover almost all the constituents in the gold parse tree. So we first use an existing constituency parser to run -best parsing with on the input sentence. Then we parse with a GM-LVeG and only consider the constituents that appear in the top 200 parses. Note that this method is different from the re-ranking technique because it may produce a parse different from the top 200 parses.
Given a training dataset containing samples, where is the gold parse tree with unrefined nonterminals for the sentence , the objective of discriminative learning is to minimize the negative log conditional likelihood:
where represents the set of parameters of the GM-LVeG.
We optimize the objective function using the Adam (Kingma and Ba, 2014) optimization algorithm. The derivative with respect to , the parameters of the weight function of an unrefined production rule , is calculated as follows (the derivation is in the supplementary material):
where indicates a parse tree with nonterminal subtypes, and is the number of occurrences of the unrefined rule in the unrefined parse tree that is obtained by replacing all the subtypes in with the corresponding nonterminals. The two expectations in Equation 12 can be efficiently computed using the inside-outside algorithm. Because the second expectation is conditioned on the parse tree , in Equation 6 and Equation 1 we can skip all the summations and assign the values of , , and according to .
In GM-LVeGs, is the set of parameters in a Gaussian mixture:
According to Equation 12, we need to take the derivatives of respect to , , and respectively:
Substituting Equation 14–16 into Equation 12, we have the full gradient formulations of all the parameters. In spite of the integral in Equation 12, we can derive a closed-form solution for the gradient of each parameter, which is shown in the supplementary material.
In order to keep each mixture weight positive, we do not directly optimize ; instead, we set and optimize by gradient descent. We use a similar trick to keep each covariance matrix positive definite.
Since we use the inside-outside algorithm described in Section 3.2 to calculate the two expectations in Equation 12, we face the same efficiency problem that we encounter in parsing. To speed up the computation,we again use both component pruning and constituent pruning introduced in Section 3.2.
Because gradient descent is often sensitive to the initial values of the parameters, we employ the following informed initialization method. Mixture weights are initialized using the treebank grammar. Suppose in the treebank grammar is the probability of a production rule . We initialize the mixture weights in the weight function by where is a constant. We initialize all the covariance matrices to identity matrices and initialize each mean with a value uniformly sampled from .
We evaluate the GM-LVeG on part-of-speech (POS) tagging and constituency parsing and compare it against its special cases such as LVGs and CVGs. It shall be noted that in this paper we focus on the basic framework of LVeGs and aim to show its potential advantage over previous special cases. It is therefore not our goal to compete with the latest state-of-the-art approaches to tagging and parsing. In particular, we currently do not incorporate contextual information of words and constituents during tagging and parsing, while such information is critical in achieving state-of-the-art accuracy. We will discuss future improvements of LVeGs in Section 5.
Parsing. We use the Wall Street Journal corpus from the Penn English Treebank (WSJ) (Marcus et al., 1994)
. Following the standard data splitting, we use sections 2 to 21 for training, section 23 for testing, and section 22 for development. We pre-process the treebank using a right-branching binarization procedure to obtain an unannotated X-bar grammar, so that there are only binary and unary production rules. To deal with the problem of unknown words in testing, we adopt the unknown word features used in the Berkeley parser and set the unknown word threshold to 1. Specifically, any word occurring less than two times is replaced by one of the 60 unknown word categories.
Tagging. (1) We use Wall Street Journal corpus from the Penn English Treebank (WSJ) (Marcus et al., 1994). Following the standard data splitting, we use sections 0 to 18 for training, sections 22 to 24 for testing, and sections 19 to 21 for development. (2) The Universal Dependencies treebank 1.4 (UD) (Nivre et al., 2016), in which English, French, German, Russian, Spanish, Indonesian, Finnish, and Italian treebanks are used. We use the original data splitting of these corpora for training and testing. For both WSJ and UD English treebanks, we deal with unknown words in the same way as we do in parsing. For the rest of the data, we use only one unknown word category and the unknown word threshold is also set to 1.
4.2 POS Tagging
POS tagging is the task of labeling each word in a sentence with the most probable part-of-speech tag. Here we focus on POS tagging with Hidden Markov Models (HMMs). Because HMMs are equivalent to probabilistic regular grammars, we can extend HMMs with both LVGs and LVeGs. Specifically, the hidden states in HMMs can be seen as nonterminals in regular grammars and therefore can be associated with latent variables or latent vectors.
We implement two training methods for LVGs. The first (LVG-G) is generative training using expectation-maximization that maximizes the joint probability of the sentence and the tags. The second (LVG-D) is discriminative training using gradient descent that maximizes the conditional probability of the tags given the sentence. In both cases, each nonterminal is split into a fixed number of subtypes. In our experiments we test 1, 2, 4, 8, and 16 subtypes of each nonterminal. Due to the limited space, we only report experimental results of LVG with 16 subtypes for each nonterminal. Full experimental results can be found in the supplementary material.
We experiment with two different GM-LVeGs: GM-LVeG-D with diagonal Gaussians and GM-LVeG-S with spherical Gaussians. In both cases, we fix the number of Gaussian components to 4 and the dimension of the latent vectors to 3. We do not use any pruning techniques in learning and inference because we find that our algorithm is fast enough with the current setting of and
. We train the GM-LVeGs for 20 epoches and select the models with the best token accuracy on the development data for the final testing.
We report both token accuracy and sentence accuracy of POS tagging in Table 2. It can be seen that, on all the testing data, GM-LVeGs consistently surpass LVGs in terms of both token accuracy and sentence accuracy. GM-LVeG-D is slightly better than GM-LVeG-S in sentence accuracy, producing the best sentence accuracy on 5 of the 9 testing datasets. GM-LVeG-S performs slightly better than GM-LVeG-D in token accuracy on 5 of the 9 datasets. Overall, there is not significant difference between GM-LVeG-D and GM-LVeG-S. However, GM-LVeG-S admits more efficient learning than GM-LVeG-D in practice since it has fewer parameters.
For efficiency, we train GM-LVeGs only on sentences with no more than 50 words (totally 39115 sentences). Since we have found that spherical Gaussians are better than diagonal Gaussians considering both model performance and learning efficiency, here we use spherical Gaussians in the weight functions. The dimension of latent vectors is set to 3, and all the Gaussian mixtures have components. We use in initializing mixture weights. We train the GM-LVeG for 15 epoches and select the model with the highest F1 score on the development data for the final testing. We use component pruning in both learning and parsing, with and in both learning and parsing, in learning and in parsing. During learning we use the first constituent pruning technique with the pruning threshold , and during parsing we use the second constituent pruning technique based on the Berkeley parser which produced 133 parses on average for each testing sentence. As can be seen, we use weaker pruning during training than during testing. This is because in training stronger pruning (even if accurate) results in worse estimation of the first expectation in Equation 12, which makes gradient computation less accurate.
We compare LVeGs with CVGs and several variants of LVGs: (1) LVG-G-16 and LVG-D-16, which are LVGs with 16 subtypes for each nonterminal with discriminative and generative training respectively (accuracies obtained from Petrov and Klein (2008a)); (2) Multi-scale grammars (Petrov and Klein, 2008b), trained without using the span features in order for a fair comparison; (3) Berkeley parser (Petrov and Klein, 2007) (accuracies obtained from Petrov and Klein (2008b) because Petrov and Klein (2007) do not report exact match scores). The experimental results are shown in Table 3. It can be seen that GM-LVeG-S produces the best F1 scores on both the development data and the testing data. It surpasses the Berkeley parser by 0.92% in F1 score on the testing data. Its exact match score on the testing data is only slightly lower than that of LVG-D-16.
We further investigate the influence of the latent vector dimension and the Gaussian component number on the efficiency and the parsing accuracy . We experiment on a small dataset (statistics of this dataset are in the supplemental material). We first fix the component number to 4 and experiment with the dimension 2, 3, 4, 5, 6, 7, 8, 9. Then we fix the dimension to 3 and experiment with the component number 2, 3, 4, 5, 6, 7, 8, 9. F1 scores on the development data are shown in the first row in Figure 1. Average time consumed per epoch in learning is shown in the second row in Figure 1. When , the best dimension is 5; when , the best Gaussian component number is 3. A higher dimension or a larger Gaussian component number hurts the model performance and requires much more time for learning. Thus our choice of and in GM-LVeGs for parsing is a good balance between the efficiency and the parsing accuracy.
It shall be noted that in this paper we choose to focus on the basic framework and algorithms of LVeGs, and therefore we leave a few important extensions for future work. One extension is to incorporate contextual information of words and constituents. which is a crucial technique that can be found in most state-of-the-art approaches to parsing or POS tagging. One possible way to utilize contextual information in LVeGs is to allow the words in the context of an anchored production rule to influence the rule’s weight function. For example, we may learn neural networks to predict the parameters of the Gaussian mixture weight functions in a GM-LVeG from the pre-trained embeddings of the words in the context.
In GM-LVeGs, we currently use the same number of Gaussian components for all the weight functions. A more desirable way would be automatically determining the number of Gaussian components for each production rule based on the ideal refinement granularity of the rule, e.g., we may need more Gaussian components for than for , since the latter is rarely used. There are a few possible ways to learn the component numbers such as greedy addition and removal, the split-merge method, and sparsity priors over mixture weights.
An interesting extension beyond LVeGs is to have a single continuous space for subtypes of all the nonterminals. Ideally, subtypes of the same nonterminal or similar nonterminals are close to each other. The benefit is that similarity between nonterminals can now be modeled.
We present Latent Vector Grammars (LVeGs) that associate each nonterminal with a latent continuous vector space representing the set of subtypes of the nonterminal. For each production rule, a LVeG defines a continuous weight function over the subtypes of the nonterminals involved in the rule. We show that LVeGs can subsume latent variable grammars and compositional vector grammars as special cases. We then propose Gaussian mixture LVeGs (GM-LVeGs). which formulate weight functions of production rules by mixtures of Gaussian distributions. The partition function and the expectations of fine-grained production rules in GM-LVeGs can be efficiently computed using dynamic programming, which makes learning and inference with GM-LVeGs feasible. We empirically show that GM-LVeGs can achieve competitive accuracies on POS tagging and constituency parsing.
This work was supported by the National Natural Science Foundation of China (61503248), Major Program of Science and Technology Commission Shanghai Municipal (17JC1404102), and Program of Shanghai Subject Chief Scientist (A type) (No.15XD1502900). We would like to thank the anonymous reviewers for their careful reading and useful comments.
Eugene Charniak. 1996.
Proceedings of the 30th National Conference on Artificial Intelligence, volume 2, pages 1031–1036.
- Charniak (2000) Eugene Charniak. 2000. A maximum-entropy-inspired parser. In Proceedings of the 1st Meeting of the North American Chapter of the Association for Computational Linguistics, pages 132–139. Association for Computational Linguistics.
- Collins (2003) Michael Collins. 2003. Head-driven statistical models for natural language parsing. Computational linguistics, 29(4):589–637.
- Durrett and Klein (2015) Greg Durrett and Dan Klein. 2015. Neural CRF parsing. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics, pages 302–312. Association for Computational Linguistics.
- Dyer et al. (2016) Chris Dyer, Adhiguna Kuncoro, Miguel Ballesteros, and Noah A Smith. 2016. Recurrent neural network grammars. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 199–209. Association for Computational Linguistics.
- Johnson (1998) Mark Johnson. 1998. PCFG models of linguistic tree representations. Computational Linguistics, 24(4):613–632.
- Kingma and Ba (2014) Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
- Klein and Manning (2003) Dan Klein and Christopher D Manning. 2003. Accurate unlexicalized parsing. In Proceedings of the 41st annual meeting on Association for Computational Linguistics, pages 423–430. Association for Computational Linguistics.
- Marcus et al. (1994) Mitchell Marcus, Grace Kim, Mary Ann Marcinkiewicz, Robert MacIntyre, Ann Bies, Mark Ferguson, Karen Katz, and Britta Schasberger. 1994. The penn treebank: annotating predicate argument structure. In Proceedings of the workshop on Human Language Technology, pages 114–119. Association for Computational Linguistics.
- Matsuzaki et al. (2005) Takuya Matsuzaki, Yusuke Miyao, and Jun’ichi Tsujii. 2005. Probabilistic CFG with latent annotations. In Proceedings of the 43rd annual meeting on Association for Computational Linguistics, pages 75–82. Association for Computational Linguistics.
- Nivre et al. (2016) Joakim Nivre, Marie-Catherine de Marneffe, Filip Ginter, Yoav Goldberg, Jan Hajic, Christopher D. Manning, Ryan T. McDonald, Slav Petrov, Sampo Pyysalo, Natalia Silveira, Reut Tsarfaty, and Daniel Zeman. 2016. Universal dependencies v1: A multilingual treebank collection. In Proceedings of the 10th International Conference on Language Resources and Evaluation, pages 1659–1666.
- Petrov et al. (2006) Slav Petrov, Leon Barrett, Romain Thibaux, and Dan Klein. 2006. Learning accurate, compact, and interpretable tree annotation. In Proceedings of the 44th annual meeting of the Association for Computational Linguistics, pages 433–440. Association for Computational Linguistics.
- Petrov and Klein (2007) Slav Petrov and Dan Klein. 2007. Improved inference for unlexicalized parsing. In Proceedings of the 2007 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 404–411. Association for Computational Linguistics.
- Petrov and Klein (2008a) Slav Petrov and Dan Klein. 2008a. Discriminative log-linear grammars with latent variables. In Advances in Neural Information Processing Systems 20, pages 1153–1160.
- Petrov and Klein (2008b) Slav Petrov and Dan Klein. 2008b. Sparse multi-scale grammars for discriminative latent variable parsing. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pages 867–876. Association for Computational Linguistics.
- Smith and Johnson (2007) Noah A Smith and Mark Johnson. 2007. Weighted and probabilistic context-free grammars are equally expressive. Computational Linguistics, 33(4):477–491.
- Socher et al. (2013) Richard Socher, John Bauer, Christopher D Manning, et al. 2013. Parsing with compositional vector grammars. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics, volume 1, pages 455–465. Association for Computational Linguistics.
Socher et al. (2011)
Richard Socher, Cliff C Lin, Chris Manning, and Andrew Y Ng. 2011.
natural scenes and natural language with recursive neural networks.
Proceedings of the 28th International Conference on Machine Learning, pages 129–136.
This supplementary material contains the following contents. (1) The derivation of the gradient formulation (Equation 12 in the paper). (2) The general idea of calculating analytic gradients for all the parameters in Gaussian Mixture Latent Vector Grammars (GM-LVeGs). (3) Algorithmic complexity and running time. (4) Statistics of the data used for part-of-speech (POS) tagging and constituency parsing. (5) Additional experimental results and analysis of GM-LVeGs.
Appendix A Derivation of Gradient Formulations
Given a training dataset containing samples, we minimize the negative log conditional likelihood during learning of GM-LVeGs:
where is the gold parse tree with unrefined nonterminals for the sentence , and is the set of parameters in GM-LVeGs.
We define as a parse tree with nonterminal subtypes, denote by the number of occurrences of the unrefined rule in the unrefined parse tree that is obtained by replacing all the subtypes in with the corresponding nonterminals, and use to represent a fine-grained production rule of , which is represented by the concatenation of the latent vectors of the nonterminals in .
The weight of is defined as:
The weight of , a parse tree with unrefined nonterminals, is defined as:
where indicates that is a parse tree with nonterminal subtypes that can be converted into a parse tree by replacing its nonterminal subtypes with the corresponding nonterminals. The weight of a sentence is defined as:
where indicates that is a parse tree of with nonterminal subtypes. Thus the conditional probability density of given is
the conditional probability density of given is
and the conditional probability of given is
Therefore, we rewrite Equation 17 as
(26) (27) (28)
Appendix B Calculation of Analytic Gradients
In GM-LVeGs, is the set of parameters in a Gaussian mixture with mixture components:
For brevity, we define
In the following discussion, we assume that all the Gaussians are diagonal. It can be verified that in Equation 33 is in fact a mixture of Gaussians, so multiplying by in Equation 26–28 results in another mixture of Gaussians. Below we consider the special case where the resulting Gaussian mixture contains only a single component:
Owing to the sum rule in integral, we can easily extend our derivation on the special case to the general case in which the Gaussian mixture contains multiple components. Because is diagonal, it can be factorized as:
are univariate Gaussians (or normal distributions),() refers to the -th element of , and is the dimension of . The integral in Equation 26 can be readily calculated as
For Equation 27, consider taking the derivative with respect to the mean in dimension . Since the means in different dimensions are independent, to solve the integral in Equation 27, we only need to solve the following integral:
For Equation 28
, when taking the derivative with respect to the variance in dimension, we also need to solve Equation 37 and additionally need to solve the following integral:
Appendix C Algorithmic Complexity and Running Time
The time complexity of the learning algorithm for each sentence in each epoch is approximately . The first term is the time complexity of the extended inside-outside algorithm, where is the number of binary productions in CNF, is the length of the sentence, is the Gaussian component number of each rule weight function, is the maximum Gaussian component number of an inside or outside score after pruning, and is the dimension of diagonal Gaussians. is generally much smaller than . It shall be noted that is bounded by , which is set to 50 in our experiments. The second term is the approximate time complexity of gradient calculation, where is the number of times that a production rule is used in all possible parses of a sentence. The second term is much smaller than the first term in general.
We run our learning and inference algorithms with a CPU cluster without any GPU. In our POS tagging experiments, GM-LVeGs are only slightly slower than the baseline LVG models, and we can perform all the tagging experiments on all the datasets with our model within one day. For parsing, there is a trade-off between running time and parsing accuracy based on the amount of pruning. For the best parsing accuracy of GM-LVeGs, it takes two weeks for training. However, once we complete training, parsing can be done within three minutes on the whole testing data of WSJ.
There are a few ways to improve the training efficiency. We currently use CPU parallelization at the sentence level in training, but in the future we may take the advantage of GPU parallelization, e.g., we can vectorize the inside-outside algorithm for a batch of sentences of the same length. Besides, for each long sentence, we can parallelize the inside or outside computation at the same recursive depth.
Appendix D Data Statistics
Statistics of the data used for constituency parsing are shown in Table 5. Statistics of the data used for POS tagging are summarized in Table 6. In the experiments of constituency parsing, in order to study the influence of the dimension of Gaussians and the number of Gaussian components on the parsing accuracy, we experimented on a small dataset. The small dataset only contains section 4 and section 5 of WSJ. In the two sections, we use file IDs from 80-89 in the two sections are used for testing, 90-99 for development, and the rest are used for training. The resulting dataset contains 3599 training samples, 426 test samples, and 375 development samples.
Appendix E Additional Experimental Results
The complete experimental results of POS tagging are shown in Table 7. In addition to the results shown in the paper, this table includes the tagging results of LVGs with 1, 2, 4, 8 subtypes for each nonterminal.
In the experiments of constituency parsing, in order to investigate the impact of the maximum Gaussian component number of inside and outside scores, we experiment with a new pruning technique. Specifically, we use a maximum component-pruning threshold . We do not prune any Gaussian component if an inside or outside score has no more than Gaussian components; otherwise we keep only Gaussian components with the largest mixture weights. We experiment on the small dataset mentioned in Section D. For efficiency, we train GM-LVeG-D only on sentences of no more than 20 words and test GM-LVeG-D only on testing sentences of no more than 25 words. We experiment with . The results are shown in Figure 2. We also experiment without component pruning, which corresponds to the rightmost point in Figure 2.
We can see that a weaker component pruning or a larger results in a better F1 score. However, it takes much more time per epoch for learning, as is shown in the lower figure in Figure 2. We find that produces a good F1 score and also admits efficient learning. Therefore, in the experiments of constituency parsing, we use in learning for the component-pruning technique introduced in Section 3.2 in the paper.