Generating output sequence with inline evidence using linguistic model neural network
The autoregressive language model neural network processes the input and contextual text sequences, generates responses and provides evidence, which solves the reliability and computational load issues of language model generated responses, is suitable for mobile devices, and achieves resource optimization and accurate prediction.
Patent Information
- Application Number
- CN202380023689.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-03-16
- Filing Date
- 2023-03-16
- Publication Date
- 2024-09-27
AI Technical Summary
Existing language models lack reliability and verifiability when generating responses, and large-scale language models are computationally overloaded on mobile devices, consume a lot of resources, and are difficult to optimize.
Process input text queries and contextual text sequences through an autoregressive language model neural network, generate responses and provide supporting evidence, update the model with search engine results, optimize the language model to fit limited resource devices, and reduce computational load through constrained sampling.
Improves the reliability and verifiability of generated responses, reduces computational load, saves computing resources, is suitable for mobile devices, and generates more accurate and timely predictions.
Smart Images

Figure CN118715523A
Abstract
Description
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application claims the benefit of priority to U.S. patent application Ser. No. 63 / 320,633, filed on Mar. 16, 2022, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This specification relates to processing an input using a neural network to generate an output sequence. Background Art
[0003] A neural network is a machine learning model that uses one or more layers of nonlinear units to predict outputs from received inputs. In addition to the output layer, some neural networks also include one or more hidden layers. The output of each hidden layer is used as the input to the next layer in the network, either another hidden layer or the output layer. Each layer of the network generates an output from the received input based on the current values of the corresponding set of parameters. Summary of the invention
[0004] This specification describes a system implemented as a computer program on one or more computers in one or more locations that generates a response to a received request using a language model neural network. In particular, the response generated by the system includes (i) a response to the request and (ii) "evidence" from one or more contextual text documents that supports the response. The evidence includes a direct quote from one of the contextual text documents.
[0005] For example, the system may provide an interface between a user and an information retrieval system that accesses a corpus of documents. The interface allows the system to utilize the information retrieval system to provide more reliable information, particularly verifiably correct information.
[0006] In one aspect, a method includes: receiving an input text query; obtaining one or more first context text sequences and corresponding natural language identifiers for each of the first context text sequences; generating a first input sequence, the first input sequence comprising the input text query, one or more first context text sequences and corresponding natural language identifiers for each of the one or more first context text sequences; processing the first input text sequence using an autoregressive language model neural network to generate a first output text sequence, the first output text sequence comprising: (i) a first output text subsequence, the first output text subsequence being a response to the input text query; (ii) a second output text subsequence, the second output text subsequence being one of the corresponding natural language identifiers of the first context text sequence, and (iii) a third output text subsequence, the third output text subsequence being text from the first context text sequence identified by the natural language identifier in the second output text subsequence; and providing at least the first output text subsequence and the third output text subsequence in response to the input text query.
[0007] In some implementations, providing at least a first output text subsequence and a first context text sequence in response to an input text query includes providing a first output text subsequence, a second output text subsequence, and a third output text subsequence in response to the query.
[0008] In some implementations, the method further includes determining, from the second output text subsequence, a source of the first context text sequence identified by a natural language identifier in the second output text subsequence; and providing a reference to the source of the first context text sequence in response to the query.
[0009] In some embodiments, the method further includes obtaining one or more second context text sequences and a corresponding natural language identifier for each second context text sequence; generating a second input sequence including an input text query, one or more second context text sequences, and a corresponding natural language identifier for each of the one or more second context text sequences; processing the second input text sequence using an autoregressive language model neural network to generate a second output text sequence, the second output text sequence including: (i) a fourth output text subsequence as a response to the input text query; (ii) a fifth output text subsequence, the fifth output text subsequence being one of the corresponding natural language identifiers of the second context text sequence, and (iii) a sixth output text subsequence, the sixth output text subsequence being text from the second context text sequence identified by the natural language identifier in the fifth output text subsequence; generating a corresponding score for each output text sequence in a set including a first output text sequence and a second output text sequence; determining that the first output text sequence has the highest score of any output text sequence in the set; and in response to determining that the first output text sequence has the highest score, providing at least a first output text subsequence and a third output text subsequence in response to the input text query.
[0010] In some implementations, generating a corresponding score for each output text sequence in a set including the first output text sequence and the second output text sequence includes: scoring each output text sequence using a learned reward model.
[0011] In some embodiments, the first output sequence includes a corresponding word-gram from a word-gram vocabulary at each time step in a plurality of time steps, wherein the autoregressive neural network is configured to, for each time step in the first output sequence (e.g., for each time step in the plurality of time steps; the word-gram corresponding to the current time step may be conveniently referred to as the "current word-gram"), generate a corresponding score for each word-gram in the vocabulary conditioned on the first input text sequence and any word-gram in the output sequence at any time step prior to the time step in the first output sequence (any word-gram in the output sequence prior to the current word-gram), and wherein generating the first output sequence includes: at each time step, selecting the word-gram at the time step (the current word-gram) using the corresponding score of the word-gram in the vocabulary generated by the neural network for the time step.
[0012] In some embodiments, the word-grams of the second output text subsequence also correspond to corresponding time-steps in the (second) plurality of time-steps. Generating the first output sequence includes: at each time-step (each of the second plurality of time-steps) in the second output text subsequence after the first time-step in the second output text subsequence: receiving a corresponding score generated by the neural network at that time-step; generating a constrained score distribution that assigns a non-zero score only to word-grams that immediately follow a word-gram that has been generated within the second output text subsequence in one of the natural language identifiers; and sampling a word-gram from the constrained score distribution at that time-step.
[0013] In some embodiments, the second output text subsequence is preceded by one or more first predetermined grammatical tokens in the first output text sequence, and generating the first output sequence includes: at a particular time step, determining that the one or more first predetermined grammatical tokens have been selected at one or more time steps immediately preceding the particular time step, and in response, determining that the particular time step is the first time step in the second output text subsequence; receiving a corresponding score generated by the neural network at the particular time step; in response to determining that the particular time step is the first time step in the second output text subsequence, generating a constrained score distribution that assigns non-zero scores only to tokens that are the first tokens in one of the natural language identifiers; and sampling the tokens at the time step according to the constrained score distribution.
[0014] In some embodiments, the word-grams of the third output text subsequence also correspond to corresponding time-steps in the (third) plurality of time-steps. Generating the first output sequence includes: at each time-step in the third output text subsequence after the first time-step in the third output text subsequence (i.e., each of the third plurality of time-steps): receiving a corresponding score generated by the neural network at time-step; generating a constrained score distribution that assigns a non-zero score only to word-grams that immediately follow a word-gram that has been generated within the third output text subsequence in the first context text sequence identified by the natural language identifier in the second output text subsequence; and sampling word-grams from the constrained score distribution at time-step.
[0015] In some embodiments, the third output text subsequence is preceded by one or more second predetermined grammatical tokens in the first output text sequence, and generating the first output sequence includes: at a second specific time step, determining that the one or more second predetermined grammatical tokens have been selected at one or more time steps immediately preceding the second specific time step, and in response, determining that the specific time step is the first time step in the third output text subsequence; receiving a corresponding score generated by the neural network at the specific time step; in response to determining that the specific time step is the first time step in the third output text subsequence, generating a constrained score distribution that assigns non-zero scores only to tokens that appear in the first context text sequence identified by a natural language identifier in the second output text subsequence; and sampling tokens from the constrained score distribution at the time step.
[0016] In some embodiments, obtaining one or more first context text sequences and a corresponding natural language identifier for each of the first context text sequences includes: submitting a query derived from an input text query to a search engine; obtaining one or more context documents from the search engine in response to the query; and selecting one or more first context sequences from the one or more context documents.
[0017] In some implementations, the corresponding natural language identifier of each of the first context text sequences is the title of the context document from which the first context text sequence was selected.
[0018] In some embodiments, the neural network has been pre-trained via unsupervised learning for a language modeling objective.
[0019] In some embodiments, the neural network has been fine-tuned through supervised learning, reinforcement learning, or both.
[0020] The subject matter described in this specification can be implemented in specific embodiments to realize one or more of the following advantages.
[0021] The system described in this specification provides a user interface for accessing a generative language model neural network that generates responses to received requests. In particular, generative language models (LMs) are increasingly useful for answering questions about the world. However, by default, LMs generate ungrounded claims that users must choose to blindly accept or verify.
[0022] This specification describes techniques for assisting a user in evaluating responses generated by a LM by generating claims together with supporting evidence. In particular, the evidence takes the form of verbatim quotations extracted from longer context documents retrieved from one or more text databases. The documents may be retrieved by an Internet search engine or any other suitable information retrieval system. Thus, the present system provides a user interface between a user and an information retrieval system, and it enhances the reliability and verifiability of information obtained using the information retrieval system.
[0023] To ensure that quotations are "verbatim" using generative methods, this specification describes a special grammar that the language model uses when quoting from a document, and in some cases, constrains the output of the language model to be an exact quote from the retrieved document based on that grammar. This can ensure that the language model accurately quotes from the context document, even if the model was pre-trained on a target that does not require quotations from the input.
[0024] In addition, large-scale language models implemented as neural networks can produce impressive results on a range of natural language processing tasks including question answering. However, some implementations of these models, particularly Transformer-based models, can have more than a billion parameters and can require a large amount of computing resources, power, and time to process network inputs to generate network outputs. Sometimes, such models can have more than 10 billion or more than 100 billion parameters. If such models are used on a large scale to serve a large number of user requests, significant energy will be consumed.
[0025] Additional considerations arise when a neural network is implemented on a digital assistant device, such as a mobile device, which is implemented in a computing system that includes back-end components, particularly data servers, that communicate with the digital assistant device over a data communications network such as the Internet. The computational load between the digital assistant device and the back-end components then needs to be optimized. This requirement may be particularly severe for large-scale language models because of their large memory and computation requirements compared to those typically found on mobile devices.
[0026] The techniques described herein address these problems. In some embodiments, the described techniques facilitate reduced computational load and improved load distribution, particularly when large-scale language models are implemented as neural networks in multi-tasking and parallel processing computer systems, distributed across multiple sites and interconnected by a data communications network.
[0027] In some embodiments, the described techniques enable beneficial distribution of computational loads between local mobile computing devices and backend servers in a network. More specifically, in embodiments, by adjusting a language model neural network based on a question in the context of representing a document obtained from an Internet search, a smaller language model neural network can be used, which facilitates implementation of the neural network on mobile devices with limited memory and computational resources.
[0028] Furthermore, using the techniques described in this specification, the system can utilize search engine results to generate predictions about input text using the latest information included in the search engine results. Some existing systems use pre-trained neural networks without access to such search engine results to generate predictions, and thus the predictions may be less reliable because the neural network can only encode information available to the neural network during training; that is, the predictions may rely on stale information and therefore be incorrect or at least out of date. Therefore, using the techniques described in this specification, the system can generate more accurate and timely predictions.
[0029] In addition, some existing systems must repeatedly retrain the neural network to ensure that the neural network encodes the latest information. Because the system described in this specification can repeatedly access new search engine results, the system does not need to retrain the neural network, thereby saving significant computing resources.
[0030] Using the techniques described in this specification, a system can generate predictions for input text using information encoded in multiple different documents provided by a search engine in response to processing a search engine query. The multiple different documents can each include corresponding different information related to the prediction. Therefore, the predictions generated by the system can be more accurate than predictions generated using a single document.
[0031] The details of one or more embodiments of the subject matter of this specification are set forth in the accompanying drawings and the description below.
[0032] Other features, aspects, and advantages of the subject matter will be apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a diagram of an example sequence generation system.
[0034] Figure 2 is a flow chart of an example process for generating an output sequence.
[0035] Figure 3 is a flow chart of an example process for selecting a candidate output sequence.
[0036] Figure 4 An example user interface for presenting an output sequence to a user is shown.
[0037] Figure 5 An example of training a language model neural network is shown.
[0038] Figure 6 An example user interface for rating generated samples is shown.
[0039] Like reference numerals and reference characters in the various drawings represent like elements. DETAILED DESCRIPTION
[0040] Figure 1 An example sequence generation system 100 is shown. Sequence generation system 100 is an example of a system implemented as a computer program on one or more computers in one or more locations in which the systems, components, and techniques described below may be implemented.
[0041] The sequence generation system 100 acts as a user interface for an information retrieval system that accesses one or more text databases (not shown), or provides functionality for a user interface implemented on a user computer that is separate from the sequence generation system 100 but in communication with it. The text databases together form a document corpus. The document corpus can be, for example, web pages and other documents accessible via the Internet. Alternatively, the document corpus can be, for example, part of a proprietary text database of a scientific publisher or other organization. The sequence generation system 100 uses the context sequence generation system 104, the input sequence generation system 110, and the language model neural network 114 to process the input text query 102 from the user to generate an output sequence 116.
[0042] The input text query 102 may be a query submitted to the system 100 by a user via a user computer, a question submitted to the system 100 via a user computer, or a different request requiring a response from the system 100. In some cases, the system receives the query as text from the user computer. In some other cases, the system receives a natural language voice query from the user, and converts the voice into the input text query 102 by applying a speech recognition engine to the voice. The input text query 102 may be received in the form of a sound (voice) signal captured by a microphone of the user computer, which is converted by the speech recognition engine, i.e., a speech-to-text converter, to form the input text query 102. Alternatively, it may be input by typing using a data input device of the user computer.
[0043] Once the system 100 receives the input text query 102 , the context sequence generation system 104 obtains one or more first context text sequences 106 and a corresponding natural language identifier 108 for each of the first context text sequences 106 .
[0044] For example, each context text sequence 106 may be extracted from a corresponding context document, and the identifier 108 may be the title of the context document. As another example, some or all of the context text sequences 106 may be extracted from the same context document, and the identifier 108 may be a section header or other identifier of the portion of the document from which the context text sequence was extracted.
[0045] Reference below Figure 2 Obtaining a context sequence is described in more detail.
[0046] The input sequence generation system 110 then generates a first input sequence 112 that includes the input text query 102 , the one or more first context text sequences 106 , and a corresponding natural language identifier 108 for each of the one or more first context text sequences.
[0047] For example, the first input sequence 112 may include a query 102, a context text sequence 106, and an identifier 108 arranged according to a predetermined input grammar. In some cases, the first input sequence 112 may also include other text, such as one or more natural language "prompts", one or more separator tokens that separate various elements of the input sequence, or both. A natural language prompt is an example of an input-output pair, where an input is an example of an input that can be provided, and an output is an example of an output that should be generated. Prompts will be described in more detail below.
[0048] Then, the sequence generation system 100 processes the first input sequence 112 using the autoregressive language model neural network 114 to generate a first output text sequence 116 .
[0049] The output sequence 116 includes (i) a first output text subsequence that is a response to the input text query 102, (ii) a second output text subsequence that is one of the corresponding natural language identifiers 108 of the first context text sequence 106, and (iii) a third output text subsequence that is text from the first context text sequence identified by the natural language identifier in the second output text subsequence.
[0050] In particular, (i), (ii) and (iii) are arranged in the output sequence according to a predetermined output grammar. Figure 3 An example of the predetermined syntax is described in more detail.
[0051] Then, the sequence generation system 100 provides at least a first output text subsequence and a third output text subsequence in response to the input text query 102. Thus, the system 100 provides a text response to the input text query 102 and text from one of the context text sequences 106 as supporting evidence for the text response.
[0052] In some implementations, the sequence generation system 100 generates a plurality of candidate output sequences 116 in response to the input query 102 .
[0053] In these embodiments, system 100 also generates a corresponding score for each candidate output sequence, and only provides text from the highest-scoring candidate output sequences in response to a user query.
[0054] In some of these embodiments, if no candidate has a score above a threshold, the system 100 instead issues a default text response to the user query, such as, for example, "I don't know" or "I am not sure."
[0055] Reference below Figure 3 Describes scoring of candidate output sequences.
[0056] The language model neural network 114 may be any suitable language model neural network that receives an input sequence consisting of text tokens selected from a vocabulary and autoregressively generates an output sequence consisting of text tokens from the vocabulary. For example, the language model neural network 114 may be a Transformer-based language model neural network or a recursive neural network-based language model.
[0057] The word-grams in the vocabulary can be any suitable text word-grams, such as words, word fragments, punctuation marks, etc., which represent text elements of one or more natural languages, and optionally, numbers and other text symbols found in a text corpus. Typically, the input text query 102, the natural language identifier 108, and / or the context text sequence 106 are also word-gram sequences selected from the vocabulary.
[0058] The language model neural network 114 is referred to as an autoregressive neural network because the neural network 114 autoregressively generates an output sequence of tokens by generating each particular token in the output sequence conditioned on a current input sequence, the current input sequence including any tokens preceding the particular text token in the output sequence, i.e., tokens that have been generated for any previous positions in the output sequence preceding the particular position of the particular token, and contextual inputs that provide context for the output sequence.
[0059] For example, when a word-gram is generated at any given position in the output sequence, the current input sequence may include the input sequence and the word-gram of the output sequence at any previous position before the given position in the output sequence. As a specific example, the current input sequence may include the input sequence followed by the word-gram at any previous position before the given position in the output sequence. Optionally, within the current input sequence, the input sequence and the word-gram from the output sequence may be separated by one or more predetermined word-grams within the current input sequence, i.e., a specified set of one or more word-grams from the vocabulary. That is, there may be one or more predetermined word-grams between the input sequence and the word-gram from the output sequence.
[0060] More specifically, to generate a particular word-gram at a particular position within the output sequence, the neural network 114 may process the current input sequence to generate a scoring distribution, such as a probability distribution, which assigns a corresponding score, such as a corresponding probability, to each word-gram in the word-gram vocabulary. The neural network 114 may then use the scoring distribution to select a word-gram from the vocabulary as the particular word-gram. For example, the neural network 114 may greedily select the word-gram with the highest score, or may sample the word-gram from the distribution, such as using kernel sampling or another sampling technique.
[0061] As a specific example, the language model neural network 114 can be an autoregressive transformation based neural network that includes (i) multiple attention blocks, each of which applies a self-attention operation, and (ii) an output subnetwork that processes the output of the last attention block to generate a rating distribution.
[0062] The neural network 114 may have any of a variety of Transformer-based neural network architectures. Examples of such architectures include those described in: J. Hoffmann, S. Borgeaud, A. Mensch,E. Buchatskaya, T. Cai, E. Rutherford, D. d. L. Casas, LA Hendricks, J.Welbl, A. Clark, et al. Training compute-optimal large language models, arXiv preprint arXiv:2203.15556, 2022; JW Rae, S.Borgeaud, T. Cai, K. Millican, J. Hoffmann, HF Song, J. Aslanides, S.Henderson, R. Ring, S. Young, E. Rutherford, T. Hennigan, J. Menick, A.Cassirer, R. Powell, G. van den Driessche, LA Hendricks, M. Rauh, P.Huang, A. Glaese, J. Welbl, S. Dathathri, S. Huang, J. Uesato, J. Mellor, I.Higgins, A. Creswell, N. McAleese, A.Wu, E. Elsen, SM Jayakumar, E.Buchatskaya, D. Budden, E. Sutherland, K. Simonyan, M. Paganini, L. Sifre, L.Martens, XL Li, A. Kuncoro, A. Nematzadeh, E. Gribovskaya, D. Donato, A.Lazaridou, A. Mensch, J. Lespiau, M. Tsimpoukelli, N. Grigorev, D. Fritz, T.Sottiaux, M. Pajarskas, T. Pohlen, Z. Gong, D. Toyama, C. de Masson d'Autume,Y. Li, T. Terzi, V.Mikulik, I. Babuschkin, A. Clark, D. de Las Casas, A.Guy, C. Jones, J. Bradbury, M. Johnson, BA Hechtman, L. Weidinger, I.Gabriel, WS Isaac, E. Lockhart, S. Osindero, L. Rimell, C. Dyer, O.Vinyals, K. Ayoub, J. Stanway, L. Bennett, D. Hassabis, K. Kavukcuoglu, andG. Irving. Scaling language models: Methods, analysis & insights from training gopher. CoRR, abs / 2112.11446, 2021; Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified Text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019; Daniel Adiwardana, Minh-Thang Luong, David R. So, Jamie Hall, Noah Fiedel, Romal Thoppilan, Zi Yang, Apoorv Kulshreshtha, Gaurav Nemade, Yifeng Lu, and Quoc V. Le. Towards a human-like open-domain chatbot. CoRR, abs / 2001.09977, 2020; and Tom BBrown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, PrafullaDhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, etal. Language models are few-shot learners. arXivpreprint arXiv:2005.14165, 2020. .
[0063] However, typically, a Transformer-based neural network includes a sequence of attention blocks, and during processing of a given input sequence, each attention block in the sequence receives a corresponding input hidden state for each input token in the given input sequence. The attention block then updates each of the hidden states at least in part by applying self-attention to generate a corresponding output hidden state for each of the input tokens. The input hidden state of the first attention block is an embedding of the input token in the input sequence, and the input hidden state of each subsequent attention block is the output hidden state generated by the previous attention block.
[0064] In this example, the output subnetwork processes the output hidden state generated by the last attention block in the sequence of the last input token in the input sequence to generate a rating distribution.
[0065] Typically, because neural network 114 is autoregressive, system 100 can use the same neural network 114 to generate multiple different candidate output sequences in response to the same request, for example, by using beam search decoding from a score distribution generated by neural network 114, using a sampling and ranking decoding strategy, by using different random seeds for a pseudo-random number generator for sampling different runs through neural network 114, or using another decoding strategy that exploits the autoregressive properties of neural network 114.
[0066] In some implementations, language model 114 is pre-trained, i.e., trained on a language modeling task that does not require providing evidence in response to a user question, and system 100 causes neural network 114 to generate an output sequence according to a predetermined grammar from natural language prompts in an input sequence.
[0067] For example, system 100 or another training system pre-trains language model neural network 114 on a language modeling task, e.g., a task requiring predicting the next token following the current sequence in training data given a current sequence of text tokens. As a specific example, language model neural network 114 can be pre-trained on a maximum likelihood objective on a large text dataset, e.g., text publicly available from the Internet or another text corpus.
[0068] In some other embodiments, after pre-training, the system 100 fine-tunes the language model 114, for example, through supervised learning, reinforcement learning, or both, to the goal of actually generating output sequences according to the grammar. This is referred to below Figure 5 Describe in more detail.
[0069] In some of these embodiments, the system 100 still includes one or more natural language prompts in the input to the language model 114 at inference time, ie, after training.
[0070] As described above, natural language prompts are examples of input-output pairs, where the input is an example of an input that can be provided, and the output is an example of an output that should be generated. Therefore, each prompt will include an example input sequence of an example query, an example set of one or more context sequences, and corresponding identifiers of one or more context sequences arranged according to a predetermined input grammar. Each prompt will also include an example first output text subsequence arranged as a response to the example query according to the output grammar, an example second output text subsequence as one of the corresponding natural language identifiers of one of the example context text sequences, and an example third output text subsequence as text from the example context text sequence identified by the natural language identifier in the example second output text subsequence. Optionally, the input sequence may also include one or more word units from the vocabulary that separates each prompt and one or more word units that separate the final prompt from the user query.
[0071] Additionally, in some implementations, the system 100 performs "constrained sampling" when selecting tokens to include in the output sequence. This can ensure that the output of the neural network 114 follows the grammar and that the sequence is internally consistent, i.e., that the evidence is a direct quote from the context text sequence 106 identified by the natural language identifier 108 in the output sequence.
[0072] In the case where system 100 generates multiple candidate output sequences, constrained sampling prevents the system from having to score invalid or inconsistent output sequences and greatly reduces the number of candidates that need to be generated to ensure high-quality output, thereby greatly improving the computational efficiency of system 100, i.e., reducing the amount of computing resources consumed by system 100.
[0073] Reference below Figure 3 An example of constrained sampling is described in more detail.
[0074] Figure 2 is a flow chart of an example process 200 for generating an output sequence given an input query. For convenience, process 200 will be described as being performed by a system of one or more computers located in one or more locations. For example, a sequence generation system appropriately programmed according to the present specification, such as Figure 1 The sequence generation system 100 depicted in FIG. 1 may perform process 200 .
[0075] The system receives an input text query from a user, for example using a user interface (step 202 ).
[0076] The system obtains one or more first context text sequences and a corresponding natural language identifier for each of the first context text sequences (step 204 ).
[0077] For example, the system can obtain one or more context sequences and a corresponding natural language identifier for each first context sequence by submitting a search query derived from an input text query to a search engine. The search engine has access to a document corpus and is configured to search the document corpus based on the search query. For example, the search query can be the same text as the input text query, or can be modified by the system, for example, to add synonyms, correct typing or spelling errors, etc.
[0078] The system may then obtain one or more documents from the search engine in response to the search query. The one or more documents may be ranked by the search engine, for example, based on quality and relevance to the received search query.
[0079] Then, the system can select one or more first context sequences from the one or more context documents, for example, by selecting one or more top-ranked search results. The system also associates a corresponding natural language identifier with each first context sequence.
[0080] In some embodiments, the search engine also provides an excerpt from a corresponding context document as part of the search result identifying the corresponding context document. In some of these embodiments, the system can generate a context sequence for a given document by extracting the excerpt and the text surrounding the excerpt from the corresponding context document. For example, the system can use the excerpt to extract the excerpt text to account for document length changes and document lengths that typically exceed the language model maximum context window size (described below).
[0081] Therefore, especially in the case of few shot prompting when multiple documents are presented at once, the system may need to limit the number of tokens spent on document content within a given input sequence. Therefore, the system can truncate the document by using snippets as described above. For example, the system can use snippets to truncate a given document into a maximum token length segment such that the segment contains the relevant search snippet.
[0082] In some implementations, the system can ensure that truncated segments begin at the beginning of a sentence or paragraph.
[0083] As a specific example, at training time, the system may randomly select such a starting position to increase the variety of inputs. At inference time, the system may allow a maximum number, such as 250, 500, or 1000 characters, before the start of the excerpt segment, and identify the first sentence that starts in that range, and use that first sentence as the start of the truncated segment.
[0084] The search engine may be any suitable search engine that can be accessed by the system and searches any suitable document corpus, such as web pages, books, or other documents. For example, the search engine may be an Internet search engine that searches and returns results that reference documents available on the Internet. As another example, the search engine may be a different search engine that searches a private document corpus, such as documents available on an internal network or stored in a collection of one or more databases.
[0085] For example, the corresponding natural language identifier of each of the first context text sequences may be the title of the context document from which the first context text sequence was selected.
[0086] The system generates a first input sequence that includes an input text query, one or more first context text sequences, and a corresponding natural language identifier for each of the one or more first context text sequences (step 206 ).
[0087] The system processes the first input text sequence using an autoregressive language model neural network to generate a first output text sequence (step 208 ).
[0088] The first output text sequence includes a first output text subsequence as a response to an input text query, a second output text subsequence as one of the corresponding natural language identifiers of the first context text sequence, and a third output text subsequence as text from the first context text sequence identified by the natural language identifier in the second output text subsequence.
[0089] In response to an input text query, the system provides (eg, to a user) at least a first output text subsequence and a third output text subsequence (step 210 ).
[0090] The system may provide a first output text subsequence, a third output text subsequence, and optionally a second output text subsequence in response to the query.
[0091] In addition, in some embodiments, the system can determine from the second output text subsequence the source of the first context text sequence identified by the natural language identifier in the second output text subsequence, and provide a reference to the source of the first context text sequence in response to the query. For example, the system can provide the reference as a hyperlink to the source of the first context text sequence, such as a web page.
[0092] Reference below Figure 4 Describes an example presentation of an output sequence generated by the system.
[0093] As described above, in some embodiments, the system generates a set of multiple candidate output sequences (which includes the first output text sequence), and for each candidate output sequence, generates a corresponding score, and provides the first output sequence only in response to determining that the first output text sequence has the highest score among any candidate output sequences.
[0094] For example, when processing a first input text sequence, the system may generate at least some of the candidate output sequences in the set by sampling different candidate output sequences from outputs generated by a language model neural network.
[0095] Additionally, in some embodiments, the system may generate more context sequences than can fit in the "context window" of the language model neural network. That is, the language model neural network may only be able to process input sequences of no more than a maximum number of characters, for example due to memory constraints or due to the framework in which the neural network is trained. In some embodiments, the natural language identifiers and tokens comprising all context sequences may exceed this maximum number. In these embodiments, the system generates multiple different input sequences, each input sequence comprising a respective subset of the context sequences.
[0096] In other words, in addition to the first context text sequence, the system can also obtain one or more second context text sequences and the corresponding natural language identifier of each of the second context text sequences, and generate a second input sequence, which includes the input text query, one or more second context text sequences and the corresponding natural language identifier of each of the one or more second context text sequences. Then, the system can process the second input text sequence using an autoregressive language model neural network to generate a second output text sequence, which includes: (i) a fourth output text subsequence as a response to the input text query; (ii) a fifth output text subsequence as one of the corresponding natural language identifiers of the second context text sequence, and (iii) a sixth output text subsequence as text from the second context text sequence identified by the natural language identifier in the fifth output text subsequence.
[0097] The system then generates a corresponding score for each candidate output text sequence in a set, such as a set including a first output text sequence and a second output text sequence, and determines that the first output text sequence has the highest score of any output text sequence in the set. In some cases, this can be accomplished by scoring each of the output text sequences using a learned reward model. Figure 3 Describes scoring candidate output sequences using a learned reward model.
[0098] The system may then provide at least a first output text subsequence and a third output text subsequence in response to the input text query in response to determining that the first output text sequence has the highest score.
[0099] Figure 3 An example of the operation of a sequence generation system is shown as the system generates multiple candidate output sequences in response to a given text query.
[0100] like Figure 3 As shown in the example of , the system 100 receives a question 302, for example, from a user computer.
[0101] The system 100 performs an Internet search 304 to identify the top k documents most relevant to the question 302. Typically, k is an integer greater than 1, such as 5, 10, 20, or 100. For example, the system 100 can provide the question 302 or a query derived from the question 302 to an Internet search engine and obtain search results from the Internet search engine that identify the top k documents.
[0102] The system then generates one or more input sequences to the language model neural network 114 using the generator 306 and samples 308 N candidate output sequences using the language model neural network 114. In some implementations, the number of candidate output sequences N is greater than the number of documents k.
[0103] For example, the generator 306 may generate a single input sequence that includes context from all k documents, and then process the single input sequence multiple times using the language model neural network 114 to sample N candidate output sequences.
[0104] As another example, the generator 306 may generate multiple input sequences, each including context from a corresponding subset of the k documents, and then process each of the multiple input sequences multiple times using the language model neural network 114 to sample N candidate output sequences.
[0105] As another example, the generator 306 may generate a plurality of input sequences, each of which includes a context from a corresponding one of the k documents, and then process each of the plurality of input sequences using the language model neural network 114 .
[0106] In any of the above examples, the plurality of input sequences may be sampled in a round-robin order until N candidate output sequences have been sampled.
[0107] In some embodiments, N may be a multiple of k. In other embodiments, N may be indivisible by k.
[0108] The system 100 then performs reward model scoring 310 on each of the N candidate output sequences.
[0109] That is, the system 100 uses the learned reward model to assign a corresponding score to each of the N candidate output sequences.
[0110] The learned reward model 310 is a model, such as another language model neural network, that receives as input an input text query and responses and quotes generated by the neural network 114, and generates as output a score representing the quality of the responses and quotes. For example, the score may represent the likelihood that a user prefers the response (and quote) relative to other responses (and accompanying quotes) to the same query generated by the neural network 114.
[0111] Reference below Figure 5 Describes the training reward model.
[0112] The system 100 then selects the “best” sample 312, i.e., the candidate output sequence with the highest score from the N sequences according to the learned reward model, as the final output sequence.
[0113] In some implementations, if no candidate has a score above a threshold, the system 100 instead issues a default text response to the user query, such as, for example, "I don't know" or "I'm not sure."
[0114] As described above, each candidate output sequence includes (i) a first output text subsequence that is a response to the input text query, (ii) a second output text subsequence that is one of the corresponding natural language identifiers of the first context text sequence, and (iii) a third output text subsequence that is text from the first context text sequence identified by the natural language identifier in the second output text subsequence.
[0115] In particular, (i), (ii) and (iii) are arranged within the output sequence according to a predetermined output grammar.
[0116] like Figure 3 As shown in the example, the output syntax is:
[0117] % <claim>%(Document title)%[Quote from document]% wherein "%<", ">%(",")%[" and "]%" are template tokens, i.e., predetermined grammatical tokens inserted before and after the subsequences, "Claim" is a placeholder for the first output text subsequence, "Document title" is a placeholder for the second output text subsequence, and "Quote from document" is a placeholder for the third output text subsequence.
[0118] However, any of a variety of syntaxes that place the "Claim" placeholder, the "Document title" placeholder, and the "Quote from document" placeholder at predetermined locations within the output sequence may be used.
[0119] In some implementations and as described above, the system samples each of the N candidates using constrained sampling to ensure that each candidate satisfies the grammar, ie, includes an exact quote from the context sequence identified by the natural language identifiers in the sequence.
[0120] That is, as described above, the generator 306 samples a given candidate output sequence in the following manner: for each time step in the output sequence, conditional on the first input text sequence and any word-grams in the output sequence, generating a corresponding score for each word-gram in the vocabulary at any time step prior to the time step in the first output sequence, and at each time step, selecting the word-gram at the time step using the corresponding score of the word-gram in the vocabulary generated by the neural network for the time step.
[0121] When constrained sampling is employed, the system constrains sampling to only sample word-grams that would be valid next word-grams according to the output sequence.
[0122] For example, when generating the second output text subsequence, and at each time step in the second output text subsequence after the first time step in the second output text subsequence, the generator 306 may receive the corresponding score generated by the neural network at that time step, and generate a constrained score distribution that assigns non-zero scores only to word-grams that immediately follow a word-gram that has already been generated within the second output text subsequence in one (or more) of the natural language identifiers, and then samples word-grams from the constrained score distribution instead of from the received score distribution at that time step. That is, the system constrains the sampling to assign non-zero scores only to word-grams that, if appended to a word-gram that has already been selected for the second output text subsequence, would produce a valid prefix of one or more natural language identifiers in the corresponding input sequence.
[0123] As another example, in some cases, the second output text subsequence is preceded by one or more first predetermined grammatical tokens in the first output text sequence. Figure 3 In the example, the second output text subsequence is preceded by the token ">%(" in the output grammar.
[0124] In these cases, generating the output sequence using constrained sampling includes, at a particular time step, determining that one or more first predetermined grammatical tokens have been selected at one or more time steps immediately preceding the particular time step, and in response, determining that the particular time step is the first time step in the second output text subsequence. For example, the system may determine that the token ">%(" has been sampled, and in response, determine that the next time step is the first time step in the second subsequence.
[0125] In this example, the system may receive a corresponding score generated by the neural network at a particular time step, and in response to determining that the particular time step is the first time step in the second output text subsequence, generate a constrained score distribution that assigns non-zero scores only to word-grams that are the first word-grams in one of the natural language identifiers in the corresponding input sequence, and sample word-grams from the constrained score distribution at the time step. That is, the system constrains the sampling to assign non-zero scores only to word-grams that are the first word-grams of one or more natural language identifiers in the corresponding input sequence.
[0126] As another example, when constrained sampling is used, at each time step in the third output text subsequence after the first time step in the third output text subsequence, the system can receive the corresponding score generated by the neural network at the time step and generate a constrained score distribution that only assigns non-zero scores to word-grams that are immediately after the word-grams that have been generated in the third output text subsequence in the first context text sequence identified by the natural language identifier in the second output text subsequence. The system then samples word-grams at the time steps from the constrained score distribution. That is, the system constrains sampling to assign non-zero scores only to word-grams that, if appended to the word-grams that have been selected for the third output text subsequence, would produce a direct match to the subsequence in the first context text sequence identified by the natural language identifier in the second output text subsequence. Therefore, the system ensures that the third output text subsequence is a direct quote from the context document identified by the natural language identifier in the second output text subsequence.
[0127] As another example, in some cases, the third output text subsequence is preceded by one or more second predetermined grammatical tokens in the first output text sequence. Figure 3 In the example, the second output text subsequence is preceded by the token "")%[" in the output grammar.
[0128] In these cases, when constrained sampling is used, at the second particular time step, the system determines that one or more second predetermined grammatical tokens have been selected at one or more time steps immediately preceding the second particular time step, and in response, determines that the particular time step is the first time step in the third output text subsequence. Then, upon receiving the corresponding score generated by the neural network at the particular time step, the system generates a constrained score distribution that assigns non-zero scores only to tokens that appear in the first context text sequence identified by the natural language identifier in the second output text subsequence, and samples the tokens from the constrained score distribution at the time step.
[0129] The system 100 then provides at least some of the text from the best sample 312 for presentation to the user. For example, the system 100 can render 314 a presentation of the best sample 312 in a user interface.
[0130] like Figure 3 As shown, the presentation may include the text of the "claim", ie, the text of the first subsequence, a quote from a context document supporting the "claim", ie, the text of the third subsequence, and optionally, a document identifier from the second subsequence.
[0131] Figure 4 An example of a user interface 400 presenting an output sequence to a user is shown.
[0132] exist Figure 4 In the example above, the user has submitted the query 402 "What kind of animal is Scooby Doo?"
[0133] In response, system 100 has generated an output sequence that includes three subsequences: (i) "A Great Danedog", (ii) "Wikipedia Page: Scooby Doo", and (iii) a quote from the Wikipedia page with the title "Scooby Doo".
[0134] Then, in response to the user query 402 , the system presents the first subsequence 404 , the second subsequence 406 , and the third subsequence 408 in the user interface 400 .
[0135] Additionally, the system has displayed the first subsequence 404 as a hyperlink to the source of the third subsequence 408, i.e., to the Wikipedia page for Scooby Doo, i.e., to the webpage titled "Wikipedia Page: Scooby Doo." Including a hyperlink in the user interface 400 allows the user to navigate to the source indicated by the second subsequence, e.g., to verify the accuracy of the quote or to obtain additional context about the response.
[0136] Figure 5 An example of training a language model neural network 114 is shown.
[0137] like Figure 5 As shown, the system obtains 502 a pre-trained language model.
[0138] For example, as mentioned above, a language model may have been trained on a language modeling objective on a large corpus of text documents.
[0139] After obtaining 502 the pre-trained language model, the system generates samples 504 and rates the generated samples via human evaluation.
[0140] For example, to obtain each rating, the system may present the rater user with a question and two candidate answers, e.g., two samples generated using a pre-trained language model with few-shot prompts. Each candidate answer may be divided into a "claim" part and a "supporting evidence" part, e.g., as described above with reference to Figure 4 shown.
[0141] The system may then obtain input from the rater user specifying whether any of the statements is a reasonable response to the question, whether the statement is supported by the accompanying cited evidence, and which answer the rater user prefers. A reasonable response to a question is a reasonable and on-topic response to the question. A supported response is a response for which the evidence provided is sufficient to verify the validity of the response.
[0142] Figure 6 An example of a user interface that can be used to obtain input from a user is shown in FIG.
[0143] That is to say, Figure 6 An example user interface 600 for rating generated samples is shown, which may, for example, receive input for human assessments of generated samples.
[0144] like Figure 6 As shown, the user is presented with a query 602 and two candidate responses 604 and 606 to the query 602. Each candidate response 604 and 606 includes a response to the query, supporting evidence from the response, and an identifier of a source of the supporting evidence.
[0145] For each candidate response 604 and 606, the user interface presents corresponding selection elements 608 and 610 that allow the user to submit input indicating whether the corresponding candidate response is a reasonable answer (or indicating that the user is unsure), and submit input indicating whether the corresponding supporting evidence supports the corresponding candidate response (or indicating that the user is unsure).
[0146] Selection elements 608 and 610 also each allow a user to submit input indicating that the corresponding candidate response 604 or 606 is the preferred response (of the two candidate responses) to query 602 .
[0147] User interface 600 may also allow a user to submit an input indicating that the two responses are "tied" or to submit comments about the sample.
[0148] Back to Figure 5 As described above, the system then uses the rating samples to perform supervised fine-tuning (SFT) 506, where the system trains a language model on the rating samples through supervised learning.
[0149] That is, for each sample used for SFT, given the question in the sample and a collection of context sequences including context sequences with supporting evidence, the system trains a language model to produce the claim and the supporting evidence in the sample.
[0150] Optionally, when performing SFT, the system can only use samples that are rated as reasonable and supported for supervised fine-tuning.
[0151] As a specific example, the system may generate an input sequence for a given sample during an SFT as follows.
[0152] For a certain proportion of samples, e.g., for 1 / 3 or 1 / 2 of the data, the system uses only a single document in the context, the same document from which the supporting evidence was extracted, enforcing that the supporting evidence exists within the context sequence.
[0153] For the remainder of the sampler, the system uses n documents in the context, e.g., where n is randomly drawn between 1 and a fixed number such as 5, 10, or 15. Similarly, the system enforces that the target document and supporting evidence citations are present in the context sequence. For the remainder of the documents in the context sequence, the system may use, e.g., the top n-1 search results for the question provided by a search engine.
[0154] The system can truncate each of the context documents so that the total token length of the input sequence does not exceed a fixed number based on the context window of the language model. This token length allows for a random split between the documents included in the prompt so that the language model sees context sequences of different sizes from different context documents within the same input sequence. When truncating a given context document to its maximum allowed length, the system can ensure that each document contains an excerpt, as described above.
[0155] Optionally, after performing supervised fine-tuning (SFT) 506, the system may use the SFT model to generate additional samples that are again rated via human assessment.
[0156] The system then trains a reward model (RM) 508 on the generated samples, such as the original generated samples or the original generated samples and additional samples generated using the SFT model.
[0157] As described above, the learned reward model is a model, such as another language model neural network, that receives as input an input text query and responses and quotes generated by the neural network 114, and generates as output a score representing the quality of the responses and quotes.
[0158] For example, given a query and response string, the system can train a reward model as a classifier that predicts a binary variable indicating which example of a given pair is preferred. That is, given the scores generated by the reward model for both examples in the pair, the system can compute the probability that the first example in the pair is preferred. For example, the system can train a reward model using a cross-entropy objective that uses the user preferences as true values and the computed probabilities as predictions.
[0159] Optionally, during training, the reward model also predicts the binary support and plausibility of the responses in the pair as an auxiliary loss. Thus, in these cases, the final loss is a combination of, for example, the average or weighted average of the pairwise preference prediction loss and the auxiliary prediction loss.
[0160] In some embodiments, the system can augment the RM training set with a collection of manufactured ("synthetic") comparisons. For example, the system can generate fake comparisons from supporting and refutation claims from a fact-checking dataset. An example of such a dataset is the FEVER dataset (Thorne et al., 2018). Including these fake comparisons can provide non-extracted additional out-of-distribution patterns for question answering, and can enable the reward model to better verify the supportability of evidence. An example of such a dataset, such as the FEVER dataset, can contain claims generated by altering sentences extracted from source text. These claims are then classified as supported, refuted, or not sufficient, and labeled with associated evidence. To convert such claims into examples of questions with answer comparisons, the system can use any of a variety of techniques. Some examples of types of techniques will now be described.
[0161] Type A: The system can generate questions from claims (e.g., '{claim}?', 'Is it true that {claim}?', 'Is it correct to say that {claim}?', '{claim}. Do you agree?') through direct template manipulation. Examples compare affirmative answers like 'Yes', 'This is correct', 'It is true' combined with supporting quotes, and negative answers combined with the same quotes. If the original claim is supported, the affirmative answer is marked as preferred, supported, and justified. Otherwise, the negative one is marked as preferred, supported, and justified.
[0162] Type B: The system can convert claims into questions using a few-shot-prompted, pre-trained language model neural network. For example, the claim Roman Atwood is a content creator. can be converted into Who is Roman Atwood? As a comparison to the claim that has been converted into a question, the system can use one answer as the corresponding claim from the dataset (with supporting quotations) and use a direct negation of the claim generated via templates (e.g., 'It is not true that {claim}') as another answer. If the original claim is supported, the answer containing the claim is marked as preferred, supported, and reasonable. Otherwise, the negative claim is marked as preferred. As another example, if the original claim is supported, the system can use the original claim as an answer and use a randomly generated claim as a comparison, where the original claim is marked as preferred, supported, and reasonable.
[0163] As described above, the system can then use the reward model at sampling time to assign scores to candidate output sequences.
[0164] After training the RM 508, the system can use the trained reward model to further fine-tune the SFT model through reinforcement learning 510. That is, the system uses the reward model to perform reinforcement learning from human preferences (RLfHP) techniques by training the model to maximize the expected reward predicted by the trained RM 508.
[0165] Optionally, the system can then use the further fine-tuned model to generate additional samples for human evaluation and re-fine-tune the model via SFT or RL or both to retrain the RM or both. That is, the system can perform more than one iteration of the described training loop to further fine-tune the language model, further fine-tune the reward model, or both.
[0166] In addition, although Figure 5 The examples in describe that the system uses both SFT and RL to fine-tune the language model, but in some cases the system uses only SFT or RL but not both. For example, when using a reward model for re-ranking, using a model fine-tuned with only SFT or RL (but not both) may improve performance so that the reward model is provided with more diverse samples for re-ranking.
[0167] Now following is a description of self-attention that can be employed by a language model neural network.
[0168] As described above, a self-attention block is a neural network layer that includes an attention mechanism that operates on the self-attention block input (or input derived from the layer input) to generate a self-attention block output. The self-attention mechanism can be causally masked so that any given position in the input sequence does not pay attention to (e.g., use data from) any position after the given position in the input sequence. There are many different possible attention mechanisms.Some examples of self-attention layers that include attention mechanisms are described in: Vaswani et al. "Attention is all you need", 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA; Colin Raffel, NoamShazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, YanqiZhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019; Daniel Adiwardana, Minh-Thang Luong, David R. So, Jamie Hall, Noah Fiedel, Romal Thoppilan, Zi Yang,Apoorv Kulshreshtha, Gaurav Nemade, Yifeng Lu, and Quoc V. Le. Towards a human-like open-domain chatbot. CoRR, abs / 2001.09977, 2020; and Tom B Brown, Benjamin Mann, Nick Ryder, MelanieSubbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam,Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
[0169] Typically, an attention mechanism maps a query and a set of key-value pairs to an output, where the query, key, and value are all vectors. The output is computed as a weighted sum of the values, where the weight assigned to each value is computed by a compatibility function of the query and the corresponding key, such as a dot product or a scaled dot product.
[0170] Typically, the self-attention mechanism is configured to associate different positions in the same sequence to determine a transformed version of the sequence as an output. For example, the attention layer input may include a vector for each element of the input sequence. These vectors provide input to the self-attention mechanism and are used by the self-attention mechanism to determine a new representation of the same sequence for the attention layer output, which similarly includes a vector for each element of the input sequence. The output of the self-attention mechanism can be used as the attention layer output, or it can be processed by one or more of a feed-forward layer, a skip connection, or a normalization operation to provide an attention layer output.
[0171] In some embodiments, the attention mechanism is configured to include, for example, the matrix The query transformation defined, for example, by the matrix The key transformation defined and for example by the matrix Each of the defined value transformations is applied to the attention layer input as the input data X of the attention layer to derive a query matrix comprising a corresponding query for each vector in the input sequence , a key matrix containing a corresponding key for each vector in the input sequence and a matrix of values containing the corresponding values for each vector in the input sequence , which is used to determine the output attention sequence. For example, the attention mechanism can be a dot-product attention mechanism applied by applying each query vector to each key vector to determine the corresponding weights for each value vector, and then combining the value vectors using the corresponding weights to determine the self-attention layer output for each element of the input sequence. The self-attention layer output can be scaled by a scaling factor, such as by the square root of the dimensions of the query and key, to achieve scaled dot-product attention. Thus, for example, the output of the attention mechanism can be determined as , where d is the dimension of the key (and value) vector. In another embodiment, the attention mechanism comprises an "additive attention" mechanism that uses a feedforward network with a hidden layer to compute the compatibility function. The output of the attention mechanism can be further processed by one or more fully connected feedforward neural network layers.
[0172] The attention mechanism can implement multi-head attention, i.e., it can apply multiple different attention mechanisms in parallel. Then, if necessary, the outputs of these can be combined by applying a learned linear transformation, such as concatenating, to reduce to the original dimension.
[0173] This specification uses the term "configuration" in conjunction with system and computer program components. For a system of one or more computers to be configured to perform a particular operation or action, it means that the system has installed thereon software, firmware, hardware, or a combination thereof, which, in operation, causes the system to perform the operation or action. For one or more computer programs to be configured to perform a particular operation or action, it means that the one or more programs include instructions that, when executed by a data processing device, cause the device to perform the operation or action.
[0174] Embodiments of the subject matter and functional operations described in this specification may be implemented in digital electronic circuits, tangibly embodied computer software or firmware, computer hardware, including the structures disclosed in this specification and their structural equivalents, or a combination of one or more of them. Embodiments of the subject matter described in this specification may be implemented as one or more computer programs, for example, one or more modules of computer program instructions encoded on a tangible non-transitory storage medium, for execution by a data processing device or for controlling the operation of a data processing device. The computer storage medium may be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagation signal, for example, on a machine-generated electrical, optical or electromagnetic signal, which is generated to encode information for transmission to a suitable receiver device for execution by a data processing device.
[0175] The term "data processing apparatus" refers to data processing hardware and covers all kinds of apparatus, devices and machines for processing data, including, for example, a programmable processor, a computer or multiple processors or computers. The apparatus may also be or further include special-purpose logic circuits, such as an FPGA (field programmable gate array) or an ASIC (application-specific integrated circuit). In addition to hardware, the apparatus may optionally include code that creates an execution environment for a computer program, for example, code constituting processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.
[0176] A computer program, which may also be referred to or described as a program, software, software application, app, module, software module, script, or code, may be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages; and it may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment. A program may, but need not, correspond to a file in a file system. A program may be stored in a portion of a file that holds other programs or data, such as one or more scripts stored in a markup language document, in a single file dedicated to the program in question, or in multiple coordinated files, such as in files that store one or more modules, subroutines, or code portions. A computer program may be deployed to be executed on one or more computers located at one site or distributed across multiple sites and interconnected by a data communications network.
[0177] In this specification, the term "database" is used broadly to refer to any collection of data: the data need not be structured in any particular way, or at all, and it may be stored on storage devices in one or more locations. Thus, for example, an index database may include multiple data collections, each of which may be organized and accessed differently.
[0178] Similarly, in this specification, the term "engine" is used broadly to refer to a software-based system, subsystem, or process that is programmed to perform one or more specific functions. Typically, an engine will be implemented as one or more software modules or components installed on one or more computers in one or more locations. In some cases, one or more computers will be dedicated to a specific engine; in other cases, multiple engines can be installed and run on the same computer or multiple computers.
[0179] The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform functions by operating on input data and generating output. The processes and logic flows can also be performed by a dedicated logic circuit such as an FPGA or ASIC, or by a combination of a dedicated logic circuit and one or more programmed computers.
[0180] Computers suitable for executing computer programs can be based on general or special purpose microprocessors or both, or any other kind of central processing unit. Typically, the central processing unit will receive instructions and data from a read-only memory or a random access memory or both. The basic elements of a computer are a central processing unit for executing or implementing instructions and one or more memory devices for storing instructions and data. The central processing unit and the memory can be supplemented by or incorporated into a dedicated logic circuit. Typically, the computer will also include one or more mass storage devices for storing data, such as magnetic disks, magneto-optical disks, or optical disks, or be operably coupled to receive data from one or more mass storage devices for storing data or to transfer data to one or more mass storage devices for storing data or both. However, the computer does not need to have such a device. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device, such as a universal serial bus (USB) flash drive, to name a few.
[0181] Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media, and memory devices, including, for example, semiconductor memory devices, such as EPROM, EEPROM, and flash memory devices; magnetic disks, such as internal hard disks or removable disks; magneto-optical disks; and CD ROM and DVD-ROM disks.
[0182] To provide interaction with a user, embodiments of the subject matter described in this specification may be implemented on a computer having a display device for displaying information to the user, such as a CRT (cathode ray tube) or LCD (liquid crystal display) monitor, and a keyboard and pointing device, such as a mouse or trackball, through which the user can provide input to the computer. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback; and input from the user may be received in any form, including acoustic, voice, or tactile input. In addition, the computer may interact with the user by sending documents to and receiving documents from a device used by the user; for example, by sending a web page to a web browser on a user's device in response to a request received from the web browser. In addition, the computer may interact with the user by sending a text message or other form of message to a personal device, such as a smart phone running a messaging application, and receiving a response message from the user in return.
[0183] The data processing apparatus for implementing the machine learning model may also include, for example, dedicated hardware accelerator units for processing common and computationally intensive parts of machine learning training or production, such as inference, workloads.
[0184] Machine learning models can be implemented and deployed using a machine learning framework such as the TensorFlow framework or the Jax framework.
[0185] Embodiments of the subject matter described in this specification may be implemented in a computing system that includes a back-end component, such as a data server, or includes a middleware component, such as an application server, or includes a front-end component, such as a client computer with a graphical user interface, a web browser, or an application through which a user can interact with an implementation of the subject matter described in this specification, or any combination of one or more such back-end, middleware, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication, such as a communication network. Examples of communication networks include local area networks (LANs) and wide area networks (WANs), such as the Internet.
[0186] The computing system may include a client and a server. The client and the server are usually remote from each other and typically interact through a communication network. The relationship between the client and the server is generated by computer programs running on respective computers and having a client-server relationship with each other. In some embodiments, the server transmits data such as HTML pages to a user device, for example, for displaying data to a user interacting with a device acting as a client and receiving user input from the user. Data generated at the user device, such as the result of a user interaction, can be received from the device at the server.
[0187] Although this specification contains many specific implementation details, these should not be interpreted as limitations on the scope of any invention or the scope that may be claimed, but rather as descriptions of features that may be specific to a particular embodiment of a particular invention. Certain features described in the context of separate embodiments in this specification may also be implemented in combination in a single embodiment. On the contrary, the various features described in the context of a single embodiment may also be implemented in multiple embodiments individually or in any suitable sub-combination. In addition, although features may be described above as working in certain combinations and even initially claimed as such, in some cases, one or more features from the claimed combination may be deleted from the combination, and the claimed combination may be directed to a sub-combination or a variation of the sub-combination.
[0188] Similarly, although operations are depicted in the drawings and recited in the claims in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in a sequential order, or that all of the illustrated operations be performed to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous. In addition, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0189] Specific embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve the desired results. As an example, the processes depicted in the accompanying drawings do not necessarily require the particular order shown or sequential order to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous.< / claim>
Claims
1. A method performed by one or more computers, the method comprising: receiving an input text query; obtaining one or more first context text sequences and a corresponding natural language identifier for each of the first context text sequences; generating a first input sequence comprising the input text query, the one or more first context text sequences, and the corresponding natural language identifier for each of the one or more first context text sequences; The first input text sequence is processed using an autoregressive language model neural network to generate a first output text sequence, wherein the first output text sequence includes: (i) a first output text subsequence, the first output text subsequence being a response to the input text query; (ii) a second output text subsequence, the second output text subsequence being one of the corresponding natural language identifiers of the first context text sequence, and (iii) a third output text subsequence, the third output text subsequence being text from the first context text sequence identified by the natural language identifier in the second output text subsequence; and In response to the input text query, at least the first output text subsequence and the third output text subsequence are provided.
2. The method according to claim 1, wherein: Providing at least the first output text subsequence and the first context text sequence in response to the input text query comprises: In response to the query, the first output text subsequence, the second output text subsequence, and the third output text subsequence are provided.
3. The method according to claim 1 or 2, further comprising: determining, from the second output text subsequence, a source of the first context text sequence identified by the natural language identifier in the second output text subsequence; as well as In response to the query, a reference to the source of the first contextual text sequence is provided.
4. The method according to any preceding claim, further comprising: obtaining one or more second context text sequences and a corresponding natural language identifier for each of the second context text sequences; generating a second input sequence comprising the input text query, the one or more second context text sequences, and the corresponding natural language identifier for each of the one or more second context text sequences; The second input text sequence is processed using the autoregressive language model neural network to generate a second output text sequence, wherein the second output text sequence includes: (i) a fourth output text subsequence, the fourth output text subsequence being a response to the input text query; (ii) a fifth output text subsequence, the fifth output text subsequence being one of the corresponding natural language identifiers of the second context text sequence, and (iii) a sixth output text subsequence, the sixth output text subsequence being text from the second context text sequence identified by the natural language identifier in the fifth output text subsequence; generating a corresponding score for each output text sequence in a set including the first output text sequence and the second output text sequence; determining that the first output text sequence has the highest score of any output text sequence in the set; and In response to determining that the first output text sequence has the highest score, at least the first output text subsequence and the third output text subsequence are provided in response to the input text query.
5. The method according to claim 4, wherein: Generating a corresponding score for each output text sequence in a set including the first output text sequence and the second output text sequence comprises: Each of the output text sequences is scored using the learned reward model.
6. A method according to any preceding claim, wherein: The first output sequence comprises a corresponding word-gram from a word-gram vocabulary at each of a plurality of time steps, wherein the autoregressive neural network is configured to, for each time step in the first output sequence, generate a corresponding score for each word-gram in the vocabulary conditioned on the first input text sequence and any word-gram in the output sequence at any time step prior to the time step in the first output sequence, and wherein generating the first output sequence comprises: At each time step, the word-gram at that time step is selected using the corresponding score of the word-gram in the vocabulary generated by the neural network for that time step.
7. The method according to claim 6, wherein: Generating the first output sequence comprises: At each time step in the second output text subsequence after the first time step in the second output text subsequence: receiving the corresponding score generated by the neural network at the time step; generating a constrained score distribution that assigns non-zero scores only to word-grams that immediately follow the word-gram that has been generated within the second output text subsequence in one of the natural language identifiers; and The word-gram is sampled from the constrained scoring distribution at the time step.
8. The method according to claim 7, wherein: The second output text subsequence is preceded by one or more first predetermined grammatical tokens in the first output text sequence, and wherein generating the first output sequence comprises: determining, at a particular time step, that the one or more first predetermined grammatical tokens have been selected at one or more time steps immediately preceding the particular time step, and in response, determining that the particular time step is the first time step in the second output text subsequence; receiving the corresponding score generated by the neural network at the particular time step; responsive to determining that the particular time step is the first time step in the second output text subsequence, generating a constrained score distribution that assigns non-zero scores only to word-grams that are the first word-gram in one of the natural language identifiers; and The word-gram is sampled from the constrained scoring distribution at the time step.
9. A method according to any preceding claim, wherein: Generating the first output sequence comprises: At each time step in the third output text subsequence after the first time step in the third output text subsequence: receiving the corresponding score generated by the neural network at the time step; generating a constrained score distribution that assigns non-zero scores only to word-grams that immediately follow the word-gram that has been generated within the third output text subsequence in the first context text sequence identified by the natural language identifier in the second output text subsequence; and The word-gram is sampled from the constrained scoring distribution at the time step.
10. The method according to claim 9, wherein: The third output text subsequence is preceded by one or more second predetermined grammatical tokens in the first output text sequence, and wherein generating the first output sequence comprises: determining, at a second particular time step, that the one or more second predetermined grammatical tokens have been selected at one or more time steps immediately preceding the second particular time step, and in response, determining that the particular time step is the first time step in the third output text subsequence; receiving the corresponding score generated by the neural network at the particular time step; In response to determining that the particular time step is the first time step in the third output text subsequence, generating a constrained score distribution that assigns non-zero scores only to word-grams that appear in the first context text sequence identified by the natural language identifier in the second output text subsequence; and The word-gram is sampled from the constrained scoring distribution at the time step.
11. A method according to any preceding claim, wherein: Obtaining one or more first context text sequences and a corresponding natural language identifier for each of the first context text sequences comprises: submitting a query derived from the input text query to a search engine; Responsive to the query, obtaining one or more context documents from the search engine; and The one or more first context sequences are selected from the one or more context documents.
12. The method according to claim 11, wherein: The corresponding natural language identifier of each of the first context text sequences is the title of the context document from which the first context text sequence was selected.
13. A method according to any preceding claim, wherein: The neural network has been pre-trained through unsupervised learning for a language modeling objective.
14. A method according to any preceding claim, wherein: The neural network has been fine-tuned through supervised learning, reinforcement learning, or both.
15. A system comprising: one or more computers; as well as One or more storage devices storing instructions which, when executed by the one or more computers, cause the one or more computers to perform corresponding operations according to any one of claims 1-14.
16. One or more computer-readable storage media storing instructions that, when executed by one or more computers, cause the one or more computers to perform corresponding operations of the method according to any one of claims 1-14.
Citation Information
Cited By
Generating content items based on source document metadata using generative neural networks
CN121328482A
