WO2020238985A1 - 模型训练方法、对话生成方法、装置、设备及存储介质 - Google Patents

模型训练方法、对话生成方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2020238985A1
WO2020238985A1 PCT/CN2020/092701 CN2020092701W WO2020238985A1 WO 2020238985 A1 WO2020238985 A1 WO 2020238985A1 CN 2020092701 W CN2020092701 W CN 2020092701W WO 2020238985 A1 WO2020238985 A1 WO 2020238985A1
Authority
WO
WIPO (PCT)
Prior art keywords
question
question sentence
representation
model
generation model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2020/092701
Other languages
English (en)
French (fr)
Inventor
杨敏
闭玮
刘晓江
陈磊
黄婷婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Shenzhen Institute of Advanced Technology of CAS
Original Assignee
Tencent Technology Shenzhen Co Ltd
Shenzhen Institute of Advanced Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd, Shenzhen Institute of Advanced Technology of CAS filed Critical Tencent Technology Shenzhen Co Ltd
Publication of WO2020238985A1 publication Critical patent/WO2020238985A1/zh
Priority to US17/367,883 priority Critical patent/US11875126B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • G06N3/0442Recurrent networks, e.g. Hopfield networks characterised by memory or gating, e.g. long short-term memory [LSTM] or gated recurrent units [GRU]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • G06N3/0455Auto-encoder networks; Encoder-decoder networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0475Generative networks
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/09Supervised learning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/096Transfer learning
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models
    • G06N5/041Abduction

Definitions

  • This application relates to the field of machine learning technology, and in particular to a dialogue generation model training method, dialogue generation method, device, equipment and computer storage medium.
  • the task of generating open-domain dialogues refers to the fact that machines in the open field generate corresponding replies based on the questions of the dialogue. Due to its powerful functions and extensive application scenarios, it has recently received more and more attention and research.
  • the open-domain dialogue generation task usually relies on the dialogue generation model to achieve, and in order to enable the dialogue generation model to generate more informative and more reasonable responses, other information can be integrated in the open-domain dialogue generation task to make the generated responses more Reasonable and more informative.
  • This application provides a method for training a dialogue generation model, which trains the dialogue generation model by transferring the knowledge information in the knowledge base question answering model, and utilizes the high accuracy of the knowledge base question answering model to better integrate knowledge information, thereby improving dialogue generation accuracy.
  • This application also provides a dialog generation method and corresponding devices, equipment, computer storage media, and computer program products.
  • an embodiment of the present application provides a method for training a dialogue generation model, and the method includes:
  • dialog data set Acquiring a dialog data set, where each dialog data as a training sample in the dialog data set includes a question sentence and a labeled reply corresponding to the question sentence;
  • the coded representation of the question sentence and the knowledge information corresponding to the question sentence transferred and learned from the knowledge base question answering model are merged to obtain the predicted response corresponding to the question sentence;
  • the model parameters of the dialogue generation model are updated based on the value of the loss function.
  • An embodiment of the present application provides a method for training a dialogue generation model, and the method includes:
  • the coded representation of the question sentence is obtained through the encoder in the pre-trained dialogue generation model, and the coded representation of the question sentence is merged with the question answering model from the knowledge base by the decoder in the dialogue generation model Transfer learning knowledge information to obtain the predicted response corresponding to the question output by the dialogue generation model;
  • the predicted response is sent to the terminal, wherein the pre-trained dialogue generation model is trained by transferring knowledge information learned from the knowledge base question answering model, so as to realize that the dialogue generation model generates a sentence matching the question sentence Reply sentence.
  • the embodiment of the present application also provides a method for training a dialogue generation model.
  • the method is executed by a server.
  • the server includes one or more processors and a memory, and one or more programs, wherein the one or More than one program is stored in the memory, the program may include one or more units each corresponding to a set of instructions, the one or more processors are configured to execute the instructions; the method includes:
  • dialog data set Acquiring a dialog data set, where each dialog data as a training sample in the dialog data set includes a question sentence and a labeled reply corresponding to the question sentence;
  • the coded representation of the question sentence and the knowledge information corresponding to the question sentence transferred and learned from the knowledge base question answering model are merged to obtain the predicted response corresponding to the question sentence;
  • the model parameters of the dialogue generation model are updated based on the value of the loss function.
  • the embodiment of the present application also provides a method for generating a dialog.
  • the method is executed by a server.
  • the server includes one or more processors, a memory, and one or more programs, wherein the one or more The program of is stored in a memory, the program may include one or more units each corresponding to a set of instructions, and the one or more processors are configured to execute instructions; the method includes:
  • the predicted response is sent to the terminal, wherein the pre-trained dialogue generation model is trained by transferring knowledge information learned from the knowledge base question answering model, so as to realize that the dialogue generation model generates a sentence matching the question sentence Reply sentence.
  • An embodiment of the present application provides a dialog generation model training device, the device includes:
  • An acquiring module configured to acquire a dialog data set, each of the dialog data as a training sample in the dialog data set includes a question sentence and a labeled reply corresponding to the question sentence;
  • the training module is configured to encode the question sentence in the dialogue data set through the encoder in the dialogue generation model to obtain the encoded representation of the question sentence;
  • the training module is configured to use the decoder in the dialogue generation model to fuse the coded representation of the question sentence and the knowledge information corresponding to the question sentence transferred and learned from the knowledge base question answering model for the question sentence, Obtain the predicted response corresponding to the question;
  • the training module is configured to determine the value of the loss function of the dialogue generation model based on the predicted response and the labeled response corresponding to the question sentence;
  • the training module is configured to update the model parameters of the dialogue generation model based on the value of the loss function.
  • An embodiment of the present application provides a dialog generating device, which includes:
  • the receiving module is configured to receive the question to be answered sent by the terminal;
  • a generation module configured to obtain the coded representation of the question through the encoder in the pre-trained dialogue generation model, and fuse the coded representation of the question and the subordinates to the question through the decoder in the dialogue generation model Transfer learned knowledge information in the knowledge base question answering model to obtain the predicted response corresponding to the question sentence output by the dialogue generation model;
  • the sending module is configured to send the predictive reply to the terminal, wherein the pre-trained dialogue generation model is trained by transferring knowledge information learned from the knowledge base question answering model, so as to realize the generation and Reply sentence that matches the question sentence.
  • An embodiment of the present application also provides a device, which includes a processor and a memory:
  • the memory is configured to store a computer program
  • the processor When the processor is configured to run the computer program, it executes the dialog generation model training method provided in the embodiment of the application or the dialog generation method provided in the embodiment of the application.
  • An embodiment of the present application provides a computer-readable storage medium, the computer storage medium stores program code, and the program code is used to execute the dialog generation model training method provided in the foregoing embodiment of the present application, or, the embodiment of the present application The provided dialog generation method.
  • the embodiment of the application provides a computer program product including instructions, which when run on a computer, causes the computer to execute the dialog generation model training method described in the embodiment of the application or the dialog generation method described in the embodiment of the application .
  • the embodiment of the application Based on the dialog generation model trained by the above model training method, the embodiment of the application also provides a dialog generation method.
  • the dialog generation model transfers the knowledge information in the knowledge base question answering model to the open domain dialog generation task through Using the high accuracy of the knowledge base question answering model enables the model to better integrate knowledge information, thereby improving the accuracy and rationality of dialogue generation, making it easier for users to obtain high-quality dialogue information, and reducing the impact of general responses on users.
  • FIG. 1 is a scene architecture diagram of a method for training a dialogue generation model in an embodiment of the application
  • FIG. 2 is a flowchart of a method for training a dialog generation model in an embodiment of the application
  • FIG. 3 is a scene architecture diagram of a dialog generation method in an embodiment of the application.
  • Fig. 4 is a flowchart of a dialog generating method in an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a dialog generation model in an embodiment of this application.
  • Fig. 6 is a flowchart of a dialog generating method in an embodiment of the application.
  • FIG. 7 is a schematic diagram of an application scenario of a dialog generation method in an embodiment of the application.
  • FIG. 8 is a schematic structural diagram of a dialog generation model training device in an embodiment of the application.
  • FIG. 9 is a schematic structural diagram of a dialog generation model training device in an embodiment of the application.
  • FIG. 10 is a schematic structural diagram of a dialog generation model training device in an embodiment of this application.
  • FIG. 11 is a schematic structural diagram of a dialog generation model training device in an embodiment of this application.
  • FIG. 12 is a schematic structural diagram of a dialog generating apparatus in an embodiment of the application.
  • FIG. 13 is a schematic structural diagram of a dialog generating apparatus in an embodiment of the application.
  • FIG. 14 is a schematic structural diagram of a dialog generating apparatus in an embodiment of the application.
  • FIG. 15 is a schematic diagram of a structure of a device in an embodiment of the application.
  • This application provides a method for training a dialogue generation model.
  • the knowledge information for the question is migrated from the Knowledge Base Question Answering (KBQA) model. Because the knowledge base question answering model has good accuracy, the coding representation of the question is merged It has a good fusion effect with the knowledge information for the question.
  • the dialogue generation model can output the predicted response to the question based on the fusion information. Based on the predicted response and the annotation response carried by the dialogue data in the dialogue data set, Determine the loss function, adjust the dialog generation model parameters based on the loss function to implement model training, improve training efficiency and accuracy, and enable the model to meet actual application requirements.
  • the dialog generation model training method provided in this application can be applied to any processing device with data processing capability, and the processing device can be a terminal or a server.
  • the terminal can be a desktop terminal, or a portable mobile terminal such as a smart phone or a tablet computer, or a vehicle-mounted terminal, or an augmented reality (AR) terminal or a virtual reality (VR) terminal.
  • AR augmented reality
  • VR virtual reality
  • the processing equipment can exist independently or in the form of a cluster.
  • the above-mentioned dialog generation model training method can be stored in a processing device in the form of a computer program, and the processing device implements the dialog generation model training method of this application by executing the application program.
  • the computer program may be an independent application program, or may be a function module, plug-in, applet, etc. integrated on other programs.
  • the scenario includes a server 10 and a sample library 20, wherein the sample library 20 stores a dialog data set, and the server 10 obtains a dialog data set from the sample library 20 Perform model training.
  • the dialog data in the dialog data set includes a file and annotated replies corresponding to the question
  • the server 10 generates the code in the dialog generation model based on the question in the dialog data set.
  • the coded representation of the question sentence is obtained by the decoder, and the coded representation of the question sentence is merged with the knowledge information transferred from the knowledge base question answering model for the question sentence through the decoder in the dialogue generation model to obtain the dialogue Generate the predicted response corresponding to the question output by the model; then determine the loss function based on the predicted response and label response corresponding to the question, and adjust the dialog generation model parameters through the loss function until the loss function of the dialog generation model is at convergence.
  • the method includes:
  • the dialog data in the dialog data set includes question sentences and labeled replies corresponding to the question sentences.
  • Each set of dialogue data in the dialogue data set is used as a training sample for training the dialogue generation model.
  • the dialogue data set may be an existing data set, such as a reddit single-round dialogue data set, or it may be generated by the server crawling the question from the network and marking the corresponding reply to the question.
  • S202 Perform encoding processing on the question sentence in the dialogue data set through the encoder in the dialogue generation model to obtain an encoded representation of the question sentence.
  • the coded representation of the question sentence is obtained by the encoder in the constructed dialogue generation model, and the coded representation of the question sentence is combined with the decoder in the dialogue generation model.
  • the predicted reply corresponding to the question sentence output by the dialogue generation model is obtained.
  • the dialogue generation model is a network model based on an encoder-decoder structure.
  • the dialogue generation model takes a question as an input and a reply to the question as an output.
  • the server encodes the question sentence of the input model through an encoder to obtain the encoded expression of the question sentence, and the decoder merges the encoded expression of the question sentence with the knowledge information transferred and learned from the knowledge base question answering model for the question sentence , And decode the fused information to generate a predicted reply corresponding to the question sentence.
  • the server may determine the word embedding representation of the question sentence based on the word embedding model through the constructed dialogue generation model, and then use the bidirectional long-term memory network (Bidirectional Long Short-Term Memory, BiLSTM) according to the word embedding representation. ) Encoding to obtain a hidden layer state representation, and use the hidden layer state representation as an encoding representation of the question sentence.
  • BiLSTM Bidirectional Long Short-Term Memory
  • the dialogue generation model is a sequence-to-sequence (Seq2Seq) framework model
  • training the dialogue generation model is essentially a condition Probability P(Y
  • the server is implemented in combination with the knowledge base question answering model when modeling P(Y
  • the knowledge base question answering model is a question answering model based on the knowledge base.
  • the knowledge base is also called the knowledge graph, which is a huge database with knowledge as the main unit and entities as the main carrier, containing the cognition of thousands of things and various facts.
  • Knowledge in the knowledge base is generally presented in the form of triples, which are specifically represented as ⁇ head entity, relationship, tail entity>, where entities refer to people, places, or specific concepts, etc., and relationships refer to head entities and tail entities The logical relationship.
  • the capital of China is Beijing, which can be represented by the following triplet: ⁇ China, capital, Beijing>.
  • the server transfers and learns the knowledge information for the question sentence from the knowledge base question answering model.
  • the server obtains the contextual attention vector of the question sentence, and inputs the contextual attention vector of the question sentence into the Multi-Layer Perception in the knowledge base question answering model In the network; the enhanced attention vector of the question sentence is obtained through the MLP, and the enhanced attention vector of the question sentence is used as the knowledge information transferred and learned from the knowledge base question answering model for the question sentence.
  • the server fuses the coded representation of the question and the enhanced attention vector through the decoder in the dialogue generation model, and the fusion vector can be used to predict the word probability distribution through the classifier in the dialogue generation model such as softmax, thereby Obtain the predicted reply corresponding to the question output by the dialogue generation model.
  • S204 Determine the value of the loss function of the dialogue generation model based on the predicted response and the labeled response corresponding to the question sentence.
  • the loss function is used to characterize the degree of inconsistency between the predicted response and the labeled response. It can be understood that there are many types of loss functions, and the corresponding types of loss functions can be selected according to requirements in practical applications.
  • the server may use a cross-entropy loss function for model training. In other words, the server can use the cross entropy of the predicted response word distribution and the labeled response word distribution as the loss function of the dialogue generation model, as follows:
  • L is the loss function
  • represents the set of all parameters of the model
  • D represents the training set containing the sequence pairs of ⁇ question (post)
  • reply (response)> represents the length of the generated response
  • x, y, and t respectively represent Question (post), reply (response) and decoding time step.
  • the server determines the loss function according to the predicted response and the labeled response corresponding to the question, and then adjusts the dialog generation model parameters based on the loss function until the loss function of the dialog generation model is in a convergent state. In this way, dialog generation is realized Model training.
  • the embodiment of the present application provides a method for training a dialogue generation model.
  • This method transfers the knowledge information for question sentences from the knowledge base question answering model when training the dialogue generation model. Because the knowledge base question answering model is better Therefore, it has a good fusion effect when fusing the coded representation of the question and the knowledge information for the question.
  • the dialogue generation model can output the predicted response to the question based on the fusion information.
  • the loss function can be determined based on the predicted response and the labeled response carried by the dialog data in the dialog data set, and the dialog generation model parameters are adjusted based on the loss function to implement model training, which improves training efficiency and accuracy, and enables the model to meet actual application requirements.
  • the server can also use transfer learning to transfer the sentence modeling representation for the question sentence from the knowledge base question answering model, and the coded representation obtained by encoding the question sentence with the encoder In combination, this can improve the accuracy of the coding representation, thereby improving the accuracy and rationality of the response generation of the dialogue generation model.
  • the server will obtain the coding representation of the question through the encoder in the dialogue generation model.
  • the server will also input the question into the knowledge base question and answer model , Obtain the coded representation output by the encoder in the knowledge base question answering model as the second coded representation of the question sentence, and then splice the first coded representation of the question sentence and the second coded representation of the question sentence , The spliced coded representation is used as the comprehensive coded representation of the question.
  • the server uses the decoder in the dialogue generation model to fuse the comprehensive coded representation of the question with the question answer from the knowledge base. The knowledge information of transfer learning in the model is decoded.
  • the server can also introduce a response to guide attention mechanism to generate the coded representation of the question.
  • the response guiding attention mechanism refers to retrieving similar question sentences corresponding to the question sentence, taking the response corresponding to the similar question sentence as the similar candidate response of the question sentence, based on the word embedding representation and the first coding representation of the similar candidate response Determine mutual attention as the third coded representation of the question.
  • the server may concatenate the first coded representation of the question sentence and the third coded representation of the question sentence, and use the concatenated coded representation as a comprehensive coded representation of the question sentence through the dialogue generation model
  • the decoder integrates the comprehensive coded representation of the question sentence and decodes the knowledge information transferred and learned from the knowledge base question answering model for the question sentence.
  • the server may also splice the first encoding representation of the question sentence, the second encoding representation of the question sentence, and the third encoding representation of the question sentence, and use the spliced encoding representation as the The integrated coding representation of the question sentence is then combined with the integrated coding representation of the question sentence and the knowledge information transferred and learned from the knowledge base question answering model for the question sentence through the decoder in the dialogue generation model.
  • the knowledge base question answering model in the embodiment shown in FIG. 2 may be pre-built.
  • This application also provides an implementation method for constructing a question and answer model of a knowledge base.
  • the server constructs an end-to-end structured neural network model, and then trains the neural network model based on a general data set and a common sense knowledge base, where the general data set can be Simple Questions, and the common sense knowledge base can be It is freebase-FB2M.
  • the neural network model parameters are adjusted through the hinge loss function Hinge loss until the loss function of the neural network model is converging, and the neural network model in the convergent state is used as the knowledge base question answering model .
  • Hinge loss in this embodiment of the application is:
  • q represents the question
  • G represents the set of candidate knowledge answers
  • G + represents the set of positive examples
  • G - represents the set of negative examples
  • S represents the correlation degree between q and the set of positive or negative examples in G
  • is a hyperparameter.
  • the application provides a specific implementation of the dialog generation model training method for the embodiments of the application. Based on the dialog generation model trained in the foregoing implementation, the application also provides a dialog generation method, which will be described below in conjunction with specific embodiments.
  • dialog generation method provided in this application can be applied to a server, and the dialog generation method is stored in the server in the form of a computer program, and the server implements the dialog generation method of this application by executing the computer program.
  • the server 10 receives the question to be answered sent by the terminal, and obtains it through the encoder in the pre-trained dialog generation model
  • the coded representation of the question sentence is obtained by fusing the coded representation of the question sentence and the knowledge information transferred and learned from the knowledge base question answering model for the question sentence by the decoder in the dialogue generation model to obtain the dialogue generation model
  • the predicted response corresponding to the output question sentence then, the server 10 sends the predicted response to the terminal 20, instructing the terminal 20 to display the predicted response, so as to realize intelligent interaction with the user.
  • the method includes:
  • the display interface of the terminal carries input controls and/or selection controls.
  • the user can input a question through the input control, or select a question through the selection control, and the terminal responds to the user's input operation or selection operation to the server Send a question, which is the question to be answered.
  • the user when inputting a question sentence or selecting a question sentence, the user can input or select one question sentence or multiple question sentences, and the number of question sentences does not affect the specific implementation of the application.
  • S402 Obtain the coded representation of the question sentence through the encoder in the pre-trained dialogue generation model, and merge the coded representation of the question sentence with the question answer from the knowledge base through the decoder in the dialogue generation model
  • the knowledge information of transfer learning in the model obtains the predicted reply corresponding to the question output by the dialogue generation model.
  • the pre-trained dialogue generation model is trained by transferring learned knowledge information from the knowledge base question answering model, so as to realize the generation of reply sentences matching the question sentences through the dialogue generation model.
  • the server has a built-in dialogue generation model, and the server encodes the question sentence using the encoder of the dialogue generation model to obtain the encoded representation of the question sentence, and then uses the decoder of the dialogue generation model to fuse the question.
  • the coded representation of the sentence and the knowledge information transferred and learned from the knowledge base question answering model for the question sentence are classified by using the classifier of the dialogue generation model to classify the decoded information, thereby obtaining the question output by the dialogue generation model The predictive response corresponding to the sentence.
  • this application provides multiple implementation ways to obtain the encoding representation of the question sentence, which will be described separately below.
  • the first implementation manner is to generate a first coded representation using the encoder coding of the dialogue generation model, and use the first coded representation as the coded representation of the question sentence.
  • the server may determine the word embedding representation of the question sentence based on the word embedding model through the constructed dialogue generation model, and obtain the hidden layer state representation through BiLSTM coding according to the word embedding representation, and express the hidden layer state As the first coded representation of the question sentence, the coded representation of the question sentence is thus obtained.
  • the second implementation manner is that the server inputs the question sentence into the knowledge base question answering model, and obtains the encoding representation output by the encoder in the knowledge base question answering model as the second encoding representation of the question sentence.
  • the coding representation is the sentence modeling representation for the question sentence obtained by migration learning from KBQA, the first coding representation of the question sentence and the second coding representation of the question sentence are spliced, and the spliced coding representation is used as the whole The comprehensive coding representation of the interrogative sentence.
  • a third implementation manner is that the server determines the reply corresponding to the similar question of the question as a similar candidate reply, and determines mutual attention based on the word embedding representation of the similar candidate reply and the first encoding representation of the question.
  • the third coded representation of the question then the first coded representation of the question and the third coded representation of the question are spliced, and the spliced coded representation is used as the comprehensive coded representation of the question .
  • the fourth implementation manner is to concatenate the first coded representation, the second coded representation and the third coded representation of the question sentence, and use the concatenated coded representation as the comprehensive coded representation of the question sentence .
  • the server introduces the knowledge information for the question sentence obtained by migration learning from the knowledge base question answering model for fusion, which has a better fusion effect.
  • the server obtains the context attention vector of the question sentence, inputs the context attention vector of the question sentence into the MLP network in the knowledge base question answering model, and obtains it through the MLP network
  • the enhanced attention vector of the question sentence is used as the knowledge information transferred and learned from the knowledge base question answering model for the question sentence.
  • the server fuses the coded representation of the question sentence and the knowledge information transferred and learned from the knowledge base question answering model for the question sentence through the decoder in the dialogue generation model to obtain the question sentence output by the dialogue generation model The corresponding predicted response.
  • the enhanced attention vector of the question sentence is obtained based on the MLP network
  • it is implemented in the following manner: obtain the context attention vector of the MLP network based on the question sentence and obtain each word from the vocabulary of the knowledge base
  • the knowledge information obtained by respectively migration is determined according to the contextual attention vector and the entity embedded representation of each word in the knowledge base vocabulary to determine the enhanced attention vector of the question sentence.
  • the server obtains the hidden layer state representation of the decoder in the dialog generation model, and then inputs the hidden layer state representation of the decoder in the dialog generation model and the above-mentioned enhanced attention vector into the classification layer of the dialog generation model as
  • the softmax layer generates a predicted reply corresponding to the question sentence according to the predicted word distribution output by the classification layer.
  • obtaining the hidden layer state representation of the decoder in the dialogue generation model is implemented in the embodiment of this application in the following manner: the hidden state representation of the encoder in the dialogue generation model for the last word in the question sentence is used as the The initial state of the decoder in the dialogue generation model and the preset symbol as the initial symbol (start of sentence, SOS), according to the previous time step state of the decoder in the dialogue generation model and the symbol generated at the previous time step
  • the word embedding representation and the attention vector generated by the current time step of the encoder in the dialogue generation model are used as the input of the decoder in the dialogue generation model to obtain the hidden layer state of the decoder in the dialogue generation model at the current time step Said.
  • the initial state can be used as the state of the previous time step at this time, and there is no generated word of the first time step when decoding the first time step.
  • the encoding representation of the question sentence fused by the decoder is the encoding representation obtained in the foregoing encoding process. That is, when the first implementation method is used for encoding, the decoder merges the first encoding representation, and when the second, third, or fourth implementation method is used, the decoder merges with splicing. The resulting comprehensive coded representation.
  • the embodiment of this application provides a dialog generation method, which is implemented based on a dialog generation model, which transfers the knowledge information in the knowledge base question answering model to the open domain dialog generation task by using
  • the high accuracy of the knowledge base question answering model enables the model to better integrate knowledge information, thereby improving the accuracy and rationality of dialogue generation.
  • the present application also provides a more specific embodiment of the dialog generation method, which will be described below in conjunction with the structure of the dialog generation model.
  • dialog generation model is mainly composed of two modules: Knowledge Base Questions and Answers (KBQA) module and dialog Generate modules.
  • KBQA Knowledge Base Questions and Answers
  • the server first determines the embedded representation of the question Q and the candidate knowledge answer K.
  • BiLSTM is used to encode the embedded representation, and then spliced to obtain the encoding representation of the question Q.
  • the candidate knowledge answer K pass The coding layer coding obtains the coding representation of the candidate knowledge answer, and the coding representation based on the question Q and the candidate knowledge answer K calculates the semantic similarity.
  • MLP can screen the best candidate answer based on the semantic similarity matching result as the answer to the question Q A.
  • the dialogue generation module determine the embedded representation of the question, and then use BiLSTM to encode the embedded representation, and then splice it to get the first encoding representation of the question.
  • transfer learning from KBQA to obtain the modeling representation of the question.
  • the representation and the third encoding representation are spliced to obtain a comprehensive encoding representation.
  • the decoder in the dialogue generation module fuses the comprehensive encoding representation and the knowledge information for the question acquired from the MLP of KBQA based on the dialog generation module to generate a reply Y .
  • the training process of the dialogue generation model includes two parts. Firstly, KBQA is pre-trained, as shown in S601 and S602 in Fig. 6, and then the dialogue generation model is trained based on the pre-trained KBQA, as shown in S603 and S604 in Fig. 6.
  • the method includes:
  • the server For the general data set, the server respectively encodes the question and the candidate knowledge answer corresponding to the question, to obtain the coding representation of the question and the coding representation of the candidate knowledge answer.
  • a general data set such as Simple Questions includes multiple sets of question and answer data, and each set of question and answer data includes a question Q and a candidate knowledge answer set G corresponding to the question Q, where the question Q corresponds to the candidate knowledge answer set can be divided into a set of positive examples and negative examples set of G + G -, refers to a collection of positive examples of elements as a set of correct answers, a negative example collection is a set of elements for the wrong answers, during training KBQA, for each question Q ,
  • the set of positive examples are the correct labeled answers, and the set of negative examples are 20 incorrect answers randomly sampled in the common sense knowledge base freebase-FB2M.
  • the candidate knowledge answer set G includes at least one positive example, and the server separately encodes the question and the candidate knowledge answer for model training.
  • the server When coding the question, the server encodes the question Q from the word level and the dependency level respectively, and then superimposes the two representations obtained from the word level and the dependency level to obtain the coding representation of the question Q.
  • the word-level coding specifically uses pre-trained Global Vectors for Word Representation (GloVe) to obtain the word embedding representation for question Q, then uses BiLSTM to encode the word embedding representation, and then encodes the representation obtained through BiLSTM Concatenating to get the word level representation of question Q.
  • GloVe Global Vectors for Word Representation
  • BiLSTM BiLSTM Concatenating
  • Is the word embedding representation of the i-th word in question Q Is the coded representation of question Q at the word level after reverse LSTM, It is the coded representation of question Q at the word level through forward LSTM.
  • the candidate knowledge answers can be represented by triples.
  • the server can encode the candidate knowledge answers from word level and knowledge level, and then combine the word level and dependency The two representations obtained by the level are superimposed to obtain the coding representation of the candidate knowledge answer.
  • the knowledge triples are regarded as a combination of single words, given a word sequence Use pre-trained GloVe to convert each word into a corresponding word embedding representation.
  • the word embedding representation is represented by a vector, and then the vector of n words is averaged as the word-level embedding representation p of the knowledge triple (w) , which is the embedded representation of the candidate knowledge answer.
  • the knowledge triples are regarded as a whole. Given the knowledge triples, the knowledge embedding representation method automatically learned by the neural network obtains the knowledge level embedding representation p (id) .
  • S602 Calculate the semantic matching similarity between the question and the candidate knowledge answer through the encoding representation, determine the best answer according to the semantic matching similarity, determine the loss function based on the best answer, and adjust the nerve based on the loss function The network model parameters until the loss function of the neural network model is in convergence.
  • the server uses S-MART as the entity linking tool. Get the link score S ent of all entities in the candidate knowledge answer set for each question Q, and input the result of entity linking, namely S ent , the question and the representation of the candidate knowledge answer as features into an MLP network, and the MLP network outputs question Q and candidates.
  • S ent the link score of all entities in the candidate knowledge answer set for each question Q
  • S ent the result of entity linking
  • the question and the representation of the candidate knowledge answer as features into an MLP network
  • the MLP network outputs question Q and candidates
  • the degree of relevance of each candidate knowledge answer in the knowledge answer set G, the degree of relevance S(q (i) ,p (i) ) can be used as the semantic matching similarity:
  • the server can determine the current loss function based on the best answer. As shown in the above formula (2), the server adjusts the neural network model parameters based on the loss function Hinge loss, which can maximize the set of positive examples and negative For the distance between the example sets, when the loss function Hinge loss of the model is converging, the server can use the converged neural network model as the KBQA model for subsequent dialogue generation model training.
  • the server uses the encoder of the dialogue generation model itself to encode the question sentence to obtain the first coded representation, learns from the pre-trained KBQA migration and learns the second coded representation for the question, and obtains it through the response guide attention mechanism
  • the third coded representation of the question sentence the first coded representation, the second coded representation and the third coded representation are spliced to obtain a comprehensive coded representation.
  • the reddit data set includes dialogue data
  • each set of dialogue data includes question sentences and labeled responses corresponding to the question sentences.
  • the word embedding representation e(x t ) of each word x t is obtained based on GloVe conversion
  • the hidden layer state is obtained by BiLSTM coding Representation, as the first encoding representation, as follows:
  • the server also uses the BiLSTM that encodes the question Q in the pre-trained KBQA to re-encode the question sentence to obtain the question sentence representation after transfer learning, that is, the second coding representation, as shown below:
  • this application also proposes a response guidance mechanism.
  • the server uses a retrieval tool, such as Lucene, to retrieve the k questions that are most similar to the question, and the corresponding k Reply as a candidate reply, calculate the embedding representation e(Y i ) of the i-th candidate reply regarding the mutual attention of the hidden layer state representation of the current question:
  • f is a non-linear activation function.
  • it can adopt a tanh function.
  • the k hidden layer state representations are weighted and averaged to obtain the final hidden layer state representation of the mechanism of replying to the guided attention example, that is, the third coded representation, as shown below:
  • S604 Use the decoder of the dialogue generation model to fuse the comprehensive coded representation of the question and the knowledge information obtained from the transfer learning from the KBQA model to obtain the predicted response, determine the loss function based on the predicted response and the annotation response, and adjust the dialogue generation through the loss function Model parameters until the loss function of the dialogue generation model is in convergence.
  • the decoder selects LSTM, and the hidden layer state calculation process of the decoder is:
  • st-1 is the hidden layer state representation of the decoder when the decoding time step is t-1
  • e(y t-1 ) is the word embedding representation of the t-1th generated word.
  • c t is the context attention vector when the decoding time step is t, and the calculation process is:
  • e tk is the similarity between the hidden layer state of the decoder at t-1 and the hidden layer state of the encoder at k, and it is a function of st-1 and h k , where V b , W b And U b are the parameters to be learned in the functional relationship, tanh is a hyperbolic function; in the same way, e tj is the degree of similarity between the hidden layer state of the decoder at t-1 and the hidden layer state of the encoder at time j, j
  • the value is a positive integer from 1 to T x (including the endpoints), where T x refers to the number of words when the question is converted into a word sequence; a tk is the t-th time of the decoder at the k-th time of the encoder Attention weight, which can be calculated based on the above similarity.
  • the server in order to transfer knowledge information from the KBQA model, the server sends the contextual attention vector to the MLP network in the previously pre-trained KBQA model:
  • r k is the knowledge information obtained by transfer learning, which is the output result of sending the context attention vector to the MLP network described in the pre-trained KBQA
  • e k is the entity embedding representation in the knowledge base
  • is the vocabulary size of the knowledge base.
  • the hidden layer state of the decoder is represented by st and the attention vector is enhanced Send it to the softmax layer to generate the predicted word distribution to generate the final dialogue response:
  • W 0 , W p and b 0 are the parameters to be learned.
  • dialog generation method can be applied to multiple scenarios of Artificial Intelligence (AI), for example, applied to chat robots, intelligent customer service assistants, automatic news reviews, and so on.
  • AI Artificial Intelligence
  • the scenario includes a server 10 and a terminal 20.
  • the server 10 is a shopping platform server.
  • the server 10 has a built-in dialog generation model.
  • the server 10 A reply corresponding to the question asked by the user can be generated based on the dialogue generation model, and the reply can be sent to the terminal 20, thereby realizing intelligent customer service.
  • the user enters a question 22 through the customer service interface 21 provided by the terminal 20, that is, "Is the number of pants correct?"
  • the terminal 20 receives the question entered by the user and determines the question as And send the question to be answered to the server 10 to request a corresponding reply.
  • the server 10 receives the question to be answered sent by the terminal 20, inputs the sentence into the dialogue generation model, and encodes the sentence to be answered by the encoder in the dialogue generation model to obtain the coded representation of the question to be answered.
  • the encoding representation is specifically a synthesis of the first encoding representation obtained by the encoder encoding of the dialogue generation model itself, the second encoding representation obtained from the transfer learning from the knowledge base question and answer model, and the third encoding representation determined based on the response guidance attention mechanism.
  • the encoding means that the server 10 also inputs the context attention vector of the question sentence into the MLP network in the knowledge base question answering model, obtains the enhanced attention vector of the question sentence through the MLP network, and transfers it As the knowledge information transferred and learned from the knowledge base question answering model for the question sentence.
  • the server 10 fuses the comprehensive coding representation of the question to be answered and the knowledge information learned from the knowledge base question answering model through the decoder in the dialogue generation model, and then sends the hidden layer state representation and the enhanced attention vector of the decoder Enter the softmax layer to generate the predicted word distribution to generate the final dialogue reply, that is, the predicted reply 23.
  • the server 10 sends the predicted reply 23 to the terminal 20, and the terminal 20 displays the predicted reply 23 for the user to view.
  • the device 800 includes:
  • the obtaining module 810 is configured to obtain a dialogue data set, and the dialogue data in the dialogue data set includes a question sentence and annotated reply corresponding to the question sentence;
  • the training module 820 is configured to obtain the coded representation of the question through the encoder in the constructed dialogue generation model based on the question sentence in the dialogue data set, and fuse the said question sentence through the decoder in the dialogue generation model.
  • the coded representation of the question sentence and the knowledge information transferred and learned from the knowledge base question and answer model for the question sentence, the predicted response corresponding to the question sentence output by the dialogue generation model is obtained, based on the predicted response and the corresponding question sentence
  • the label response determines the loss function, and the dialog generation model parameters are adjusted through the loss function until the loss function of the dialog generation model is in convergence.
  • FIG. 9 is a schematic structural diagram of the dialog generation model training apparatus provided by an embodiment of the present application. Based on the structure shown in FIG. 8, the apparatus 800 further includes:
  • the first migration module 830 is configured to obtain the context attention vector of the question sentence, input the context attention vector of the question sentence into the multi-layer perceptron network in the knowledge base question answering model, and pass the multi-layer The perceptron network obtains the enhanced attention vector of the question sentence, and uses the enhanced attention vector of the question sentence as the knowledge information transferred and learned from the knowledge base question answering model for the question sentence.
  • FIG. 10 is a schematic structural diagram of a dialog generation model training device provided by an embodiment of this application. Based on the structure shown in FIG. 8, the device 800 further includes:
  • the second migration module 840 is configured to input the question sentence into the knowledge base question answering model, and obtain the coded representation output by the encoder in the knowledge base question answering model as the second coded representation of the question sentence;
  • the determining module 850 is configured to determine a reply corresponding to a similar question of the question as a similar candidate reply, and determine mutual attention based on the word embedding representation of the similar candidate reply and the first encoding representation of the question, as The third coded representation of the interrogative sentence;
  • the training module 820 is also configured as:
  • the integrated coding representation of the question sentence and the knowledge information transferred and learned from the knowledge base question answering model for the question sentence are merged by the decoder in the dialogue generation model.
  • FIG. 11 is a schematic structural diagram of the dialog generation model training apparatus provided by an embodiment of the present application. Based on the structure shown in FIG. 8, the apparatus 800 further includes:
  • the knowledge base question answering model building module 860 is configured to construct an end-to-end structured neural network model, train the neural network model based on a general data set and a common sense knowledge base, and adjust the neural network model parameters through the hinge loss function during the training process Until the loss function of the neural network model is converging, the neural network model in the convergent state is used as the knowledge base question answering model.
  • FIG. 11 may also include the above-mentioned knowledge base question answering model building module based on FIG. 9 or FIG. 10.
  • the training module 820 when the training module 820 obtains the coded representation of the question sentence through the encoder in the constructed dialogue generation model, it is further configured to:
  • the constructed dialogue generation model determines the word embedding representation of the question sentence based on the word embedding model.
  • the hidden layer state representation is obtained through two-way long and short-term memory network coding, and the hidden layer state representation is used as the question.
  • the coded representation of the sentence is used as the question.
  • the apparatus 1200 includes:
  • the receiving module 1210 is configured to receive the question to be answered sent by the terminal;
  • the generating module 1220 is configured to obtain the coded representation of the question through the encoder in the pre-trained dialogue generation model, and to fuse the coded representation of the question with the coded representation of the question through the decoder in the dialogue generation model. Transfer the learned knowledge information from the knowledge base question answering model, and obtain the predicted response corresponding to the question sentence output by the dialogue generation model;
  • the sending module 1230 is configured to send the predicted reply to the terminal.
  • FIG. 13 is a schematic structural diagram of a dialog generating apparatus provided in an embodiment of this application. Based on the structure shown in FIG. 12, the apparatus 1200 further includes:
  • the first migration module 1240 is configured to obtain the context attention vector of the question sentence, input the context attention vector of the question sentence into the multi-layer perceptron network in the knowledge base question answering model, and pass the multi-layer The perceptron network obtains the enhanced attention vector of the question sentence, and uses the enhanced attention vector of the question sentence as the knowledge information transferred and learned from the knowledge base question answering model for the question sentence.
  • the first migration module 1240 is further configured to obtain the enhanced attention vector of the question through the multilayer perceptron network:
  • the enhanced attention vector of the question sentence is determined.
  • the first migration module 1240 is further configured to: when obtaining the predicted response corresponding to the question output by the dialogue generation model:
  • the predicted reply corresponding to the question sentence is generated according to the predicted word distribution output by the classification layer.
  • the first migration module 1240 when the first migration module 1240 obtains the hidden layer state representation of the decoder in the dialog generation model, it is further configured to:
  • the input of the decoder in the generation model is used to obtain the hidden layer state representation of the decoder in the dialog generation model at the current time step.
  • FIG. 14 is a schematic structural diagram of a dialog generating apparatus provided in an embodiment of this application. Based on the structure shown in FIG. 12, the apparatus 1200 further includes:
  • the second migration module 1250 is configured to input the question sentence into the knowledge base question answering model, and obtain the coding representation output by the encoder in the knowledge base question answering model as the second coding representation of the question sentence;
  • the determining module 1260 is configured to determine a reply corresponding to a similar question of the question as a similar candidate reply, and determine mutual attention based on the word embedding representation of the similar candidate reply and the first encoding representation of the question, as The third coded representation of the question sentence;
  • the generating module 1220 is also configured to:
  • the integrated coding representation of the question sentence and the knowledge information transferred and learned from the knowledge base question answering model for the question sentence are merged by the decoder in the dialogue generation model.
  • the embodiment of this application also provides a device for dialogue generation model training and a device for dialogue generation.
  • a device for dialogue generation model training and a device for dialogue generation.
  • the following is a description of the above-mentioned methods provided in the embodiments of this application from the perspective of hardware materialization. The equipment is introduced.
  • FIG. 15 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • the device may be a server.
  • the server 1500 may have relatively large differences due to different configurations or performance, and may include one or more central processing units (central processing units). units, CPU) 1522 (for example, one or more processors) and memory 1532, and one or more storage media 1530 (for example, one or more storage devices with a large amount of data) storing application programs 1542 or data 1544.
  • the memory 1532 and the storage medium 1530 may be short-term storage or permanent storage.
  • the program stored in the storage medium 1530 may include one or more modules (not shown in the figure), and each module may include a series of command operations on the server.
  • the central processing unit 1522 may be configured to communicate with the storage medium 1530, and execute a series of instruction operations in the storage medium 1530 on the server 1500.
  • the server 1500 may also include one or more power supplies 1526, one or more wired or wireless network interfaces 1550, one or more input and output interfaces 1558, and/or one or more operating systems 1541, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • operating systems 1541 such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • the steps performed by the server in the above embodiment may be based on the server structure shown in FIG. 15.
  • the CPU 1522 is configured to perform the following steps:
  • the dialogue data in the dialogue data set including a question sentence and annotated replies corresponding to the question sentence;
  • the coded representation of the question sentence is obtained by the encoder in the constructed dialogue generation model, and the coded representation of the question sentence is combined with the decoder in the dialogue generation model.
  • the knowledge information transferred and learned from the question answering model of the knowledge base for the question sentence obtain the predicted reply corresponding to the question sentence output by the dialogue generation model;
  • the loss function is determined based on the predicted response and the label response corresponding to the question sentence, and the dialog generation model parameters are adjusted through the loss function until the loss function of the dialog generation model is in convergence.
  • the CPU 1522 is further configured to execute the dialog generation model training method provided by the present application.
  • This application also provides another device, which is used to generate a dialog, and has the same structure as that of FIG. 15.
  • the CPU 1522 is configured to perform the following steps:
  • the coded representation of the question sentence is obtained through the encoder in the pre-trained dialogue generation model, and the coded representation of the question sentence is merged with the question answering model from the knowledge base by the decoder in the dialogue generation model Transfer learning knowledge information to obtain the predicted response corresponding to the question output by the dialogue generation model;
  • the CPU 1522 is further configured to execute the steps of any implementation manner of the dialog generation method provided in the present application.
  • the embodiments of the present application also provide a computer-readable storage medium storing a computer program, and the computer program is used to execute any one of the dialog generation model training method or the dialog generation method described in the foregoing embodiments.
  • the embodiments of the present application also provide a computer program product including instructions, which when run on a computer, cause the computer to execute any one of the dialog generation model training method or the dialog generation method described in the foregoing embodiments.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (English full name: Read-Only Memory, English abbreviation: ROM), random access memory (English full name: Random Access Memory, English abbreviation: RAM), magnetic Various media that can store program codes, such as discs or optical discs.
  • the model when training the model, firstly obtain each dialog data in the dialog data set as a training sample, including the question sentence and the labeled reply corresponding to the question sentence, and then based on the said training sample Question, the coded representation of the question is obtained by the encoder in the dialogue generation model, and then the coded representation of the question is merged with the knowledge base question answering model for the question by the decoder in the dialogue generation model Because the knowledge information in the knowledge base question and answer model has high accuracy, the prediction response corresponding to the question output by the dialogue generation model fused with the knowledge information has high accuracy.
  • the loss function determined by the predicted response and the labeled response adjusts the dialog generation model parameters to implement model training, which not only improves the training efficiency of the model, but also improves the accuracy of the model.
  • the dialogue generation model trained based on the above-mentioned model training method.
  • the dialogue generation model transfers the knowledge information in the knowledge base question answering model to the open domain dialogue generation task, by using the high accuracy of the knowledge base question answering model , So that the model can better integrate knowledge information, thereby improving the accuracy and rationality of dialogue generation, making it easier for users to obtain high-quality dialogue information, and reducing the impact of general responses on users.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

一种对话生成模型训练方法,包括:获取对话数据集(201),通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示(202);通过所述对话生成模型中的解码器,融合所述问句的编码表示和从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复(203);基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值(204);基于所述损失函数的值更新所述对话生成模型的模型参数(205)。

Description

模型训练方法、对话生成方法、装置、设备及存储介质
相关申请的交叉引用
本申请基于申请号为201910470526.9、申请日为2019年05月31日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请涉及机器学习技术领域,尤其涉及一种对话生成模型训练方法、对话生成方法、装置、设备及计算机存储介质。
背景技术
开放域对话生成任务是指在开放领域内机器根据对话的问句生成对应的回复,因其强大的功能和广泛的应用场景,近来受到越来越多的关注和研究。
由于开放域对话生成任务通常依赖对话生成模型来实现,而为了使得对话生成模型能够生成具有更多信息量且更合理的回复,可以在开放域对话生成任务中融合其他信息能够使得生成的回复更加合理且更加富有信息量。
但是,由于未考虑所增加信息的准确性以及合理性,这种融合效果并不好,还不能满足实际应用需求。
发明内容
本申请提供了一种对话生成模型训练方法,其通过迁移学习知识库问答模型中的知识信息训练对话生成模型,利用知识库问答模型的高精准性, 更好地融合知识信息,从而提高对话生成准确性。本申请还提供了对话生成方法以及对应的装置、设备、计算机存储介质及计算机程序产品。
有鉴于此,本申请实施例提供了一种对话生成模型训练方法,所述方法包括:
获取对话数据集,所述对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复;
通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示;
通过所述对话生成模型中的解码器,融合所述问句的编码表示和从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复;
基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值;
基于所述损失函数的值更新所述对话生成模型的模型参数。
本申请实施例提供一种对话生成模型训练方法,所述方法包括:
接收终端发送的待回答的问句;
通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
向所述终端发送所述预测回复,其中,所述预训练的对话生成模型通过从知识库问答模型中迁移学习的知识信息进行训练,以实现通过所述对话生成模型生成与问题语句相匹配的回复语句。
本申请实施例还提供了一种对话生成模型训练方法,所述方法由服务器执行,所述服务器包括有一个或多个处理器以及存储器,以及一个 或一个以上的程序,其中,所述一个或一个以上的程序存储于存储器中,所述程序可以包括一个或一个以上的每一个对应于一组指令的单元,所述一个或多个处理器被配置为执行指令;所述方法包括:
获取对话数据集,所述对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复;
通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示;
通过所述对话生成模型中的解码器,融合所述问句的编码表示和从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复;
基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值;
基于所述损失函数的值更新所述对话生成模型的模型参数。
本申请实施例还提供了一种对话生成方法,所述方法由服务器执行,所述服务器包括有一个或多个处理器以及存储器,以及一个或一个以上的程序,其中,所述一个或一个以上的程序存储于存储器中,所述程序可以包括一个或一个以上的每一个对应于一组指令的单元,所述一个或多个处理器被配置为执行指令;所述方法包括:
接收终端发送的待回答的问句;
通过预训练的对话生成模型中的编码器获得所述问句的编码表示;
通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
向所述终端发送所述预测回复,其中,所述预训练的对话生成模型通过从知识库问答模型中迁移学习的知识信息进行训练,以实现通过所 述对话生成模型生成与问题语句相匹配的回复语句。
本申请实施例提供一种对话生成模型训练装置,所述装置包括:
获取模块,配置为获取对话数据集,所述对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复;
训练模块,配置为通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示;
所述训练模块,配置为通过所述对话生成模型中的解码器,融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复;
所述训练模块,配置为基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值;
所述训练模块,配置为基于所述损失函数的值更新所述对话生成模型的模型参数。
本申请实施例提供一种对话生成装置,所述装置包括:
接收模块,配置为接收终端发送的待回答的问句;
生成模块,配置为通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
发送模块,配置为向所述终端发送所述预测回复,其中,所述预训练的对话生成模型通过从知识库问答模型中迁移学习的知识信息进行训练,以实现通过所述对话生成模型生成与问题语句相匹配的回复语句。
本申请实施例还提供一种设备,所述设备包括处理器以及存储器:
所述存储器配置为存储计算机程序;
所述处理器配置为运行所述计算机程序时,执行本申请实施例所提供 的对话生成模型训练方法或本申请实施例所提供的对话生成方法。
本申请实施例提供一种计算机可读存储介质,所述计算机存储介质存储有程序代码,所述程序代码用于执行上述本申请实施例所提供的对话生成模型训练方法,或者,本申请实施例所提供的对话生成方法。
本申请实施例提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得所述计算机执行本申请实施例所述的对话生成模型训练方法或本申请实施例所述的对话生成方法。
应用本申请实施例提供的对话生成模型训练方法、对话生成方法、装置、设备及计算机存储介质,至少具有以下有益技术效果:
1)本申请实施例通过在训练模型时,首先获取对话数据集对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复,然后基于所述训练样本中的所述问句,通过对话生成模型中的编码器获得所述问句的编码表示,接着通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,由于知识库问答模型中的知识信息具有较高的精准性,因此,对话生成模型融合该知识信息输出的所述问句对应的预测回复具有较高的精准性,基于该预测回复和标注回复确定的损失函数调整对话生成模型参数以实现模型训练,不仅提高了模型的训练效率,还能够提高了模型的精准度。
2)基于上述模型训练方法训练得到的对话生成模型,本申请实施例还提供了一种对话生成方法,该对话生成模型将知识库问答模型中的知识信息迁移到开放域对话生成任务中,通过利用知识库问答模型的高精准性,使得模型能够更好地融合知识信息,从而提高对话生成准确性和合理性使得用户更加便捷地获取高质量的对话信息,减少通用回复影响用户的使用。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对 实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例中对话生成模型训练方法的场景架构图;
图2为本申请实施例中对话生成模型训练方法的流程图;
图3为本申请实施例中对话生成方法的场景架构图;
图4为本申请实施例中对话生成方法的流程图;
图5为本申请实施例中对话生成模型的结构示意图;
图6为本申请实施例中对话生成方法的流程图;
图7为本申请实施例中对话生成方法的应用场景示意图;
图8为本申请实施例中对话生成模型训练装置的结构示意图;
图9为本申请实施例中对话生成模型训练装置的结构示意图;
图10为本申请实施例中对话生成模型训练装置的结构示意图;
图11为本申请实施例中对话生成模型训练装置的结构示意图;
图12为本申请实施例中对话生成装置的结构示意图;
图13为本申请实施例中对话生成装置的结构示意图;
图14为本申请实施例中对话生成装置的结构示意图;
图15为本申请实施例中设备的一个结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
针对将问句中实体关联到外部知识以将外部知识融合到回复中,存在的融合效果不好、不能满足实际应用需求的问题,本申请提供了一种对话生成模型训练方法,该方法在训练对话生成模型时,从知识库问答模型(Knowledge Base Question Answering,KBQA)中迁移针对问句的知识信息,由于知识库问答模型具有较好的精准性,因此,在融合所述问句的编码表示和针对所述问句的知识信息时具有较好的融合效果,该对话生成模型基于融合信息能够输出针对所述问句的预测回复,基于该预测回复和对话数据集中对话数据携带的标注回复可以确定损失函数,基于该损失函数调整对话生成模型参数实现模型训练,提高了训练效率和精准度,使得模型能够满足实际应用需求。
可以理解,本申请提供的对话生成模型训练方法可以应用于任意具有数据处理能力的处理设备,该处理设备可以是终端,也可以是服务器。其中,终端可以是桌面终端,也可以是智能手机、平板电脑等便携式移动终端,还可以是车载终端,或者增强现实(Augmented Reality,AR)终端、虚拟现实(Virtual Reality,VR)终端,本申请对此不作限定。
其中,处理设备可以独立存在,也可以是以集群的形式存在。在实际应用时,上述对话生成模型训练方法可以以计算机程序的形式存储于处理设备中,处理设备通过执行应用程序实现本申请的对话生成模型训练方法。需要说明的是,计算机程序可以是独立的应用程序,也可以是集成于其他程序上的功能模块、插件、小程序等等。
为了使得本申请的技术方案更加清楚、易于理解,下面将以处理设备 为服务器作为示例,结合具体场景对本申请提供的对话生成模型训练方法进行介绍。
参见图1所示的对话生成模型训练方法的场景架构图,该场景中包括服务器10和样本库20,其中,样本库20中存储有对话数据集,服务器10从样本库20中获取对话数据集进行模型训练。
在本申请的一些实施例中,对话数据集中的对话数据包括文件和所述问句对应的标注回复,服务器10基于所述对话数据集中的所述问句,通过构建的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;然后基于所述问句对应的预测回复和标注回复确定损失函数,通过损失函数调整所述对话生成模型参数直到所述对话生成模型的损失函数处于收敛。
接下来,将从服务器的角度对本申请实施例提供的对话生成模型训练方法的各个步骤进行详细说明。
参见图2所示的对话生成模型训练方法的流程图,该方法包括:
S201:获取对话数据集。
所述对话数据集中的对话数据包括问句和所述问句对应的标注回复。该对话数据集中每一组对话数据作为一个训练样本,用于训练对话生成模型。在实际应用时,对话数据集可以是已有的数据集,如reddit单轮对话数据集,也可以是服务器从网络中爬取问句,并对所述问句标注对应的回复而生成的。
S202:通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示。
基于所述对话数据集中的所述问句,通过构建的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复。
可以理解,对话生成模型是一种基于编码器-解码器结构的网络模型,该对话生成模型以问句为输入,以针对该问句的回复为输出。服务器通过 编码器对输入模型的问句进行编码获得所述问句的编码表示,解码器将所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息进行融合,并对融合后的信息解码以便生成所述问句对应的预测回复。
本申请实施例中,服务器可以通过构建的对话生成模型基于词嵌入模型确定所述问句的词嵌入表示,然后根据所述词嵌入表示通过双向长短期记忆网络(Bidirectional Long Short-Term Memory,BiLSTM)编码得到隐藏层状态表示,将所述隐藏层状态表示作为所述问句的编码表示。
考虑到对话生成模型是一种序列到序列(Sequence-to-Sequence,Seq2Seq)框架的模型,输入该对话生成模型的问句可以通过单词序列的形式呈现,如问句X={x 1,x 2,…x Tx},该对话生成模型输出的答复也可以通过单词序列的形式呈现,如答复Y={y 1,y 2,…y Ty},如此,训练对话生成模型实质上是对条件概率P(Y|X)进行建模。
本申请实施例中,服务器在建模P(Y|X)时是结合知识库问答模型实现的。其中,知识库问答模型是一种基于知识库的问答模型。知识库也称作知识图谱,是一种以知识为主要单位,以实体为主要载体,包含着对万千事物的认知与各类事实的庞大数据库。知识库中的知识一般以三元组形式呈现,该三元组具体表现为<头实体,关系,尾实体>,其中,实体是指人、地点或者特定概念等,关系是指头实体和尾实体的逻辑关系。作为一个示例,中国的首都是北京,可以通过如下三元组表征:<中国,首都,北京>。
在实际应用时,服务器从知识库问答模型中迁移学习针对所述问句的知识信息。在本申请的一些实施例中,服务器获取所述问句的上下文注意力向量,将所述问句的上下文注意力向量输入所述知识库问答模型中的多层感知机(Multi-Layer Perception)网络中;通过所述MLP获得所述问句的增强注意力向量,将所述问句的增强注意力向量作为针对所述问句从知识库问答模型中迁移学习的知识信息。
如此,服务器通过对话生成模型中的解码器融合所述问句的编码表示和所述增强注意力向量,针对融合后的向量可以通过对话生成模型中的分类器如softmax进行单词概率分布预测,从而获得所述对话生成模型输出的所述问句对应的预测回复。
S203:通过所述对话生成模型中的解码器,融合所述问句的编码表示和从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复。
S204:基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值。
S205:基于所述损失函数的值更新所述对话生成模型的模型参数。
在本实施例中,损失函数用于表征预测回复和标注回复的不一致程度。可以理解,损失函数具有多种类型,在实际应用时可以根据需求选择相应类型的损失函数。作为一个示例,服务器可以采用交叉熵损失函数进行模型训练。换言之,服务器可以将预测回复的单词分布与标注回复的单词分布的交叉熵作为对话生成模型的损失函数,具体如下:
Figure PCTCN2020092701-appb-000001
其中,L为损失函数,θ代表模型所有参数集合,D代表包含<问句(post),回复(response)>序列对的训练集,T y代表生成回复的长度,x、y、t分别代表问句(post)、回复(response)以及解码时间步。
本申请实施例中,服务器根据问句对应的预测回复和标注回复确定损失函数,然后基于该损失函数调整对话生成模型参数,直至对话生成模型的损失函数处于收敛状态,如此,即实现了对话生成模型的训练。
由上可知,本申请实施例提供了一种对话生成模型的训练方法,该方法在训练对话生成模型时,从知识库问答模型中迁移针对问句的知识信息,由于知识库问答模型具有较好的精准性,因此,在融合所述问句的编码表示和针对所述问句的知识信息时具有较好的融合效果,该对话生成模型基于融合信息能够输出针对所述问句的预测回复,基于该预测回复和对话数据集中对话数据携带的标注回复可以确定损失函数,基于该损失函数调整对话生成模型参数实现模型训练,提高了训练效率和精准度,使得模型能够满足实际应用需求。
可以理解,服务器除了可以利用迁移学习从知识库问答模型迁移知识信息,还可以利用迁移学习从知识库问答模型迁移针对问句的句子建模表示,将其与编码器对问句编码所得编码表示结合,如此可以提高编码表示 的精准度,从而提高对话生成模型回复生成的准确性和合理性。
在本申请的一些实施例中,服务器将通过对话生成模型中的编码器获得所述问句的编码表示,作为所述问句的第一编码表示,服务器还将问句输入至知识库问答模型,获取所述知识库问答模型中编码器输出的编码表示,作为所述问句的第二编码表示,然后将所述问句的第一编码表示和所述问句的第二编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示,在解码过程中,服务器通过对话生成模型中的解码器融合所述问句的综合编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息进行解码。
在一些可能的实现方式中,服务器还可以引入回复引导注意力机制生成问句的编码表示。其中,回复引导注意力机制是指检索出与问句对应的相似问句,将所述相似问句对应的回复作为问句的相似候选回复,基于相似候选回复的词嵌入表示和第一编码表示确定互注意力,作为问句的第三编码表示。如此,服务器可以将所述问句的第一编码表示和所述问句的第三编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示,通过所述对话生成模型中的解码器融合所述问句的综合编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息进行解码。
在实际应用时,服务器还可以将所述问句的第一编码表示、所述问句的第二编码表示以及所述问句的第三编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示,接着通过所述对话生成模型中的解码器融合所述问句的综合编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息。
可以理解,图2所示实施例中知识库问答模型可以是预先构建的。本申请还提供了一种构建知识库问答模型的实现方式。在本申请的一些实施例中,服务器构建端到端结构的神经网络模型,然后基于通用数据集和常识知识库训练所述神经网络模型,其中,通用数据集可以是Simple Questions,常识知识库可以是freebase-FB2M,在训练过程中通过铰链损失函数Hinge loss调整所述神经网络模型参数,直到所述神经网络模型的损失函数处于收敛,将处于收敛状态的神经网络模型作为所述知识库问答模型。
在一个示例中,Hinge loss本申请实施例中为:
loss=max{0,λ-S(q,G +)+S(q,G -)}             (2)
其中,q表征问句,G代表候选知识答案集,G +代表正例集合,G -代表负例集合,S代表q与G中正例集合或负例集合的关联度,λ为超参数。
以上为本申请实施例提供对话生成模型训练方法的具体实现方式,基于上述实现方式训练得到的对话生成模型,本申请还提供了一种对话生成方法,下面结合具体实施例进行说明。
可以理解,本申请提供的对话生成方法可以应用于服务器,对话生成方法以计算机程序的形式存储于服务器中,服务器通过执行该计算机程序实现本申请的对话生成方法。
为了方便理解,本申请还将结合具体场景对该对话生成方法进行说明。
参见图3所示的对话生成方法的场景架构图,该场景中包括服务器10和终端20,其中,服务器10接收终端发送的待回答的问句,通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;接着,服务器10向所述终端20发送所述预测回复,指示所述终端20显示预测回复,从而实现与用户的智能交互。
接下来,从服务器的角度对本申请实施例提供的对话生成方法的各个步骤进行详细说明。
参见图4所示的对话生成方法的流程图,该方法包括:
S401:接收终端发送的待回答的问句。
本申请实施例中,终端的显示界面承载有输入控件和/或选择控件,用户可以通过输入控件输入问句,或者通过选择控件选择问句,终端响应于用户的输入操作或者选择操作,向服务器发送问句,该问句即为待回答的问句。
其中,用户在输入问句或者选择问句时,可以输入或选择一个问句,也可以输入或选择多个问句,问句的数量并不影响本申请的具体实现。
S402:通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所 述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复。
S403:向所述终端发送所述预测回复。
其中,所述预训练的对话生成模型通过从知识库问答模型中迁移学习的知识信息进行训练,以实现通过所述对话生成模型生成与问题语句相匹配的回复语句。
在本申请的一些实施例中,服务器内置对话生成模型,服务器利用对话生成模型的编码器对问句进行编码,获得所述问句的编码表示,接着利用对话生成模型的解码器融合所述问句的编码表示和所述针对所述问句从知识库问答模型中迁移学习的知识信息,通过利用对话生成模型的分类器对解码后信息分类,从而获得所述对话生成模型输出的所述问句对应的预测回复。
针对编码过程,本申请提供了多种实现方式获得所述问句的编码表示,下面分别进行说明。
第一种实现方式为,利用对话生成模型的编码器编码生成第一编码表示,将该第一编码表示作为所述问句的编码表示。本申请实施例中,服务器可以通过构建的对话生成模型基于词嵌入模型确定所述问句的词嵌入表示,根据所述词嵌入表示通过BiLSTM编码得到隐藏层状态表示,将所述隐藏层状态表示作为所述问句的第一编码表示,如此即得到所述问句的编码表示。
第二种实现方式为,服务器将所述问句输入所述知识库问答模型,获取所述知识库问答模型中编码器输出的编码表示,作为所述问句的第二编码表示,该第二编码表示即为从KBQA中迁移学习得到针对问句的句子建模表示,将所述问句的第一编码表示和所述问句的第二编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
第三种实现方式为,服务器确定所述问句的相似问句对应的回复作为相似候选回复,根据所述相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示,然后将所述问句的第一编码表示和所述问句的第三编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
第四种实现方式为,将所述问句的第一编码表示、第二编码表示和所述问句的第三编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
针对解码过程,服务器引入从知识库问答模型迁移学习得到的针对所述问句的知识信息进行融合,具有较好的融合效果。在本申请的一些实施例中,服务器获取所述问句的上下文注意力向量,将所述问句的上下文注意力向量输入所述知识库问答模型中的MLP网络中,通过所述MLP网络获得所述问句的增强注意力向量,将所述问句的增强注意力向量作为针对所述问句从知识库问答模型中迁移学习的知识信息。如此,服务器通过对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,以获得所述对话生成模型输出的所述问句对应的预测回复。
在基于MLP网络获得所述问句的增强注意力向量时,本申请实施例中通过如下方式实现:获取所述MLP网络基于所述问句的上下文注意力向量和从知识库词表中各词分别迁移得到的知识信息,根据所述上下文注意力向量和所述知识库词表中各词的实体嵌入表示,确定问句的增强注意力向量。
在实际应用时,服务器获得对话生成模型中解码器的隐藏层状态表示,然后将所述对话生成模型中解码器的隐藏层状态表示和上述增强注意力向量输入所述对话生成模型中分类层如softmax层,根据所述分类层输出的预测单词分布生成所述问句对应的预测回复。
其中,获得对话生成模型中解码器的隐藏层状态表示本申请实施例中通过如下方式实现:将所述对话生成模型中编码器针对所述问句中最后一个词的隐藏状态表示,作为所述对话生成模型中解码器的初始状态并将预设符号作为初始符号(start of sentence,SOS),根据所述对话生成模型中解码器的上一时间步状态和上一时间步生成的符号对应的词嵌入表示以及所述对话生成模型中编码器的当前时间步生成的注意力向量作为所述对话生成模型中解码器的输入,获得所述对话生成模型中解码器在当前时间步的隐藏层状态表示。
需要说明的是,解码第一时间步时,由于没有上一时间步的状态,此 时可以采用初始状态作为上一时间步的状态,解码第一时间步时也没有第一时间步的生成词,此时可以将SOS作为上一时间步的生成词。
需要说明的是,解码器融合的所述问句的编码表示是上述编码过程中获得的编码表示。也即,采用第一种实现方式编码时,则解码器融合的是第一编码表示,采用第二种实现方式、第三种实现方式或第四种实现方式时,则解码器融合的是拼接得到的综合编码表示。
由上可知,本申请实施例提供了一种对话生成方法,该方法是基于对话生成模型实现的,该对话生成模型将知识库问答模型中的知识信息迁移到开放域对话生成任务中,通过利用知识库问答模型的高精准性,使得模型能够更好地融合知识信息,从而提高对话生成准确性和合理性。
为了使得本申请的技术方案更加清楚、易于理解,本申请还提供了对话生成方法更为具体的实施例,下面将结合对话生成模型的结构进行说明。
参见图5所示的对话生成模型的结构示意图,以及图6所示的对话生成方法流程图,如图5所示,对话生成模型主要由两大模块组成:知识库问答(KBQA)模块和对话生成模块。
在KBQA模块中,服务器先确定问题Q和候选知识答案K的嵌入表示,针对问题Q,采用BiLSTM对其嵌入表示进行编码,再进行拼接,得到问题Q的编码表示,针对候选知识答案K,通过其编码层编码得到候选知识答案的编码表示,基于问题Q和候选知识答案K的编码表示计算语义相似度,MLP能够基于语义相似度匹配结果筛选最佳候选答案,作为针对所述问题Q的答案A。
在对话生成模块中,确定问句的嵌入表示,然后利用BiLSTM对其嵌入表示进行编码,再进行拼接,得到问句的第一编码表示,此外,从KBQA中迁移学习得到问句建模表示,即问句的第二编码表示,以及基于问句P确定上下文注意力向量,基于上下文注意力向量和回复引导注意力机制确定问句的第三编码表示,将上述第一编码表示、第二编码表示和第三编码表示拼接得到综合编码表示,对话生成模块中的解码器融合该综合编码表示和基于该对话生成模块的从KBQA的MLP中迁移学习得到的针对问句的知识信息,生成回复Y。
对话生成模型的训练过程包括两部分,首先预训练KBQA,如图6中S601和S602所示,然后基于预训练的KBQA训练对话生成模型,如图6中S603和S604所示,该方法包括:
S601:针对通用数据集,服务器分别对问题和该问题对应的候选知识答案进行编码,得到所述问题的编码表示和所述候选知识答案的编码表示。
在本申请的一些实施例中,通用数据集如Simple Questions中包括多组问答数据,每组问答数据包括问题Q和该问题Q对应的候选知识答案集G,其中,问题Q对应的候选知识答案集可以分为正例集合G +和负例集合G -,正例集合是指元素为正确答案的集合,负例集合是指元素为错误答案的集合,在训练KBQA时,针对每一个问题Q,正例集合为正确标注答案,负例集合为在常识知识库freebase-FB2M中随机采样20个错误答案。候选知识答案集G中至少包括一条正例,服务器分别对问题和候选知识答案进行编码以用于模型训练。
在对问题进行编码时,服务器针对问题Q,分别从词级别和依存级别进行编码,接着将词级别和依存级别得到的两种表示进行叠加,得到问题Q的编码表示。
其中,词级别编码具体是对问题Q利用预训练的通用词向量(Global Vectors for Word Representation,GloVe)转换得到词嵌入表示,然后使用BiLSTM对词嵌入表示进行编码,再将通过BiLSTM编码得到的表示拼接,从而得到问题Q的词级别表示,具体计算过程参见如下公式:
Figure PCTCN2020092701-appb-000002
Figure PCTCN2020092701-appb-000003
其中,
Figure PCTCN2020092701-appb-000004
为问题Q中第i个词的词嵌入表示,
Figure PCTCN2020092701-appb-000005
为词级别上问题Q经过反向LSTM得到的编码表示,
Figure PCTCN2020092701-appb-000006
为词级别上问题Q经过正向LSTM得到的编码表示。
在本实施例中,为了更好地表征问题Q中的依存关系,先将问题Q中所有实体替换为<E>后得到问题Q’,针对问题Q’中的依存关系用带方向的依存标签进行替换,得到替换后的问题Q”,例如,将{what is the best movie in the<E>}替换成
Figure PCTCN2020092701-appb-000007
接着利用GloVe转换得到词嵌入表示,然后使用BiLSTM对词嵌入表示进行编码,再将通过BiLSTM编码得到的表示拼接,从而得到问题Q的依存级别表示,具体 参见如下公式:
Figure PCTCN2020092701-appb-000008
Figure PCTCN2020092701-appb-000009
其中,
Figure PCTCN2020092701-appb-000010
为依存级别上问题Q经过反向LSTM得到的编码表示,
Figure PCTCN2020092701-appb-000011
为依存级别上问题Q经过正向LSTM得到的编码表示。
将上述公式(4)和公式(6)叠加,可以得到问题Q的编码表示如下:
q=q (tok)+q (dep)             (7)
针对候选知识答案的编码,该候选知识答案可以通过三元组表征,考虑到知识三元组的编码表示,服务器可以从词级别和知识级别对候选知识答案进行编码,然后将将词级别和依存级别得到的两种表示进行叠加,得到候选知识答案的编码表示。
针对词级别编码,将知识三元组视为单个词的组合,给定单词序列
Figure PCTCN2020092701-appb-000012
使用预训练的GloVe将每个单词转换为对应的词嵌入表示,该词嵌入表示通过向量进行表征,然后对n个单词的向量取平均值,作为该知识三元组在词级别的嵌入表示p (w),也即候选知识答案的嵌入表示。
针对知识级别编码,将知识三元组视为一个整体,给定知识三元组,通过神经网络自动学习到的知识嵌入表示方法得到知识级别的嵌入表示p (id)
如此,将词级别和知识级别的嵌入表示进行叠加,得到候选知识答案的编码表示如下:
p=p (w)+p (id)             (8)
S602:通过问题和候选知识答案的编码表示,计算出二者间的语义匹配相似度,根据所述语义匹配相似度确定最佳答案,基于该最佳答案可以确定损失函数,基于损失函数调整神经网络模型参数,直至所述神经网络模型的损失函数处于收敛。
给定候选知识答案集的向量表示G={p (1),…,p (N)},为了计算问题和候选知识答案间的语义匹配相似度,服务器采用S-MART作为实体链接工具,以得到每个问题Q关于候选知识答案集中所有实体的链接分数S ent,将实体链接的结果即S ent、问题以及候选知识答案的表示作为特征输入到一个 MLP网络中,MLP网络输出问题Q与候选知识答案集G中每一个候选知识答案的关联度,该关联度S(q (i),p (i))可以作为语义匹配相似度:
S(q (i),p (i))=MLP([q (i);p i;S ent])          (9)
本申请实施例中,服务器可以基于最佳答案确定当前损失函数,如上述公式(2)所示,服务器基于该损失函数Hinge loss对神经网络模型参数进行调整,可以极大化正例集合与负例集合之间的间距,当模型的损失函数Hinge loss处于收敛时,服务器可以将收敛的神经网络模型作为KBQA模型,用于后续对话生成模型的训练。
S603:针对reddit数据集,服务器通过对话生成模型自身的编码器对问句编码获得第一编码表示,从预训练的KBQA迁移学习得到针对问句的第二编码表示,通过回复引导注意力机制得到针对问句的第三编码表示,将第一编码表示、第二编码表示和第三编码表示拼接得到综合编码表示。
在本申请的一些实施例中,reddit数据集中包括对话数据,每组对话数据包括问句以及问句对应的标注回复。假设问句的单词序列为X={x 1,x 2,…x Tx},首先基于GloVe转换得到每一个单词x t的词嵌入表示e(x t),然后利用BiLSTM编码得到其隐藏层状态表示,作为第一编码表示,具体如下:
h t=BiLSTM(e(x t),h t-1)          (10)
本申请实施例中,服务器还使用预训练的KBQA中对问题Q进行编码的BiLSTM对问句再次编码,得到迁移学习后的问句表示,即第二编码表示,如下所示:
Figure PCTCN2020092701-appb-000013
其中,
Figure PCTCN2020092701-appb-000014
表征针对问句的词级别表示,
Figure PCTCN2020092701-appb-000015
表征针对问句的依存级别表示。
此外,为了更好地辅助对话回复的生成,本申请还提出一种回复引导注意例机制,服务器采用检索工具,如Lucene,检索与问句最相似的k个问句,将其对应的k个回复作为候选回复,计算第i个候选回复的嵌入表示e(Y i)关于当前问句隐藏层状态表示的互注意力:
Figure PCTCN2020092701-appb-000016
其中,f是非线性激活函数,作为一个示例,其可以采用tanh函数。
接着,对这k个隐藏层状态表示进行加权平均,以得到回复引导注意例机制的最终隐藏层状态表示,即第三编码表示,如下所示:
Figure PCTCN2020092701-appb-000017
将上述公式(11)至(13)叠加,得到问句的综合编码表示:
Figure PCTCN2020092701-appb-000018
S604:通过对话生成模型的解码器融合问句的综合编码表示以及从KBQA模型中迁移学习得到的知识信息,得到预测回复,基于预测回复和标注回复确定损失函数,通过损失函数调整所述对话生成模型参数直到所述对话生成模型的损失函数处于收敛。
在本申请的一些实施例中,解码器选用LSTM,则解码器的隐藏层状态计算过程为:
s t=LSTM(s t-1,[c t;e(y t-1)])              (15)
其中,s t-1为解码时间步为t-1时解码器的隐藏层状态表示,e(y t-1)为第t-1个生成词的词嵌入表示。c t为解码时间步为t时的上下文注意力向量,其计算过程为:
Figure PCTCN2020092701-appb-000019
其中,e tk是第t-1时刻解码器隐藏层状态表示与编码器第k时刻隐藏层状态表示的相似度,其是关于s t-1和h k的函数,其中,V b、W b和U b是函数关系中要学习的参数,tanh是双曲函数;同理,e tj是第t-1时刻解码器隐藏层状态表示与编码器第j时刻隐藏层状态表示的相似度,j取值为1至T x(包含端点在内)的正整数,其中,T x是指问句转换为词序列时词的个数;a tk是解码器第t时刻在编码器第k时刻的注意力权重,其可以基于上述相似度计算得到。
在Seq2Seq框架中,为了从KBQA模型中迁移知识信息,服务器将上下文注意力向量送入到之前预训练的KBQA模型中的MLP网络中:
Figure PCTCN2020092701-appb-000020
其中,r k为迁移学习得到知识信息,其是将上下文注意力向量送入预训练的KBQA中所述MLP网络输出的结果,e k为知识库中的实体嵌入表示,
Figure PCTCN2020092701-appb-000021
为问句的实体链接分数,
Figure PCTCN2020092701-appb-000022
为基于KBQA模型迁移后的增强注意力向量,|V k|为知识库的词表大小。
最后,将解码器的隐藏层状态表示s t和增强注意力向量
Figure PCTCN2020092701-appb-000023
送入softmax层,以产生预测的单词分布,从而生成最终的对话回复:
Figure PCTCN2020092701-appb-000024
其中,W 0、W p和b 0为要学习的参数。
可以理解,本申请提供的对话生成方法可以应用于人工智能(Artificial Intelligence,AI)的多个场景中,例如,应用于聊天机器人、智能客服助手、新闻自动评论等等。
为了使得本申请的技术方案更加清楚、易于理解,下面结合智能客服助手的应用场景对本申请的对话生成方法进行介绍。
参见图7所示的对话生成方法的场景图,该场景中包括服务器10和终端20,服务器10为购物平台方服务器,该服务器10内置有对话生成模型,当用户通过终端20提问时,服务器10可以基于该对话生成模型生成与用户提出的问句对应的回复,并将该回复发送至终端20,从而实现智能客户服务。
在本申请的一些实施例中,用户通过终端20提供的客服界面21输入问句22,即“这条裤子码数正吗”,终端20接收到用户输入的问句,将该问句确定为待回答的问句,并向服务器10发送该待回答的问句,请求对应的回复。
服务器10接收到终端20发送的待回答的问句,将文句输入至对话生成模型,通过对话生成模型中的编码器对待回答的文句进行编码,得到该待回答问句的编码表示,其中,该编码表示具体为对话生成模型自身的编码器编码所得的第一编码表示、从知识库问答模型中迁移学习得到的第二 编码表示以及基于回复引导注意力机制确定的第三编码表示拼接生成的综合编码表示,服务器10还将该问句的上下文注意力向量,将问句的上下文注意力向量输入知识库问答模型中的MLP网络中,通过MLP网络获得该问句的增强注意力向量,将其作为针对所述问句从知识库问答模型中迁移学习的知识信息。
服务器10通过对话生成模型中的解码器融合该待回答的问句的综合编码表示和从知识库问答模型中迁移学习到的知识信息,然后将解码器的隐藏层状态表示和增强注意力向量送入softmax层,以产生预测的单词分布,从而生成最终的对话回复,也即预测回复23,服务器10向终端20发送该预测回复23,终端20显示该预测回复23,以便用户查看。
以上为本申请实施例提供的对话生成模型训练方法和对话生成方法的具体实现方式,基于此,本申请实施例还提供了对应的装置,下面将从功能模块化的角度,对本申请实施例提供的上述装置进行介绍。
参见图8所示的对话生成模型训练装置的结构示意图,该装置800包括:
获取模块810,配置为获取对话数据集,所述对话数据集中的对话数据包括问句和所述问句对应的标注回复;
训练模块820,配置为基于所述对话数据集中的所述问句,通过构建的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复,基于所述问句对应的预测回复和标注回复确定损失函数,通过损失函数调整所述对话生成模型参数直到所述对话生成模型的损失函数处于收敛。
在本申请的一实施例中,参见图9,图9为本申请实施例提供的对话生成模型训练装置的一个结构示意图,在图8所示结构的基础上,所述装置800还包括:
第一迁移模块830,配置为获取所述问句的上下文注意力向量,将所述问句的上下文注意力向量输入所述知识库问答模型中的多层感知机网络 中,通过所述多层感知机网络获得所述问句的增强注意力向量,将所述问句的增强注意力向量作为针对所述问句从知识库问答模型中迁移学习的知识信息。
在本申请的一实施例中,参见图10,图10为本申请实施例提供的对话生成模型训练装置的一个结构示意图,在图8所示结构的基础上,所述装置800还包括:
第二迁移模块840,配置为将所述问句输入所述知识库问答模型,获取所述知识库问答模型中编码器输出的编码表示,作为所述问句的第二编码表示;
确定模块850,配置为确定所述问句的相似问句对应的回复作为相似候选回复,根据所述相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示;
所述训练模块820还配置为:
将所述通过所述对话生成模型中的编码器获得所述问句的编码表示,作为所述问句的第一编码表示;
将所述问句的第二编码表示和第三编码表示中至少一个,与所述问句的第一编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示;
通过所述对话生成模型中的解码器融合所述问句的综合编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息。
在本申请的一实施例中,参见图11,图11为本申请实施例提供的对话生成模型训练装置的一个结构示意图,在图8所示结构的基础上,所述装置800还包括:
知识库问答模型构建模块860,配置为构建端到端结构的神经网络模型,基于通用数据集和常识知识库训练所述神经网络模型,在训练过程中通过铰链损失函数调整所述神经网络模型参数,直到所述神经网络模型的损失函数处于收敛,将处于收敛状态的神经网络模型作为所述知识库问答模型。
其中,图11也可以是在图9或图10基础上还包括上述知识库问答模型构建模块。
在本申请的一实施例中,所述训练模块820在通过构建的对话生成模型中的编码器获得所述问句的编码表示时,还配置为:
通过构建的对话生成模型基于词嵌入模型确定所述问句的词嵌入表示,根据所述词嵌入表示通过双向长短期记忆网络编码得到隐藏层状态表示,将所述隐藏层状态表示作为所述问句的编码表示。
接下来,参见图12所示的对话生成装置的结构示意图,该装置1200包括:
接收模块1210,配置为接收终端发送的待回答的问句;
生成模块1220,配置为通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
发送模块1230,配置为向所述终端发送所述预测回复。
在本申请的一实施例中,参见图13,图13为本申请实施例提供的对话生成装置的一个结构示意图,在图12所示结构的基础上,所述装置1200还包括:
第一迁移模块1240,配置为获取所述问句的上下文注意力向量,将所述问句的上下文注意力向量输入所述知识库问答模型中的多层感知机网络中,通过所述多层感知机网络获得所述问句的增强注意力向量,将所述问句的增强注意力向量作为针对所述问句从知识库问答模型中迁移学习的知识信息。
在本申请的一实施例中,所述第一迁移模块1240在通过所述多层感知机网络获得所述问句的增强注意力向量还配置为:
获取所述多层感知机网络基于所述问句的上下文注意力向量和从知识库词表中各词分别迁移到的知识信息;
根据所述问句的上下文注意力向量和所述知识库词表中各词的实体嵌入表示,确定所述问句的增强注意力向量。
在本申请的一实施例中,所述第一迁移模块1240在获得所述对话生成模型输出的所述问句对应的预测回复时还配置为:
获得所述对话生成模型中解码器的隐藏层状态表示;
将所述对话生成模型中解码器的隐藏层状态表示和增强注意力向量输入所述对话生成模型中分类层;
根据所述分类层输出的预测单词分布生成所述问句对应的预测回复。
在本申请的一实施例中,所述第一迁移模块1240在获得所述对话生成模型中解码器的隐藏层状态表示时还配置为:
将所述对话生成模型中编码器针对所述问句中最后一个词的隐藏状态表示,作为所述对话生成模型中解码器的初始状态并将预设符号作为初始符号;
根据所述对话生成模型中解码器的上一时间步状态和上一时间步生成的符号对应的词嵌入表示以及所述对话生成模型中编码器的当前时间步生成的注意力向量作为所述对话生成模型中解码器的输入,获得所述对话生成模型中解码器在当前时间步的隐藏层状态表示。
在本申请的一实施例中,参见图14,图14为本申请实施例提供的对话生成装置的一个结构示意图,在图12所示结构的基础上,所述装置1200还包括:
第二迁移模块1250,配置为将所述问句输入所述知识库问答模型,获取所述知识库问答模型中编码器输出的编码表示,作为所述问句的第二编码表示;
确定模块1260,配置为确定所述问句的相似问句对应的回复作为相似候选回复,根据所述相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示;
则所述生成模块1220还配置为:
将所述通过所述对话生成模型中的编码器获得所述问句的编码表示,作为所述问句的第一编码表示;
将所述问句的第二编码表示和第三编码表示中至少一个,与所述问句的第一编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示;
通过所述对话生成模型中的解码器融合所述问句的综合编码表示和针对所述问句从所述知识库问答模型中迁移学习的知识信息。
基于本申请提供的上述方法和装置的具体实现方式,本申请实施例还提供了用于对话生成模型训练的设备和对话生成的设备,下面将从硬件实体化的角度对本申请实施例提供的上述设备进行介绍。
图15是本申请实施例提供的一种设备的结构示意图,该设备可以为服务器,该服务器1500可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1522(例如,一个或一个以上处理器)和存储器1532,一个或一个以上存储应用程序1542或数据1544的存储介质1530(例如一个或一个以上海量存储设备)。其中,存储器1532和存储介质1530可以是短暂存储或持久存储。存储在存储介质1530的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对服务器中的一系列指令操作。更本申请实施例中,中央处理器1522可以设置为与存储介质1530通信,在服务器1500上执行存储介质1530中的一系列指令操作。
服务器1500还可以包括一个或一个以上电源1526,一个或一个以上有线或无线网络接口1550,一个或一个以上输入输出接口1558,和/或,一个或一个以上操作系统1541,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
上述实施例中由服务器所执行的步骤可以基于该图15所示的服务器结构。
其中,CPU 1522配置为执行如下步骤:
获取对话数据集,所述对话数据集中的对话数据包括问句和所述问句对应的标注回复;
基于所述对话数据集中的所述问句,通过构建的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
基于所述问句对应的预测回复和标注回复确定损失函数,通过损失函数调整所述对话生成模型参数直到所述对话生成模型的损失函数处于收敛。
在本申请的一实施例中,所述CPU 1522还配置为执行本申请提供的对话生成模型训练方法。
本申请还提供了另一种设备,该设备用于生成对话,其具有与图15相同的结构,在该设备中,所述CPU 1522配置为执行如下步骤:
接收终端发送的待回答的问句;
通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
向所述终端发送所述预测回复。
在本申请的一实施例中,所述CPU 1522还配置为执行本申请提供的对话生成方法的任意一种实现方式的步骤。
本申请实施例还提供一种计算机可读存储介质,存储计算机程序,该计算机程序用于执行前述各个实施例所述的对话生成模型训练方法或者对话生成方法中的任意一种实施方式。
本申请实施例还提供一种包括指令的计算机程序产品,当其在计算机上运行时,使得计算机执行前述各个实施例所述的对话生成模型训练方法或者对话生成方法中的任意一种实施方式。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地 方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文全称:Read-Only Memory,英文缩写:ROM)、随机存取存储器(英文全称:Random Access Memory,英文缩写:RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。
工业实用性
本申请实施例中通过在训练模型时,首先获取对话数据集对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复,然后基于所述训练样本中的所述问句,通过对话生成模型中的编码器获得所述问句的编码表示,接着通过所述对话生成模型中的解码器融 合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,由于知识库问答模型中的知识信息具有较高的精准性,因此,对话生成模型融合该知识信息输出的所述问句对应的预测回复具有较高的精准性,基于该预测回复和标注回复确定的损失函数调整对话生成模型参数以实现模型训练,不仅提高了模型的训练效率,还能够提高了模型的精准度。同时基于上述模型训练方法训练得到的对话生成模型,在对话生成时,该对话生成模型将知识库问答模型中的知识信息迁移到开放域对话生成任务中,通过利用知识库问答模型的高精准性,使得模型能够更好地融合知识信息,从而提高对话生成准确性和合理性使得用户更加便捷地获取高质量的对话信息,减少通用回复影响用户的使用。

Claims (22)

  1. 一种对话生成模型训练方法,所述方法由服务器执行,所述服务器包括有一个或多个处理器以及存储器,以及一个或一个以上的程序,其中,所述一个或一个以上的程序存储于存储器中,所述程序可以包括一个或一个以上的每一个对应于一组指令的单元,所述一个或多个处理器被配置为执行指令;包括:
    获取对话数据集,所述对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复;
    通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示;
    通过所述对话生成模型中的解码器,融合所述问句的编码表示和从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复;
    基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值;
    基于所述损失函数的值更新所述对话生成模型的模型参数。
  2. 根据权利要求1所述的方法,其中,针对所述问句从知识库问答模型中迁移学习得到知识信息,包括:
    获取所述问句的上下文注意力向量,将所述问句的上下文注意力向量输入所述知识库问答模型中的多层感知机网络中;
    通过所述多层感知机网络获得所述问句的增强注意力向量,确定所述问句的增强注意力向量为从知识库问答模型中迁移学习的知识信息。
  3. 根据权利要求1所述的方法,其中,所述通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示,包括:
    基于词嵌入模型,通过对话生成模型中的编码器确定所述问句的词嵌入表示;
    通过所述编码器的双向长短期记忆网络,对所述词嵌入表示编码得到隐藏层状态表示,将所述隐藏层状态表示作为所述问句的编码表示。
  4. 根据权利要求3所述的方法,其中,所述方法还包括:
    将通过所述对话生成模型中的编码器得到的所述问句的编码表示,作为所述问句的第一编码表示,
    将所述问句输入所述知识库问答模型,通过所述知识库问答模型中的编码器对所述问句进行编码,得到所述问句的第二编码表示;
    将所述第一编码表示与所述第二编码表示进行拼接,得到所述问句的综合编码表示。
  5. 根据权利要求3所述的方法,其中,所述方法还包括:
    将通过所述对话生成模型中的编码器得到的所述问句的编码表示,作为所述问句的第一编码表示,
    确定所述问句的相似问句对应的回复作为相似候选回复,根据所述相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示;
    将所述问句的第一编码表示和所述问句的第三编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
  6. 根据权利要求3所述的方法,其中,所述方法还包括:
    将通过所述对话生成模型中的编码器得到的所述问句的编码表示,作为所述问句的第一编码表示,
    将所述问句输入所述知识库问答模型,获取所述知识库问答模型中编码器输出的编码表示,作为所述问句的第二编码表示;
    确定所述问句的相似问句对应的回复作为相似候选回复,根据所述 相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示;
    将所述问句的第一编码表示、所述问句的第二编码表示和所述问句的第三编码进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
  7. 根据权利要求4至6中任一项所述的方法,其中,所述通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复,包括:
    通过所述对话生成模型中的解码器,融合所述问句的综合编码表示和从知识库问答模型中迁移学习的对应所述问句的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复。
  8. 根据权利要求1所述的方法,其中,所述方法还包括:
    构建端到端结构的神经网络模型;
    获取与所述神经网络模型相匹配的通用数据集和常识知识库;
    基于所述通用数据集包括的多组问答数据,通过与所述神经网络模型相匹配的铰链损失函数调整所述神经网络模型参数,直到所述铰链损失函数处于收敛,将处于收敛状态的神经网络模型作为所述知识库问答模型,以实现对所述知识库问答模型的训练。
  9. 根据权利要求8所述的方法,其中,所述方法还包括:
    对所述通用数据集和所述常识知识库中的问题和对应的候选知识答案进行编码,得到所述问题的编码表示和所述候选知识答案的编码表示;
    确定所述问题的编码表示和所述候选知识答案的编码表示的语义匹配相似度;
    根据所述语义匹配相似度确定最佳答案,并基于该最佳答案确定所 述知识库问答模型相匹配的损失函数。
  10. 一种对话生成方法,所述方法由服务器执行,所述服务器包括有一个或多个处理器以及存储器,以及一个或一个以上的程序,其中,所述一个或一个以上的程序存储于存储器中,所述程序可以包括一个或一个以上的每一个对应于一组指令的单元,所述一个或多个处理器被配置为执行指令;包括:
    接收终端发送的待回答的问句;
    通过预训练的对话生成模型中的编码器获得所述问句的编码表示;
    通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
    向所述终端发送所述预测回复,其中,所述预训练的对话生成模型通过从知识库问答模型中迁移学习的知识信息进行训练,以实现通过所述对话生成模型生成与问题语句相匹配的回复语句。
  11. 根据权利要求10所述的方法,其中,所述针对所述问句从知识库问答模型中迁移学习得到知识信息,包括:
    获取所述问句的上下文注意力向量;
    将所述问句的上下文注意力向量输入所述知识库问答模型中的多层感知机网络中;
    通过所述多层感知机网络获得所述问句的增强注意力向量,将所述问句的增强注意力向量作为针对所述问句从知识库问答模型中迁移学习的知识信息。
  12. 根据权利要求11所述的方法,其中,所述通过所述多层感知机网络获得所述问句的增强注意力向量,包括:
    获取所述多层感知机网络基于所述问句的上下文注意力向量和从知 识库词表中各词分别迁移到的知识信息;
    根据所述问句的上下文注意力向量和所述知识库词表中各词的实体嵌入表示,确定所述问句的增强注意力向量。
  13. 根据权利要求12所述的方法,其中,所述获得所述对话生成模型输出的所述问句对应的预测回复,包括:
    获得所述对话生成模型中解码器的隐藏层状态表示;
    将所述对话生成模型中解码器的隐藏层状态表示和所述增强注意力向量输入所述对话生成模型中分类层;
    根据所述分类层输出的预测单词分布生成所述问句对应的预测回复。
  14. 根据权利要求13所述的方法,其中,所述获得所述对话生成模型中解码器的隐藏层状态表示,包括:
    将所述对话生成模型中编码器针对所述问句中最后一个词的隐藏状态表示,作为所述对话生成模型中解码器的初始状态并将预设符号作为初始符号;
    根据所述对话生成模型中解码器的上一时间步状态和上一时间步生成的符号对应的词嵌入表示以及所述对话生成模型中编码器的当前时间步生成的注意力向量作为所述对话生成模型中解码器的输入,获得所述对话生成模型中解码器在当前时间步的隐藏层状态表示。
  15. 根据权利要求12所述的方法,其中,所述方法还包括:
    将通过所述对话生成模型中的编码器得到的所述问句的编码表示,作为所述问句的第一编码表示,
    将所述问句输入所述知识库问答模型,通过所述知识库问答模型中的编码器对所述问句进行编码,得到所述问句的第二编码表示;
    将所述第一编码表示与所述第二编码表示进行拼接,得到所述问句 的综合编码表示。
  16. 根据权利要求12所述的方法,其中,所述方法还包括:
    将通过所述对话生成模型中的编码器得到的所述问句的编码表示,作为所述问句的第一编码表示,
    确定所述问句的相似问句对应的回复作为相似候选回复,根据所述相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示;
    将所述问句的第一编码表示和所述问句的第三编码表示进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
  17. 根据权利要求12所述的方法,其中,所述方法还包括:
    将通过所述对话生成模型中的编码器得到的所述问句的编码表示,作为所述问句的第一编码表示,
    将所述问句输入所述知识库问答模型,获取所述知识库问答模型中编码器输出的编码表示,作为所述问句的第二编码表示;
    确定所述问句的相似问句对应的回复作为相似候选回复,根据所述相似候选回复的词嵌入表示和所述问句的第一编码表示确定互注意力,作为所述问句的第三编码表示;
    将所述问句的第一编码表示、所述问句的第二编码表示和所述问句的第三编码进行拼接,将拼接后的编码表示作为所述问句的综合编码表示。
  18. 根据权利要求15至17中任一项所述的方法,其中,所述通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复,包括:
    通过所述对话生成模型中的解码器,融合所述问句的综合编码表示 和从知识库问答模型中迁移学习的对应所述问句的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复。
  19. 一种对话生成模型训练装置,包括:
    获取模块,配置为获取对话数据集,所述对话数据集中作为训练样本的每一对话数据包括问句和所述问句对应的标注回复;
    训练模块,配置为通过对话生成模型中的编码器,对所述对话数据集中的所述问句进行编码处理,得到所述问句的编码表示;
    所述训练模块,配置为通过所述对话生成模型中的解码器,融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的对应所述问句的知识信息,得到所述问句对应的预测回复;
    所述训练模块,配置为基于所述问句对应的预测回复和标注回复,确定所述对话生成模型的损失函数的值;
    所述训练模块,配置为基于所述损失函数的值更新所述对话生成模型的模型参数。
  20. 一种对话生成装置,包括:
    接收模块,配置为接收终端发送的待回答的问句;
    生成模块,配置为通过预训练的对话生成模型中的编码器获得所述问句的编码表示,通过所述对话生成模型中的解码器融合所述问句的编码表示和针对所述问句从知识库问答模型中迁移学习的知识信息,获得所述对话生成模型输出的所述问句对应的预测回复;
    发送模块,配置为向所述终端发送所述预测回复,其中,所述预训练的对话生成模型通过从知识库问答模型中迁移学习的知识信息进行训练,以实现通过所述对话生成模型生成与问题语句相匹配的回复语句。
  21. 一种设备,所述设备包括处理器以及存储器:
    所述存储器配置为存储计算机程序;
    所述处理器配置为运行所述计算机程序时,执行权利要求1至9任一项所述的对话生成模型训练方法,或者,执行权利要求10至18任一项所述的对话生成方法。
  22. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序用于执行权利1至9任一项所述的对话生成模型训练方法,或者,执行权利要求10至18任一项所述的对话生成方法。
PCT/CN2020/092701 2019-05-31 2020-05-27 模型训练方法、对话生成方法、装置、设备及存储介质 Ceased WO2020238985A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/367,883 US11875126B2 (en) 2019-05-31 2021-07-06 Method, apparatus, device, and storage medium for training model and generating dialog

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910470526.9 2019-05-31
CN201910470526.9A CN110188182B (zh) 2019-05-31 2019-05-31 模型训练方法、对话生成方法、装置、设备及介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/367,883 Continuation US11875126B2 (en) 2019-05-31 2021-07-06 Method, apparatus, device, and storage medium for training model and generating dialog

Publications (1)

Publication Number Publication Date
WO2020238985A1 true WO2020238985A1 (zh) 2020-12-03

Family

ID=67719565

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/092701 Ceased WO2020238985A1 (zh) 2019-05-31 2020-05-27 模型训练方法、对话生成方法、装置、设备及存储介质

Country Status (3)

Country Link
US (1) US11875126B2 (zh)
CN (1) CN110188182B (zh)
WO (1) WO2020238985A1 (zh)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112784028A (zh) * 2021-01-25 2021-05-11 浪潮云信息技术股份公司 基于深度学习模型构建智能聊天平台的方法及系统
CN112800203A (zh) * 2021-02-05 2021-05-14 江苏实达迪美数据处理有限公司 一种融合文本和知识表征的问答匹配方法及系统
CN113569559A (zh) * 2021-07-23 2021-10-29 北京智慧星光信息技术有限公司 短文本实体情感分析方法、系统、电子设备及存储介质
CN113656569A (zh) * 2021-08-24 2021-11-16 电子科技大学 一种基于上下文信息推理的生成式对话方法
CN114036960A (zh) * 2021-11-29 2022-02-11 中国人民大学 一种多粒度个性化对话生成方法
CN114238621A (zh) * 2021-11-30 2022-03-25 南通大学 一种基于Transformer的编程问题帖标题自动生成方法
CN114625861A (zh) * 2022-05-11 2022-06-14 之江实验室 改进Transformer融入知识的端到端对话方法
CN115358289A (zh) * 2022-07-20 2022-11-18 南京航空航天大学 一种融合多类型知识库和推理技术的文本生成算法
CN116737888A (zh) * 2023-01-11 2023-09-12 北京百度网讯科技有限公司 对话生成模型的训练方法和答复文本的确定方法、装置
CN117591658A (zh) * 2024-01-17 2024-02-23 翌东寰球(深圳)数字科技有限公司 一种智能问答方法、装置、设备及存储介质

Families Citing this family (83)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110188182B (zh) 2019-05-31 2023-10-27 中国科学院深圳先进技术研究院 模型训练方法、对话生成方法、装置、设备及介质
CN110222164B (zh) * 2019-06-13 2022-11-29 腾讯科技(深圳)有限公司 一种问答模型训练方法、问题语句处理方法、装置及存储介质
CN110674246A (zh) * 2019-09-19 2020-01-10 北京小米智能科技有限公司 问答模型训练方法、自动问答方法及装置
CN110704597B (zh) * 2019-09-29 2022-07-29 北京金山安全软件有限公司 对话系统可靠性校验方法、模型生成方法及装置
CN110990543A (zh) * 2019-10-18 2020-04-10 平安科技(深圳)有限公司 智能对话的生成方法、装置、计算机设备及计算机存储介质
CN111061847A (zh) * 2019-11-22 2020-04-24 中国南方电网有限责任公司 对话生成及语料扩充方法、装置、计算机设备和存储介质
CN111160512B (zh) * 2019-12-04 2023-06-13 华东师范大学 基于生成式对抗网络构建双判别器对话生成模型的方法
CN111061851B (zh) * 2019-12-12 2023-08-08 中国科学院自动化研究所 基于给定事实的问句生成方法及系统
CN113010023B (zh) * 2019-12-20 2024-12-24 北京搜狗科技发展有限公司 一种信息推荐方法、装置和电子设备
US11544946B2 (en) * 2019-12-27 2023-01-03 Robert Bosch Gmbh System and method for enhancing neural sentence classification
CN111310847B (zh) * 2020-02-28 2023-06-23 支付宝(杭州)信息技术有限公司 训练要素分类模型的方法和装置
CN111368058B (zh) * 2020-03-09 2023-05-02 昆明理工大学 一种基于迁移学习的问答匹配方法
CN111428015B (zh) * 2020-03-20 2023-03-14 腾讯科技(深圳)有限公司 一种信息生成方法、装置、设备及存储介质
CN113495943B (zh) * 2020-04-02 2023-07-14 山东大学 一种基于知识追踪与转移的人机对话方法
CN111639163A (zh) * 2020-04-29 2020-09-08 深圳壹账通智能科技有限公司 问题生成模型的训练方法、问题生成方法及其相关设备
CN111400481B (zh) * 2020-05-15 2023-04-28 支付宝(杭州)信息技术有限公司 针对多轮对话生成回复语句的方法和装置
CN112308650B (zh) * 2020-07-01 2022-09-30 北京沃东天骏信息技术有限公司 推荐理由生成方法、装置、设备及存储介质
CN111897933B (zh) * 2020-07-27 2024-02-06 腾讯科技(深圳)有限公司 情感对话生成方法、装置及情感对话模型训练方法、装置
CN112035627B (zh) * 2020-07-27 2023-11-17 深圳技术大学 自动问答方法、装置、设备及存储介质
CN111949768B (zh) * 2020-08-23 2024-02-02 云知声智能科技股份有限公司 一种文件分类方法
CN112256851A (zh) * 2020-10-23 2021-01-22 大连东软教育科技集团有限公司 一种教育机器人对话数据集的生成方法、装置及存储介质
KR102529431B1 (ko) * 2020-11-10 2023-05-08 주식회사 포티투마루 문맥 기반 질의응답 생성 아키텍처
CN112347760B (zh) * 2020-11-16 2024-11-22 北京京东尚科信息技术有限公司 意图识别模型的训练方法及装置、意图识别方法及装置
CN113780610B (zh) * 2020-12-02 2024-08-20 北京沃东天骏信息技术有限公司 一种客服画像构建方法和装置
CN112650768A (zh) * 2020-12-22 2021-04-13 网易(杭州)网络有限公司 对话信息的生成方法、装置及电子设备
US20220198149A1 (en) * 2020-12-23 2022-06-23 Industrial Technology Research Institute Method and system for machine reading comprehension
CN114691815B (zh) * 2020-12-25 2025-01-03 科沃斯商用机器人有限公司 模型训练方法、装置、电子设备和存储介质
US12380344B2 (en) * 2020-12-31 2025-08-05 International Business Machines Corporation Generating summary and next actions in real-time for multiple users from interaction records in natural language
CN112926736B (zh) * 2021-02-26 2023-12-08 国网智能电网研究院有限公司 一种深度学习技术工具链系统
CN113076944A (zh) * 2021-03-11 2021-07-06 国家电网有限公司 一种基于人工智能的单据检测识别方法
CN113239157B (zh) * 2021-03-31 2022-02-25 北京百度网讯科技有限公司 对话模型的训练方法、装置、设备和存储介质
CN113486160B (zh) * 2021-05-26 2023-04-11 山东大学 基于跨语言知识的对话方法及系统
CN113268577B (zh) * 2021-06-04 2022-08-23 厦门快商通科技股份有限公司 一种基于对话关系的训练数据处理方法、装置及可读介质
CN113377907B (zh) * 2021-06-08 2023-06-09 四川大学 基于记忆掩码自注意力网络的端到端任务型对话系统
CN115640383A (zh) * 2021-07-20 2023-01-24 阿里巴巴新加坡控股有限公司 模型训练方法、装置、设备及计算机存储介质
CN113515617B (zh) * 2021-07-30 2023-07-04 中央财经大学 一种对话生成模型的方法、装置以及设备
CN113627557B (zh) * 2021-08-19 2023-10-03 电子科技大学 一种基于上下文图注意力机制的场景图生成方法
CN114281958A (zh) * 2021-10-20 2022-04-05 腾讯科技(深圳)有限公司 回复模型的获取方法、回复语句的获取方法、装置及设备
CN113961722B (zh) * 2021-11-05 2025-04-04 叩鼎(厦门)大数据科技有限公司 一种新的面向知识图谱完备的端到端嵌入学习系统
CN114417086B (zh) * 2021-12-13 2025-05-13 贝壳找房(北京)科技有限公司 基于强化学习策略的人机交互训练方法及装置
CN116881393A (zh) * 2022-03-28 2023-10-13 北京沃东天骏信息技术有限公司 一种确定客服答复文本的方法和装置
CN114661884B (zh) * 2022-04-19 2025-06-13 杭州电子科技大学 一种开放域问答下基于kl正则化的检索器预训练方法
CN114817467B (zh) * 2022-04-20 2024-12-03 中国人民解放军国防科技大学 一种意图识别响应方法、装置、设备及存储介质
CN114860877B (zh) * 2022-04-29 2024-10-29 华侨大学 一种基于知识图谱关系预测的问题链生成方法及系统
CN115035405B (zh) * 2022-05-26 2024-09-10 华南农业大学 基于双重迁移学习的柑橘叶片病害识别方法、系统及设备
CN115062123A (zh) * 2022-05-26 2022-09-16 北京航空航天大学 一种对话生成系统的知识库问答对生成方法
CN114925681B (zh) * 2022-06-08 2024-08-27 工银科技有限公司 知识图谱问答问句实体链接方法、装置、设备及介质
CN114783596B (zh) * 2022-06-17 2022-10-18 天津幸福生命科技有限公司 诊断数据识别方法及装置、电子设备、存储介质
CN115080739B (zh) * 2022-06-24 2025-10-24 北京百度网讯科技有限公司 用于训练对话模型的方法以及用于输出应答信息的方法
CN115293142B (zh) * 2022-07-15 2025-07-22 浙江大学 一种基于词典增强预训练模型的常识问答方法
CN115186149B (zh) * 2022-07-28 2025-07-18 天津大学 一种知识对话生成中主题驱动的知识选择方法
CN115470327A (zh) * 2022-08-11 2022-12-13 天津泰凡科技有限公司 基于知识图谱的医疗问答方法及相关设备
CN115526184A (zh) * 2022-10-08 2022-12-27 齐鲁工业大学 基于局部自注意力的知识增强的词义消歧方法和装置
CN115617954B (zh) * 2022-11-17 2023-03-28 清华大学 问答方法、装置、电子设备及存储介质
CN116245114B (zh) * 2022-11-23 2023-09-12 重庆大学 一种基于对话状态指导的端到端任务型对话系统
CN116108918A (zh) * 2022-12-30 2023-05-12 深圳数联天下智能科技有限公司 对话预训练模型的训练方法及相关装置
CN116000929A (zh) * 2022-12-30 2023-04-25 上海交通大学 一种基于知识嵌入的服务机械臂任务为导向的抓取方法
CN116738976A (zh) * 2023-02-01 2023-09-12 南通大学 基于预训练模型t5的编程问答帖子标题自动补全方法
CN116127040B (zh) * 2023-02-20 2026-04-17 马上消费金融股份有限公司 多轮对话模型的训练方法、多轮对话预测方法及装置
CN116665662A (zh) * 2023-02-20 2023-08-29 阿里巴巴(中国)有限公司 人机对话方法及对话数据集生成方法
CN116136870A (zh) * 2023-02-21 2023-05-19 深圳市网联安瑞网络科技有限公司 基于增强实体表示的智能社交对话方法、对话系统
CN116595985A (zh) * 2023-03-09 2023-08-15 华院计算技术(上海)股份有限公司 一种基于生成式常识辅助增强对话中情绪识别的方法
CN116467413A (zh) * 2023-03-22 2023-07-21 信号旗智能科技(上海)有限公司 一种提取报关单申报要素的方法、系统、装置和存储介质
CN116541494B (zh) * 2023-04-14 2025-09-23 中国农业银行股份有限公司 模型训练方法、回复信息的方法、装置、设备及介质
CN116306917B (zh) * 2023-05-17 2023-09-08 卡奥斯工业智能研究院(青岛)有限公司 任务处理方法、装置、设备和计算机存储介质
CN116756280A (zh) * 2023-06-07 2023-09-15 京东科技控股股份有限公司 生成对话的方法、装置和计算机可读存储介质
EP4738181A1 (en) * 2023-06-30 2026-05-06 Guangdong Midea Kitchen Appliances Manufacturing Co., Ltd. Session information processing method, apparatus and system, and statement generation method and apparatus
CN117112742B (zh) * 2023-07-24 2025-06-10 苏州浪潮智能科技有限公司 一种对话模型优化方法、装置、计算机设备和存储介质
CN121713195A (zh) * 2023-08-16 2026-03-20 维萨国际服务协会 经由查询数据库进行大型语言模型推理
CN117216210A (zh) * 2023-09-06 2023-12-12 中核装备技术研究(上海)有限公司 问答方法、装置、设备、介质及产品
CN117332851B (zh) * 2023-09-08 2024-05-31 珠海盈米基金销售有限公司 一种基于私有知识库的llm问答平台搭建方法及系统
CN117370516B (zh) * 2023-10-10 2025-11-14 中国科学院信息工程研究所 一种基于层级对比学习知识增强对话系统训练的方法
WO2025090062A1 (en) * 2023-10-25 2025-05-01 Hitachi Vantara Llc Generative ai appliance
CN117131187B (zh) * 2023-10-26 2024-02-09 中国科学技术大学 一种基于噪声绑定扩散模型的对话摘要方法
CN117151228B (zh) * 2023-10-31 2024-02-02 深圳大数信科技术有限公司 一种基于大模型与知识库生成的智能客服系统
US20250209278A1 (en) * 2023-12-20 2025-06-26 Adobe Inc. Identifying speaker names in transcripts utilizing language models
CN117708307B (zh) * 2024-02-06 2024-05-14 西北工业大学 一种大语言模型微调和Adapter融合方法及装置
CN118504988B (zh) * 2024-07-11 2024-10-29 国网安徽省电力有限公司电力科学研究院 新增设备启动风险识别方法及系统
CN118886426B (zh) * 2024-09-27 2025-04-01 中铁七局集团第三工程有限公司 一种情感对话生成方法及系统
CN119578490B (zh) * 2024-11-26 2025-11-18 神州数码(中国)有限公司 模型训练方法、装置、电子设备和计算机可读存储介质
CN119415961B (zh) * 2025-01-03 2025-05-13 成都数之联科技股份有限公司 一种多点位虚拟量测方法、系统、设备及存储介质
CN120106222B (zh) * 2025-03-04 2025-10-31 中山大学 一种基于多源知识融合的问句生成方法及装置
CN121415084B (zh) * 2025-12-24 2026-04-17 崂山国家实验室 声纳图像视觉问答方法及其系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170323204A1 (en) * 2016-05-03 2017-11-09 International Business Machines Corporation Text Simplification for a Question and Answer System
CN108021705A (zh) * 2017-12-27 2018-05-11 中科鼎富(北京)科技发展有限公司 一种答案生成方法及装置
CN109213851A (zh) * 2018-07-04 2019-01-15 中国科学院自动化研究所 对话系统中口语理解的跨语言迁移方法
CN109597993A (zh) * 2018-11-30 2019-04-09 深圳前海微众银行股份有限公司 语句分析处理方法、装置、设备以及计算机可读存储介质
US20190130248A1 (en) * 2017-10-27 2019-05-02 Salesforce.Com, Inc. Generating dual sequence inferences using a neural network model
CN110188182A (zh) * 2019-05-31 2019-08-30 中国科学院深圳先进技术研究院 模型训练方法、对话生成方法、装置、设备及介质

Family Cites Families (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5171962B2 (ja) * 2007-10-11 2013-03-27 本田技研工業株式会社 異種データセットからの知識移転を伴うテキスト分類
CA2689026A1 (en) * 2009-07-17 2011-01-17 Andre Gene Douen Systems, methods and articles for managing presentation of information
US11961624B2 (en) * 2013-03-15 2024-04-16 James Paul Smurro Augmenting clinical intelligence with federated learning, imaging analytics and outcomes decision support
US9836452B2 (en) * 2014-12-30 2017-12-05 Microsoft Technology Licensing, Llc Discriminating ambiguous expressions to enhance user experience
US10706063B2 (en) * 2015-10-28 2020-07-07 Qomplx, Inc. Automated scalable contextual data collection and extraction system
KR102447513B1 (ko) * 2016-01-22 2022-09-27 한국전자통신연구원 점증적 대화지식 자가학습 기반 대화장치 및 그 방법
US10540967B2 (en) * 2016-11-14 2020-01-21 Xerox Corporation Machine reading method for dialog state tracking
US11586827B2 (en) * 2017-05-10 2023-02-21 Oracle International Corporation Generating desired discourse structure from an arbitrary text
CN109710915B (zh) * 2017-10-26 2021-02-23 华为技术有限公司 复述语句生成方法及装置
KR102132407B1 (ko) * 2017-11-22 2020-07-10 인하대학교 산학협력단 점진적 딥러닝 학습을 이용한 적응적 영상 인식 기반 감성 추정 방법 및 장치
WO2020032919A1 (en) * 2018-08-06 2020-02-13 Google Llc Captcha automated assistant
CN111046147A (zh) * 2018-10-11 2020-04-21 马上消费金融股份有限公司 一种问答方法、装置及终端设备
CN109508457B (zh) * 2018-10-31 2020-05-29 浙江大学 一种基于机器阅读到序列模型的迁移学习方法
US11074253B2 (en) * 2018-11-02 2021-07-27 International Business Machines Corporation Method and system for supporting inductive reasoning queries over multi-modal data from relational databases
US11620544B2 (en) * 2018-12-21 2023-04-04 TeselaGen Biotechnology Inc. Method, apparatus, and computer-readable medium for efficiently optimizing a phenotype with a specialized prediction model
SG10201914104YA (en) * 2018-12-31 2020-07-29 Dathena Science Pte Ltd Deep learning engine and methods for content and context aware data classification
CN109800294B (zh) * 2019-01-08 2020-10-13 中国科学院自动化研究所 基于物理环境博弈的自主进化智能对话方法、系统、装置
WO2020159395A1 (ru) * 2019-01-29 2020-08-06 Публичное Акционерное Общество "Сбербанк России" Способ создания модели анализа диалогов на базе искусственного интеллекта
CN110032646B (zh) * 2019-05-08 2022-12-30 山西财经大学 一种基于多源领域适应联合学习的跨领域文本情感分类方法
US11531875B2 (en) * 2019-05-14 2022-12-20 Nasdaq, Inc. Systems and methods for generating datasets for model retraining
US11501233B2 (en) * 2019-05-21 2022-11-15 Hcl Technologies Limited System and method to perform control testing to mitigate risks in an organization

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170323204A1 (en) * 2016-05-03 2017-11-09 International Business Machines Corporation Text Simplification for a Question and Answer System
US20190130248A1 (en) * 2017-10-27 2019-05-02 Salesforce.Com, Inc. Generating dual sequence inferences using a neural network model
CN108021705A (zh) * 2017-12-27 2018-05-11 中科鼎富(北京)科技发展有限公司 一种答案生成方法及装置
CN109213851A (zh) * 2018-07-04 2019-01-15 中国科学院自动化研究所 对话系统中口语理解的跨语言迁移方法
CN109597993A (zh) * 2018-11-30 2019-04-09 深圳前海微众银行股份有限公司 语句分析处理方法、装置、设备以及计算机可读存储介质
CN110188182A (zh) * 2019-05-31 2019-08-30 中国科学院深圳先进技术研究院 模型训练方法、对话生成方法、装置、设备及介质

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112784028A (zh) * 2021-01-25 2021-05-11 浪潮云信息技术股份公司 基于深度学习模型构建智能聊天平台的方法及系统
CN112800203A (zh) * 2021-02-05 2021-05-14 江苏实达迪美数据处理有限公司 一种融合文本和知识表征的问答匹配方法及系统
CN113569559B (zh) * 2021-07-23 2024-02-02 北京智慧星光信息技术有限公司 短文本实体情感分析方法、系统、电子设备及存储介质
CN113569559A (zh) * 2021-07-23 2021-10-29 北京智慧星光信息技术有限公司 短文本实体情感分析方法、系统、电子设备及存储介质
CN113656569A (zh) * 2021-08-24 2021-11-16 电子科技大学 一种基于上下文信息推理的生成式对话方法
CN113656569B (zh) * 2021-08-24 2023-10-13 电子科技大学 一种基于上下文信息推理的生成式对话方法
CN114036960A (zh) * 2021-11-29 2022-02-11 中国人民大学 一种多粒度个性化对话生成方法
CN114036960B (zh) * 2021-11-29 2024-04-02 中国人民大学 一种多粒度个性化对话生成方法
CN114238621A (zh) * 2021-11-30 2022-03-25 南通大学 一种基于Transformer的编程问题帖标题自动生成方法
CN114625861A (zh) * 2022-05-11 2022-06-14 之江实验室 改进Transformer融入知识的端到端对话方法
CN114625861B (zh) * 2022-05-11 2022-09-06 之江实验室 改进Transformer融入知识的端到端对话方法
CN115358289A (zh) * 2022-07-20 2022-11-18 南京航空航天大学 一种融合多类型知识库和推理技术的文本生成算法
CN116737888A (zh) * 2023-01-11 2023-09-12 北京百度网讯科技有限公司 对话生成模型的训练方法和答复文本的确定方法、装置
CN116737888B (zh) * 2023-01-11 2024-05-17 北京百度网讯科技有限公司 对话生成模型的训练方法和答复文本的确定方法、装置
CN117591658A (zh) * 2024-01-17 2024-02-23 翌东寰球(深圳)数字科技有限公司 一种智能问答方法、装置、设备及存储介质
CN117591658B (zh) * 2024-01-17 2024-03-29 翌东寰球(深圳)数字科技有限公司 一种智能问答方法、装置、设备及存储介质

Also Published As

Publication number Publication date
US20210342551A1 (en) 2021-11-04
US11875126B2 (en) 2024-01-16
CN110188182A (zh) 2019-08-30
CN110188182B (zh) 2023-10-27

Similar Documents

Publication Publication Date Title
WO2020238985A1 (zh) 模型训练方法、对话生成方法、装置、设备及存储介质
CN112214591B (zh) 一种对话预测的方法及装置
EP4113357A1 (en) Method and apparatus for recognizing entity, electronic device and storage medium
CA2929018C (en) Natural expression processing method, processing and response method, device and system
US12333426B2 (en) Method and apparatus for creating dialogue, and storage medium
CN111143540A (zh) 智能问答方法、装置、设备及存储介质
WO2022078146A1 (zh) 语音识别方法、装置、设备以及存储介质
CN113392265B (zh) 多媒体处理方法、装置及设备
EP3623957A1 (en) Generation of point of interest copy
CN112069302A (zh) 会话意图识别模型的训练方法、会话意图识别方法及装置
CN116932731A (zh) 面向5g消息的多模态知识问答方法及系统
CN108959388B (zh) 信息生成方法及装置
CN118230091A (zh) 图像评价模型构建方法、评价方法、装置及存储介质
CN114330704A (zh) 语句生成模型更新方法、装置、计算机设备和存储介质
CN114648032A (zh) 语义理解模型的训练方法、装置和计算机设备
CN113868451A (zh) 基于上下文级联感知的社交网络跨模态对话方法及装置
CN116975288A (zh) 文本处理方法及文本处理模型训练方法
Jiang et al. Knowledge augmented dialogue generation with divergent facts selection
CN112445899A (zh) 一种基于神经网络的知识库问答中的属性匹配方法
CN117636849A (zh) 语音识别方法以及语音识别模型训练方法
CN117271745A (zh) 一种信息处理方法、装置及计算设备、存储介质
CN113761189B (zh) 一种修正文本的方法、装置、计算机设备及存储介质
CN114996426A (zh) 一种问答交互的方法和装置
KR20230116141A (ko) 지식 컨텐츠 기반 상담 시스템
CN115130461B (zh) 一种文本匹配方法、装置、电子设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20814248

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20814248

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20814248

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 090622)

122 Ep: pct application non-entry in european phase

Ref document number: 20814248

Country of ref document: EP

Kind code of ref document: A1