A toolkit for coreference resolution and error analysis.
Understanding a long document requires tracking how entities are introduced and evolve over time. We present a new type of language model, EntityNLM, that can explicitly model entities, dynamically update their representations, and contextually generate their mentions. Our model is generative and flexible; it can model an arbitrary number of entities in context while generating each entity mention at an arbitrary length. In addition, it can be used for several different tasks such as language modeling, coreference resolution, and entity prediction. Experimental results with all these tasks demonstrate that our model consistently outperforms strong baselines and prior work.READ FULL TEXT VIEW PDF
Rich entity representations are useful for a wide class of problems invo...
Measuring entity relatedness is a fundamental task for many natural lang...
Does the effectiveness of neural language models derive entirely from
Politicians often have underlying agendas when reacting to events. Argum...
Understanding procedural language requires anticipating the causal effec...
We present a new architecture for storing and accessing entity mentions
We focus on the problem of capturing declarative knowledge in the learne...
A toolkit for coreference resolution and error analysis.
Understanding a narrative requires keeping track of its participants over a long-term context. As a story unfolds, the information a reader associates with each character in a story increases, and expectations about what will happen next change accordingly. At present, models of natural language do not explicitly track entities; indeed, in today’s language models, entities are no more than the words used to mention them.
In this paper, we endow a generative language model with the ability to build up a dynamic representation of each entity mentioned in the text. Our language model defines a probability distribution over the whole text, with a distinct generative story for entity mentions. It explicitly groups those mentions that corefer and associates with each entity a continuous representation that is updated by every contextualized mention of the entity, and that in turn affects the text that follows.
Our method builds on recent advances in representation learning, creating local probability distributions from neural networks. It can be understood as a recurrent neural network language model, augmented with random variables for entity mentions that capture coreference, and with dynamic representations of entities. We estimate the model’s parameters from data that is annotated with entity mentions and coreference.
|[ John] wanted to go to [ the coffee shop] in [ downtown Copenhagen]. [ He] was told that [ it] sold [ the best beans].|
” is likely to come next, by using entity information encoded in the dynamic distributed representation.
Because our model is generative, it can be queried in different ways. Marginalizing everything except the words, it can play the role of a language model. In §5.1, we find that it outperforms both a strong -gram language model and a strong recurrent neural network language model on the English test set of the CoNLL 2012 shared task on coreference evaluation (Pradhan et al., 2012). The model can also identify entity mentions and coreference relationships among them. In §5.2, we show that it can easily be used to add a performance boost to a strong coreference resolution system, by reranking a list of -best candidate outputs. On the CoNLL 2012 shared task test set, the reranked outputs are significantly better than the original top choices from the same system. Finally, the model can perform entity cloze tasks. As presented in §5.3, it achieves state-of-the-art performance on the InScript corpus (Modi et al., 2017).
A language model defines a distribution over sequences of word tokens; let denote the random variable for the th word in the sequence, denote the value of and the distributed representation (embedding) of this word. Our starting point for language modeling is a recurrent neural network (Mikolov et al., 2010), which defines
where and are parameters of the model (along with word embeddings ), lstm
is the widely used recurrent function known as “long short-term memory”(Hochreiter and Schmidhuber, 1997), and is a lstm hidden state encoding the history of the sequence up to the th word.
Great success has been reported for this model (Zaremba et al., 2015), which posits nothing explicitly about the words appearing in the text sequence. Its generative story is simple: the value of each
is randomly chosen conditioned on the vectorencoding its history.
To introduce our model, we associate with each word an additional set of random variables. At position ,
is a binary random variable that indicates whether belongs to an entity mention () or not (). Though not explored here, this is easily generalized to a categorial variable for the type of the entity (e.g., person, organization, etc.).
is a categorical random variable if , which indicates the number of remaining words in this mention, including the current word (i.e., for the last word in any mention). is a predefined maximum length fixed to be 25, which is an empirical value derived from the training corpora used in the experiments. If , then . We denote the value of by .
is the index of the entity referred to, if . The set consists of , i.e., the indices of all previously mentioned entities plus an additional value for a new entity. Thus starts as and grows monotonically with , allowing for an arbitrary number of entities to be mentioned. We denote the value of by . If , then is fixed to a special value .
The values of these random variables for our running example are shown in Figure 2.
In addition to using symbolic variables to encode mentions and coreference relationships, we maintain a vector representation of each entity that evolves over time. For the th entity, let be its representation at time . These vectors are different from word vectors (), in that they are not parameters of the model. They are similar to history representations (), in that they are derived through parameterized functions of the random variables’ values, which we will describe in the next subsections.
The generative story for the word (and other variables) at timestep is as follows; forward-referenced equations are in the detailed discussion that follows.
If (i.e., is not continuing an already-started entity mention):
Choose (Equation 3).
Set , , .
Sample from the word distribution given the LSTM hidden state and the current (or most recent) entity embedding (Equation 6). (If , then still represents the most recently mentioned entity.)
Advance the RNN, i.e., feed it the word vector to compute (Equation 2).
If , update using and , then set . Details of the entity updating are given in §2.4.
For every entity , set (i.e., no changes to other entities’ representations).
Note that at any given time step , will always contain the most recent vector representation of the most recently mentioned entity.
A generative model with a similar hierarchical structure was used by Haghighi and Klein (2010)
for coreference resolution. Our approach differs in two important ways. First, our model defines a joint distribution over all of the text, not just the entity mentions. Second, we use representation learning rather than Bayesian nonparametrics, allowing natural integration with the language model.
The generative story above referenced several parametric distributions defined based on vector representations of histories and entities. These are defined as follows.
where is the parameterized embedding associated with , which paves the way for exploring entity type representations in future work; is a parameter matrix for the bilinear score for and .
To give the possibility of predicting a new entity, we need an entity embedding beforehand with index , which is randomly sampled from Equation 7. Then, for every :
where is the embedding of entity at time step and is the weight matrix for predicting entities using their continuous representations. The score above is normalized over values . represents a vector of distance features associated with and the mentions of the existing entities. Hence two information sources are used to predict the next entity: (i) contextual information , and (ii) distance features from the current mention to the closest mention from each previously mentioned entity. if is a new entity. This term can also be extended to include other surface-form features for coreference resolution (Martschat and Strube, 2015; Clark and Manning, 2016b).
For the chosen entity from Equation 4, the distribution over its mention length is drawn according to
where is the most recent embedding of the entity , not updated with . The intuition is that will help contextual information to select the residual length of entity . is the weight matrix for length prediction, with rows.
Finally, the probability of a word as the next token is jointly modeled by and the vector representation of the most recently mentioned entity :
where is a transformation matrix to adjust the dimensionality of . cfsm is a class factorized softmax function (Goodman, 2001; Baltescu and Blunsom, 2015). It uses a two-step prediction with predefined word classes instead of direct prediction on the whole vocabulary, and reduces the time complexity to the log of vocabulary size.
Before predicting the entity at step , we need an embedding for the new candidate entity with index
if it does not exist. The new embedding is generated randomly, according to a normal distribution, then projected onto the unit ball:
where . The time step in means the current embedding contains no information from step , although it will be updated once we have and if . is the parameterized embedding for , which will be jointly optimized with other parameters and is expected to encode some generic information about entities. All the initial entity embeddings are centered on the mean , which is used in Equation 3 to determine whether the next token belongs to an entity mention. Another choice would be to initialize with a zero vector, although our preliminary experiments showed this did not work as well as random initialization in Equation 7.
Assume and , which means is part of a mention of entity . Then, we need to update based on the new information we have from . The new embedding is a convex combination of the old embedding () and current LSTM hidden state (
) with the interpolation () determined dynamically based on a bilinear function:
This updating scheme will be used to update in each of all the following steps. The projection in the last step keeps the magnitude of the entity embedding fixed, avoiding numeric overflow. A similar updating scheme has been used by Henaff et al. (2016) for the “memory blocks” in their recurrent entity network models. The difference is that their model updates all memory blocks in each time step. Instead, our updating scheme in subsection 2.4 only applies to the selected entity at time step .
The model is trained to maximize the log of the joint probability of , and :
where is the collection of all the parameters in this model. Based on the formulation in §2.3, Equation 9 can be decomposed as the sum of conditional log-probabilities of each random variable at each time step.
This objective requires the training data annotated as in Figure 2. We do not assume that these variables are observed at test time.
Our model is implemented with DyNet (Neubig et al., 2017) and available at https://github.com/jiyfeng/entitynlm. We use AdaGrad (Duchi et al., 2011) with learning rate and ADAM (Kingma and Ba, 2014) with default learning rate as the candidate optimizers of our model. For all the parameters, we use the initialization tricks recommended by Glorot and Bengio (2010). To avoid overfitting, we also employ dropout (Srivastava et al., 2014) with the candidate rates as .
In addition, there are two tunable hyperparameters ofEntityNLM: the size of word embeddings and the dimension of LSTM hidden states. For both of them, we consider the values . We also experiment with the option to either use the pretrained GloVe word embeddings (Pennington et al., 2014) or randomly initialized word embeddings (then updated during training). For all experiments, the best configuration of hyperparameters and optimizers is selected based on the objective value on the development data.
We evaluate our model in diverse use scenarios: (i) language modeling, (ii) coreference resolution, and (iii) entity prediction. The evaluation on language modeling shows how the internal entity representation, when marginalized out, can improve the perplexity of language models. The evaluation on coreference resolution experiment shows how our new language model can improve a competitive coreference resolution system. Finally, we employ an entity cloze task to demonstrate the generative performance of our model in predicting the next entity given the previous context.
We use two datasets for the three evaluation tasks. For language modeling and coreference resolution, we use the English benchmark data from the CoNLL 2012 shared task on coreference resolution (Pradhan et al., 2012). We employ the standard training/development/test split, which includes 2,802/343/348 documents with roughly 1M/150K/150K tokens, respectively. We follow the coreference annotation in the CoNLL dataset to extract entities and ignore the singleton mentions in texts.
For entity prediction, we employ the InScript corpus created by Modi et al. (2017). It consists of 10 scenarios, including grocery shopping, taking a flight, etc. It includes 910 crowdsourced simple narrative texts in total and 18 stories were ignored due to labeling problems (Modi et al., 2017). On average, each story has 12.4 sentences, 24.9 entities and 217.2 tokens. Each entity mention is labeled with its entity index. We use the same training/development/test split as in (Modi et al., 2017), which includes 619, 91, 182 texts, respectively.
For the CoNLL dataset, we lowercase all tokens and remove any token that only contains a punctuation symbol unless it is in an entity mention. We also replace numbers in the documents with the special token num and low-frequency word types with unk. The vocabulary size of the CoNLL data after preprocessing is 10K. For entity mention extraction, in the CoNLL dataset, one entity mention could be embedded in another. For embedded mentions, only the enclosing entity mention is kept. We use the same preprocessed data for both language modeling and coreference resolution evaluation.
For the InScript corpus, we apply similar data preprocessing to lowercase all tokens, and we replace low-frequency word types with unk. The vocabulary size after preprocessing is 1K.
In this section, we present the experimental results on the three evaluation tasks.
The goal of language modeling is to compute the marginal probability:
However, due to the long-range dependency in recurrent neural networks, the search space of during inference grows exponentially. We thus use importance sampling to approximate the marginal distribution of . Specifically, with the samples from a proposal distribution , the approximated marginal probability is defined as
A similar idea of using importance sampling for language modeling evaluation has been used by Dyer et al. (2016).
For language modeling evaluation, we train our model on the training set from the CoNLL 2012 dataset with coreference annotation. On the test data, we treat coreference structure as latent variables and use importance sampling to approximate the marginal distribution of . For each document, the model randomly draws samples from the proposal distribution, discussed next.
For implementation of , we use a discriminative variant of EntityNLM by taking the current word for predicting the entity-related variables in the same time step. Specifically, in the generative story described in §2.2, we delete step 3 (words are not generated, but rather conditioned upon), move step 4 before step 1, and replace with in the steps for predicting entity type , entity and mention length . This model variant provides a conditional probability at each timestep.
We compare the language modeling performance with two competitive baselines: 5-gram language model implemented in KenLM (Heafield et al., 2013) and RNNLM with LSTM units implemented in DyNet (Neubig et al., 2017). For RNNLM, we use the same hyperparameters described in §3 and grid search on the development data to find the best configuration.
The results of EntityNLM and the baselines on both development and test data are reported in Table 1. For EntityNLM, we use the value of on the development set with coreference annotation to select the best model configuration and report the best number. On the test data, we are able to calculate perplexity by marginalizing all other random variables using Equation 11. To compute the perplexity numbers on the test data, our model only takes account of log probabilities on word prediction. The difference is that coreference information is only used for training EntityNLM and not for test. All three models reported in Table 1 share the same vocabulary, therefore the numbers on the test data are directly comparable. As shown in Table 1, EntityNLM outperforms both the 5-gram language model and the RNNLM on the test data. Better performance of EntityNLM on language modeling can be expected, if we also use the marginalization method defined in Equation 11 on the development data to select the best configuration. However, we plan to use the same experimental setup for all experiments, instead of customizing our model for each individual task.
|1. 5-gram LM||138.37|
We show how EntityLM, which allows an efficient computation of the probability , can be used as a coreference reranker to improve a competitive coreference resolution system due to Martschat and Strube (2015). This task is analogous to the reranking approach used in machine translation (Shen et al., 2004). The specific formulation is as follows:
where is the -best list for a given document. In our experiments, . To the best of our knowledge, the problem of obtaining -best outputs of a coreference resolution system has not been studied before.
We rerank the output of a system that predicts an antecedent for each mention by relying on pairwise scores for mention pairs. This is the dominant approach for coreference resolution (Martschat and Strube, 2015; Clark and Manning, 2016a). The predictions induce an antecedent tree, which represents antecedent decisions for all mentions in the document. Coreference chains are obtained by transitive closure over the antecedent decisions encoded in the tree. A mention also can have an empty mention as antecedent, which denotes that the mention is non-anaphoric.
For extending Martschat and Strube’s greedy decoding approach to -best inference, we cannot simply take the
highest scoring trees according to the sum of edge scores, because different trees may represent the same coreference chain. Instead, we use an heuristic that creates an approximate-best list on candidate antecedent trees. The idea is to generate trees from the original system output by considering suboptimal antecedent choices that lead to different coreference chains. For each mention pair , we compute the difference of its score to the score of the optimal antecedent choice for . We then sort pairs in ascending order according to this difference and iterate through the list of pairs. For each pair , we create a tree by replacing the antecedent of in the original system output with . If this yields a tree that encodes different coreference chains from all chains encoded by trees in the -best list, we add to the -best list. In the case that we cannot generate a given number of trees (particularly for a short document with a large
), we pad the list with the last item added to the list.
We employed cort111https://github.com/smartschat/cort, we used version 0.2.4.5. (Martschat and Strube, 2015) as our baseline coreference resolution system. Here, we compare with the original (one best) outputs of cort’s latent ranking model, which is the best-performing model implemented in cort. We consider two rerankers based on EntityNLM. The first reranking method only uses the log probability for EntityNLM to sort the candidate list (Equation 12). The second method uses a linear combination of both log probabilities from EntityNLM and the scores from cort, where the coefficients were found via grid search with the CoNLL score on the development set.
The reranked results on the CoNLL 2012 test set are reported in Table 2. The numbers of the baseline are higher than the results reported in Martschat and Strube (2015) since the feature set of cort was subsequently extended. Lines 2 and 3 in Table 2 present the reranked best results. As shown in this table, both reranked results give more than 1% of CoNLL score improvement on the test set over cort, which are significant based on an approximate randomization test222https://github.com/smartschat/art.
|1. Baseline: cort’s one best||62.93||77.15||68.67||72.66||66.00||54.92||59.95||60.07||52.76||56.18|
|2. Rerank: EntityNLM||64.00||77.90||69.45||73.44||66.84||56.12||61.01||61.73||53.90||57.55|
|3. Rerank: EntityNLM + cort||64.04||77.93||69.49||73.47||67.08||55.99||61.04||61.76||53.98||57.61|
Additional experiments also found that increasing from 100 to 500 had a minor effect. That is because the diversity of each -best list is limited by (i) the number of entity mentions in the document, (ii) the performance of the baseline coreference resolution system, and possibly (iii) the approximate nature of our -best inference procedure. We suspect that a stronger baseline system (such as that of Clark and Manning, 2016a) could give greater improvements, if it can be adapted to provide -best lists. Future work might incorporate the techniques embedded in such systems into EntityNLM.
|[ I] was about to ride [ my] [ bicycle] to the [ park] one day when [ I] noticed that the front [ tire] was flat . [ I] realized that [ I] would have to repair [ it] . [ I] went into [ my] [ garage] to get some [ tools] . The first thing [ I] did was remove the xxxx|
Based on Modi et al. (2017), we introduce a novel entity prediction task that tries to predict the next entity given the preceding text. For a given text as in Figure 3, this task makes a forward prediction based on only the left context. This is different from coreference resolution, where both left and right contexts from a given entity mention are used in decoding. It is also different from language modeling, since this task only requires predicting entities. Since EntityNLM is generative, it can be directly applied to this task. To predict entities in test data, is always given and EntityNLM only needs to predict when .
We introduce two baselines in this task: (i) the always-new baseline that always predicts “new entity”; (ii) a linear classification model using shallow features from Modi et al. (2017), including the recency of an entity’s last mention and the frequency. We also compare with the model proposed by Modi et al. (2017). Their work assumes that the model has prior knowledge of all the participant types, which are specific to each scenario and fine-grained, e.g., rider in the bicycle narrative, and predicts participant types for new entities. This assumption is unrealistic for pure generative models like ours. Therefore, we remove this assumption and adapt their prediction results to our formulation by mapping all the predicted entities that have not been mentioned to “new entity”. We also compare to the adapted human prediction used in the InScript corpus. For each entity slot, Modi et al. (2017) acquired 20 human predictions, and the majority vote was selected. More details about human predictions are discussed in (Modi et al., 2017).
Table 3 shows the prediction accuracies. EntityNLM (line 4) significantly outperforms both baselines (line 1 and 2) and prior work (line 3) (, paired -test). The comparison between line 4 and 5 shows our model is even close to the human prediction performance.
|1. Baseline: always-new||31.08|
|2. Baseline: shallow features||45.34|
|3. Modi et al. (2017)||62.65|
|5. Human prediction||77.35|
The originally proposed recurrent neural network language models only capture information within sentences. To extend the capacity of RNNLMs, various researchers have incorporated information beyond sentence boundaries. Previous work focuses on contextual information from previous sentences (Ji et al., 2016a) or discourse relations between adjacent sentences (Ji et al., 2016b), showing improvements to language modeling and related tasks like coherence evaluation and discourse relation prediction. In this work, EntityNLM adds explicit entity information to the language model, which is another way of adding a memory network for language modeling. Unlike the work by Tran et al. (2016), where memory blocks are used to store general contextual information for language modeling, EntityNLM assigns each memory block specifically to only one entity.
Two recent approaches to modeling entities in text are closely related to our model. The first is the “reference-aware” language models proposed by Yang et al. (2016), where the referred entities are from either a predefined item list, an external database, or the context from the same document. Yang et al. (2016) present three models, one for each case. For modeling a document with entities, they use coreference links to recover entity clusters, though they only model entity mentions as containing a single word (an inappropriate assumption, in our view). Their entity updating method takes the latest hidden state (similar to when in our model) as the new representation of the current entity; no long-term history of the entity is maintained, just the current local context. In addition, their language model evaluation assumes that entity information is provided at test time (Yang, personal communication), which makes a direct comparison with our model impossible. Our entity updating scheme is similar to the “dynamic memory” method used by Henaff et al. (2016). Our entity representations are dynamically allocated and updated only when an entity appears up, while the EntNet from Henaff et al. (2016) does not model entities and their relationships explicitly. In their model, entity memory blocks are pre-allocated and updated simultaneously in each timestep. So there is no dedicated memory block for every entity and no distinction between entity mentions and non-mention words. As a consequence, it is not clear how to use their model for coreference reranking and entity prediction.
The hierarchical structure of our entity generation model is inspired by Haghighi and Klein (2010). They implemented this idea as a probabillistic graphical model with the distance-dependent Chinese Restaurant Process (Pitman, 1995) for entity assignment, while our model is built on a recurrent neural network architecture. The reranking method considered in our coreference resolution evaluation could also be extended with samples from additional coreference resolution systems, to produce more variety (Ng, 2005). The benefit of such a system comes, we believe, from the explicit tracking of each entity throughout the text, providing entity-specific representations. In previous work, such information has been added as features (Luo et al., 2004; Björkelund and Kuhn, 2014) or by computing distributed entity representations (Wiseman et al., 2016; Clark and Manning, 2016b). Our approach complements these previous methods.
The entity prediction task discussed in §5.3 is based on work by Modi et al. (2017). The main difference is that we do not assume that all entities belong to a previously known set of entity types specified for each narrative scenario. This task is also closely related to the “narrative cloze” task of Chambers and Jurafsky (2008) and the “story cloze test” of Mostafazadeh et al. (2016). Those studies aim to understand relationships between events, while our task focuses on predicting upcoming entity mentions.
We have presented a neural language model, EntityNLM, that defines a distribution over texts and the mentioned entities. It provides vector representations for the entities and updates them dynamically in context. The dynamic representations are further used to help generate specific entity mentions and the following text. This model outperforms strong baselines and prior work on three tasks: language modeling, coreference resolution, and entity prediction.
We thank anonymous reviewers for the helpful feedback on this work. We also thank the members of Noah’s ARK and XLab at University of Washington for their valuable comments, particularly Eunsol Choi for pointing out the InScript corpus. This research was supported in part by a University of Washington Innovation Award, Samsung GRO, NSF grant IIS-1524371, the DARPA CwC program through ARO (W911NF-15-1-0543), and gifts by Google and Facebook.
Learning structured perceptrons for coreference resolution with latent antecedents and non-local features.In ACL.
Deep reinforcement learning for mention-ranking coreference models.In EMNLP.
Journal of Machine Learning Research, 12:2121–2159.