Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
POINTER SENTINEL MIXTURE ARCHITECTURE
Document Type and Number:
WIPO Patent Application WO/2018/057809
Kind Code:
A1
Abstract:
The technology disclosed provides a so-called "pointer sentinel mixture architecture" for neural network sequence models that has the ability to either reproduce a token from a recent context or produce a token from a predefined vocabulary. In one implementation, a pointer sentinel-LSTM architecture achieves state of the art language modeling performance of 70.9 perplexity on the Penn Treebank dataset, while using far fewer parameters than a standard softmax LSTM.

Inventors:
MERITY STEPHEN JOSEPH (US)
XIONG CAIMING (US)
BRADBURY JAMES (US)
SOCHER RICHARD (US)
Application Number:
PCT/US2017/052819
Publication Date:
March 29, 2018
Filing Date:
September 21, 2017
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
SALESFORCE COM INC (US)
International Classes:
G06N3/04
Other References:
CAGLAR GULCEHRE ET AL: "Pointing the Unknown Words", PROCEEDINGS OF THE 54TH ANNUAL MEETING OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS (VOLUME 1: LONG PAPERS), 21 August 2016 (2016-08-21), Stroudsburg, PA, USA, pages 140 - 149, XP055430117, DOI: 10.18653/v1/P16-1014
Attorney, Agent or Firm:
DURDIK, Paul A. et al. (US)
Download PDF:
Claims:
CLAIMS

What is claimed is:

1. A computer-implemented method of predicting a next word given a sequence of context words and a vocabulary of words, including circumstances in which the next word is in the vocabulary and not in the sequence, including: providing the sequence of context words as input to a neural network to produce a vocabulary distribution over words in the vocabulary, wherein the vocabulary distribution specifies respective likelihoods of each of the vocabulary words being the next word;

querying the neural network to produce a pointer distribution over context words in the sequence and a sentinel, wherein the pointer distribution specifies respective likelihoods of each of the context words being the next word;

mixing respective likelihoods from the vocabulary distribution and the pointer distribution to produce joint likelihoods for each of the words in the vocabulary and the sequence, with the mixing controlled by the sentinel; and

selecting a word from the vocabulary and/or the sequence as the next word based on the produced joint likelihoods.

2. The computer-implemented method of claim 1 , wherein the neural network is a recurrent neural network (abbreviated RNN).

3. The computer-implemented method of any of claims 1 to 2, wherein the RNN is a long short-term memory (abbreviated LSTM) network.

4. The computer-implemented method of any of claims 1 to 3, further including: formulating a query vector from a final hidden state vector of the neural network by processing the final hidden state vector through a multilayer perceptron;

using inner product to compare the query vector against hidden state vectors of the neural network and generating unnormalized attention scalars for each of the context words;

using inner product to compare the query vector against a pre-trained sentinel vector and generating an unnormalized sentinel gate scalar;

concatenating the unnormalized attention scalars and the unnormalized sentinel gate scalar in an attention vector and exponentially normalizing the attention vector to generate normalized attention masses and normalized sentinel gate mass; and using the normalized attention vector as the pointer distribution and the normalized attention masses as the respective likelihoods of each of the context words being the next word.

5. The computer-implemented method of any of claims 1 to 4, further including: if a word is in the sequence and not in the vocabulary, then determining a joint likelihood for the word from a corresponding normalized attention mass,

if a word is in the vocabulary and not in the sequence, then determining a joint likelihood for the word from a corresponding vocabulary probability mass determined from the vocabulary distribution, and

if a word is in both the sequence and the vocabulary, then determining a joint likelihood for the word by multiplying the normalized sentinel gate mass with a corresponding vocabulary probability mass produced from the vocabulary distribution and adding a corresponding normalized attention mass; and

selecting a word with a maximum joint likelihood as a response to the query vector and therefore the predicted next word.

6. The computer-implemented method of any of claims 1 to 5, wherein the normalized sentinel gate mass controls whether the next word is a context word from the sequence or a vocabulary word from the vocabulary.

7. The computer-implemented method of any of claims 1 to 6, further including: the normalized sentinel gate mass being unity when the next word exists only in the vocabulary; and

predicting the next word only from the vocabulary.

8. The computer-implemented method of any of claims 1 to 7, further including: the normalized sentinel gate mass being zero when the next word exists only in the sequence; and

predicting the next word only from the sequence.

9. The computer-implemented method of any of claims 1 to 8, wherein a context word appears at multiple positions in the sequence, further including: adding normalized attention masses corresponding to each of the positions of the context word in the sequence to generate a final normalized attention mass for the word; and

using the final normalized attention mass to produce a joint likelihood for the word. 10. The computer-implemented method of any of claims 1 to 9, further including: using the neural network and the joint likelihoods for one or more language modeling tasks, including speech recognition, machine translation, text summarization, question answering, image captioning, and text-to-speech synthesis.

11. A system including one or more processors coupled to memory, the memory loaded with computer instructions to predict a next word given a sequence of context words and a vocabulary of words, including circumstances in which the next word is in the vocabulary and not in the sequence, the instructions, when executed on the processors, implement actions comprising: providing the sequence of context words as input to a neural network to produce a vocabulary distribution over words in the vocabulary, wherein the vocabulary distribution specifies respective likelihoods of each of the vocabulary words being the next word;

querying the neural network to produce a pointer distribution over context words in the sequence and a sentinel, wherein the pointer distribution specifies respective likelihoods of each of the context words being the next word;

mixing respective likelihoods from the vocabulary distribution and the pointer distribution to produce joint likelihoods for each of the words in the vocabulary and the sequence, with the mixing controlled by the sentinel; and

selecting a word from the vocabulary and/or the sequence as the next word based on the produced joint likelihoods.

12. The system of claim 1 1 , further implementing actions comprising: formulating a query vector from a final hidden state vector of the neural network by processing the final hidden state vector through a multilayer perceptron;

using inner product to compare the query vector against hidden state vectors of the neural network and generating unnormalized attention scalars for each of the context words;

using inner product to compare the query vector against a pre-trained sentinel vector and generating an unnormalized sentinel gate scalar;

concatenating the unnormalized attention scalars and the unnormalized sentinel gate scalar in an attention vector and exponentially normalizing the attention vector to generate normalized attention masses and normalized sentinel gate mass; and

using the normalized attention vector as the pointer distribution and the normalized attention masses as the respective likelihoods of each of the context words being the next word. 13. The system of any of claims 11 to 12, further implementing actions comprising: if a word is in the sequence and not in the vocabulary, then determining a joint likelihood for the word from a corresponding normalized attention mass,

if a word is in the vocabulary and not in the sequence, then determining a joint likelihood for the word f om a corresponding vocabulary probability mass produced from the vocabulary distribution, and

if a word is in both the sequence and the vocabulary, then determining a joint likelihood for the word by multiplying the normalized sentinel gate mass with a corresponding vocabulary probability mass produced from the vocabulary distribution and adding a corresponding normalized attention mass; and

selecting a word with a maximum joint likelihood as a response to the query vector and therefore the predicted next word.

14. A non-transitory computer readable storage medium impressed with computer program instructions to predict a next word given a sequence of context words and a vocabulary of words, including circumstances in which the next word is in the vocabulary and not in the sequence, the instructions, when executed on a processor, implement a method comprising: providing the sequence of context words as input to a neural network to produce a vocabulary distribution over words in the vocabulary, wherein the vocabulary distribution specifies respective likelihoods of each of the vocabulary words being the next word;

querying the neural network to produce a pointer distribution over context words in the sequence and a sentinel, wherein the pointer distribution specifies respective likelihoods of each of the context words being the next word;

mixing respective likelihoods from the vocabulary distribution and the pointer distribution to produce joint likelihoods for each of the words in the vocabulary and the sequence, with the mixing controlled by the sentinel; and

selecting a word from the vocabulary and/or the sequence as the next word based on the produced joint likelihoods.

15. The non-transitory computer readable storage medium of claim 14, implementing the method further comprising: formulating a query vector from a final hidden state vector of the neural network by processing the final hidden state vector through a multilayer perceptron; using inner product to compare the query vector against hidden state vectors of the neural network and generating unnormalized attention scalars for each of the context words;

using inner product to compare the query vector against a pre-trained sentinel vector and generating an unnormalized sentinel gate scalar;

concatenating the unnormalized attention scalars and the unnormalized sentinel gate scalar in an attention vector and exponentially normalizing the attention vector to generate normalized attention masses and normalized sentinel gate mass; and

using the normalized attention vector as the pointer distribution and the normalized attention masses as the respective likelihoods of each of the context words being the next word.

Description:
POINTER SENTINEL MIXTURE ARCHITECTURE

CROSS REFERENCE TO OTHER APPLICATIONS

[0001] This application claims the benefit of U.S. Provisional Patent Application

62/397,926, 'TOINTER SENTINEL MIXTURE MODELS" (Atty. Docket No. SALE 1174- 1/1863PROV1), filed on September 22, 2016. The priority provisional application is hereby incorporated by reference;

[0002] This application claims the benefit of U.S. Provisional Patent Application

62/398,461, "POINTER SENTINEL MIXTURE MODELS" (Atty. Docket No. SALE 1174- 2/1863PROV2), filed on September 22, 2016. The priority provisional application is hereby incorporated by reference; and

[0003] This application claims the benefit of U.S. Provisional Patent Application

62/417,334, 'TOINTER SENTINEL MIXTURE MODELS" (Atty. Docket No. SALE 1174- 3/1863PROV3), filed on November 04, 2016. The priority provisional application is hereby incorporated by reference.

[0004] This application claims the benefit of U.S. Non-Provisional Patent Application 15/421,016, "POINTER SENTINEL MIXTURE MODELS" (Atty. Docket No. SALE 1174- 4/1863US), filed on January 31, 2017. The priority non-provisional application is hereby incorporated by reference.

FIELD OF THE TECHNOLOGY DISCLOSED

[0005] The technology disclosed relates generally to natural language processing (NLP) using deep neural networks, and in particular relates to a pointer sentinel mixture architecture that improves next word prediction in neural network-based language modeling.

BACKGROUND

[0006] The subject matter discussed in this section should not be assumed to be prior art merely as a result of its mention in this section. Similarly, a problem mentioned in this section or associated with the subject matter provided as background should not be assumed to have been previously recognized in the prior art. The subject matter in this section merely represents different approaches, which in and of themselves can also correspond to implementations of the claimed technology.

[0007] Recent neural network sequence models with softmax classifiers have achieved their best language modeling performance only with very large hidden states and large vocabularies. Even then they struggle to predict rare or unseen words even if the context makes the prediction unambiguous. The technology disclosed provides a so-called "pointer sentinel mixture architecture" for neural network sequence models that has the ability to either reproduce a token from a recent context or produce a token from a predefined vocabulary. In one implementation, a pointer sentinel-LSTM architecture achieves state of the art language modeling performance of 70.9 perplexity on the Penn Treebank dataset, while using far fewer parameters than a standard softmax LSTM.

BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In the drawings, like reference characters generally refer to like parts throughout the different views. Also, the drawings are not necessarily to scale, with an emphasis instead generally being placed upon illustrating the principles of the technology disclosed. In the following description, various implementations of the technology disclosed are described with reference to the following drawings, in which:

[0009] FIG. 1 illustrates aspects of a pointer sentinel mixture architecture that improves prediction of rare and out of vocabulary (OoV) tokens in neural network sequence modeling.

[0010] FIG.2 shows one implementation of operation of the pointer sentinel mixture architecture of FIG. 1.

[0011] FIG.3 depicts one implementation of a sentinel gate vector that dictates how much weight to give to a pointer network and to a vocabulary network.

[0012] FIG.4 is a numerical example that shows one implementation of operation of the pointer sentinel mixture architecture of FIG. I.

[0013] FIG. 5 illustrates a table that compares a pointer sentinel-LSTM to a variety of other models on a Penn Treebank dataset.

[0014] FIG. 6 is a table that compares a pointer sentinel-LSTM to a variety of other models on a WikiText-2 language modeling task.

[0015] FIG. 7 is a graph that depicts mean difference in log perplexity on a Penn Treebank dataset when using a pointer sentinel-LSTM compared to a LSTM model.

[0016] FIG. 8A and FIG. 8B illustrate visualized qualitative analysis of how a pointer network is used by the pointer sentinel mixture architecture of FIG. 1 to predict rare and out of vocabulary (OoV) tokens.

[0017] FIG. 9 is a simplified block diagram of a computer system that can be used to implement the pointer sentinel mixture architecture of FIG. 1.

APPENDIX A

[0018] The following is incorporated by reference herein and also attached hereto as part of a single invention: [0019] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv: 1609.07843, 2016. The pointer sentinel mixture models have the ability to either reproduce a word from the recent context or produce a word from a standard softmax classifier. The pointer sentinel-LSTM model achieves state of the art language modeling performance on the Perm Treebank (70.9 perplexity) while using far fewer parameters than a standard softmax LSTM.

DETAILED DESCRIPTION

[0020] The following discussion is presented to enable any person skilled in the art to make and use the technology disclosed, and is provided in the context of a particular application and its requirements. Various modifications to the disclosed implementations will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other implementations and applications without departing from the spirit and scope of the technology disclosed. Thus, the technology disclosed is not intended to be limited to the implementations shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.

[0021] The discussion is organized as follows. First, an introduction describing some of the problems addressed by the pointer sentinel mixture architecture is presented. Then, the pointer network is described, followed by some examples of operation of the pointer sentinel mixture architecture. Lastly, some experimental results illustrating performance of the pointer sentinel mixture architecture on various NLP datasets and tasks are provided.

Introduction

[0022] A major difficulty in language modeling is learning when to predict specific tokens from the immediate context. For instance, imagine a new person is introduced and two paragraphs later the context would allow one to very accurately predict this person's name as the next token. For standard neural network sequence models to predict this name, they would have to encode the name, store it for many time steps in their hidden state, and then decode it when appropriate. As the hidden state is limited in capacity and the optimization of such models suffers from the vanishing gradient problem, this is a lossy operation when performed over many timesteps. This is especially true for rare tokens.

[0023] Models with soft attention or memory components have been proposed to help deal with this challenge, aiming to allow for the retrieval and use of relevant previous hidden states, in effect increasing hidden state capacity and providing a path for gradients not tied to timesteps. Even with attention, the standard softmax classifier that is being used in these models often struggles to correctly predict rare or previously unknown tokens. [0024] Pointer networks provide one potential solution for rare and out of vocabulary (OoV) tokens as a pointer network uses attention to select an element from the input as output. This allows it to produce previously unseen input tokens. While pointer networks improve performance on rare tokens and long term dependencies, they are unable to select tokens that do not exist in the input, a common scenario in language modeling.

[0025] To address these problems, the technology disclosed provides a so-called "pointer sentinel mixture architecture" that combines the advantages of standard softmax classifiers with those of a pointer network for effective and efficient language modeling. Rather than relying on the RNN hidden state to decide when to use the pointer network, the pointer sentinel mixture architecture allows the pointer network itself to decide when to use the vocabulary through a sentinel gate vector. The pointer sentinel mixture architecture improves the state of the art perplexity on the Penn Treebank dataset.

Pointer Sentinel Mixture Architecture

[0026] FIG. 1 illustrates aspects of a pointer sentinel mixture architecture 100 that improves prediction of rare and out of vocabulary (OoV) tokens in neural network sequence modeling.

FIG.2 shows one implementation of operation of the pointer sentinel mixture architecture 100.

[0027] Given a sequence or window of tokens 202, also referred to herein as

the "context text" or "pointer window", the pointer sentinel mixture architecture 100 predicts the next token . The context text is stored in a database 122. As used herein, the term "token" can refer to a word, a character, or a phrase.

[0028] The pointer sentinel mixture architecture 100 includes a recurrent neural network (RNN) 114. RNNs have seen widespread use for language modeling due to their ability to retain long term dependencies. RNNs employ the chain rule to factorize the joint probabilities over a sequence of tokens: More precisely, at each

time step i , a RNN hidden state is computed in dependence upon the previous hidden state

and the input X mat The hidden states of the RNN /. such

114 generated over the window of tokens also referred to herein as the "output

states" or "output state vectors", are stored in a database 116.

[0029] When all the N— 1 tokens have been processed by the RNN 114, the final output state vector 204 is provided to a vocabulary network 124. The vocabulary network 124 includes a vocabulary probability masses calculator 126, which feeds the final output state vector 204 into an exponential normalizer (e.g., a softmax layer) and computes a distribution of

vocabulary probability masses over a vocabulary of possible tokens, also referred to herein as the "vocabulary distribution" 220. As such, in implementations, a sum of the vocabulary probability masses is a predetermined constant (e.g., 1, 2, 10, and so on).

[0030] The following mathematical formulation shows one implementation of operation of the vocabulary network 124 and the vocabulary probability masses calculator 126:

where is the vocabulary distribution 220 , is the hidden

size, and is the vocabulary size. The vocabulary, also referred to herein as the 'Vocabulary text", is stored in a database 118.

[0031] R Ns can suffer from the vanishing gradient problem. The long short-term memory (LSTM) architecture has been proposed to deal with the vanishing gradient problem by updating the hidden state according to a set of gates. The pointer sentinel mixture architecture uses the LSTM, in one implementation. In other implementations, it uses variants of the LSTM, such as no input gate (NIG) variant, no forget gate (NFG) variant, no output gate (NOG) variant, no input activation function (NIAF) variant, no output activation function (NOAF) variant, no peepholes (NP) variant, coupled input-forget gate (CIFG) variant, and full gate recurrent (FGR) variant. In yet other implementations, it uses a gated recurrent unit (GRU), or any other type of RNN, or any other conventional or future-developed neural network, such as the ones that employ a softmax classifier.

[0032] The pointer sentinel mixture architecture 100 also includes a pointer network 102. To predict the next token in the sequence, the pointer network 102 selects a member of the

input sequence with the maximal attention probability mass as the output,

according to one implementation. The pointer network 102 comprises an attention probability masses calculator 112, which computes an attention probability mass 214 for a specific hidden state using an inner product with all the past hidden states h , with each hidden state being

As used herein, "inner product" is referred to as "dot product", "distance measure

product", and/or "linguistic similarity determiner". In another implementation, to compute an attention probability mass 214 for the most recent token (since this token may be repeated), the attention probability masses calculator 112 also includes the last hidden state itself in the inner product. In implementations, the inner product is carried out by a distance measure calculator 108 of the pointer network 102, which produces respective unnormalized attention values for each of the token position in the window of tokens Then, the attention

probability masses calculator 112 uses an exponential normalizer, like a softmax activation function, to generate the normalized attention probability masses 214 from the unnormalized attention values.

[0033] Taking the inner product of a vector with itself results in the vector's magnitude squared, meaning the attention probability masses 214 would be strongly biased towards the most recent token. To resolve this problem, the pointer network 102 comprises a query creator 106, which projects the current output state vector through a linear layer (e.g., a multilayer perceptron) to produce a nonlinear projection in the form of a so-called "query vector" q 208.

The following mathematical formulation shows one implementation of generating the query vector q 208:

where

[0034] In another implementation, the attention probability masses calculator 112 computes an attention probability mass 214 for each token position in the window of tokens

by calculating an inner product between the previous R N output states and the query vector q 208, followed by a softmax activation function to obtain a probability distribution, as shown in the following mathematical formulation:

where is the total number of hidden states. In implementations,

the inner product between the output states and the query vector q 208 is carried out by the

distance measure calculator 108, which produces respective unnormalized attention values for each of the token position in the window of tokens Then, the attention

probability masses calculator 112 uses an exponential normalizer, like the softmax activation function, to generate the normalized attention probability masses 214 from the unnormalized attention values. [0035] When a token appears at multiple positions in the context text, the final attention probability mass assigned to the token is the sum of the attention probability masses given to all token positions where the token appears, as shown in the following mathematical formulation:

where results in all positions of the token W in the input is

the pointer distribution.

[0036] Given the length of the documents used in language modeling, it may not be feasible for the pointer network 102 to evaluate attention probability masses 214 for all the tokens back to the beginning of the dataset. Instead, in some implementations, the pointer network 102 elects to maintain only a window of M most recent tokens to match against. The length M of the window is a hyperparameter that can be tuned on a held out dataset or by empirically analyzing how frequently a token at position t appears in the last M tokens.

[0037] To illustrate the advantages of this approach, consider a long article featuring two sentences "President Obama discussed the economy" and "President Obama then flew to Prague". If the query is "Which President is the article about?", attention probability masses could be calculated for "Obama" in either sentence. If the question instead is "Who flew to Prague?", only the latter occurrence of 'Obama" provides the proper context. The pointer network 102 ensures that, as long as the final attention probability mass is distributed over all the occurrences of ' bama", the pointer network 102 achieves zero loss. This flexibility provides supervision without forcing the pointer network 102 to put attention probability mass on supervision signals that may be incorrect or lack proper context.

[0038] Accordingly, the pointer sentinel mixture architecture 100 has two base distributions: the distribution of attention probability masses 214 over the tokens in the context text 122 calculated by the pointer network 102 (also referred to herein as the "pointer distribution" 214) and the distribution of vocabulary probability masses over the tokens in the vocabulary text 118 (also referred to herein as the "vocabulary distribution" 220). To combine the two base distributions, the pointer sentinel mixture architecture 100 has a pointer-vocabulary mixer 128 that implements a gating function, referred to herein as the "gate probability mass" g 216. The gate probability mass g 216 is derived from a so-called "sentinel gate vector" 104 of the pointer network 102. In implementations, the sentinel gate vector 104 is part of a sentinel layer 206 of the pointer network 102. The sentinel gate vector 104 controls accumulation of information from the vocabulary network 124 and the pointer network 102. That is, the sentinel gate vector 104 governs mixing of the attention probability masses 214 and the vocabulary probability masses 220, as illustrated in the following mathematical formulations:

where is the sentinel gate vector 104 that is trained a priori to dictate which base

distribution a data point belongs to during testing and is a distribution of output

probability masses over tokens ( also referred to herein as the "output distribution" 222), where represents the tokens in the context text 122 and the vocabulary text 118 such that each token is identified in the output distribution 222 only once.

[0039] In one implementation, the sentinel gate vector 104 is a trained vector that is not modified during the testing and remains fixed. In another implementation, the sentinel gate vector 104 is a trained vector that is dynamically modified during the testing in dependence upon the final output state vector 204 produced for a given input sequence of context text. In

the dynamic implementation, the sentinel gate vector 104 is combined 224 with the final output state vector 204 (e.g., using concatenation or elementwise summation), and the

combination of the two is projected through a linear layer (e.g., a multilayer perceptron) to produce a nonlinear projection in the form of a so-called "dynamic sentinel state vector". The following mathematical formulation shows one implementation of the dynamic sentinel state vector z , :

where and denotes concatenation.

[0040] To train the sentinel gate vector 104, the pointer sentinel mixture architecture 100 implements a sentinel loss function. Implementing the sentinel loss function includes minimizing the cross-entropy loss of - is a one hot encoding of the

correct output. During training, as is one hot, only a single mixed probability p (y ) is

computed for calculating the loss. This results in a far more efficient GPU implementation. At prediction time, for all values of p (y, \ χ,) , a maximum of L token probabilities is mixed, as there is a maximum of L unique tokens in the pointer window of length L . This mixing occurs on the CPU where random access indexing is more efficient than the GPU. The sentinel loss function then becomes - results in all positions of the

correct output y in the input X .

[0041] To produce the gate probability mass g 216, a gate probability mass calculator 110 of the pointer network 102 calculates an inner product between the sentinel gate vector 104 and the query vector q 208. In the fixed implementation, the gate probability mass calculator 110 calculates the inner product between a fixed sentinel gate vector and the query vector q 208. In a dynamic implementation, the gate probability mass calculator 110 calculates the inner product between a dynamic sentinel gate vector and the query vector q 208. The result of the inner product is an unnormalized gate value.

[0042] Next, the gate probability mass calculator 110 uses an exponential normalizer, like a softmax activation function, to generate the gate probability mass g 216 from the unnormalized gate value. In implementations, the unnormalized attention values for each of the token position in the window of tokens and the unnormalized gate value are arrayed and/or

arranged and/or concatenated in a so-called "pointer sequence". Then, an exponential normalizer (e.g., softmax) is applied to the pointer sequence to generate the normalized attention probability masses 214 from the unnormalized attention values and the gate probability mass g 216 from the unnormalized gate value. That is, the attention probability masses calculator 112 and the gate probability mass calculator 110 share a single exponential normalizer 210 (e.g., softmax) that applies in parallel to the unnormalized attention values and the unnormalized gate value of the pointer sequence to calculate a joint probability mass a 212. As such, in implementations, a sum of the attention probability masses 214 and the gate probability mass g 216 is a predetermined constant (e.g., 1, 2, 10, and so on). The following mathematical formulation describes the joint probability mass 212 over the pointer sequence:

where is the joint probability mass distribution 212 over both the tokens in the context text 122 as well as the sentinel gate vector 104, T is the vector containing the unnormalized attention values for each of the token position in the window of tokens

in the context text 122, is the query vector 208, is the sentinel gate vector

104, " * " denotes concatenation, and the values within the square brackets [ ] together represent the pointer sequence. The last element of the joint probability mass distribution is interpreted to be the gate probability mass 216, with

[0043] Thus, in one implementation, the normalized pointer distribution then becomes:

where denotes the first

V elements of the vector.

[0044] The output distribution 222 then becomes:

where the pointer-vocabulary mixer 128 uses the gate probability mass g 216 to mix the vocabulary distribution 220 and the pointer distribution 214

and produces the output distribution 222

[0045] In implementations, the gate probability mass g 216 is a scalar in the range [0, 1]. A value of 0 implies that only the pointer network 102 is used and 1 means only the vocabulary network 124 is used. Thus the pointer sentinel mixture architecture 100 relies on the gate probability mass g 216 to use the pointer network 102 whenever possible and back-off to the vocabulary network 124 otherwise. By using the sentinel gate vector 104 to integrate the gating function into the computations of the pointer network 102, the pointer sentinel mixture architecture 100 is influenced by both the hidden states of the RNN 114 and the window of tokens in the immediate context text 122.

[0046] The integration allows the gate probability mass g 216 to use as much context as possible. The decision to back-off to the vocabulary distribution 220 is then informed by both the query vector q 208, generated using the final output state vector 204 of the RNN 114,

and from the contents of the hidden states for the pointer window itself. This allows the pointer sentinel mixture architecture 100 to accurately query which hidden states are contained in the pointer window and avoid maintaining state for tokens that may have fallen out of the pointer window. [0047] In some implementations, prior to the mixing governed by the gate probability mass g 216, a transformer 218 is used to transform the dimensionality of the pointer distribution 214 to match that of the vocabulary distribution 220.

[0048] During training, the gate probability mass g 216 can be assigned all probability mass if, for instance, the correct output exists only in the vocabulary distribution 220. In

some implementations, there is no penalty if the pointer sentinel mixture architecture 100 places the entire probability mass on any of the instances of the correct token in the pointer window. If the pointer network 102 places the entirety of the probability mass on the gate probability mass g 216, the pointer network 102 incurs no penalty and the loss is entirely determined by the loss of the vocabulary network 124, according to some implementations.

[0049] In one implementation, an LSTM-based pointer sentinel mixture architecture 100 (also referred to herein as the "pointer sentinel-LSTM") results in a relatively minor increase in parameters and hyperparameters and computation time, especially when compared to the model size required to achieve similar performance using a standard LSTM. The only two additional parameters required by the architecture 100 are those required for computing the query vector q

208, specifically , and the sentinel gate vector embedding,

. This is independent of the depth of the R N 114, as the pointer network 102 only

interacts with the output of the final RNN layer. The additional parameters are minor compared to a single LSTM layer's parameters. Some implementations

also include using multiple LSTM layers. In terms of additional computation, a pointer sentinel- LSTM of window size L only requires computing the query vector q 208 using a linear layer with tanh activation, a total of L parallelizable inner product calculations, and the attention probability masses 214 for the L resulting scalars via the softmax function.

[0050] Other implementations of the pointer sentinel mixture architecture 100 include using normalizers different than, in addition to, and/or in combination with the exponential normalizes Some examples include sigmoid based normalizers (e.g., multiclass sigmoid, piecewise ramp), hyperbolic tangent based normalizers, rectified linear unit (ReLU) based normalizers, identify based normalizers, logistic based normalizers, sine based normalizers, cosine based normalizers, unit sum based normalizers, and step based normalizers. Other examples include hierarchical softmax, differentiated softmax, importance sampling, noise contrastive estimation, negative sampling, gated softmax spherical sof max, Taylor softmax, and sparsemax. In yet other implementations, any other conventional or future-developed normalizer can be used.

[0051] The components in FIG. 1 can be implemented in hardware or software, and need not be divided up in precisely the same blocks as shown in FIG. 1. Some of the components can also be implemented on different processors or computers, or spread among a number of different processors or computers. In addition, it will be appreciated that some of the components can be combined, operated in parallel or in a different sequence than that shown in FIG. 1 without affecting the functions achieved. Also as used herein, the term "component" can include "subcomponents", which themselves can be considered herein to constitute components. For example, the sentinel gate vector 104, the query creator 106, the distance measure calculator 108, the gate probability mass calculator 110, and the attention probability masses calculator 112 can also be considered herein to be sub-components of the pointer network 102. Furthermore, the blocks in FIG. 1 can also be thought of as flowchart steps in a method. A component or subcomponent also need not necessarily have all its code disposed contiguously in memory; some parts of the code can be separated from other parts of the code with code from other components or sub-components or other functions disposed in between. Also, the components in FIG. 1 are connected via a network(s) 120.

[0052] In some implementations, the pointer network 102 and the vocabulary network 124 are entirely separate. In other implementations, they share many of the parameters and hyperparameters. In one implementation, the sharing minimizes the total number of parameters and hyperparameters in the pointer sentinel mixture architecture 100 and improves the pointer network 102's supervision of the vocabulary network 124.

[0053] FIG.3 depicts one implementation of the sentinel gate vector 104 that dictates how much weight to give to the pointer network 102 and to a vocabulary network 124. In the example shown in FIG.3, the pointer sentinel mixture architecture 100 predicts the next word after seeing a set of sentences like "Fed Chair Janet Yellen ... raised rates. Ms. ???".

[0054] In FIG.3, at the bottom, the vocabulary network 124 predicts the next word using the fixed set of words in the vocabulary text 118. This knowledge may be more related to the distant past, such as old references or training data involving the previous Fed Char Ben Barnanke. Also in FIG. 3, at the top, the pointer network 102 predicts the next word using the story's recent history. By looking at the relevant context, it realizes that "Janet Yellen" will likely be referred to again, and also realizing that "Janet" is a first name and that it needs a last name, the pointer network 102 points to "Yellen".

[0055] By mixing the two information sources, i.e., by first "pointing" to recent relevant words using context and then otherwise using the RN 's internal memory and vocabulary if there is no good context, the pointer sentinel mixture architecture 100 is able to get a far more confident answer.

[0056] FIG.4 is a numerical example that shows one implementation of operation of the pointer sentinel mixture architecture 100. In FIG.4, the words "dog" and "chased" represent the input sequence or the context words 402 such that the NLP task is to predict the next missing word ??? in light of the preceding words "dog" and "chased".

[0057] The pointer distribution 214 calculated by the pointer network 102 assigns the word "dog" an attention probability mass of 0.1 and assigns the word "chased" an attention probability mass of 0. Further, the gate probability mass g 216 determined by the pointer network 102 is

0.9. Note that the joint probability mass over the pointer sequence 404 adds to a unit sum.

[0058] Also assume that in the example shown in FIG. 4 the vocabulary text 118 comprises only four known words 406, namely, "dog", "chased", "cat", and "mailman". Accordingly, the vocabulary distribution 220 calculated by the vocabulary network 124 assigns the word "dog" a vocabulary probability mass of 0.2, assigns the word "chased" a vocabulary probability mass of 0, assigns the word "cat" a vocabulary probability mass of 0.5, and assigns the word "mailman" a vocabulary probability mass of 0.3. Note that the vocabulary distribution 220 over the vocabulary words 406 adds to a unit sum.

[0059] To identify the missing word ???, the output distribution 222 is calculated by mixing the pointer distribution 214 and the vocabulary distribution 220 such that the mixing is governed by the gate probability mass g 216 of 0.9. As shown in FIG. 4, the output distribution for the word "dog" is calculated to be 0.28, the output distribution for the word "chased" is calculated to be 0, the output distribution for the word "cat" is calculated to be 0.4S, and the output distribution for the word "mailman" is calculated to be 0.27. Note that the output distribution 222 over the context words 402 and the vocabulary words 406 adds to a unit sum.

[0060] Finally, the word with a maximal or highest output probability mass is selected as the missing word ???, which in this example is the word "cat".

[0061] In one implementation, if a selected token that completes the context text 122 is in the context text 122 and not in the vocabulary text 118, then an output probability mass is produced for the token in dependence upon a corresponding attention probability mass. In another implementation, if a token is in the vocabulary text 118 is and not in the context text 122, then an output probability mass is produced for the token in dependence upon multiplying the gate probability mass g 216 with a corresponding vocabulary probability mass. In yet another implementation, if a token is in both the context text 122 and the vocabulary text 118, then an output probability mass is produced for the token in dependence upon multiplying the gate probability mass g 216 with a corresponding vocabulary probability mass and adding a corresponding attention probability mass.

Experimental Results

[0062] FIG. 5 illustrates a table that compares a pointer sentinel-LSTM to a variety of other models on a Penn Treebank dataset. A pointer sentinel-LSTM architecture achieves state of the art language modeling performance of 70.9 perplexity on the Penn Treebank dataset, while using far fewer parameters than a standard softmax LSTM.

[0063] FIG. 6 is a table that compares a pointer sentinel-LSTM to a variety of other models on a WikiText-2 language modeling task. A pointer sentinel-LSTM architecture achieves state of the art language modeling performance of 80.8 perplexity on the WikiText-2 language modeling task, while using far fewer parameters than a standard softmax LSTM.

[0064] A hypothesis as to why the pointer sentinel-LSTM can outperform an LSTM is that the pointer network 102 allows the pointer sentinel mixture architecture 100 to effectively reproduce rare words. The RNN 114 can better use hidden state capacity by relying on the pointer network 102. The pointer network 102 also allows for a sharper selection of a single token than may be possible using only the softmax classifier.

[0065] FIG. 7 contains a graph which shows the improvement of perplexity when comparing the LSTM to the pointer sentinel-LSTM. Words are split across buckets according to frequency. As the words become rarer, the pointer sentinel-LSTM has stronger improvements in perplexity. Even on the Penn Treebank dataset, where there is a relative absence of rare words due to only selecting the most frequent 10k words, the pointer sentinel-LSTM provides a direct benefit. While the improvements are largest on rare words, the pointer sentinel-LSTM is still helpful on relatively f equent words. This is due to the pointer network 102 directly selecting the word or through the pointer supervision signal improving the RNN 114 by allowing gradients to flow directly to other occurrences of the word in that window.

[0066] In a qualitative analysis, FIGs. 8A and 8B visualize the gate use and pointer attention for a variety of examples in the validation set, focusing on predictions where the gate is primarily used by the pointer network 102. As expected, the pointer network 102 is heavily used for rare names such as "Seidman" (23 times in training), "Iverson" (7 times in training), and "Rosenthal" (3 times in training). The pointer network 102 is also heavily used when it comes to other named entity names such as companies like "Honeywell" (8 times in training) and "Integrated" (41 times in training, though due to lowercasing of words this includes integrated circuits, fully integrated, and other generic usage). The pointer network 102 is also used for many frequent tokens. For selecting units of measurement (tons, kilograms, . . . ) or the short scale of numbers (thousands, millions, billions, . . . ), the pointer network 102 refers to recent usage. This is to be expected, especially when phrases are of the form increased from N tons to N tons. In some implementations, the pointer sentinel mixture architecture 100 relies on a mixture of the softmax and the pointer network 102 for predicting frequent verbs such as "said".

[0067] Additionally, the pointer network 102 points to words at the very end of the 100 word window (position 97), which is far longer horizon than the 35 steps that most language models truncate their backpropagation training to. This illustrates why the pointer sentinel mixture architecture 100 integrates the gating function into the pointer network 102. If the gating function only uses the RN hidden states 116, it would need to be wary of words that were near the tail of the pointer window, especially if it is not able to accurately track exactly how long it has been since seeing a word. By integrating the gating function into the pointer network 102, the pointer sentinel mixture architecture 100 avoids the RNN hidden states 116 from having to maintain this intensive bookkeeping.

[0068] FIGs. 8A and 8B, for a qualitative analysis, visualize how the pointer network 102 is used within the pointer sentinel mixture architecture 100. The gate refers to the result of the gating function, with 1 indicating the vocabulary network 124 is exclusively used whilst 0 indicates the pointer network 102 is exclusively used. FIGs. 8A and 8B begin with predictions that are using the vocabulary network 124 primarily and move to ones that use the pointer network 102 primarily.

[0069] Referring to prediction 802, in predicting "the fall season has been a good one especially for those retailers", the pointer network 102 suggests many words from the historical window that would fit - "retailers", "investments", "chains", and "institutions". The gate is still primarily weighted towards the vocabulary network 124.

[0070] Referring to prediction 804, in predicting "the national cancer institute also projected that overall u.s. mortality", the pointer network 102 is focused on mortality and rates, both of which would fit. The gate is still primarily weighted towards the vocabulary network 124.

[0071] Referring to prediction 806, in predicting "people don't seem to be unhappy with it he said", the pointer network 102 correctly selects "said" and is almost equally weighted with the vocabulary network 124.

[0072] Referring to prediction 808, in predicting "the federal government has had to pump in SN billion", the pointer network 102 focuses on the recent usage of billion with highly similar context. The pointer network 102 is also relied upon more heavily than the vocabulary network 124.

[0073] Referring to prediction 810, in predicting "[unk]'s ghost sometimes runs through the e ring dressed like gen. noriega", the pointer network 102 reaches 97 timesteps back to retrieve "gen. douglas". Unfortunately this prediction is incorrect, but without additional context, a human would have guessed the same word. This additionally illustrates why the gating function is integrated into the pointer network 102. The named entity "gen. douglas" would have fallen out of the window in only four more timesteps because the R N hidden states 116 would not be able to accurately retain information for almost 100 timesteps.

[0074] Referring to prediction 812, in predicting "mr. iverson", the pointer network 102 learns the ability to point to the last name of the most recent named entity. The named entity also occurs 45 timesteps ago, which is longer than the 35 steps that most language models truncate their backpropagation to.

[0075] Referring to prediction 814, in predicting "mr. rosenthal", the pointer network 102 is almost exclusively used and reaches back 65 timesteps to identify "bruce rosenthal" as the person speaking, correctly only selecting the last name.

[0076] Referring to prediction 816, in predicting "in composite trading on the new york stock exchange yesterday integrated", the company "Integrated" and the [unk] token are primarily attended to by the pointer network 102, with nearly the full prediction determined by the pointer network 102.

Particular Implementations

[0077] We describe systems, methods, and articles of manufacture for a pointer sentinel mixture architecture that improves next word prediction in neural network-based language modeling. One or more features of an implementation can be combined with the base implementation. Implementations that are not mutually exclusive are taught to be combinable. One or more features of an implementation can be combined with other implementations. This disclosure periodically reminds the user of these options. Omission from some implementations of recitations that repeat these options should not be taken as limiting the combinations taught in the preceding sections - these recitations are hereby incorporated forward by reference into each of the following implementations.

[0078] A system implementation of the technology disclosed includes one or more processors coupled to the memory. The memory is loaded with computer instructions to predict a token given context text and vocabulary text, including circumstances in which the token is in the vocabulary text and not in the context text

[0079] The system mixes results of a pointer network and a vocabulary network to predict the token, with the mixing governed by a gate probability mass.

[0080] The system calculates the results of the pointer network over a window of tokens in the context text and the gate probability mass by using a trained sentinel gate vector, hidden state vectors of a recurrent neural network (abbreviated RNN) for each position in the window of tokens, a query vector formulated from a final hidden state vector of the RNN, an unnormalized gate value calculated as a distance measure product between the query vector and the trained sentinel gate vector, and unnormalized attention values for each of the positions in the window of tokens, each calculated as a distance measure product between the query vector and each of the hidden state vectors.

[0081] The system concatenates the unnormalized attention values and the unnormalized gate value and exponentially normalizes the concatenated attention and gate values to produce a vector of attention probability masses and the gate probability mass.

[0082] The system calculates the results of the vocabulary network by computing, from the final hidden state vector of the RNN, a distribution of vocabulary probability masses over tokens in the vocabulary text.

[0083] The system produces a distribution of output probability masses over the tokens in the context text and the vocabulary text. If a token is in the context text and not in the vocabulary text, then the system produces an output probability mass for the token as a corresponding attention probability mass. If a token is in the vocabulary text and not in the context text, then the system produces an output probability mass for the token by multiplying the gate probability mass with a corresponding vocabulary probability mass. If a token is in both the context text and the vocabulary text, then the system produces an output probability mass for the token by multiplying the gate probability mass with a corresponding vocabulary probability mass and adding a corresponding attention probability mass.

[0084] The system selects a token with a maximum output probability mass as a response to the query vector.

[0085] This system implementation and other systems disclosed optionally include one or more of the following features. System can also include features described in connection with methods disclosed. In the interest of conciseness, alternative combinations of system features are not individually enumerated. Features applicable to systems, methods, and articles of manufacture are not repeated for each statutory class set of base features. The reader will understand how features identified in this section can readily be combined with base features in other statutory classes.

[0086] The query vector can be formulated from the final hidden state vector of the RNN by processing the final hidden state vector through a linear layer to generate a non-linear projection.

[0087] The gate probability mass can result from exponentially normalizing the

unnormalized gate value. A sum of the vector of the attention probability masses and the gate probability mass can a predetermined constant (e.g., 1). A sum of the distribution of the vocabulary probability masses over the tokens in the vocabulary text can be a predetermined constant (e.g., 1). A sum of the distribution of the output probability masses over the tokens in the context text and the vocabulary text can a predetermined constant (e.g., 1).

[0088] When a token appears at multiple positions in the context text, the system adds attention probability masses corresponding to each of the positions of the token in the context text to calculate a final attention probability mass for the token and uses the final attention probability mass to calculate an output probability mass for the token.

[0089] The trained sentinel gate vector can be trained a priori. The trained sentinel gate vector can control accumulation of information f om the vocabulary network and the pointer network. The gate probability mass being unity can result in accumulation of information from the vocabulary network. The gate probability mass being zero can result in accumulation of information from the pointer network.

[0090] A dynamic sentinel gate vector can be formulated from the final hidden state vector of the RN by concatenating the final hidden state vector with the trained sentinel gate vector and processing the concatenation through a linear layer to generate a non-linear projection.

[0091] The token can be a word, a character, or a phrase.

[0092] Other implementations may include a non-transitory computer readable storage medium storing instructions executable by a processor to perform functions of the system described above. Yet another implementation may include a method performing the functions of the system described above.

[0093] Another system implementation of the technology disclosed includes one or more processors coupled to the memory. The memory is loaded with computer instructions to predict a token given context text and vocabulary text, including circumstances in which the token is in the vocabulary text and not in the context text.

[0094] The system mixes results of a pointer network and a vocabulary network to predict the token, with the mixing governed by a gate probability mass.

[0095] The system calculates the results of the pointer network over a window of tokens in the context text and the gate probability mass by using a trained sentinel gate vector, hidden state vectors of a recurrent neural network (abbreviated RNN) for each position in the window of tokens, a query vector formulated from a final hidden state vector of the RNN, an unnormalized gate value calculated as a distance measure product between the query vector and the trained sentinel gate vector, and unnormalized attention values for each of the positions in the window of tokens, each calculated as a distance measure product between the query vector and each of the hidden state vectors. [0096] The system concatenates the unnormalized attention values and the unnormalized gate value and exponentially normalizes the concatenated attention and gate values to produce a vector of attention probability masses and the gate probability mass.

[0097] The system calculates the results of the vocabulary network by computing, from the final hidden state vector of the RN , a distribution of vocabulary probability masses over tokens in the vocabulary text.

[0098] The system produces a distribution of output probability masses over the tokens in the context text and the vocabulary text.

[0099] The system selects a token with a maximum output probability mass as a response to the query vector.

[00100] Each of the features discussed in this particular implementation section for the first system implementation apply equally to this system implementation. As indicated above, all the system features are not repeated here and should be considered repeated by reference.

[00101] If a token is in the context text and not in the vocabulary text, then the system can produce an output probability mass for the token as a corresponding attention probability mass. If a token is in the vocabulary text and not in the context text, then the system can produce an output probability mass for the token by multiplying the gate probability mass with a corresponding vocabulary probability mass. If a token is in both the context text and the vocabulary text, then the system can produce an output probability mass for the token by multiplying the gate probability mass with a corresponding vocabulary probability mass and adding a corresponding attention probability mass.

[00102] Other implementations may include a non-transitory computer readable storage medium storing instructions executable by a processor to perform functions of the system described above. Yet another implementation may include a method performing the functions of the system described above.

[00103] Yet another system implementation of the technology disclosed includes one or more processors coupled to the memory. The memory is loaded with computer instructions to predict a token given context text and vocabulary text, including circumstances in which the token is in the vocabulary text and not in the context text.

[00104] The system mixes results of a pointer network and a vocabulary network to predict the token, with the mixing governed by a gate probability mass.

[00105] The system calculates the results of the pointer network over a window of tokens in the context text and the gate probability mass by using a trained sentinel gate vector, hidden state vectors of a recurrent neural network (abbreviated RNN) for each position in the window of tokens, a query vector formulated from a final hidden state vector of the RNN, an unnormalized gate value calculated as a distance measure product between the query vector and the trained sentinel gate vector, and unnormalized attention values for each of the positions in the window of tokens, each calculated as a distance measure product between the query vector and each of the hidden state vectors.

[00106] The system concatenates the unnormalized attention values and the unnormalized gate value and exponentially normalizes the concatenated attention and gate values to produce a vector of attention probability masses and the gate probability mass.

[00107] The system calculates the results of the vocabulary network by computing, from the final hidden state vector of the RNN, a distribution of vocabulary probability masses over tokens in the vocabulary text.

[00108] The system combines results after applying the gate probability mass to at least one of results of the pointer network and the vocabulary network.

[00109] The system selects the token responsive to the query vector from tokens in the context text or in the vocabulary text, based on the combined results.

[00110] Each of the features discussed in this particular implementation section for the first system implementation apply equally to this system implementation. As indicated above, all the system features are not repeated here and should be considered repeated by reference.

[00111] Other implementations may include a non-transitory computer readable storage medium storing instructions executable by a processor to perform functions of the system described above. Yet another implementation may include a method performing the functions of the system described above.

[00112] Method implementations of the technology disclosed include methods implementing actions of the systems described above. Each of the features discussed in this particular implementation section for the system implementations apply equally to the method

implementations. As indicated above, all the system features are not repeated here and should be considered repeated by reference.

[00113] Computer readable media (abbreviated CRM) implementations of the technology disclosed include non-transitory computer readable storage media impressed with computer program instructions, when executed on a processor, implementing actions of the systems described above. Each of the features discussed in this particular implementation section for the system implementations apply equally to the CRM implementations. As indicated above, all the system features are not repeated here and should be considered repeated by reference.

[00114] Yet another system implementation of the technology disclosed includes one or more processors coupled to the memory. The memory is loaded with computer instructions to predict a next word given a sequence of context words and a vocabulary of words, including

circumstances in which the next word is in the vocabulary and not in the sequence.

[00115] The system provides the sequence of context words as input to a neural network to produce a vocabulary distribution over words in the vocabulary. The vocabulary distribution specifies respective likelihoods of each of the vocabulary words being the next word. The neural network can be a recurrent neural network (abbreviated RNN). The RN can be a long short- term memory (abbreviated LSTM) network.

[00116] The system queries the neural network to produce a pointer distribution over context words in the sequence and a sentinel. The pointer distribution specifies respective likelihoods of each of the context words being the next word.

[00117] The system mixes respective likelihoods from the vocabulary distribution and the pointer distribution to produce joint likelihoods for each of the words in the vocabulary and the sequence, with the mixing controlled by the sentinel.

[00118] The system selects a word from the vocabulary and/or the sequence as the next word based on the produced joint likelihoods.

[00119] This system implementation and other systems disclosed optionally include one or more of the following features. System can also include features described in connection with methods disclosed. In the interest of conciseness, alternative combinations of system features are not individually enumerated. Features applicable to systems, methods, and articles of manufacture are not repeated for each statutory class set of base features. The reader will understand how features identified in this section can readily be combined with base features in other statutory classes.

[00120] The system formulates a query vector from a final hidden state vector of the neural network by processing the final hidden state vector through a multilayer perceptron. The system uses inner product to compare the query vector against hidden state vectors of the neural network and generates unnormalized attention scalars for each of the context words. The system uses inner product to compare the query vector against a pre-trained sentinel vector and generates an unnormalized sentinel gate scalar. The system concatenates the unnormalized attention scalars and the unnormalized sentinel gate scalar in an attention vector and exponentially normalizes the attention vector to generate normalized attention masses and normalized sentinel gate mass. The system uses the normalized attention vector as the pointer distribution and the normalized attention masses as the respective likelihoods of each of the context words being the next word.

[00121] If a word is in the sequence and not in the vocabulary, then the system can produce a joint likelihood for the word f om a corresponding normalized attention mass. If a word is in the vocabulary and not in the sequence, then the system can produce a joint likelihood for the word from a corresponding vocabulary probability mass produced from the vocabulary distribution. If a word is in both the sequence and the vocabulary, then the system can produce a joint likelihood for the word by multiplying the normalized sentinel gate mass with a corresponding vocabulary probability mass produced from the vocabulary distribution and adding a corresponding normalized attention mass. The system can select a word with a maximum joint likelihood as a response to the query vector and therefore the predicted next word.

[00122] The normalized sentinel gate mass can control whether the next word is a context word from the sequence or a vocabulary word from the vocabulary. The normalized sentinel gate mass can be unity when the next word exists only in the vocabulary. In such a case, the system predicts the next word only from the vocabulary. The normalized sentinel gate mass can be zero when the next word exists only in the sequence. In such a case, the system predicts the next word only from the sequence.

[00123] When a context word appears at multiple positions in the sequence, the system adds normalized attention masses corresponding to each of the positions of the context word in the sequence to generate a final normalized attention mass for the word and uses the final normalized attention mass to produce a joint likelihood for the word.

[00124] The system uses the neural network and the joint likelihoods for one or more language modeling tasks, including speech recognition, machine translation, text summarization, question answering, image captioning, and text-to-speech synthesis.

[00125] Other implementations may include a non-transitory computer readable storage medium storing instructions executable by a processor to perform actions of the system described above. Yet another implementation may include a method performing the actions of the system described above.

[00126] A method implementation of the technology disclosed includes predicting a next word given a sequence of context words and a vocabulary of words, including circumstances in which the next word is in the vocabulary and not in the sequence.

[00127] The method includes providing the sequence of context words as input to a neural network to produce a vocabulary distribution over words in the vocabulary. The vocabulary distribution specifies respective likelihoods of each of the vocabulary words being the next word. The neural network can be a recurrent neural network (abbreviated RN ). The RNN can be a long short-term memory (abbreviated LSTM) network.

[00128] The method includes querying the neural network to produce a pointer distribution over context words in the sequence and a sentinel. The pointer distribution specifies respective likelihoods of each of the context words being the next word. [00129] The method includes mixing respective likelihoods from the vocabulary distribution and the pointer distribution to produce joint likelihoods for each of the words in the vocabulary and the sequence, with the mixing controlled by the sentinel.

[00130] The method includes selecting a word from the vocabulary and/or the sequence as the next word based on the produced joint likelihoods.

[00131 ] Each of the features discussed in this particular implementation section for the system implementations apply equally to this method implementation. As indicated above, all the system features are not repeated here and should be considered repeated by reference.

[00132] Other implementations may include a non-transitory computer readable storage medium storing instructions executable by a processor to perform the method described above. Yet another implementation may include a system including memory and one or more processors operable to execute instructions, stored in the memory, to perform the method described above.

[00133] Computer readable media (abbreviated CRM) implementations of the technology disclosed include a non-transitory computer readable storage medium impressed with computer program instructions, when executed on a processor, implement the method described above.

[00134] Each of the features discussed in this particular implementation section for the system implementations apply equally to the CRM implementation. As indicated above, all the system features are not repeated here and should be considered repeated by reference.

Computer System

[00135] FIG. 9 is a simplified block diagram of a computer system 900 that can be used to implement the pointer sentinel mixture architecture 100. Computer system 900 typically includes one or more CPU processors 920 that communicate with a number of peripheral devices via bus subsystem 932. These peripheral devices can include a memory subsystem 912 including, for example, memory devices and a file storage subsystem 918, user interface input devices 930, user interface output devices 924, a network interface subsystem 922, and a GPU 926 with multiple GPU processing cores or GPU processors 928. The input and output devices allow user interaction with computer system 900. Network interface subsystem 922 provides an interface to outside networks, including an interface to corresponding interface devices in other computer systems.

[00136] The operations of the pointer sentinel mixture architecture 100 are performed by the GPU processing cores 928, according to some implementations.

[00137] User interface input devices 930 or clients or client devices can include a keyboard; pointing devices such as a mouse, trackball, touchpad, or graphics tablet; a scanner; a touch screen incorporated into the display; audio input devices such as voice recognition systems and microphones; and other types of input devices. In general, use of the term "input device" is intended to include all possible types of devices and ways to input information into computer system 900.

[00138] User interface output devices 924 can include a display subsystem, a printer, a fax machine, or non-visual displays such as audio output devices. The display subsystem can include a cathode ray tube (CRT), a flat-panel device such as a liquid crystal display (LCD), a projection device, or some other mechanism for creating a visible image. The display subsystem can also provide a non-visual display such as audio output devices. In general, use of the term "output device" is intended to include all possible types of devices and ways to output information from computer system 900 to the user or to another machine or computer system.

[00139] Storage subsystem 910 stores programming and data constructs that provide the functionality of some or all of the modules and methods described herein. These software modules are generally executed by CPU processors 920 alone or in combination with other processors like GPU processors 928.

[00140] Memory subsystem 912 in the storage subsystem can include a number of memories including a main random access memory (RAM) 916 for storage of instructions and data during program execution and a read only memory (ROM) 914 in which fixed instructions are stored. A file storage subsystem 918 can provide persistent storage for program and data files, and can include a hard disk drive, a floppy disk drive along with associated removable media, a CD- ROM drive, an optical drive, or removable media cartridges. The modules implementing the functionality of certain implementations can be stored by file storage subsystem 918 or the memory subsystem 912, or in other machines accessible by the processor.

[00141] Bus subsystem 932 provides a mechanism for letting the various components and subsystems of computer system 900 communicate with each other as intended. Although bus subsystem 932 is shown schematically as a single bus, alternative implementations of the bus subsystem can use multiple busses. In some implementations, an application server (not shown) can be a framework that allows the applications of computer system 900 to run, such as the hardware and/or software, e.g., the operating system.

[00142] Computer system 900 itself can be of varying types including a personal computer, a portable computer, a workstation, a computer terminal, a network computer, a television, a mainframe, a server farm, a widely-distributed set of loosely networked computers, or any other data processing system or user device. Due to the ever-changing nature of computers and networks, the description of computer system 900 depicted in FIG. 9 is intended only as a specific example for purposes of illustrating the preferred embodiments of the present invention. Many other configurations of computer system 900 are possible having more or less components than the computer system depicted in FIG. 9.

[00143] The preceding description is presented to enable the making and use of the technology disclosed. Various modifications to the disclosed implementations will be apparent, and the general principles defined herein may be applied to other implementations and applications without departing from the spirit and scope of the technology disclosed. Thus, the technology disclosed is not intended to be limited to the implementations shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein. The scope of the technology disclosed is defined by the appended claims.