Retrieval-based multi-round dialogue method and system
The Additive Triple-Attention mechanism strengthens dialogue sequence interaction in the retrieval-style multi-turn dialogue model, solving the problems of information loss and unutilized contextual information in the existing technology, improving the accuracy and efficiency of dialogue, and reducing labor costs.
Patent Information
- Application Number
- CN202210972612.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-08-15
Smart Images

Figure CN115129824B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of artificial intelligence and natural language processing, and in particular to a retrieval-type multi-round dialogue method and system. Background Art
[0002] In recent years, retrieval-based multi-turn dialogue systems have received increasing attention in the field of natural language processing. The reason is that retrieval-based multi-turn dialogue systems have many practical application scenarios, and even many fields are now inseparable from the support of retrieval-based multi-turn dialogue systems, such as intelligent customer service, intelligent retrieval, etc. In simple terms, a retrieval-based dialogue system refers to selecting the most appropriate sentence in a candidate list to reply to the user based on the historical dialogue content and the sentence currently input by the user, thereby helping the user find a satisfactory answer. In this era of information explosion, retrieval-based multi-turn dialogue systems can undoubtedly reduce labor costs and improve response efficiency, thereby bringing considerable benefits. However, retrieval-based multi-turn dialogue is a very challenging task, and so far, existing methods have not substantially solved this problem.
[0003] Through analysis and research, it can be found that the existing retrieval-based multi-round dialogue methods can be basically divided into two categories:
[0004] ① Treat all historical conversations as a complete sequence, use the encoder to encode the historical conversation sequence and the candidate response sequence, and then match and compare the semantic relevance. The advantage of this type of method is that the idea is simple and easy to implement, but the disadvantages are also obvious: since this type of method treats all historical conversations as a sequence, it will inevitably lead to information loss during the encoding process; in addition, each utterance in the historical conversation does not contribute equally to the prediction of the response sentence, and this type of method obviously does not pay attention to this problem.
[0005] ② Realizing the problems of the first type of method, this type of method will use different strategies to make all sentences in the historical dialogue interact with the response sentence as much as possible. Experiments have shown that this type of method is indeed better than the first type of method, but this type of method also has shortcomings: the interaction mechanism between sequences mostly uses the attention mechanism, but the existing attention mechanism can only realize the interaction between the two, and for retrieval-based multi-round dialogue tasks, it may not be sufficient to only interact between two sentence sequences without considering contextual information.
[0006] Therefore, how to use contextual information to strengthen the interactive process of dialogue sequences and how to achieve direct interaction between multiple dialogue sequences, and how to use natural language processing technology to select matching answers for users from existing question and answer results and recommend them to users, thereby reducing the workload of manual customer service and reducing labor costs, thereby improving the accuracy of dialogue are technical problems that need to be solved urgently. Summary of the invention
[0007] The technical task of the present invention is to provide a retrieval-based multi-round dialogue method and system to solve the problem of how to strengthen the dialogue sequence interaction process through context information and how to achieve direct interaction between multiple dialogue sequences, and to use natural language processing technology to select matching answers for users from existing question and answer results and recommend them to users, thereby reducing the workload of manual customer service, reducing labor costs, and improving the accuracy of dialogue.
[0008] The technical task of the present invention is achieved in the following way: a search-based multi-round dialogue method, the method is specifically as follows:
[0009] Obtain a retrieval-based multi-round dialogue dataset: Download the publicly available retrieval-based multi-round dialogue dataset from the Internet;
[0010] Construct a retrieval-based multi-round dialogue model: Construct a retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism;
[0011] Train the retrieval-based multi-turn dialogue model: Train the retrieval-based multi-turn dialogue model on the retrieval-based multi-turn dialogue training dataset.
[0012] As a preferred option, the Additive Triple-Attention mechanism is an attention mechanism based on the Additive Attention algorithm. The specific implementation process is as follows:
[0013] (1) Calculate the correlation score between the input tensors query, key, and context as follows:
[0014] ① Perform additive operations on the three input tensors query, key, and context to achieve interactive calculations among query, key, and context. The formula is as follows:
[0015]
[0016] Among them, query represents the question information in multiple rounds of dialogue; key represents the response information in multiple rounds of dialogue; context represents the context information in multiple rounds of dialogue; and Respectively represent the input tensors query, key and context; i and j represent the input tensors and The element subscript, i = 1, 2, ..., I kl ; j = 1, 2, ..., J cl ;I kl and J clRepresents the input tensor respectively and The number of elements in , and Represents the parameters to be trained;
[0017] ② The correlation scores of query, key and context are obtained through normalization operation and recorded as α. The formula is as follows:
[0018]
[0019] Among them, i=1, 2,...,I kl ; i' = 1, 2, ..., I kl ; j = 1, 2, ..., J cl ; j' = 1, 2, ..., J cl ;
[0020] (2) Feature aggregation: Aggregate the input tensors value and context by adding them element by element. The formula is as follows:
[0021]
[0022] Among them, value represents the response information in multiple rounds of dialogue; and Respectively represent the input tensor value and context; i and j represent the input tensor and The element subscript, i = 1, 2, ..., I vl ; j = 1, 2, ..., J cl ; I vl and J cl Represents the input tensor respectively and The number of elements in ;
[0023] (3) Dot product operation: perform a dot product operation on the correlation score obtained in step (1) and the feature aggregation representation obtained in step (2) to obtain the context-enhanced attention embedding representation. The formula is as follows:
[0024]
[0025] Among them, i and j represent the element subscripts of α and v'; I and J represent the lengths of the two dimensions in the input tensors α and v';
[0026] Additive Triple-Attention is a stackable structure that dynamically adjusts the number of layers according to specific tasks, denoted as Depth indicates the specific number of layers set for a specific task; Corresponding to three input tensors query, key and context; the input tensor value is the same as the key.
[0027] As a preferred method, the retrieval-based multi-round dialogue model is constructed as follows:
[0028] Input data: For each piece of data in the dataset, if the historical conversation contains n sentences, then join S1-S n-1 , sentences are separated by the separator "SEP", which serves as the context, formalized as context; S n As a question, it is formalized as query; select a response from multiple responses as the current response, formalized as response; determine the label of the data according to whether the response is a correct response, that is, if the response is a correct response, it is recorded as 1; otherwise, it is recorded as 0; context, query and response three text sequences and labels together constitute an input data;
[0029] Pre-trained embedding representation: Use the pre-trained language model to perform embedding encoding operations on the constructed input data to obtain the embedded representations of the context, question, and response in the input data, which are recorded as and Among the three text sequences, context sequence, question sequence and response sequence, the context sequence uses a separate encoding module, while the question sequence and response sequence share a encoding module. Since the pre-trained language model itself contains a multi-layer encoding network, the output of different layers can be selected as its embedded representation according to different input objects. The formula is as follows:
[0030]
[0031] in, Indicates that the pre-trained language model BERT is used to embed the input context sequence context; the subscript n indicates the number of network layers inside BERT used; Embedded representations that represent context;
[0032]
[0033] in, Indicates that the pre-trained language model BERT is used to embed the input question sequence query; the subscript t indicates the number of network layers inside BERT used; Embedding representation of question sentence;
[0034]
[0035] in, Indicates that the input response sequence response is embedded and encoded using the pre-trained language model BERT; the subscript t indicates the number of network layers inside BERT used; Embedded representation of the response;
[0036] Feature filtering: Embedding representations of context sequences, question sequences, and response sequences using adaptive average pooling operations and Perform feature filtering operations to obtain feature representations, namely context pooling feature representation, question pooling feature representation, and response pooling feature representation, which are denoted as and
[0037] Additive Triple-Attention interaction: Take context pooling feature representation, question pooling feature representation and response pooling feature representation as input; the first-layer interaction structure interacts with question pooling feature representation and response pooling feature representation respectively based on context pooling feature representation to obtain the first-layer question interaction result and the first-layer response interaction result, and pass them to the second-layer interaction structure. At the same time, a layer of fully connected network is used to map the context pooling feature representation to obtain the first-layer mapping representation of the context, and pass it to the second-layer interaction structure; the second-layer interaction structure interacts with the first-layer question interaction result and the first-layer response interaction result respectively based on the first-layer mapping representation of the context to obtain the second-layer question interaction result and the second-layer response interaction result, and pass them to the third-layer interaction structure. At the same time, a layer of fully connected network is used to map the first-layer mapping representation of the context to obtain the second-layer mapping representation of the context, and pass it to the third-layer interaction structure; and so on, repeated interactions are performed to generate the depth-th layer question interaction result, the depth-th layer response interaction result and the depth-th layer mapping result of the context;
[0038] Feature aggregation: Use adaptive average pooling to perform feature filtering on the depth-th layer question interaction result, depth-th layer response interaction result, and depth-th layer mapping representation of the context, and concatenate the three filtered feature representations to obtain the final aggregated feature representation, which is recorded as
[0039] Label prediction: based on the final aggregated feature representation Determine whether the current response is a correct response.
[0040] Better yet, the Additive Triple-Attention interaction is as follows:
[0041] The first-layer interaction structure interacts with the question pooling feature representation and the response pooling feature representation based on the context pooling feature representation to obtain the first-layer question interaction result and the first-layer response interaction result, denoted as and The context pooling feature representation is mapped through a layer of fully connected network to obtain the first layer mapping representation of the context, which is recorded as The formula is as follows:
[0042]
[0043]
[0044]
[0045] in, and They respectively represent the context pooling feature representation, question pooling feature representation, and response pooling feature representation obtained after being processed by the feature filtering module; Indicates the use Interactive operations are performed on question pooling feature representation and response pooling feature representation based on context pooling feature representation; Indicates the use Based on the context pooling feature representation, the response pooling feature representation and the question pooling feature representation are interactively operated; Indicates the use of fully connected Dense 1 Perform mapping operations on the contextual pooled feature representation;
[0046] The first-level question interaction results, the first-level response interaction results and the first-level mapping of the context are represented as follows: and The second-layer interaction structure is passed to the second-layer interaction structure; the second-layer interaction structure interacts with the first-layer question interaction result and the first-layer response interaction result based on the first-layer mapping representation of the context to obtain the second-layer question interaction result and the second-layer response interaction result, which are recorded as and The first-layer mapping representation of the context is mapped through a layer of fully connected network to obtain the second-layer mapping representation of the context, denoted as The formula is as follows:
[0047]
[0048]
[0049]
[0050] in, Indicates the use The first-layer mapping based on context represents the interactive operation of the first-layer question interaction results and the first-layer response interaction results; Indicates the use The first-layer mapping based on context represents the interactive operation of the first-layer response interaction results and the first-layer question interaction results; Indicates the use of Dense 2 Performing a mapping operation on the second-layer mapping representation of the context;
[0051] The second-level question interaction results, the second-level response interaction results and the second-level mapping of the context are represented as: and Passed to the third layer interaction structure; and so on, repeated interactions are performed to generate the depth-th layer question interaction representation, the depth-th layer response interaction representation, and the depth-th layer mapping representation of the context; for the depth-th layer, the formula is as follows:
[0052]
[0053]
[0054]
[0055] in, Indicates the use The context-based depth-1 layer mapping represents the interactive operation of the depth-1 layer question interaction result and the depth-1 layer response interaction result; Indicates the use The context-based depth-1 layer mapping represents the interactive operation of the depth-1 layer response interaction result and the depth-1 layer question interaction result; Indicates the use of Dense depth Performs a mapping operation on the depth-1th mapping representation of the context.
[0056] Preferably, the training of the retrieval-based multi-round dialogue model is as follows:
[0057] Construct loss function: cross entropy is used as the loss function;
[0058] Constructing the optimization function: After testing various optimization functions, we finally chose to use the BertAdam optimization function as the optimization function for the retrieval-based multi-round dialogue model. Except for the learning rate being set to 1e-5, the other hyperparameters of BertAdam were set to the default values in pytorch.
[0059] When the retrieval-based multi-round dialogue model has not been trained, further training is required to optimize the parameters of the retrieval-based multi-round dialogue model; when the retrieval-based multi-round dialogue model is trained, it can predict which of the candidate responses is the correct response.
[0060] A retrieval-based multi-round dialogue system, the system comprising:
[0061] A data set acquisition unit, used to download the publicly available search-based multi-round dialogue data set from the Internet;
[0062] Model building unit, used to build a retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism;
[0063] The model training unit is used to train the constructed retrieval-based multi-turn dialogue model on the retrieval-based multi-turn dialogue training dataset.
[0064] Preferably, the model building unit comprises:
[0065] Input module, used to preprocess the original data set to construct input data;
[0066] A pre-trained embedding representation module is used to perform embedding encoding operations on input data using a pre-trained language model, thereby obtaining embedding representations of context, questions, and responses in the input data;
[0067] A feature filtering module is used to perform feature filtering operations on the embedded representations of context, question, and response using an adaptive average pooling operation to obtain corresponding feature pooling representations;
[0068] The Additive Triple-Attention interaction module is used to repeatedly interact the context pooling feature representation, question pooling feature representation and response pooling feature representation to generate the depth-th layer question interaction result, the depth-th layer response interaction result and the depth-th layer mapping result of the context;
[0069] a feature aggregation module, configured to perform feature filtering operations on the depth-th layer question interaction results, the depth-th layer response interaction results, and the depth-th layer mapping results of the context using an adaptive average pooling operation, and concatenate the filtered depth-th layer question interaction results, the depth-th layer response interaction results, and the depth-th layer mapping results of the context to obtain a final aggregated feature representation;
[0070] The label prediction module is used to determine whether the current response is a correct response based on the final aggregated feature representation.
[0071] More preferably, the model training unit includes:
[0072] The loss function building block is used to calculate the error between the predicted results and the true data using the cross entropy loss function.
[0073] The optimization function building module is used to train and adjust the parameters in model training to reduce the prediction error.
[0074] An electronic device comprising: a memory and at least one processor;
[0075] Wherein, the memory stores a computer program;
[0076] The at least one processor executes the computer program stored in the memory, so that the at least one processor performs the above-mentioned retrieval-based multi-round dialogue method.
[0077] A computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the above-mentioned retrieval-based multi-round dialogue method.
[0078] The retrieval-based multi-round dialogue method and system of the present invention have the following advantages:
[0079] (i) The present invention uses natural language processing technology to select matching answers from existing question and answer results for users and recommend them to users, thereby reducing the workload of manual customer service and reducing labor costs, while improving the accuracy of the dialogue system and solving the problem of inefficient question answering;
[0080] (ii) The present invention combines the Additive Triple-Attention mechanism to effectively improve the accuracy of sequence interaction in retrieval-based multi-round dialogues. At the same time, it can use context information to strengthen the dialogue sequence interaction process and realize direct interaction between the three sequences, thereby improving the accuracy of the dialogue system.
[0081] (III) The present invention can capture and utilize the semantic information contained in the sentence through pre-training embedding representation processing, so that the captured semantic features are richer and more accurate;
[0082] (iv) The present invention can effectively filter out useless information through feature filtering, reduce sequence length, and thus reduce the cost of training the model;
[0083] (V) The present invention can add context information to the sequence interaction process through Additive Triple-Attention interaction, thereby realizing the direct interaction of three sequences and making the sequence interaction more complete;
[0084] (vi) The Additive Triple-Attention interaction proposed in the present invention is implemented based on tensor addition, so the simplicity of the additive calculation method can be utilized to improve the reasoning efficiency of the model;
[0085] (VII) The present invention can aggregate and utilize multiple features through feature aggregation, thereby improving the accuracy of retrieval-based multi-round dialogues. BRIEF DESCRIPTION OF THE DRAWINGS
[0086] The present invention is further described below in conjunction with the accompanying drawings.
[0087] Attached Figure 1 This is a flowchart of the retrieval-based multi-round dialogue method;
[0088] Attached Figure 2 A flowchart for building a retrieval-based multi-round dialogue model;
[0089] Attached Figure 3 This is a flowchart for training a retrieval-based multi-round dialogue model;
[0090] Attached Figure 4 This is the structural block diagram of the retrieval-based multi-turn dialogue system;
[0091] Attached Figure 5 Schematic diagram of Additive Triple-Attention interaction;
[0092] Attached Figure 6 This is a schematic diagram of the retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism. DETAILED DESCRIPTION
[0093] The search-based multi-round dialogue method and system of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments.
[0094] Example:
[0095] As attached Figure 1 As shown, this embodiment provides a search-based multi-round dialogue method, which is specifically as follows:
[0096] S1. Obtain a retrieval-based multi-round dialogue dataset: Download a publicly available retrieval-based multi-round dialogue dataset from the Internet;
[0097] For example, there are many publicly available searchable multi-turn dialogue datasets on the Internet, such as the Ubuntu DialogueCorpus dataset. The data format in this dataset is as follows:
[0098]
[0099] In the training set and validation set, for the same historical dialogue sequence, there is only one correct response (Positive (label: 1)) and nine incorrect responses (negative (label: 0)); in the test set, there is only one correct response (Positive (label: 1)) and one incorrect response (negative (label: 0)).
[0100] S2. Build a retrieval-based multi-round dialogue model: Build a retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism;
[0101] S3. Train the retrieval-based multi-round dialogue model: Train the retrieval-based multi-round dialogue model on the retrieval-based multi-round dialogue training dataset.
[0102] The difference between the Additive Triple-Attention and Additive Attention algorithms is that the latter receives three inputs (query, key, and value) and can only calculate the attention weight between query and key, while the former can receive four inputs (query, key, value, and context) and calculate the attention weight between query, key, and context, where context represents the contextual information related to query and key. It should be noted that in AdditiveTriple-Attention and Additive Attention, the input value and key received are the same.
[0103] As attached Figure 5 As shown, the Additive Triple-Attention mechanism in this embodiment is an attention mechanism implemented based on the AdditiveAttention algorithm, and the specific implementation process is as follows:
[0104] (1) Calculate the correlation score between the input tensors query, key, and context as follows:
[0105] ① Perform additive operations on the three input tensors query, key, and context to achieve interactive calculations among query, key, and context. The formula is as follows:
[0106]
[0107] Among them, query represents the question information in multiple rounds of dialogue; key represents the response information in multiple rounds of dialogue; context represents the context information in multiple rounds of dialogue; and Respectively represent the input tensors query, key and context; i and j represent the input tensors and The element subscript, i = 1, 2, ..., I kl ; j = 1, 2, ..., J cl ;I kl and J cl Represents the input tensor respectively and The number of elements in , and Represents the parameters to be trained;
[0108] ② The correlation scores of query, key and context are obtained through normalization operation and recorded as α. The formula is as follows:
[0109]
[0110] Among them, i=1, 2,...,I kl ; i' = 1, 2, ..., I kl ; j = 1, 2, ..., J cl ; j' = 1, 2, ..., J cl ;
[0111] Example:
[0112] In pytorch, the code for the above operation is implemented as follows:
[0113] #Receive three inputs and map them to query, key and context in the above formula through different fully connected networks.
[0114] query_layer=self.query(sen1)
[0115] key_layer = self.key(sen2)
[0116] context_layer=self.context(context_sens)
[0117] #Implement the element-by-element addition operation between the three tensors query, key and context
[0118] key_context=unsqueeze(key_layer,dim=3)+unsqueeze(context_layer,dim=2)
[0119] key_context=key_context.view(key_context.size(0),key_context.size(1),
[0120] key_context.size(2)*key_context.size(3),key_context.size(4))
[0121] query_key_context=unsqueeze(query_layer,dim=3)+unsqueeze(key_context, dim=2)
[0122] query_key_context=query_key_context.view(query_key_context.size(0), query_key_context.size(1), query_key_context.size(2)*query_key_context.size(3), query_key_context.size(4))
[0123] #Normalize by softmax
[0124] query_key_context=self.add_dense(query_key_context)
[0125] attention_scores=self.add_dense_vt(nn.Tanh()(query_key_context))
[0126] attention_probs=nn.Softmax(dim=-1)(attention_scores)
[0127] Among them, sen1 represents the sen2 represents the context_sens represents the attention_scores represents the attention_probs represents the relevance score in the formula, which is α.
[0128] (2) Feature aggregation: Aggregate the input tensors value and context by adding them element by element. The formula is as follows:
[0129]
[0130] Among them, value represents the response information in multiple rounds of dialogue; and Respectively represent the input tensor value and context; i and j represent the input tensor and The element subscript, i = 1, 2, ..., I vl ; j = 1, 2, ..., J cl ; I vl and J cl Represents the input tensor respectively and The number of elements in ;
[0131] Example:
[0132] In pytorch, the code described above is implemented as follows:
[0133] #Perform aggregation operations on value and context by adding elements one by one
[0134] value_context=unsqueeze(key_layer,dim=3)+unsqueeze(context_layer,dim=2)
[0135] value_context=value_context.view(value_context.size(0), value_context.size(1),
[0136] value_context.size(2)*value_context.size(3),value_context.size(4))
[0137] Among them, value_context represents the aggregation result in the formula, that is, v'.
[0138] (3) Dot product operation: perform a dot product operation on the correlation score obtained in step (1) and the feature aggregation representation obtained in step (2) to obtain the context-enhanced attention embedding representation. The formula is as follows:
[0139]
[0140] Among them, i and j represent the element subscripts of α and v'; I and J represent the lengths of the two dimensions in the input tensors α and v';
[0141] For example, in pytorch, the code described above is implemented as follows:
[0142] #Perform dot product operations on the attention weights and aggregate representations of the three input tensors
[0143] query_new_layer=torch.matmul(attention_probs,value_context)
[0144] Among them, query_new_layer represents the interaction result in the formula, that is, q new .
[0145] Additive Triple-Attention is a stackable structure that can dynamically adjust the number of layers according to specific tasks, denoted as Depth indicates the specific number of layers set for a specific task; Corresponding to the three input tensors query, key and context; for the input tensor value, that is Its The same is omitted here.
[0146] When the Additive Triple-Attention mechanism is applied in the present invention, query represents the question information in multiple rounds of dialogue, such as question embedding representation, question pooling feature representation and the i-th layer question interaction result; key is the same as value, which represents the response information in multiple rounds of dialogue, such as response embedding representation, response pooling feature representation and the i-th layer response interaction result; context represents the context information in multiple rounds of dialogue, such as context embedding representation, context pooling feature representation and the i-th layer mapping result of the context.
[0147] As attached Figure 2 As shown, the construction of the search-based multi-round dialogue model in step S2 of this embodiment is specifically as follows:
[0148] S201, input data: For each piece of data in the data set, if the historical conversation contains n sentences, then join S1-S n-1 , sentences are separated by the separator "SEP", which is used as context and formalized as context; S n As a question, formalized as query; select a response from multiple responses as the current response, formalized as response; determine the label of the data according to whether the response is a correct response, that is, if the response is a correct response, it is recorded as 1; otherwise, it is recorded as 0; the three text sequences of context, query and response and the label together constitute an input data;
[0149] For example, use the data shown in S1 as an example to form an input data. The result is as follows:
[0150] (context: "hey guys i am trying to compile an application__path__wentwell and it created a__path__which takes some arguments but idont know how to use this file...can somebody givem me a hint SEP did n't__path__created amakefile SEP ikonia take a look at this__url__SEP it did but is does nothingSEP it just mentions make***no targets specified and no makefile foundstop."", query: "seems like __path__uses this..you do n't have to run thismanually", response: "look at the install file i think i just have to pass theright arguments", 1).
[0151] S202, pre-trained embedding representation: Use the pre-trained language model to perform embedding encoding operations on the constructed input data to obtain the embedded representations of the context, question and response in the input data, which are respectively denoted as and Among the three text sequences, context sequence, question sequence and response sequence, the context sequence uses a separate encoding module, while the question sequence and response sequence share a encoding module. Since the pre-trained language model itself contains a multi-layer encoding network, the output of different layers can be selected as its embedded representation according to different input objects. The formula is as follows:
[0152]
[0153] in, Indicates that the pre-trained language model BERT is used to embed the input context sequence context; the subscript n indicates the number of network layers inside BERT used; Embedded representations that represent context;
[0154]
[0155] in, Indicates that the pre-trained language model BERT is used to embed the input question sequence query; the subscript t indicates the number of network layers inside BERT used; Embedding representation of question sentence;
[0156]
[0157] in, Indicates that the input response sequence response is embedded and encoded using the pre-trained language model BERT; the subscript t indicates the number of network layers inside BERT used; Embedded representation of the response;
[0158] For example, when the present invention is implemented on the RACE dataset, n is set to 12 and t is set to 1. In pytorch, the code implementation described above is as follows:
[0159] #Use bert to encode the input
[0160] context_embed,_=BERT_n(context)
[0161] query_embed,_=BERT_t(query)
[0162] response_embed,_=BERT_t(response)
[0163] Among them, context_embed is the embedding representation of the context, query_embed is the embedding representation of the question, and response_embed is the embedding representation of the response.
[0164] S203, feature filtering: using adaptive average pooling operation to embed the context sequence, question sequence and response sequence and Perform feature filtering operations to obtain feature representations, namely context pooling feature representation, question pooling feature representation, and response pooling feature representation, which are denoted as and
[0165] For example, in pytorch, the code described above is implemented as follows:
[0166] # Use average pooling to filter the embedded representation
[0167] self.context_pool_adapt=AdaptiveAvgPool1d(output_size=64)
[0168] context_pool=torch.transpose(self.context_pool_adapt(torch.transpose(conte xt_embed,dim0=1,dim1=2)),dim0=1,dim1=2)
[0169] self.qr_pool_adapt=AdaptiveAvgPool1d(output_size=15)
[0170] query_pool=torch.transpose(self.qr_pool_adapt(torch.transpose(query_embed, dim0=1,dim1=2)), dim0=1, dim1=2)
[0171] response_pool=torch.transpose(self.qr_pool_adapt(torch.transpose(response_embed,dim0=1,dim1=2)),dim0=1,dim1=2)
[0172] Wherein, AdaptiveAvgPool1d() represents an adaptive average pooling operation, output_size represents the output dimension of the input data after being processed by the operation, in the present invention, the output dimension of the context representation is set to 64, and the output dimension of the question and response is set to 15, torch.transpose represents a transposition operation, context_pool represents the context pooling feature representation obtained after the embedding representation of the context is processed by adaptive average pooling, query_pool represents the question pooling feature representation obtained after the embedding representation of the question is processed by adaptive average pooling, and response_pool represents the response pooling feature representation obtained after the embedding representation of the response is processed by adaptive average pooling.
[0173] S204, Additive Triple-Attention interaction: take context pooling feature representation, question pooling feature representation and response pooling feature representation as input; the first-layer interaction structure interacts with question pooling feature representation and response pooling feature representation respectively based on context pooling feature representation to obtain first-layer question interaction result and first-layer response interaction result, and pass them to the second-layer interaction structure, and use a layer of fully connected network to map context pooling feature representation to obtain first-layer mapping representation of context, and pass it to the second-layer interaction structure; the second-layer interaction structure interacts with first-layer question interaction result and first-layer response interaction result respectively based on first-layer mapping representation of context to obtain second-layer question interaction result and second-layer response interaction result, and pass them to the third-layer interaction structure, and use a layer of fully connected network to map first-layer mapping representation of context to obtain second-layer mapping representation of context, and pass it to the third-layer interaction structure; and so on, repeatedly interact to generate depth-th layer question interaction result, depth-th layer response interaction result and depth-th layer mapping result of context;
[0174] S205, feature aggregation: Use adaptive average pooling operation to perform feature filtering operation on the depth-th layer question interaction result, the depth-th layer response interaction result and the depth-th layer mapping representation of the context, and connect the three filtered feature representations to obtain the final aggregated feature representation, which is recorded as
[0175] For example, in pytorch, the code described above is implemented as follows:
[0176] query_out=torch.squeeze(self.pool_qo(torch.transpose(query_inter,dim0=1, dim1=2)),dim=-1)
[0177] response_out=torch.squeeze(self.pool_qo(torch.transpose(response_inter, dim0=1,dim1=2)),dim=-1)
[0178] context_out=torch.squeeze(self.pool_qo(torch.transpose(context_dense, dim0=1,dim1=2)),dim=-1)
[0179] # Feature aggregation through join operation
[0180] feature=torch.cat([query_out,response_out,context_out],dim=-1)
[0181] Among them, query_out is the question feature representation after the average pooling operation on the depth-th layer question interaction results, response_inter is the response feature representation after the average pooling operation on the depth-th layer response interaction results, context_dense is the context feature representation after the average pooling operation on the depth-th layer mapping representation of the context, and feature is the final aggregated feature representation.
[0182] S206. Label prediction: based on the final aggregated feature representation Determine whether the current response is a correct response.
[0183] The final aggregated feature representation is processed by a fully connected network with a dimension of 1 and an activation function of sigmoid to obtain the probability that the current response is the correct response.
[0184] The Additive Triple-Attention interaction in step S204 of this embodiment is specifically as follows:
[0185] S20401, the first-layer interaction structure interacts with the question pooling feature representation and the response pooling feature representation based on the context pooling feature representation to obtain the first-layer question interaction result and the first-layer response interaction result, denoted as and The context pooling feature representation is mapped through a layer of fully connected network to obtain the first layer mapping representation of the context, which is recorded as The formula is as follows:
[0186]
[0187]
[0188]
[0189] in, and They respectively represent the context pooling feature representation, question pooling feature representation, and response pooling feature representation obtained after being processed by the feature filtering module; Indicates the use Interactive operations are performed on question pooling feature representation and response pooling feature representation based on context pooling feature representation; Indicates the use Based on the context pooling feature representation, the response pooling feature representation and the question pooling feature representation are interactively operated; Indicates the use of fully connected Dense 1 Perform mapping operations on the contextual pooled feature representation;
[0190] S20402, the first-layer question interaction result, the first-layer response interaction result and the first-layer mapping representation of the context, that is, and The second-layer interaction structure is passed to the second-layer interaction structure; the second-layer interaction structure interacts with the first-layer question interaction result and the first-layer response interaction result based on the first-layer mapping representation of the context to obtain the second-layer question interaction result and the second-layer response interaction result, which are recorded as and The first-layer mapping representation of the context is mapped through a layer of fully connected network to obtain the second-layer mapping representation of the context, denoted as The formula is as follows:
[0191]
[0192]
[0193]
[0194] in, Indicates the use The first-layer mapping based on context represents the interactive operation of the first-layer question interaction results and the first-layer response interaction results; Indicates the use The first-layer mapping based on context represents the interactive operation of the first-layer response interaction results and the first-layer question interaction results; Indicates the use of Dense 2 Performing a mapping operation on the second-layer mapping representation of the context;
[0195] S20403, the second-layer question interaction result, the second-layer response interaction result and the second-layer mapping representation of the context, that is, and Pass it to the third-layer interaction structure; and so on, repeatedly interact to generate the depth-th layer question interaction representation, the depth-th layer response interaction representation, and the depth-th layer mapping representation of the context; for the depth-th layer, the formula is as follows:
[0196]
[0197]
[0198]
[0199] in, Indicates the use The context-based depth-1 layer mapping represents the interactive operation of the depth-1 layer question interaction result and the depth-1 layer response interaction result; Indicates the use The context-based depth-1 layer mapping represents the interactive operation of the depth-1 layer response interaction result and the depth-1 layer question interaction result; Indicates the use of Dense depth Performs a mapping operation on the depth-1th mapping representation of the context.
[0200] For example, in pytorch, the code described above is implemented as follows:
[0201]
[0202] Among them, query_inter is the i-th layer question interaction result, response_inter is the i-th layer response interaction result, context_dense is the i-th layer mapping representation of the context, depth is the number of layers when the structure achieves the optimal result on the data set. In the present invention, depth is set to 2.
[0203] It is implemented based on the AdditiveTriple-Attention mechanism; the process of the Additive Triple-Attention algorithm includes three steps. The first step is to calculate the correlation score of the context embedding representation, question embedding representation and response embedding representation. The second step is to perform feature aggregation operation on the context embedding representation and response embedding representation. The third step is to perform a dot product operation on the correlation score obtained in the first step and the feature aggregation representation obtained in the second step to obtain the question interaction result. Additive Triple-Attention mechanism; the context embedding representation, question embedding representation and response embedding representation correspond to context, key and query respectively.
[0204] As attached Figure 3 As shown, the training retrieval-based multi-round dialogue model in step S3 of this embodiment is specifically as follows:
[0205] S301, construct loss function: cross entropy is used as loss function;
[0206] For example, in pytorch, the code described above is implemented as follows:
[0207] # Calculate the error between the predicted value and the label through the cross entropy loss function
[0208] loss_fct = CrossEntropyLoss()
[0209] loss=loss_fct(logits.view(-1,self.num_labels),labels.view(-1))
[0210] Among them, labels are the real labels and logits are the correct probabilities output by the model.
[0211] S302. Constructing an optimization function: After testing a variety of optimization functions, we finally choose to use the BertAdam optimization function as the optimization function of the retrieval-based multi-round dialogue model. Except for setting its learning rate to 1e-5, the other hyperparameters of BertAdam are set to the default values in pytorch.
[0212] For example, in pytorch, the code described above is implemented as follows:
[0213] #Optimize model parameters through BertAdam optimizer
[0214] optimizer=BertAdam(optimizer_grouped_parameters,lr=2e-5)
[0215] Among them, optimizer_grouped_parameters are the parameters to be optimized, and the default is all the parameters in this model.
[0216] When the retrieval-based multi-round dialogue model has not been trained, step S3 needs to be further executed for training to optimize the parameters of the retrieval-based multi-round dialogue model; when the retrieval-based multi-round dialogue model is trained, step S206 can be executed to predict which of the candidate responses is the correct response.
[0217] Embodiment 2:
[0218] As attached Figure 4 As shown, this embodiment provides a retrieval-based multi-round dialogue system, which includes:
[0219] A data set acquisition unit, used to download the publicly available search-based multi-round dialogue data set from the Internet;
[0220] Model building unit, used to build a retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism;
[0221] The model training unit is used to train the constructed retrieval-based multi-turn dialogue model on the retrieval-based multi-turn dialogue training dataset.
[0222] As attached Figure 6 As shown, the model building unit in this embodiment includes:
[0223] Input module, used to preprocess the original data set to construct input data;
[0224] A pre-trained embedding representation module is used to perform embedding encoding operations on input data using a pre-trained language model, thereby obtaining embedding representations of context, questions, and responses in the input data;
[0225] A feature filtering module is used to perform feature filtering operations on the embedded representations of context, question, and response using an adaptive average pooling operation to obtain corresponding feature pooling representations;
[0226] The Additive Triple-Attention interaction module is used to repeatedly interact the context pooling feature representation, question pooling feature representation and response pooling feature representation to generate the depth-th layer question interaction result, the depth-th layer response interaction result and the depth-th layer mapping result of the context;
[0227] a feature aggregation module, configured to perform feature filtering operations on the depth-th layer question interaction results, the depth-th layer response interaction results, and the depth-th layer mapping results of the context using an adaptive average pooling operation, and concatenate the filtered depth-th layer question interaction results, the depth-th layer response interaction results, and the depth-th layer mapping results of the context to obtain a final aggregated feature representation;
[0228] The label prediction module is used to determine whether the current response is a correct response based on the final aggregated feature representation.
[0229] The pre-trained embedding representation module performs embedding encoding processing on the input context sequence, question sequence and response sequence to obtain their respective embedded encoding representations, and passes them to the feature filtering module of the model. The feature filtering module performs average pooling operation on the embedded encoding representations of the three to obtain filtered feature representations, namely context representation, question representation and response representation, and passes them to the Additive Triple-Attention interaction module. The Additive Triple-Attention interaction module is a stackable module with controllable number of layers. It receives the feature representation output by the feature filtering module, performs interaction operations on the context representation, question representation and response representation through the Additive Triple-Attention mechanism, and passes the result to the feature aggregation module. The feature aggregation module performs average pooling processing on the question representation and response representation after interaction, and connects them with the context representation that has also been processed by average pooling to obtain the final feature representation, and passes it to the label prediction module. The label prediction module maps the feature representation to a floating-point value in a specified interval and uses it as the matching degree of the response to the question; then compares the matching degrees of different responses, and takes the response with the highest matching degree as the correct answer.
[0230] The model training unit in this embodiment includes:
[0231] The loss function building block is used to calculate the error between the predicted results and the true data using the cross entropy loss function.
[0232] The optimization function building module is used to train and adjust the parameters in model training to reduce the prediction error.
[0233] Embodiment 3:
[0234] This embodiment also provides an electronic device, including: a memory and a processor;
[0235] Wherein, the memory stores computer-executable instructions;
[0236] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the search-based multi-round dialogue method in any embodiment of the present invention.
[0237] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.
[0238] The memory can be used to store computer programs and / or modules. The processor realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state storage devices.
[0239] Embodiment 4:
[0240] This embodiment also provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions are loaded by a processor, so that the processor executes the search-based multi-round dialogue method in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code that implements the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.
[0241] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0242] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0243] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0244] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0245] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A search-based multi-round dialogue method, characterized in that: The method is as follows: Obtain a retrieval-based multi-turn dialogue dataset: Download the publicly available retrieval-based multi-turn dialogue dataset from the Internet; Construct a retrieval-based multi-round dialogue model: Construct a retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism; Train the retrieval-based multi-turn dialogue model: Train the retrieval-based multi-turn dialogue model on the retrieval-based multi-turn dialogue training dataset; Among them, the Additive Triple-Attention mechanism is an attention mechanism based on the Additive Attention algorithm. The specific implementation process is as follows: (1) Calculate the correlation score between the input tensors query, key, and context as follows: ① Perform additive operations on the three input tensors query, key, and context to achieve interactive calculations among query, key, and context. The formula is as follows: Among them, query represents the question information in multiple rounds of dialogue; key represents the response information in multiple rounds of dialogue; context represents the context information in multiple rounds of dialogue; and Respectively represent the input tensors query, key, and context; i, and j represent the input tensors and The element subscript, i = 1, 2, ..., I kl ; j = 1, 2, ..., J cl ;I kl and J cl Represents the input tensor respectively and The number of elements in , and Represents the parameters to be trained; ② The correlation scores of query, key and context are obtained through normalization operation and recorded as α. The formula is as follows: where \(i = 1, 2, \ldots, I\) kl ; \(i' = 1, 2, \ldots, I\) kl ; \(j = 1, 2, \ldots, J\) cl ; \(j' = 1, 2, \ldots, J\) cl ; (2) Feature aggregation: Aggregate the input tensors value and context by adding them element by element. The formula is as follows: Among them, value represents the response information in multiple rounds of dialogue, which is the same as the input tensor key; and Respectively represent the input tensor value and context; i and j represent the input tensor and The element subscript, i = 1, 2, ..., I vl ; j = 1, 2, ..., J cl ;I vl and J cl Represents the input tensor respectively and The number of elements in ; (3) Dot product operation: Perform a dot product operation on the correlation score obtained in step (1) and the feature aggregation representation obtained in step (2) to obtain the context-enhanced attention embedding representation. The formula is as follows: Among them, i and j represent the element subscripts of α and v'; I and J represent the lengths of the two dimensions in the input tensors α and v'; Additive Triple-Attention is a stackable structure that dynamically adjusts the number of layers according to specific tasks, denoted as Depth indicates the specific number of layers set for a specific task; Corresponding to three input tensors query, key and context; the input tensor value is the same as the key; The details of building a retrieval-based multi-round dialogue model are as follows: Input data: For each piece of data in the dataset, if the historical conversation contains n sentences, then join S1-S n-1 , sentences are separated by the separator "SEP", which is used as context and formalized as context; S n As a question, it is formalized as query; select a response from multiple responses as the current response, formalized as response; determine the label of the data according to whether the response is a correct response, that is, if the response is a correct response, it is recorded as 1; otherwise, it is recorded as 0; the three text sequences of context, query and response and the label together constitute an input data; Pre-trained embedding representation: Use the pre-trained language model to perform embedding encoding operations on the constructed input data to obtain the embedded representations of the context, question, and response in the input data, which are recorded as and Among the three text sequences, context sequence, question sequence and response sequence, the context sequence uses a separate encoding module, while the question sequence and response sequence share a encoding module. According to different input objects, the output of different layers is selected as its embedding representation. The formula is as follows: in, Indicates that the pre-trained language model BERT is used to embed the input context sequence context; the subscript n indicates the number of network layers inside BERT used; Embedded representations that represent context; in, Indicates that the pre-trained language model BERT is used to embed the input question sequence query; the subscript t indicates the number of network layers inside BERT used; Embedding representation of question sentence; in, Indicates that the input response sequence response is embedded and encoded using the pre-trained language model BERT; the subscript t indicates the number of network layers inside BERT used; Embedded representation of the response; Feature filtering: Embedding representations of context sequences, question sequences, and response sequences using adaptive average pooling operations and Perform feature filtering operations to obtain feature representations, namely context pooling feature representation, question pooling feature representation, and response pooling feature representation, which are denoted as and Additive Triple-Attention interaction: Take context pooling feature representation, question pooling feature representation and response pooling feature representation as input; the first-layer interaction structure interacts with question pooling feature representation and response pooling feature representation respectively based on context pooling feature representation to obtain the first-layer question interaction result and the first-layer response interaction result, and pass them to the second-layer interaction structure. At the same time, a layer of fully connected network is used to map the context pooling feature representation to obtain the first-layer mapping representation of the context, and pass it to the second-layer interaction structure; the second-layer interaction structure interacts with the first-layer question interaction result and the first-layer response interaction result respectively based on the first-layer mapping representation of the context to obtain the second-layer question interaction result and the second-layer response interaction result, and pass them to the third-layer interaction structure. At the same time, a layer of fully connected network is used to map the first-layer mapping representation of the context to obtain the second-layer mapping representation of the context, and pass it to the third-layer interaction structure; and so on, repeated interactions are performed to generate the depth-th layer question interaction result, the depth-th layer response interaction result and the depth-th layer mapping result of the context; Feature aggregation: Use adaptive average pooling to perform feature filtering on the depth-th layer question interaction result, depth-th layer response interaction result, and depth-th layer mapping representation of the context, and concatenate the three filtered feature representations to obtain the final aggregated feature representation, which is denoted as Label prediction: based on the final aggregated feature representation Determine whether the current response is a correct response.
2. The search-based multi-round dialogue method according to claim 1, characterized in that: The Additive Triple-Attention interactions are as follows: The first-layer interaction structure interacts with the question pooling feature representation and the response pooling feature representation based on the context pooling feature representation to obtain the first-layer question interaction result and the first-layer response interaction result, denoted as and The context pooling feature representation is mapped through a layer of fully connected network to obtain the first layer mapping representation of the context, which is recorded as The formula is as follows: in, and They respectively represent the context pooling feature representation, question pooling feature representation, and response pooling feature representation obtained after being processed by the feature filtering module; Indicates the use Interactive operations are performed on question pooling feature representation and response pooling feature representation based on context pooling feature representation; Indicates the use Based on the context pooling feature representation, the response pooling feature representation and the question pooling feature representation are interactively operated; Indicates the use of fully connected Dense 1 Perform mapping operations on the contextual pooled feature representation; The first-level question interaction results, the first-level response interaction results and the first-level mapping of the context are represented as follows: and The second-layer interaction structure is passed to the second-layer interaction structure; the second-layer interaction structure interacts with the first-layer question interaction result and the first-layer response interaction result based on the first-layer mapping representation of the context to obtain the second-layer question interaction result and the second-layer response interaction result, which are recorded as and The first-layer mapping representation of the context is mapped through a layer of fully connected network to obtain the second-layer mapping representation of the context, denoted as The formula is as follows: in, Indicates the use The first-layer mapping based on context represents the interactive operation of the first-layer question interaction results and the first-layer response interaction results; Indicates the use The first-layer mapping based on context represents the interactive operation of the first-layer response interaction results and the first-layer question interaction results; Indicates the use of Dense 2 Performing a mapping operation on the second-layer mapping representation of the context; The second-level question interaction results, the second-level response interaction results and the second-level mapping of the context are represented as: and Pass it to the third-layer interaction structure; and so on, repeatedly interact to generate the depth-th layer question interaction representation, the depth-th layer response interaction representation, and the depth-th layer mapping representation of the context; for the depth-th layer, the formula is as follows: in, Indicates the use The context-based depth-1 layer mapping represents the interactive operation of the depth-1 layer question interaction result and the depth-1 layer response interaction result; Indicates the use The context-based depth-1 layer mapping represents the interactive operation of the depth-1 layer response interaction result and the depth-1 layer question interaction result; Indicates the use of Dense depth Performs a mapping operation on the depth-1th mapping representation of the context.
3. The search-based multi-round dialogue method according to claim 1 or 2, characterized in that: The specific steps for training the retrieval-based multi-round dialogue model are as follows: Construct loss function: cross entropy is used as the loss function; Constructing the optimization function: After testing various optimization functions, we finally chose to use the BertAdam optimization function as the optimization function for the retrieval-based multi-round dialogue model. Except for the learning rate being set to 1e-5, the other hyperparameters of BertAdam were set to the default values in pytorch. When the retrieval-based multi-round dialogue model has not been trained, further training is required to optimize the parameters of the retrieval-based multi-round dialogue model; when the retrieval-based multi-round dialogue model is trained, it can predict which of the candidate responses is the correct response.
4. A search-based multi-round dialogue system using the search-based multi-round dialogue method according to any one of claims 1 to 3, characterized in that: The system includes, A data set acquisition unit, used to download the publicly available search-based multi-round dialogue data set from the Internet; Model building unit, used to build a retrieval-based multi-round dialogue model based on the Additive Triple-Attention mechanism; The model training unit is used to train the constructed retrieval-based multi-turn dialogue model on the retrieval-based multi-turn dialogue training dataset.
5. The search-based multi-round dialogue system according to claim 4, characterized in that: The model building unit includes: Input module, used to preprocess the original data set to construct input data; A pre-trained embedding representation module is used to perform embedding encoding operations on input data using a pre-trained language model, thereby obtaining embedding representations of context, questions, and responses in the input data; A feature filtering module is used to perform feature filtering operations on the embedded representations of context, question, and response using an adaptive average pooling operation to obtain corresponding feature pooling representations; The Additive Triple-Attention interaction module is used to repeatedly interact the context pooling feature representation, question pooling feature representation and response pooling feature representation to generate the depth-th layer question interaction result, the depth-th layer response interaction result and the depth-th layer mapping result of the context; A feature aggregation module is used to perform feature filtering operations on the depth-th layer question interaction results, the depth-th layer response interaction results, and the depth-th layer mapping results of the context using an adaptive average pooling operation, and concatenate the filtered depth-th layer question interaction results, the depth-th layer response interaction results, and the depth-th layer mapping results of the context to obtain the final aggregated feature representation; The label prediction module is used to determine whether the current response is a correct response based on the final aggregated feature representation.
6. The search-based multi-round dialogue system according to claim 4 or 5, characterized in that: The model training unit includes: The loss function building module is used to calculate the error between the predicted results and the real data using the cross entropy loss function; The optimization function building module is used to train and adjust the parameters in model training to reduce the prediction error.
7. An electronic device, characterized in that: include: memory and at least one processor; Wherein, the memory stores a computer program; The at least one processor executes the computer program stored in the memory, so that the at least one processor performs the search-based multi-turn dialogue method according to any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the search-based multi-round dialogue method according to any one of claims 1 to 3.
