Self-learning-based temporal weighting difference perception reply generation method and system

By employing a time-weighted difference-aware response generation method based on autostep learning, and utilizing a deep learning network model to select background knowledge and generate responses, the problem of meaningless responses in generative dialogue systems is solved, improving the accuracy and semantic understanding of responses and achieving higher-quality dialogue generation.

CN116775839BActive Publication Date: 2026-02-17FUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310794750.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2026-02-17
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

Existing generative dialogue systems suffer from meaningless or empty responses when generating replies, and the models lack sufficient semantic understanding of the dialogue context and candidate knowledge when selecting knowledge, making them susceptible to noise interference and affecting the quality of the replies.

Method used

A time-weighted differential perception response generation method based on auto-learning is adopted. Dialogue data is collected from social platforms to construct a training dataset. A time-weighted differential perception deep learning network model is used to select background knowledge and generate responses. GRU and BiGRU are used to encode dialogue history information. Knowledge is selected by combining time decay weighting function and attention mechanism. A two-stage training strategy is adopted to optimize the generation process.

Benefits of technology

It improves the accuracy and quality of generated responses, enhances the model's semantic understanding of dialogue context and background knowledge, reduces noise interference, and generates more meaningful responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116775839B_ABST
    Figure CN116775839B_ABST
Patent Text Reader

Abstract

This invention relates to a time-weighted difference-aware response generation method and system based on auto-step learning. The method includes the following steps: Step A: Collect natural, open-domain dialogues from social media software, and use a retrieval system to search for relevant background knowledge of the dialogue in an encyclopedia, and label real responses and real knowledge to construct a training dataset. DE Step B: Using the training dataset DE Step C involves training a time-weighted difference-aware deep learning network model M based on a self-synchronizing learning strategy. This model selects necessary background knowledge and generates responses based on the selected background knowledge. Step C involves inputting the dialogue context and background knowledge base into the trained deep learning network model M to generate corresponding responses. This method and system help improve the accuracy of generated responses.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing, specifically relating to a time-weighted difference-aware response generation method and system based on self-step learning. Background Technology

[0002] Dialogue systems are a hot research topic in the field of natural language processing, aiming to enable machines to understand human conversations and mimic human language habits to converse with humans. With the development of natural speech processing technology, dialogue systems have made significant progress, and various dialogue systems are gradually entering people's work and lives. Examples include Apple's Siri, intelligent customer service on major e-commerce platforms, and intelligent voice navigation systems on map apps. Apple's Siri recognizes user commands through voice recognition to understand and meet user needs; intelligent customer service on e-commerce platforms analyzes the intent in user speech and provides corresponding purchase suggestions, return and exchange services, etc., improving the efficiency of communication between users and merchants while reducing the burden on human customer service personnel; intelligent navigation systems in map apps can recognize users' text or speech to determine their destination and navigate to the corresponding location via voice. Furthermore, some dialogue systems, such as Microsoft's Cortana and IBM Watson, not only provide services to users but can also engage in casual conversation to alleviate user emotions, demonstrating significant application value.

[0003] Currently, the main implementation methods for open-domain dialogue systems are retrieval-based dialogue and generative dialogue. Among them, generative dialogue has gradually become the mainstream development trend in the industry due to its high flexibility, diverse generated responses, and high versatility. With the continuous deepening of research on deep learning methods, many researchers have also applied deep learning models to the field of dialogue generation. Vinyals et al. proposed using LSTM as an encoder and decoder. The dialogue context is first input into the encoder for encoding, and then the encoded dialogue context information is input into the decoder to generate responses in sequence. This is the earliest generative multi-turn dialogue model based on the Seq2Seq framework, which opened the prelude to building generative dialogue systems using deep learning methods. Serban et al. further proposed models such as HRED, VHRED, and MrRNN based on the hierarchical Seq2Seq framework. These models can model the hierarchical structure of text sequences, which is more suitable for multi-turn dialogue scenarios. With the great success of Transformer in the field of NLP, pre-trained language generation models based on Transformer, such as GPT-2, PLATO, and ERNIE-GEN, have also become very popular. Pre-trained models, which are pre-trained on large corpora and then fine-tuned on specific tasks, can achieve good results in downstream tasks and have been widely used.

[0004] Further research revealed that models tend to generate meaningless and empty responses such as "I don't know" or "okay." To address this issue, some researchers have attempted to mimic the thought processes employed in human dialogue: when organizing conversations, people typically combine current dialogue information with relevant background knowledge to structure their language. Therefore, researchers have tried incorporating external knowledge into dialogue generation models to enhance the information content of generated responses, better meeting human needs. Dinan et al. first proposed further subdividing the dialogue generation task based on unstructured knowledge into two subtasks: knowledge selection and response generation. The former involves selecting suitable knowledge from a knowledge base for the next response, while the latter combines the selected knowledge to generate a natural response. This has become the main paradigm for solving the dialogue generation problem based on unstructured knowledge. For the knowledge selection task, some researchers have attempted to match dialogue context and background knowledge using different matching algorithms to obtain appropriate knowledge. Zhang et al. proposed a knowledge pre-selection method, using dialogue context as prior information and a dynamic bidirectional attention mechanism to select the most relevant knowledge from the text, constructing a dynamic word distribution based on background knowledge. Meng et al. treated the selection of knowledge in the current round and the tracking of knowledge selected in the previous round as a dual task and designed a dual knowledge interaction learning method to allow the two to learn from each other and optimize, thereby promoting their interaction. Zhao et al. were the first to use the pre-trained language model GPT-2 in a knowledge dialogue task and proposed an unsupervised joint optimization strategy based on reinforcement learning and curriculum learning to optimize the knowledge selection module and the response generation module, respectively.

[0005] Some researchers have also considered factors influencing the knowledge selection process as latent variables and employed latent variable modeling methods for knowledge selection. Lian et al. proposed using posterior knowledge distribution to guide knowledge selection, thereby generating more appropriate and informative responses in dialogues. Kim et al. proposed a latent variable model for continuous knowledge selection, which reduces the range of possible candidate knowledge and improves the accuracy of knowledge selection by modeling historical knowledge selection. Zhan et al. proposed a co-latent variable model that integrates knowledge selection and response generation in an independent but collaborative latent space to capture the correlation between knowledge selection and response generation. However, these models still suffer from insufficient semantic understanding of the dialogue context and candidate knowledge, and are susceptible to noise interference during training, all of which affect the quality of generated responses. Summary of the Invention

[0006] The purpose of this invention is to provide a time-weighted difference-aware response generation method and system based on self-step learning, which is beneficial to improving the accuracy of the generated response.

[0007] To achieve the above objectives, the technical solution adopted by this invention is: a time-weighted difference-aware response generation method based on self-stepping learning, comprising the following steps:

[0008] Step A: Collect natural, open-domain dialogues on social platforms, retrieve relevant background knowledge for the dialogues, and then label the real responses and real knowledge to construct the training dataset DE.

[0009] Step B: Train a time-weighted difference-aware deep learning network model M based on auto-learning using the training dataset DE. Use this model to select the required background knowledge and generate a response based on the selected background knowledge.

[0010] Step C: Input the dialogue context and background knowledge into the trained deep learning network model M to generate the corresponding response.

[0011] Furthermore, step B specifically includes the following steps:

[0012] Step B1: Initialize the encoding of all training samples in the training dataset DE to obtain the sentence representation vector of the current dialogue context. The sentence representation vector of the actual responses in this round Sentence representation vector of candidate knowledge in this round

[0013] Step B2: Convert the sentence representation vectors obtained in Step B1 for the current dialogue. And the sentence representation vector of the actual responses in this round. The dialogue history information is represented by GRU encoding. The candidate knowledge representation vector is encoded using BiGRU to obtain a vector representation r containing inter-sentence relation information. t ;

[0014] Step B3: Represent the sentences of the candidate knowledge selected by the previous M rounds of modeling. The candidate knowledge vector representation r of the current round, which contains inter-sentence relation information, obtained in step B2. t Differences are calculated, and the differences between different rounds are summed using a time-decay-based weighting function to obtain a difference representation of candidate knowledge.

[0015] Step B4: The knowledge selector will use the dialogue history information from the previous round. The sentences in the preceding dialogue represent vectors. The vectors are concatenated to form a query vector, and then the sentence representation vectors of the candidate knowledge are used. The difference information obtained in step B3 is concatenated to form the key vector of the knowledge selector. Its attention score is calculated, and the knowledge with the highest score is selected by the knowledge selector in this round.

[0016] Step B5: Employ a two-stage training strategy based on self-learning, and apply the knowledge selected in this round to different training stages. Or pseudo-true knowledge The decoder generates the response for this round based on the information input from the dialogue, and real knowledge is used in the pre-training phase. During the training and fine-tuning phase, a self-learning strategy is employed, and the use of real knowledge is determined based on the magnitude of the scoring function. Or the knowledge selected in this round The selected knowledge and contextual information are input into the decoder to generate the response y for this round. t ;

[0017] Step B6: When the change in loss value generated by the iteration of the deep learning network model is less than the given threshold, or when the maximum number of iterations is reached, the training process of the deep learning network model is terminated.

[0018] Furthermore, step B1 specifically includes the following steps:

[0019] Step B11: Traverse the training dataset DE, and after segmenting the dialogue content and knowledge and removing special symbols and stop words, each training sample in DE is represented as de = (x t ,y t ,k t ); where x t For the content of the dialogue above, y t For x t The corresponding set of real responses, k t This is the set of background knowledge corresponding to this round of dialogue;

[0020] The text content above the dialogue x t Represented as:

[0021]

[0022] in, For the dialogue above x t The i-th word in the string, i = 1, 2, ..., |x t |,x t For the dialogue above x t The number of words;

[0023] Real reply y t Represented as:

[0024]

[0025] in, To provide a true response to y t The i-th word in the string, i = 1, 2, ..., |y t |,|y t |For a genuine response y t The number of words;

[0026] Background knowledge set k t Represented as:

[0027]

[0028] Where N represents the number of candidate knowledge items in this round, and each candidate knowledge item... Represented as:

[0029]

[0030] in, For each candidate knowledge The j-th word in For candidate knowledge The number of words;

[0031] Step B12: Obtain the dialogue context from step B11. The dialogue context representation vector is obtained by encoding using BERT and then passing it through an average pooling layer. The calculation process is as follows:

[0032]

[0033]

[0034] Where MeanPool(·) represents the average pooling function;

[0035] Step B13: Obtain the dialogue text from step B11. The sentence representation vector of the actual response is obtained by encoding with BERT and then passing it through an average pooling layer. The calculation process is as follows:

[0036]

[0037]

[0038] Where MeanPool(·) represents the average pooling function;

[0039] Step B14: Background knowledge obtained in step B11 Each element is encoded using BERT, and then the sentence representation vectors of the candidate knowledge are obtained through an average pooling layer. The calculation process is as follows:

[0040]

[0041]

[0042] MeanPool(·) represents the average pooling function.

[0043] Furthermore, step B2 specifically includes the following steps:

[0044] Step B21: Vector representation of the dialogue context using GRU Vector representation of the actual response Encode the dialogue history information to obtain a representation. The calculation process is as follows:

[0045]

[0046] Step B22: The sentence representation vectors of the candidate knowledge obtained in step B14 are further encoded using BiGRU to obtain candidate knowledge vector representations that are aware of inter-sentence relationships. The calculation process is as follows:

[0047]

[0048] Furthermore, step B3 specifically includes the following steps:

[0049] Step B31: Calculate the weight λ for each round using the time decay function. m The calculation process is as follows:

[0050]

[0051] f(m)=e -αm

[0052] Step B32: Incorporate the knowledge selected in the previous M rounds of model selection. The difference between the candidate knowledge vector representation obtained in step B22 and the one obtained in step B31 is calculated, and the result λ is used to calculate the difference. m We perform a weighted summation of the difference information from different rounds to obtain the difference information representation of candidate knowledge. The calculation results are as follows:

[0053]

[0054] Diff(a,b)=FullConnect([ab;a⊙b])

[0055] Where, ; represents the connection operation, FullConnect(·) is a fully connected layer activated by tanh, and α is the attenuation coefficient.

[0056] Furthermore, step B4 specifically includes the following steps:

[0057] Step B41: The knowledge selector uses the dialogue history information obtained in step B21. And the context vector of the current dialogue obtained in step B12 The concatenation is used as the query, and the difference information obtained in step B32 and the candidate knowledge vector obtained in step B14 are used as the key. The knowledge selection distribution is obtained by calculating the attention score. The calculation process is as follows:

[0058]

[0059] Where tanh(·) is the activation function, W que W key v T These are trainable parameters; represents the vector concatenation operation.

[0060] Step B42: Select and distribute the knowledge obtained in step B41. Perform a normalization operation and select the knowledge with the highest probability as the knowledge to be selected by the knowledge selector in this round. The calculation process is as follows:

[0061]

[0062]

[0063] Here, softmax() is the normalization function, and argmax() is the function that finds the maximum value of the function corresponding to the independent variable.

[0064] Step B43: Train the knowledge selector using cross-entropy loss. The calculation process is as follows:

[0065]

[0066] in, Represents cross-entropy loss, It is a real knowledge tag. This represents the selection distribution of the knowledge selector.

[0067] Furthermore, step B5 specifically includes the following steps:

[0068] Step B51: Employ a two-stage training method based on a self-tracking learning strategy. The pre-training stage uses real knowledge. Alternative choice knowledge During the response generation and fine-tuning phase, a self-learning strategy is employed to process the knowledge selected by the knowledge selector. Treat it as a complex sample, and apply real knowledge. Treating the sample as a simple sample, the loss of the student's knowledge selector is used as the score for self-paced learning, and a weight V is set to indicate whether complex samples should be used for response generation. The calculation of V is as follows:

[0069]

[0070]

[0071] δ=h(T)=δ0e T

[0072] Step B52: Select the knowledge The dialogue above x t The input is concatenated, and the Transformer decoder, which combines a copying mechanism, generates the response for this round. The process is as follows:

[0073]

[0074]

[0075]

[0076]

[0077]

[0078]

[0079] Here, ; indicates a concatenation operation, and TransformerDecoder() represents a Transformer decoder. This is the hidden vector of the nth word in the current round of responses. MultHead() represents the multi-head attention mechanism. Represents a vocabulary list. It is the final generated distribution;

[0080] Step B53: Calculate and generate the loss value based on the weight V obtained in step B51. The calculation formula is as follows:

[0081]

[0082]

[0083]

[0084] Step B54: The sum of the knowledge selection loss obtained in step B43 and the generation loss obtained in step B53 is used as the total loss. The model parameters are iteratively updated using backpropagation to train the model by minimizing the loss function. The total loss is calculated as follows:

[0085]

[0086] The present invention also provides a time-weighted difference-aware response generation system based on self-stepping learning employing the above method, comprising:

[0087] The data collection module is used to extract dialogue content and background knowledge from open-domain dialogues on social platforms, and to label real responses and real knowledge to build a training set.

[0088] The preprocessing module is used to preprocess the training samples in the training set, including word segmentation and stop word removal.

[0089] The encoding module is used to find the word vectors of words in the pre-processed input content, response content, and background knowledge content in the pre-trained word vector matrix, and encode this information to obtain the representation vectors of the input content, response content, and background knowledge.

[0090] The difference information construction module calculates the difference between the knowledge selected in previous rounds and the candidate knowledge in the current round, and uses a time decay weighting function to weight and sum the difference information of different rounds to obtain the difference information representation of the knowledge in this round.

[0091] The network model training module is used to input the representation vector of the input dialogue, the representation vector of the response, the representation vector of the background knowledge, and the representation of the difference information into the deep learning network. It selects the background knowledge required for the current round of dialogue and inputs the selected knowledge and context into the decoder to generate the response for the current round. It calculates the loss by comparing it with the real responses in the training set and trains the entire deep learning network with the goal of minimizing the loss, so as to obtain a deep learning network model for time-weighted difference-aware response generation based on the self-step learning strategy.

[0092] The response generation module is used to generate responses. It uses a trained deep learning network model based on a self-stepping learning strategy to analyze and process the input dialogue, selects knowledge for the current round based on context and difference information, and then generates a response based on the selected knowledge.

[0093] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a time-weighted difference-aware response generation method and system based on self-stepping learning. The method constructs a time-weighted difference-aware deep learning network model based on self-stepping learning, and uses this model to select the required background knowledge and generate a response based on the selected background knowledge, thereby improving the accuracy of response generation. Attached Figure Description

[0094] Figure 1 This is a flowchart illustrating the method implementation of an embodiment of the present invention;

[0095] Figure 2 This is an architecture diagram of the time-weighted difference-aware deep learning network model in an embodiment of the present invention;

[0096] Figure 3 This is a flowchart illustrating the processing of dialogue context and candidate knowledge in an embodiment of the present invention;

[0097] Figure 4 This is a schematic diagram of the system structure according to an embodiment of the present invention. Detailed Implementation

[0098] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0099] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0100] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0101] like Figure 1 As shown, this embodiment provides a time-weighted difference-aware response generation method based on self-stepping learning, characterized by the following steps:

[0102] Step A: Collect natural, open-domain conversations on social platforms, retrieve relevant background knowledge for these conversations, and then label the actual responses and knowledge to construct the training dataset DE.

[0103] Step B: Train a time-weighted difference-aware deep learning network model M based on auto-learning using the training dataset DE. Use this model to select the required background knowledge and generate a response based on the selected background knowledge.

[0104] Step C: Input the dialogue context and background knowledge into the trained deep learning network model M to generate the corresponding response.

[0105] In this embodiment, the architecture of the time-weighted difference-aware deep learning network model M based on autosynchronous learning and its specific process for processing dialogue context and candidate knowledge are as follows: Figure 2 , 3 As shown. In this embodiment, step B specifically includes the following steps:

[0106] Step B1: Initialize the encoding of all training samples in the training dataset DE to obtain the sentence representation vector of the current dialogue context. The sentence representation vector of the actual responses in this round Sentence representation vector of candidate knowledge in this round

[0107] In this embodiment, step B1 specifically includes the following steps:

[0108] Step B11: Traverse the training dataset DE, and after segmenting the dialogue content and knowledge and removing special symbols and stop words, each training sample in DE is represented as de = (x t ,y t ,k t ); where x t For the content of the dialogue above, y t For x t The corresponding set of real responses, k t This is the set of background knowledge relevant to this round of dialogue.

[0109] The text content above the dialogue x t Represented as:

[0110]

[0111] in, For the dialogue above x t The i-th word in the string, i = 1, 2, ..., |x t |,|x t |For the dialogue above x t The number of words.

[0112] Real reply y t Represented as:

[0113]

[0114] in, To provide a true response to y t The i-th word in the string, i = 1, 2, ..., |y t |,|y t |For a genuine response y t The number of words.

[0115] Background knowledge set k t Represented as:

[0116]

[0117] Where N represents the number of candidate knowledge items in this round, and each candidate knowledge item... Represented as:

[0118]

[0119] in, For each candidate knowledge The j-th word in For candidate knowledge The number of words.

[0120] Step B12: Obtain the dialogue context from step B11. The dialogue context representation vector is obtained by encoding using BERT and then passing it through an average pooling layer. The calculation process is as follows:

[0121]

[0122]

[0123] MeanPool(·) represents the average pooling function.

[0124] Step B13: Obtain the dialogue text from step B11. The sentence representation vector of the actual response is obtained by encoding with BERT and then passing it through an average pooling layer. The calculation process is as follows:

[0125]

[0126]

[0127] MeanPool(·) represents the average pooling function.

[0128] Step B14: Background knowledge obtained in step B11 Each element is encoded using BERT, and then the sentence representation vectors of the candidate knowledge are obtained through an average pooling layer. The calculation process is as follows:

[0129]

[0130]

[0131] MeanPool(·) represents the average pooling function.

[0132] Step B2: Convert the sentence representation vectors obtained in Step B1 for the current dialogue. And the sentence representation vector of the actual responses in this round. The dialogue history information is represented by GRU encoding. The candidate knowledge representation vector is encoded using BiGRU to obtain a vector representation r containing inter-sentence relation information. t .

[0133] In this embodiment, step B2 specifically includes the following steps:

[0134] Step B21: Vector representation of the dialogue context using GRU Vector representation of the actual response Encode the dialogue history information to obtain a representation. The calculation process is as follows:

[0135]

[0136] Step B22: The sentence representation vectors of the candidate knowledge obtained in step B14 are further encoded using BiGRU to obtain candidate knowledge vector representations that are aware of inter-sentence relationships. The calculation process is as follows:

[0137]

[0138] Step B3: Represent the sentences of the candidate knowledge selected by the previous M rounds of modeling. The candidate knowledge vector representation r of the current round, which contains inter-sentence relation information, obtained in step B2. t Differences are calculated, and the differences between different rounds are summed using a time-decay-based weighting function to obtain a difference representation of candidate knowledge.

[0139] In this embodiment, step B3 specifically includes the following steps:

[0140] Step B31: Calculate the weight λ for each round using the time decay function. m The calculation process is as follows:

[0141]

[0142] f(m)=e -αm

[0143] Step B32: Incorporate the knowledge selected in the previous M rounds of model selection. The difference between the candidate knowledge vector representation obtained in step B22 and the one obtained in step B31 is calculated, and the result λ is used to calculate the difference. m We perform a weighted summation of the difference information from different rounds to obtain the difference information representation of candidate knowledge. The calculation results are as follows:

[0144]

[0145] Diff(a,b)=FullConnect([ab;a⊙b])

[0146] Where, ; represents the connection operation, FullConnect(·) is a fully connected layer activated by tanh, and α is the attenuation coefficient.

[0147] Step B4: The knowledge selector will use the dialogue history information from the previous round. The sentences in the preceding dialogue represent vectors. The vectors are concatenated to form a query vector, and then the sentence representation vectors of the candidate knowledge are used. The difference information obtained in step B3 is concatenated to form the key vector of the knowledge selector. Its attention score is calculated, and the knowledge with the highest score is selected by the knowledge selector in this round.

[0148] In this embodiment, step B4 specifically includes the following steps:

[0149] Step B41: The knowledge selector uses the dialogue history information obtained in step B21. And the context vector of the current dialogue obtained in step B12 The concatenation is used as the query, and the difference information obtained in step B32 and the candidate knowledge vector obtained in step B14 are used as the key. The knowledge selection distribution is obtained by calculating the attention score. The calculation process is as follows:

[0150]

[0151] Where tanh(·) is the activation function, W que W key v T is a trainable parameter; represents the vector concatenation operation.

[0152] Step B42: Select and distribute the knowledge obtained in step B41. Perform a normalization operation and select the knowledge with the highest probability as the knowledge to be selected by the knowledge selector in this round. The calculation process is as follows:

[0153]

[0154]

[0155] Here, softmax() is the normalization function, and argmax() is the function that finds the value of the function corresponding to the independent variable.

[0156] Step B43: Train the knowledge selector using cross-entropy loss. The calculation process is as follows:

[0157]

[0158] in, Represents cross-entropy loss, It is a real knowledge tag. This represents the selection distribution of the knowledge selector.

[0159] Step B5: Employ a two-stage training strategy based on self-learning, and apply the knowledge selected in this round to different training stages. Or pseudo-true knowledge The decoder generates the response for this round based on the information input from the dialogue, and real knowledge is used in the pre-training phase. During the training and fine-tuning phase, a self-learning strategy is employed, and the use of real knowledge is determined based on the magnitude of the scoring function. Or the knowledge selected in this round The selected knowledge and contextual information are input into the decoder to generate the response y for this round. t .

[0160] In this embodiment, step B5 specifically includes the following steps:

[0161] Step B51: Employ a two-stage training method based on a self-tracking learning strategy. The pre-training stage uses real knowledge. Alternative choice knowledge During the response generation and fine-tuning phase, a self-learning strategy is employed to process the knowledge selected by the knowledge selector. Treat it as a complex sample, and apply real knowledge. Treating the sample as a simple sample, the loss of the student's knowledge selector is used as the score for self-paced learning, and a weight V is set to indicate whether complex samples should be used for response generation. The calculation of V is as follows:

[0162]

[0163]

[0164] δ=h(T)=δ0e T

[0165] Step B52: Select the knowledge The dialogue above x t The input is concatenated, and the Transformer decoder, which combines a copying mechanism, generates the response for this round. The process is as follows:

[0166]

[0167]

[0168]

[0169]

[0170]

[0171]

[0172] Here, ; indicates a concatenation operation, and TransformerDecoder() represents a Transformer decoder. This is the hidden vector of the nth word in the current round of responses. MultHead() represents the multi-head attention mechanism. Represents a vocabulary list. It is the final generated distribution.

[0173] Step B53: Calculate and generate the loss value based on the weight V obtained in step B51. The calculation formula is as follows:

[0174]

[0175]

[0176]

[0177] Step B54: The sum of the knowledge selection loss obtained in step B43 and the generation loss obtained in step B53 is used as the total loss. The model parameters are iteratively updated using backpropagation to train the model by minimizing the loss function. The total loss is calculated as follows:

[0178]

[0179] Step B6: When the change in loss value generated by the iteration of the deep learning network model is less than the given threshold, or when the maximum number of iterations is reached, the training process of the deep learning network model is terminated.

[0180] like Figure 4 As shown, this embodiment provides a time-series weighted difference-aware response generation system based on self-stepping learning using the above method, including:

[0181] The data collection module is used to extract dialogue content and background knowledge from open-domain dialogues on social platforms, and to label real responses and real knowledge to build a training set.

[0182] The preprocessing module is used to preprocess the training samples in the training set, including word segmentation and stop word removal.

[0183] The encoding module is used to find the word vectors of words in the pre-processed input content, response content, and background knowledge content in the pre-trained word vector matrix, and encode this information to obtain the representation vectors of the input content, response content, and background knowledge.

[0184] The difference information construction module calculates the difference between the knowledge selected in previous rounds and the candidate knowledge in the current round, and uses a time decay weighting function to weight and sum the difference information of different rounds to obtain the difference information representation of the knowledge in this round.

[0185] The network model training module is used to input the representation vector of the input dialogue, the representation vector of the response, the representation vector of the background knowledge, and the representation of the difference information into the deep learning network. It selects the background knowledge required for the current round of dialogue and inputs the selected knowledge and context into the decoder to generate the response for the current round. It calculates the loss by comparing it with the real responses in the training set and trains the entire deep learning network with the goal of minimizing the loss, so as to obtain a deep learning network model for time-weighted difference-aware response generation based on the self-step learning strategy.

[0186] The response generation module is used to generate responses. It uses a trained deep learning network model based on a self-stepping learning strategy to analyze and process the input dialogue, selects knowledge for the current round based on context and difference information, and then generates a response based on the selected knowledge.

[0187] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0188] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0189] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0190] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0191] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A time-weighted difference-aware response generation method based on self-stepping learning, characterized in that, Includes the following steps: Step A: Collect natural, open-domain dialogues on social platforms, retrieve relevant background knowledge for the dialogues, and then label the real responses and real knowledge to construct the training dataset DE. Step B: Train a time-weighted difference-aware deep learning network model M based on auto-learning using the training dataset DE. Use this model to select the required background knowledge and generate a response based on the selected background knowledge. Step C: Input the dialogue context and background knowledge into the trained deep learning network model M to generate the corresponding response; Step B specifically includes the following steps: Step B1: Initialize the encoding of all training samples in the training dataset DE to obtain the sentence representation vector of the current dialogue context. The sentence representation vector of the actual responses in this round Sentence representation vectors of candidate knowledge in this round Step B2: Convert the sentence representation vectors obtained in Step B1 for the current dialogue. And the sentence representation vector of the actual responses in this round. The dialogue history information is represented by GRU encoding. The candidate knowledge representation vector is encoded using BiGRU to obtain a vector representation r containing inter-sentence relation information. t ; Step B3: Represent the sentences of the candidate knowledge selected by the previous M rounds of modeling. The candidate knowledge vector representation r of the current round, which contains inter-sentence relation information, obtained in step B2. t Differences are calculated, and the differences between different rounds are summed using a time-decay-based weighting function to obtain a difference representation of candidate knowledge. Step B4: The knowledge selector will use the dialogue history information from the previous round. The sentences in the preceding dialogue represent vectors. The vectors are concatenated to form a query vector, and then the sentence representation vectors of the candidate knowledge are used. The difference information obtained in step B3 is concatenated to form the key vector of the knowledge selector. Its attention score is calculated, and the knowledge with the highest score is selected by the knowledge selector in this round. Step B5: Employ a two-stage training strategy based on self-learning, and apply the knowledge selected in this round to different training stages. Or pseudo-true knowledge The decoder generates the response for this round based on the information input from the dialogue, and real knowledge is used in the pre-training phase. During the training and fine-tuning phase, a self-learning strategy is employed, and the use of real knowledge is determined based on the magnitude of the scoring function. Or the knowledge selected in this round The selected knowledge and contextual information are input into the decoder to generate the response y for this round. t ; Step B6: When the change in loss value generated by the iteration of the deep learning network model is less than the given threshold or the maximum number of iterations is reached, the training process of the deep learning network model is terminated.

2. The time-weighted difference-aware response generation method based on self-stepping learning according to claim 1, characterized in that, Step B1 specifically includes the following steps: Step B11: Traverse the training data set DE, and after the dialogue content and knowledge are segmented and special symbols and stop words are removed, each training sample in DE is represented as de=(x t ,y t ,k t ); wherein x t is the dialogue context, y t is the corresponding real reply set of x t , and k t is the background knowledge set corresponding to the current dialogue; The text content above the dialogue x t Represented as: in, For the dialogue above x t The i-th word in the string, i = 1, 2, ..., |x t |,|x t |For the dialogue above x t The number of words; Real reply y t Represented as: in, To provide a true response to y t The i-th word in the string, i = 1, 2, ..., |y t |,|y t |For a genuine response y t The number of words; Background knowledge set k t Represented as: Where N represents the number of candidate knowledge items in this round, and each candidate knowledge item... Represented as: in, For each candidate knowledge The j-th word in For candidate knowledge The number of words; Step B12: Obtain the dialogue context from step B11. The dialogue context representation vector is obtained by encoding using BERT and then passing it through an average pooling layer. The calculation process is as follows: Where MeanPool(·) represents the average pooling function; Step B13: Obtain the dialogue text from step B11. The sentence representation vector of the actual response is obtained by encoding with BERT and then passing it through an average pooling layer. The calculation process is as follows: Step B14: Background knowledge obtained in step B11 Each element is encoded using BERT, and then the sentence representation vectors of the candidate knowledge are obtained through an average pooling layer. The calculation process is as follows:

3. The time-weighted difference-aware response generation method based on self-stepping learning according to claim 2, characterized in that, Step B2 specifically includes the following steps: Step B21: Vector representation of the dialogue context using GRU Vector representation of the actual response Encode the dialogue history information to obtain a representation. The calculation process is as follows: Step B22: The sentence representation vectors of the candidate knowledge obtained in step B14 are further encoded using BiGRU to obtain candidate knowledge vector representations that are aware of inter-sentence relationships. The calculation process is as follows:

4. The time-weighted difference-aware response generation method based on self-stepping learning according to claim 3, characterized in that, Step B3 specifically includes the following steps: Step B31: Calculate the weight λ for each round using the time decay function. m The calculation process is as follows: f(m)=e -αm Step B32: Incorporate the knowledge selected in the previous M rounds of model selection. The difference between the candidate knowledge vector representation obtained in step B22 and the one obtained in step B31 is calculated, and the result λ is used to calculate the difference. m We perform a weighted summation of the difference information from different rounds to obtain the difference information representation of candidate knowledge. The calculation results are as follows: Diff(a,b)=FullConnect([ab;a⊙b]) Where [;] represents a connection operation, FullConnect(·) is a fully connected layer activated by tanh, and α is the attenuation coefficient.

5. The time-weighted difference-aware response generation method based on self-stepping learning according to claim 4, characterized in that, Step B4 specifically includes the following steps: Step B41: The knowledge selector uses the dialogue history information obtained in step B21. And the context vector of the current dialogue obtained in step B12 The concatenation is used as the query, and the difference information obtained in step B32 and the candidate knowledge vector obtained in step B14 are used as the key. The knowledge selection distribution is obtained by calculating the attention score. The calculation process is as follows: Where tanh(·) is the activation function, W que W key v T These are trainable parameters, and [;] represents the vector concatenation operation; Step B42: Select and distribute the knowledge obtained in step B41. Perform a normalization operation and select the knowledge with the highest probability as the knowledge to be selected by the knowledge selector in this round. The calculation process is as follows: Here, softmax() is the normalization function, and argmax() is the function that finds the maximum value of the function corresponding to the independent variable. Step B43: Train the knowledge selector using cross-entropy loss. The calculation process is as follows: in, Represents cross-entropy loss, It is a real knowledge tag. This represents the selection distribution of the knowledge selector.

6. The time-weighted difference-aware response generation method based on self-stepping learning according to claim 5, characterized in that, Step B5 specifically includes the following steps: Step B51: Employ a two-stage training method based on a self-tracking learning strategy. The pre-training stage uses real knowledge. Alternative choice knowledge During the response generation and fine-tuning phase, a self-learning strategy is employed to process the knowledge selected by the knowledge selector. Treat it as a complex sample, and apply real knowledge. Treating the sample as a simple sample, the loss of the student's knowledge selector is used as the score for self-paced learning, and a weight V is set to indicate whether complex samples should be used for response generation. The calculation of V is as follows: δ=h(T)=δ0e T Step B52: Select the knowledge The dialogue above x t The input is concatenated, and the Transformer decoder, which combines a copying mechanism, generates the response for this round. The process is as follows: Here, [;] represents a concatenation operation, and TransformerDecoder() represents a Transformer decoder. This is the hidden vector of the nth word in the current round of responses. MultHead() represents the multi-head attention mechanism. Represents a vocabulary list. It is the final generated distribution; Step B53: Calculate and generate the loss value based on the weight V obtained in step B51. The calculation formula is as follows: Step B54: The sum of the knowledge selection loss obtained in step B43 and the generation loss obtained in step B53 is used as the total loss. The model parameters are iteratively updated using backpropagation to train the model by minimizing the loss function. The total loss is calculated as follows:

7. A time-series weighted difference-aware response generation system based on self-stepping learning, employing the method described in any one of claims 1-6, characterized in that, include: The data collection module is used to extract dialogue content and background knowledge from open-domain dialogues on social platforms, and to label real responses and real knowledge to build a training set. The preprocessing module is used to preprocess the training samples in the training set, including word segmentation and stop word removal; The encoding module is used to find the word vectors of words in the pre-processed input content, response content, and background knowledge content in the pre-trained word vector matrix, and encode this information to obtain the representation vectors of the input content, response content, and background knowledge. The difference information construction module calculates the difference between the knowledge selected in previous rounds and the candidate knowledge in the current round, and uses a time decay weighting function to weight and sum the difference information of different rounds to obtain the difference information representation of the knowledge in this round. The network model training module is used to input the representation vector of the input dialogue, the representation vector of the response, the representation vector of background knowledge, and the representation of difference information into the deep learning network. It selects the background knowledge required for this round of dialogue and inputs the selected knowledge and context into the decoder to generate the response for this round. It calculates the loss by comparing it with the real responses in the training set and trains the entire deep learning network with the goal of minimizing the loss, so as to obtain a deep learning network model for time-weighted difference-aware response generation based on the self-step learning strategy. The response generation module is used to generate responses. It uses a trained deep learning network model based on a self-stepping learning strategy to analyze and process the input dialogue, selects knowledge for the current round based on context and difference information, and then generates a response based on the selected knowledge.

Citation Information

Patent Citations

  • Joint learning from explicit and inferred tags

    CN115668220A

  • Multi-round dialogue method and system for domain data enhancement and multi-granularity semantic understanding

    CN116050432A