A Dialogue Generation Method Based on Personality Expansion
Through role retrieval and natural language inference models, a sequential network is constructed to predict the distribution of personality importance, which solves the problems of lack of personality and insufficient consistency in traditional personality dialogue methods, and realizes the generation of personality consistency dialogue.
Patent Information
- Application Number
- CN202211288538.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-20
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-10-20
AI Technical Summary
In the traditional personalized dialogue method, a fixed predefined personalized collection cannot cover all types of user questions, resulting in the lack of personality problems, and ignore the differences in the role of different personalities in the dialogue generation process, resulting in the lack of personality consistency in the generation results.
The role search model, sentence pair matching model and natural language inference model are used to evaluate the correlation and logical association between candidate personality and predefined personality, and a sequential network is constructed to predict the distribution of personality importance, and respond to decoding through weighted methods to generate conversation text with consistent personality.
The individual consistency of dialogue generation results is improved, and by introducing new personal information and weight adjustments, the effective use of personal information during dialogue generation is ensured, and the generation effect is improved.
Smart Images

Figure CN116028616B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to natural language processing technology, and in particular to a dialogue generation method based on personality expansion. Background Art
[0002] Traditional personality dialogue methods usually complete dialogue generation based on a specific set of personalities. However, the fixed predefined set of personalities cannot represent the complete personality of the robot, and it is easy to trigger the problem of personality loss during the generation of dialogue responses. Currently, most research works encode predefined personalities based on technologies such as deep recurrent neural networks and Transformers. Although these models can fully understand the semantics of predefined personalities, the fixed predefined personalities cannot cover all types of user questions, which has obvious drawbacks. At the same time, the current work only focuses on mixing all personality information with equal weights, ignoring the differences in the roles of different personalities in the actual personality dialogue generation process, so it has great limitations. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a dialogue generation method based on personality expansion to effectively improve the personality consistency of the dialogue generation result in view of the defects in the prior art.
[0004] The technical solution adopted by the present invention to solve its technical problems is: a dialogue generation method based on personality expansion, including the following steps:
[0005] 1) Perform dialogue personality expansion according to user queries and predefined personality information;
[0006] Given a query and a set of predefined personalities where each personality can be represented as a sentence
[0007] Suppose is a global role set, and a role retrieval model (Persona Retrieval Model) is used to rank the candidate personalities therein;
[0008] Use a sentence pair matching model to predict the correlation between the query and the candidate personalities, and the confidence of this binary classification model is the required correlation score;
[0009] Use a natural language inference model to evaluate the logical association between the candidate personalities and the predefined personality set;
[0010] Use a natural language inference model to evaluate the entailment score and conflict score between the candidate and the predefined personality set:
[0011]
[0012]
[0013] Among different personalities in the predefined personality set, the candidate personalities are compared with it in turn, and the maximum value is taken as the final implied score and conflict score;
[0014] For all candidate personalities, they are sorted according to the combined score S = α·r + β·(1 - c) + γ·e, and the one with the highest score is the extended personality, where α, β, and γ are all adjustable hyperparameters;
[0015] 2) Construct an importance distribution model of the personality set based on the prior and posterior network to obtain the personality importance distribution;
[0016] In the prior and posterior network, the posterior network takes the user query, personality set, and target response as inputs, and the training objective is to determine whether each personality information is adopted in the target response; the prior network takes the user query and personality set as inputs, and the training objective is to make the discrimination result of the personality consistent with that of the posterior network;
[0017] Use GPT to encode the user query, predefined personality, and target response into sentence vector representations
[0018] Among them, the attention network used to encode the personality importance in the prior and posterior network is defined as follows:
[0019]
[0020]
[0021] Among them, represents the importance of each personality in the prior (pri) or posterior (post) network;
[0022] Use a feedforward neural network with a sigmoid activation function to convert them into the weights of each personality in the prior (pri) or posterior (post) network:
[0023]
[0024] Among them, the loss function in the posterior network is defined by cross entropy:
[0025]
[0026] Since the finally obtained personality distribution can be regarded as a vector with the number of dimensions equal to the number of personalities, the loss function when the prior and posterior network approximates is defined as follows:
[0027]
[0028] Among them, cos represents the Cosine distance between the output vectors of the prior and posterior networks;
[0029] 3) According to the personality importance distribution predicted by the posterior network, use the weighted personality information for response decoding;
[0030] Adopt a weighted method to fuse all personality representations. During the training process, perform personality fusion based on the prediction results of the posterior network:
[0031]
[0032] where n p represents the total number of personalities in the personality set, represents the representation of the i-th personality after attention interaction with the generated part at time t;
[0033] Adopt mean pooling to fuse the user query, personality information, and decoded part required for decoding, and then use GPT to decode the response word r at this moment t :
[0034]
[0035]
[0036] Essentially, the generation model predicts the target response based on the personality set and user query. Therefore, we applied the negative log-likelihood loss during training:
[0037]
[0038] 4) Response inference to generate the dialogue text of the query;
[0039] Use the prediction result of the personality importance distribution of the prior network to replace the posterior network, and obtain the overall weighted encoding of the personality as:
[0040]
[0041] Iteratively generate response words in an autoregressive form, and this process can be expressed as:
[0042]
[0043]
[0044] where represents the encoded representation of the autoregressively generated part of the response at time t.
[0045] The beneficial effects produced by the present invention are:
[0046] 1. By evaluating the relevance of personality candidates to predefined personalities in the dimension of natural language inference, introducing new personality information that has a logical connection with the predefined personalities, predicting the importance distribution of personality information in the dialogue generation stage through a prior and posterior network, and improving the personality consistency of the dialogue generation result by combining the weighted personality information.
[0047] 2. Different personalities in the personality set contribute differently to the generation task. Predict the importance distribution of personality information in the dialogue generation stage through a prior and posterior network, and complete the response decoding by combining the weighted personality information. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The present invention will be further described below in conjunction with the drawings and embodiments. In the drawings:
[0049] Figure 1 is the flowchart of the personality extension dialogue generation method according to the embodiment of the present invention;
[0050] Figure 2 is the schematic diagram of the construction method of the generation module in the personality extension dialogue generation method according to the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0051] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0052] As Figure 1 shown, a method for improving the personality consistency of a dialogue based on personality extension includes the following steps:
[0053] 1) Perform dialogue personality extension according to the user query and predefined personality information;
[0054] Given a query and a set of predefined personalities where each personality can be represented as a sentence
[0055] Assume is a global role set, and use a persona retrieval model to rank the candidate personalities therein;
[0056] Use a sentence pair matching model to predict the relevance between the query and the candidate personality, and the confidence of this binary classification model is the required relevance score;
[0057] Use a natural language inference model to evaluate the logical association between the candidate personality and the predefined personality set;
[0058] A natural language inference model is used to evaluate the entailment score and conflict score of a candidate with a predefined set of personalities:
[0059]
[0060]
[0061] Among them, for different personalities in the predefined set of personalities, the candidate personality is compared with each of them in turn, and the maximum value is taken as the final entailment score and conflict score;
[0062] For all candidate personalities, they are sorted according to the combined score S = α·r + β·(1 - c) + γ·e, and the one with the highest score is the extended personality, where α, β, and γ are all adjustable hyperparameters;
[0063] 2) Based on the prior and posterior network, construct an importance distribution model of the personality set to obtain the personality importance distribution;
[0064] In the prior and posterior network, the posterior network takes the user query, the personality set, and the target response as inputs, and the training objective is to determine whether each personality information is adopted in the target response; the prior network takes the user query and the personality set as inputs, and the training objective is to make the discrimination result of the personality as consistent as possible with the posterior network;
[0065] Use GPT to encode the user query, predefined personality, and target response into sentence vector representations
[0066] Among them, the attention network used to encode the personality importance in the prior and posterior network is defined as follows:
[0067]
[0068]
[0069] Among them, represents the importance of each personality in the prior (pri) or posterior (post) network;
[0070] Use a feedforward neural network with a sigmoid activation function to convert them into the weights of each personality in the prior (pri) or posterior (post) network:
[0071]
[0072] Among them, the loss function in the posterior network is defined by cross entropy:
[0073]
[0074] Since the final obtained personality distribution can be regarded as a vector with the number of personalities as the dimension, the loss function for approximating the prior and posterior networks is defined as follows:
[0075]
[0076] where cos represents the Cosine distance between the output vectors of the prior and posterior networks;
[0077] 3) According to the personality importance distribution predicted by the posterior network, use the weighted personality information for response decoding;
[0078] Adopt a weighted method to fuse all personality representations. During the training process, perform personality fusion based on the prediction results of the posterior network:
[0079]
[0080] where n p represents the total number of personalities in the personality set, represents the representation of the i-th personality after attention interaction with the generated part at time t;
[0081] Use mean pooling to fuse the user query, personality information, and decoded part required for decoding, and then use GPT to decode the response word r at this moment t :
[0082]
[0083]
[0084] Essentially, the generative model predicts the target response based on the personality set and user query. Therefore, we applied the negative log-likelihood loss during training:
[0085]
[0086] 4) Response inference to generate the dialogue text of the query;
[0087] Use the prediction result of the personality importance distribution of the prior network to replace the posterior network, and obtain the overall weighted encoding of the personality as:
[0088]
[0089] Generate response words iteratively in an autoregressive form, and this process can be expressed as:
[0090]
[0091]
[0092] Among them, represents the autoregressive generated partial response encoding representation at time t.
[0093] Experiments show that compared with existing mainstream methods, the personalized dialogue generation method of the present invention has achieved better results. The experiments were evaluated using two benchmark personalized dialogue datasets, namely the IT-ConvAI2 dataset and the ConvAI2 dataset. The detailed information of the datasets is shown in Table 1.
[0094] Table 1 Corpus Information
[0095]
[0096] The experimental part aims to evaluate the effectiveness of the personalized dialogue generation model proposed by the present invention on different datasets. Specifically, we use the Entail, BLEU, ROUGE, and CIDEr results of the model on the two datasets as evaluation indicators of the model. The experimental comparison results are given in Table 2.
[0097] Table 2 Comparison Experiment Results of Personalized Dialogue Generation
[0098]
[0099] It should be noted that, as can be observed from the above table, the method proposed by the present invention is always superior to all these benchmark models in different metrics because these models do not have the ability of personality extension, and their generated results are not closely related to personality information under the condition of lack of appropriate personality. In addition, on the IT-ConvAI2 benchmark data, the method proposed by the present invention has a higher improvement ratio compared with the benchmark model because there are more examples lacking personality in this benchmark data, so the role of the personality extension module proposed by the present invention is more significant. The present invention first proposes to combine a natural language inference model to expand personality information, and proposes to more accurately learn the importance distribution of the expanded personality information in the response generation stage through a prior and posterior network. Based on natural language inference and the prior and posterior network, the method proposed by the present invention can more accurately expand new personality information that conforms to the predefined personality, and can more effectively learn the utilization method of the personality set in the response generation process, thereby improving the personality consistency of dialogue generation.
[0100] It should be understood that for those of ordinary skill in the art, improvements or changes can be made according to the above description, and all such improvements and changes should fall within the protection scope of the appended claims of the present invention.
Claims
1. A dialogue generation method based on personality extension, characterized in that Including the following steps: 1) Perform dialogue personality expansion according to the user query and predefined personality information; 1.1) Predict the correlation between the query and candidate personalities; 1.2) Use a natural language inference model to evaluate the logical association between the candidate personality and the predefined personality set; For all candidate personalities, rank the candidate personalities according to the combined score of the correlation between the query and the candidate personality and the logical association between the candidate personality and the predefined personality set. The one with the highest score is the expanded personality; 2) Construct an importance distribution model of the personality set based on the prior and posterior network to obtain the personality importance distribution; In the prior and posterior network, the posterior network takes the user query, the personality set, and the target response as inputs, and the training objective is to determine whether each personality information is adopted in the target response; The prior network takes the user query and the personality set as inputs, and the training objective is to make the discrimination result of the personality as consistent as possible with the posterior network; Encode the user query, predefined personality, and target response into sentence vector representations using GPT E pi ; Among them, the attention network used to encode the personality importance in the prior and posterior network is defined as follows: Among them, represents the importance of each personality in the prior (pri) or posterior (post) network; Use a feedforward neural network with a sigmoid activation function to convert them into the weights of each personality in the prior pri or posterior post network; 3) According to the personality importance distribution predicted by the posterior network, use the weighted personality information to perform response decoding; Adopt a weighted method to fuse all personality representations. During the training process, perform personality fusion based on the prediction results of the posterior network; where n p represents the total number of personalities in the personality set, represents the representation of the i-th personality after attention interaction with the already generated part at time t; Use average pooling to fuse the user query, personality information, and the decoded part required for decoding, and then use GPT to decode the response word r at that moment t : 4) Response inference to generate the dialogue text of the query; Use the prediction result of the personality importance distribution of the prior network to replace the posterior network to obtain the overall weighted encoding of the personality as: Generate response words iteratively in an autoregressive form to obtain, which can be expressed as: Among them, represents the encoded representation that has autoregressively generated a partial response at time t.
2. The method for generating a dialogue based on personality extension according to claim 1, wherein In step 1), the dialogue personality expansion is performed according to the user query and the predefined personality information, specifically as follows: Given a query and a set of predefined personalities where each personality can be represented as a sentence Hypothesis is a global personality set, and a personality retrieval model is used to rank the candidate personalities therein; Adopt a sentence pair matching model to predict the correlation between the query and the candidate personality, and the confidence of this binary classification model is the required correlation score; Use a natural language inference model to evaluate the logical association between the candidate personality and the predefined personality set; Use a natural language inference model to evaluate the entailment score and conflict score between the candidate and the predefined personality set; Among them, for different personalities in the predefined personality set, compare the candidate personality with each of them in turn, and take the maximum value as the final entailment score and conflict score; For all candidate personalities, rank them according to the combined score S = α·r + β·(1 - c) + γ·e. The one with the highest score is the expanded personality, where α, β, and γ are all adjustable hyperparameters.
3. The method for generating a dialogue based on personality extension according to claim 1, wherein In step 2), the loss function in the posterior network is defined by cross-entropy; Define the loss function when the prior and posterior network approximates as follows: Among them, cos represents the Cosine distance between the output vectors of the prior and posterior networks.
4. The method for generating a dialogue based on personality extension according to claim 1, wherein In step 2), the negative log-likelihood loss function is adopted during training;
Citation Information
Patent Citations
Emotion reply automatic generation method for open domain dialogue system
CN111782788A
Dialogue generation method and device, network training method and device, storage medium and equipment
CN111897941A