Learning task-specific bilexical embeddings
Abstract
We present a method that learns bilexical operators over distributional representations of words and leverages supervised data for a linguistic relation. The learning algorithm exploits lowrank bilinear forms and induces low-dimensional embeddings of the lexical space tailored for the target linguistic relation. An advantage of imposing low-rank constraints is that prediction is expressed as the inner-product between low-dimensional embeddings, which can have great computational benefits. In experiments with multiple linguistic bilexical relations we show that our method effectively learns using embeddings of a few dimensions.
Full text
Proceedings of COLING 2014, the 25th International Conference on Computational Linguistics: Technical Papers, pages 161–171, Dublin, Ireland, August 23-29 2014. Learning Task-specific Bilexical Embeddings Pranava Swaroop Madhyastha Xavier Carreras Ariadna Quattoni TALP Research Center Universitat Polit` ecnica de Catalunya Campus Nord UPC, Barcelona pranava,carreras,[email protected] Abstract We present a method that learns bilexical operators over distributional representations of words and leverages supervised data for a linguistic relation. The learning algorithm exploits lowrank bilinear forms and induces low-dimensional embeddings of the lexical space tailored for the target linguistic relation. An advantage of imposing low-rank constraints is that prediction is expressed as the inner-product between low-dimensional embeddings, which can have great computational benefits. In experiments with multiple linguistic bilexical relations we show that our method effectively learns using embeddings of a few dimensions. 1 Introduction We address the task of learning functions that compute compatibility scores between pairs of lexical items under some linguistic relation. We refer to these functions as bilexical operators. As an instance of this problem, consider learning a model that predicts the probability that an adjective modifies a noun in a sentence. In this case, we would like the bilexical operator to capture the fact that some adjectives are more compatible with some nouns than others. For example, a bilexical operator should predict that the adjective electronic has high probability of modifying the noun device but little probability of modifying the noun case. Bilexical operators can be useful for multiple NLP applications. For example, they can be used to reduce ambiguity in a parsing task. Consider the following sentence extracted from a weblog: Vynil can be applied to electronic devices and cases, wooden doors and furniture and walls. If we want to predict the dependency structure of this sentence we need to make several decisions. In particular, the parser would need to decide (1) Does electronic modify devices? (2) Does electronic modify cases? (3) Does wooden modify doors? (4) Does wooden modify furniture? Now imagine that in the corpus used to train the parser none of these nouns have been observed, then it is unlikely that these attachments can be resolved correctly. However, if an accurate noun-adjective bilexical operator were available most of the uncertainty could be resolved. This is because a good bilinear operator would give high probability to the pairs electronic-device,wooden-door,wooden-furniture and low probability to the pair electronic-case. The simplest way of inducing a bilexical operator is to learn it from a training corpus. That is, assuming that we are given some data annotated with a linguistic relation between a modifier and a head (e.g. adjective and noun) we can simply build a maximum likelihood estimator for Pr(m|h)by counting the occurrences of modifiers and heads under the target relation. For example, we could consider learning bilexical operators from sentences annotated with dependency structures. Clearly, this model can not generalize to head words not present in the training data. To mitigate this we could consider bilexical operators that can exploit lexical embeddings, such as a distributional vector-space representation of words. In this case, we assume that for every word we can compute an n-dimensional vector space representation φ(w)→Rn. This representation typically captures distributional features of the context in which the lexical item can occur. The key point is that This work is licenced under a Creative Commons Attribution 4.0 International License. Page numbers and proceedings footer are added by the organizers. License details: http://creativecommons.org/licenses/by/4.0/ 161
we do not need a supervised corpus to compute the representation. All we need is a large textual corpus to compute the relevant statistics. Once we have the representation we can exploit operations in the induced vector space to define lexical compatibility operators. For example we could define a bilexical operator as: Pr(m|h) = exp {hφ(m), φ(h)i} Pm0exp {hφ(m0), φ(h)i} (1) where hφ(x), φ(y)idenotes the inner-product. Alternatively, given an initial high-dimensional distributional representation computed from a large textual corpus we could first induce a projection to a lower kdimensional space by performing truncated singular value decomposition. The idea is that the lower dimensional representation will be more efficient and it will better capture the relevant dimensions of the distributional representation. The bilexical operator would then take the form of: Pr(m|h) = exp {hUφ(m), Uφ(h)i} Pm0exp {hUφ(m0), Uφ(h)i} (2) where U∈Rk×nis the projection matrix obtained via SVD. The advantage of this approach is that as long as we can estimate the distribution of contexts of words we can compute the value of the bilexical operator. However, this approach has a clear limitation: to design a bilinear operator for a target linguistic relation we must design the appropriate distributional representation. Moreover, there is no clear way of exploiting a supervised training corpus. In this paper we combine both the supervised and distributional approaches and present a learning algorithm for inducing bilexical operators from a combination of supervised and unsupervised training data. The main idea is to define bilexical operators using bilinear forms over distributional representations: φ(x)>Wφ(y), where W∈Rn×nis a matrix of parameters. We can then train our model on the supervised training corpus via conditional maximum-likelihood estimation. To induce a low-dimensional representation, we first observe that the implicit dimensionality of the bilinear form is given by the rank of W. In practice controlling the rank of Wcan result in important computational savings in cases where one evaluates a target word xagainst a large number of candidate words y: this is because we can project the representations φ(x)and φ(y)down to the low-dimensional space where evaluating the function is simply an inner-product. This setting is in fact usual, for example for lexical retrieval applications (e.g. given a noun, sort all adjectives in the vocabulary according to their compatibility), or for parsing (where one typically evaluates the compatibility between all pairs of words in a sentence). Consequently with these ideas, we propose to regularize the maximum-likelihood estimation using a nuclear norm regularizer that serves as a convex relaxation to the rank function. To minimize the regularized objective we make use of an efficient iterative proximal method that involves computing the gradient of the function and performing singular value decompositions. We test the proposed algorithm on several linguistic relations and show that it can predict modifiers for unknown words more accurately than the unsupervised approach. Furthermore, we compare different types of regularizers for the bilexical operator W, and observe that indeed the low-rank regularizer results in the most efficient technique at prediction time. In summary, the main contributions of this paper are: •We propose a supervised framework for learning bilexical operators over distributional representations, based on learning bilinear forms W. •We show that we can obtain low-dimensional compressions of the distributional representation by imposing low-rank constraints to the bilinear form. Combined with supervision, this results in lexical embeddings tailored for a specific bilexical task. •In experiments, we show that our models generalize well to unseen word pairs, using only a few dimensions, and outperforming standard unsupervised distributional approaches. We also present an application to prepositional phrase attachment. 162
2 Bilinear Models for Bilexical Predictions 2.1 Definitions Let Vbe a vocabulary, and let x∈ V denote a word. Let H ⊆ V be a set of head words, and M⊆Vbe a set of modifier words. In the noun-adjective relation example, His the set of nouns and Mis the set of adjectives. The task is as follows. We are given a training set of ltuples D={(m, h)1,...,(m, h)l}, where m∈ M and h∈ H and we want to learn a model of the conditional distribution Pr(m|h). We want this model to perform well on all head-modifier pairs. In particular we will test the performance of the model on heads that do not appear in D. We assume that we are given access to a distributional representation function φ:V → Rn, where φ(x)is the n-dimensional representation of x. Typically, this function is computed from an unsupervised corpus. We use φ(x)[i]to refer to the i-th coordinate of the vector. 2.2 Bilinear Model Our model makes use of the bilinear form W:Rn×Rn→R, where W∈Rn×n, and evaluates as φ(m)>Wφ(h). We define the bilexical operator as: Pr(m|h) = exp φ(m)>Wφ(h) Pm0∈M exp {φ(m0)>Wφ(h)}(3) Note that the above model is nothing more than a conditional log-linear model defined over n2fea- tures fi,j(m, h) = φ(m)[i]φ(h)[j](this can be seen clearly when we write the bilinear form as Pn i=1 Pn j=1 fi,j(m, h)Wi,j. The reason why it is useful to regard Was a matrix will become evident in the next section. Before moving to the next section, let us note that the unsupervised SVD model in Eq. (2) is also a bilinear model as defined here. This can be seen if we set W=UU>, which is a bilinear form of rank k. The key difference is in the way Wis learned using supervision. 3 Learning Low-rank Bilexical Operators 3.1 Low-rank Optimization Given a training set Dand a feature function φ(x)we can do standard conditional max-likelihood optimization and minimize the negative of the log-likelihood function, log Pr(D): X (m,h)∈D φ(m)>Wφ(h)−log X m0∈M exp nφ(m0)>Wφ(h)o(4) We would like to control the complexity of the learned model by including some regularization penalty. Moreover, like in the low-dimensional unsupervised approach we want our model to induce a lowdimensional representation of the lexical space. The first observation is that the bilinear form computes a weighted inner product in some space. Consider the singular value decomposition: W=UΣV. We can write the bilinear form as: [φ(m)>U] Σ [V φ(h)], thus we can regard ˜m=φ(m)>Uas a projection of mand ˜ h=V φ(h)as a projection of h. Then the bilinear form can be written as: Pn i=1 Σ[i,i]˜m[i]˜ h[i]. The rank of Wdefines the dimensionality of the induced space. It is easy to see that if Whas rank kit can be factorized as UΣVwhere U∈Rn×kand V∈Rk×n. Since the rank of Wdetermines the dimensionality of the induced space, it would be reasonable to add a rank minimization penalty in the objective in (4). Unfortunately this would lead to a non-convex regularized objective. Instead, we propose to use as a regularizer a convex relaxation of the rank function, the nuclear norm kWk∗(the `1norm of the singular values of W). Putting it all together, our learning algorithm minimizes: X (m,h)∈D −log Pr(m|h)) + λkWk∗(5) 163
Here λis a constant that controls the trade-off between fitting the data and the complexity of the model. This objective is clearly convex since both the objective and the regularizer are convex. To minimize it we use the a proximal gradient algorithm which is described next. 3.2 A Proximal Algorithm for Bilexical Operators We now describe the learning algorithm that we use to induce the bilexical operators from training data. We are interested in minimizing the objective (5), or in fact a more general version where we can replace the regularizer kWk∗by standard `1or `2penalties. For any convex regularizer r(W)(namely `1,`2or the nuclear norm) the objective in (5) is convex. Our learning algorithm is based on a simple optimization scheme known as forward-backward splitting (FOBOS) (Duchi and Singer, 2009). This algorithm has convergence rates in the order of 1/2, which we found sufficiently fast for our application. Many other optimization approaches are possible, for example one could express the regularizer as a convex constraint and utilize a projected gradient method which has a similar convergence rate. Proximal methods are slightly more simple to implement and we chose the proximal approach. The FOBOS algorithm works as follows. In a series of iterations t= 1 . . . T compute parameter matrices Wtas follows: 1. Compute the gradient of the negative log-likelihood, and update the parameters Wt+0.5=Wt−ηtg(Wt) where ηt=c √tis a step size and g(Wt)is the gradient of the loss at Wt. 2. Update Wt+0.5to take into account the regularization penalty r(W), by solving Wt+1 = argmin W ||Wt+0.5−W||2 2+ηtλr(W) For the regularizers we consider, this step is solved using the proximal operator associated with the regularizer. Specifically: •For `1it is a simple thresholding: Wt+1(i, j) = sign(Wt+0.5(i, j)) ·max(Wt+0.5(i, j)−ηtλ, 0) •For `2it is a simple scaling: Wt+1 =1 1 + ηtλWt+0.5 •For nuclear-norm, perform SVD thresholding. Compute the SVD to write Wt+0.5=USV > with Sa diagonal matrix and U, V orthogonal matrices. Denote by σithe i-th element on the diagonal of S. Define a new matrix ¯ Swith diagonal elements ¯σi= max(σi−ηtλ, 0). Then set Wt+1 =U¯ SV > Optimizing a bilinear model using nuclear-norm regularization involves the extra cost of performing SVD of Wat each iteration. In our experiments the dimension of Wwas 2,000 ×2,000 and computing SVD was fast, much faster than computing the gradient, which dominates the cost of the algorithm. The optimization parameters of the method are the regularization constant λ, the step size constant cand the number of iterations T. In our experiments we ran a range of λand cvalues for 200 iterations, and used a validation set to pick the best configuration. 164
4 Related Work Research in learning representations for natural language processing can be broadly classified into two different paradigms based on the learning setting: unsupervised representation learning and semisupervised representation learning. Unsupervised representation learning does not require any supervised training data, while semi-supervised representation learning requires the presence of supervised training data with the potential advantage that it can adapt the representation to the task at hand. Unsupervised approaches to learning representations mainly involve representations that are learned not for a specific task, rather a variety of tasks. These representations rely more on the property of abstractness and generalization. Further, unsupervised approaches can be roughly categorized into (a) clustering-based approaches that make use of clusters induced using a notion of distributed similarity, such as the method by Brown et al. (1992); (b) neural-network-based representations that focus on learning multilayer neural network in a way to extract features from the data (Morin and Bengio, 2005; Mnih and Hinton, 2007; Bengio and S´ en´ ecal, 2008; Mnih and Hinton, 2009); (c) pure distributional approaches that principally follow the distributional assumption that the words which share a set of contexts are similar (Sahlgren, 2006; Turney and Pantel, 2010; Dumais et al., 1988; Landauer et al., 1998; Lund et al., 1995; V¨ ayrynen et al., 2007). We also induce lexical embeddings, but in our case we employ supervision. That is, we follow a semi-supervised paradigm for learning representations. Semi-supervised approaches initially learn representations typically in an unsupervised setting and then induce a representation that is jointly learned for the task with a labeled corpus. A high-dimensional representation is extracted from unlabeled data, while the supervised step compresses the representation to be low-dimensional in a way that favors the the task at hand. Collobert and Weston (2008) present a neural network language model, where given a sentence, it performs a set of language processing tasks (from part of speech tagging, chunking, extracting named entity, extracting semantic roles and decisions on the correctness of the sentence) by using the learned representations. The representation itself is extracted from unlabeled corpora, while all the other tasks are jointly trained on labeled corpus. Socher et al. (2011) present a model based on recursive neural networks that learns vector space representations for words, multi-word phrases and sentences. Given a sentence with its syntactic structure, their model assings vector representations to each of the lexical tokens of the sentence, and then traverses the syntactic tree bottom-up, such that at each node a vector representation of the corresponding phrase is obtained by composing the vectors associated with the children. Bai et al. (2010) use a technique similar to ours, using bilinear forms with low-rank constraints. In their case, they explicitly look for a low-rank factorization of the matrix, making their optimization non-convex. As far as we know, ours is the first convex formulation, where we employ a relaxation of the rank (i.e. the nuclear norm) to make the objective convex. They apply the method to document ranking, and thus optimize a max-margin ranking loss. In our application to bilexical models, we perform conditional max-likelihood estimation. Hutchinson et al. (2013) propose an explicitly sparse and lowrank maximum-entropy language model. The sparse plus low rank setting is learned in such a way that the low rank component learns the regularities in the training data and the sparse component learns the exceptions like multiword expressions etc. Chechik et al. (2010) also learned bilinear operators using max-margin techniques, with pairwise similarity as supervision, but they did not consider low-rank constraints. One related area where bilinear operators are used to induce embeddings is distance metric learning. Weinberger and Saul (2009) used large-margin nearest neighbor methods to learn a non-sparse embedding, but these are computationally intensive and might not be suitable for large-scale tasks in NLP. 5 Experiments on Syntactic Relations We conducted a set of experiments to test the ability of our algorithm to learn bilexical operators for several linguistic relations. As supervised training data we use the gold standard dependencies of the WSJ training section of the Penn Treebank (Marcus et al., 1993). We consider the following relations: 165
50 55 60 65 70 75 80 85 90 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations Adjectives given Noun unsupervised NN L1 L2 66 68 70 72 74 76 78 80 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations Nouns given Adjective unsupervised NN L1 L2 46 48 50 52 54 56 58 60 62 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations Objects given Verb unsupervised NN L1 L2 60 65 70 75 80 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations Verbs given Object unsupervised NN L1 L2 Figure 1: Pairwise accuracy with respect to the number of double operations required to compute the distribution over modifiers for a head word. Plots for noun-adjective and verb-object relations, in both directions. •Noun-Adjective: we model the distribution of adjectives given a noun; and a separate distribution of nouns given an adjective. •Verb-Object: we model the distribution of object nouns given a verb; and a separate distribution of verbs given an object. •Prepositions: in this case we consider bilexical operators associated with a preposition, which model the probability of a head noun or verb above the preposition given the noun below the preposition. We present results for prepositional relations given by “with”, “for”, “in” and “on”. The distributional representation φ(x)was computed using the BLLIP corpus (Charniak et al., 2000). We compute a bag-of-words representation for the context of each lexical item, that is φ(w)[i]corresponds to the frequency of word iappearning in the context of w. We use a context window of size 10 and restrict our bag-of-words vocabulary to contain only the 2,000 most frequent words present in the corpus. Vectors were normalized. 166
50 55 60 65 70 75 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations With unsupervised NN L1 L2 54 56 58 60 62 64 66 68 70 72 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations For unsupervised NN L1 L2 46 48 50 52 54 56 58 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations In unsupervised NN L1 L2 60 62 64 66 68 70 72 74 76 78 80 1e3 1e4 1e5 1e6 1e7 1e8 pairwise accuracy number of operations On unsupervised NN L1 L2 Figure 2: Pairwise accuracy with respect to the number of double operations required to compute the distribution over modifiers for a head word. Plots for four prepositional relations: with, for, in, on. The distributions are of verbs and objects above the preposition given the noun below the preposition. To test the performance of our algorithm for each relation we partition the set of heads into a training and a test set, 60% of the heads are use for training, 10% of the heads are used for validation and 30% of the heads are used for testing. Then, we consider all observed modifiers in the data to form a vocabulary of modifier words. The goal of this task is to learn conditional distribution over all these modifers given a head word without context. In our experiments, the number of modifiers per relation ranges from 2,500 to 7,500 words. For each head word, we create a list of compatible modifiers from the annotated data, by taking all modifiers that occur at least once with the head. Hence, for each head the set of all modifiers is partitioned into compatible and non-compatible. For testing, we measure a pairwise accuracy, the percentage of compatible/non-compatible pairs of modifiers where the former obtains higher probability. Let us stress that none of the test head words has been observed in training, while the list of modifiers is the same for training, validation and testing. We compare the performance of the bilexical model trained with nuclear norm regularization (NN) with other regularization penalties (L1 and L2). We also compare these supervised methods with an 167
Noun Predicted Adjectives president executive, senior, chief, frank, former, international, marketing, assistant, annual, financial wife former, executive, new, financial, own, senior, old, other, deputy, major shares annual, due, net, convertible, average, new, high-yield, initial, tax-exempt, subordinated mortgages annualized, annual, three-month, one-year, average, six-month, conventional, short-term, higher, lower month last, next, fiscal, first, past, latest, early, previous, new, current problem new, good, major, tough, bad, big, first, financial, long, federal holiday new, major, special, fourth-quarter, joint, quarterly, third-quarter, small, strong, own Table 1: 10 most likely adjectives for some test nouns. unsupervised model: a low-dimensional SVD model as in Eq. (2), which corresponds to an inner product as in Eq. (1) when all dimensions are considered. To report performance, we measure pairwise accuracy with respect to the capacity of the model in terms of number of active parameters. To measure the capacity of a model we consider the number of double operations that are needed to compute, given a head, the scores for all modifiers in the vocabulary (we exclude the exponentiations and normalization needed to compute the distribution of modifiers given a head, since this is a constant cost for all the models we compare, and is not needed if we only want to rank modifiers). Recall that the dimension of φ(x)is n, and assume that there are mtotal modifiers in the vocabulary. In our experiments n= 2,000 and mranges from 2,500 to 7,500. The correspondances with operations are: •Assume that the L1 and L2 models have knon-zero weights in W. Then the number of operations to compute a distribution is km. •Assume that the NN and the unsupervised models have rank k. We assume that the modifier vectors are alredy projected down to kdimensions. For a new head, one needs to project it and perform m inner products, hence the number of operations is kn +km. Figure 1 shows the performance of models for noun-adjective and verb-object relations, while Figure 2 shows plots for prepositional relations. 1The first observation is that supervised approaches outperform the unsupervised approach. In cases such as noun-adjetive relations the unsupervised approach performs close to the supervised approaches, suggesting that the pure distributional approach can sometimes work. But in most relations the improvement obtained by using supervision is very large. When comparing the type of regularizer, we see that if the capacity of the model is unrestricted (right part of the curves), all models tend to perform similarly. However, when restricting the size, the nuclear-norm model performs much better. Roughly, 20 hidden dimensions are enough to obtain the most accurate performances (which result in ∼140,000 operations for initial representaions of 2,000 dimensions and 5,000 modifier candidates). As an example of the type of predictions, Table 1 shows the most likely adjectives for some test nouns. 6 Experiments on PP Attachment We now switch to a standard classification task, prepositional phrase attachment, that we frame as a bilexical prediction task. We start from the formulation of the task as a binary classification problem by Ratnaparkhi et al. (1994): given a tuple x=hv, o, p, niconsisting of a verb v, noun object o, preposition 1To obtain curves for each model type with respect to a range of number of operations, we first obtained the best model on validation data and then forced it to have at most knon-zero features or rank kby projecting, for a range of kvalues. 168
55 60 65 70 75 80 for from with attachment accuracy bilinear L1 bilinear L2 bilinear NN linear interpolated L1 interpolated L2 interpolated NN Figure 3: Attachment accuracies of linear, bilinear and interpolated models for three prepositions. pand noun n, decide if the prepositional phrase p-nattaches to v(y=V) or to o(y=O). For example, in hmeet,demand,for,productsithe correct attachment is O. Ratnaparkhi et al. (1994) define a linear maximum likelihood model of the form Pr(y|x) = exp{hw, f(x, y)i} ∗ Z(x)−1, where f(x, y)is a vector of dfeatures, wis a parameter vector in Rd, and Z(x)is the normalizer summing over y={V,O}. Here we define a bilexical model of the form that uses a distributional representation φ: Pr(V|hv, o, p, ni) = exp{φ(v)>Wp Vφ(n)} Z(x)Pr(O|hv, o, p, ni) = exp{φ(o)>Wp Oφ(n)} Z(x)(6) The bilinear model is parameterized by two matrices WVand WOper preposition, each of which captures the compatibility between nouns below a certain preposition and heads of Vor Oprepositional relations, respectively. Again Z(x)is the normalizer summing over y={V,O}, but now using the bilinear form. It is straighforward to modify the learning algorithm in Section 3 such that the loss is a negative loglikelihood for binary classification, and the regularizer considers the sum of norms of the model matrices. We ran experiments using the data by Ratnaparkhi et al. (1994). We trained separate models for different prepositions, focusing on the prepositions that are more ambiguous: for, from, with. We compare to a linear “maxent” model following Ratnaparkhi et al. (1994) that uses the same feature set. Figure 3 shows the test results for the linear model, and bilinear models trained with L1, L2, NN regularization penalties. The results of the bilinear models are significantly below the accuracy of the linear model, suggesting that some of the non-lexical features of the linear model (such as prior weighting of the two classes) might be difficult to capture by the bilinear model over lexical representations. To check if the bilinear model might complement the linear model or just be worse than it, we tested simple combinations based on linear interpolations. For a constant λ∈[0,1] we define: Pr(y|x) = λPrL(y|x) + (1 −λ) PrB(y|x).(7) We search for the best λon the validation set, and report results of combining the linear model with each of the three bilinear models. Results are shown also in Figure 3. Interpolation models improve over linear models, though only the improvement for for is significant (2.6%). Future work should exploit finer combinations between standard linear features and distributional bilinear forms. 7 Conclusions We have presented a model for learning bilexical operators that can leverage both supervised and unsupervised data. The model is based on exploiting bilinear forms over distributional representations. The 169