A context-adaptive intelligent dialogue response generation method, device and medium
By selecting different response generation methods according to the length and type of the dialogue history, the sequential reader or skip reader processes the dialogue history, which solves the problem of dialogue features being ignored in the existing technology, achieves more efficient and flexible response generation, and improves Accuracy and quality of responses.
Patent Information
- Application Number
- CN202210355134.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-01
AI Technical Summary
Existing open-domain dialogue systems ignore the specific textual characteristics of the dialogue when generating responses and use the same model to process all dialogues. This results in a lack of pertinence in the model and the inability to achieve the best response generation effect. It is also incompatible with human response generation ideas and lacks Flexibility and efficiency.
A context-adaptive intelligent dialogue response generation method is adopted, and different response generation methods are selected according to the length and short types of historical dialogues. Short-type dialogues use sequential readers, long-type dialogues use skip readers, and sequential readers are generated through encoders and decoders. In response, skip readers process conversation history through hierarchical encoding and integration mechanisms or assimilation mechanisms.
It enables flexible selection of response generation methods based on the length and type of conversation history, improves the accuracy of response generation, and can filter noise in long conversations and extract focus information to generate higher quality responses.
Smart Images

Figure CN114706967B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of intelligent dialogue data processing, and in particular relates to a context-adaptive intelligent dialogue response generation method. Background Art
[0002] Building intelligent dialogue systems that can interact naturally with humans is one of the most important goals of artificial intelligence. Current dialogue systems can be mainly divided into two types, task-oriented and open-domain. Task-oriented dialogue systems are designed to be digital assistants for humans, helping to complete specific tasks, such as booking a hotel or purchasing a product. This technical solution is aimed at open-domain dialogue systems, focusing on enabling dialogue systems to talk naturally about a variety of open-ended topics, with the ultimate goal of establishing long-term relationships with humans.
[0003] Response generation is the core of the open domain dialogue system. It takes the user's latest message and dialogue context as input, and then generates response utterances through selection or generation. The premise of response is understanding. The model needs to accurately understand the dialogue history in order to generate high-quality responses. For dialogue history modeling, there are mainly hierarchical methods and non-hierarchical methods.
[0004] The non-hierarchical approach concatenates all historical utterances into a sequence and feeds it into an encoder-decoder (Seq2Seq) framework, e.g. Figure 1 As shown in Figure 2. Seq2Seq uses an RNN-based structure to encode the conversation history, and then generates response utterances through an RNN-based decoder. Transformer can be used to replace the RNN structure in Seq2Seq, enabling it to process longer text sequences. In addition, generative pre-trained models such as T5 and GPT-3 are also used for non-hierarchical conversation history modeling, achieving impressive performance in response generation.
[0005] Hierarchical methods believe that there are multiple layers of semantic structure in multi-turn dialogues, so they model the dialogue history at multiple semantic levels by using different encoders, such as Figure 2 As shown in Figure 2. Typical work includes the Hierarchical Encoding and Decoding Framework (HRED), which uses a two-level encoder to semantically encode each context utterance and the entire conversation context respectively. On this basis, latent variable models, memory networks, attention mechanisms, and topic control are also introduced into HRED, which can effectively improve the quality of generated responses.
[0006] There are many works on response generation, but most of them follow a common paradigm: using a single response generation method to handle all dialogue situations. This means that in existing technical solutions, the same model is used to generate responses regardless of the specific circumstances of the dialogue history.
[0007] However, as the conversation progresses, its text features change, and the challenges faced by response generation also change. For example, short conversations contain fewer conversation turns, the semantics of the conversation history is relatively sparse, and the background information provided is very limited; however, in long conversations, the context information is relatively sufficient, but often contains multiple topic transfers. At this time, the bigger problem is how to filter the noise in the conversation history and select the most relevant context for response generation.
[0008] In human conversations, when a person generates responses, for efficiency reasons, he or she usually adopts different understanding modes depending on the specific circumstances of a given conversation. For example, given a short conversation, he or she may read the conversation history sequentially and regard the previous utterances as the context of the later utterances; while for a long conversation, he or she usually focuses on the latest utterances first, and then selectively reads some important historical utterances as supplements.
[0009] Therefore, existing technical solutions ignore the specific text features of the conversation and use the same model to process all conversations. This approach, on the one hand, makes the model non-targeted and loses sight of the big picture, and fails to achieve the best response generation effect; on the other hand, it does not conform to the way humans perform response generation, lacking flexibility and efficiency. Summary of the invention
[0010] The present invention provides a context-adaptive intelligent dialogue response generation method for an open domain dialogue system, which can adaptively adopt different response generation methods to generate responses for different dialogue histories.
[0011] In order to achieve the above technical objectives, the present invention adopts the following technical solutions:
[0012] A context-adaptive intelligent dialogue response generation method, comprising:
[0013] According to the number of utterances included in the historical dialogue, determine the length type of the historical dialogue: long type or short type;
[0014] If the historical dialogue is a short type dialogue, a sequential reader is used to generate responses based on the historical dialogue;
[0015] If the historical dialogue is a long type dialogue, a skip reader is used to generate a response based on the historical dialogue.
[0016] Furthermore, the method for the sequential reader to generate responses based on historical conversations is: first, all utterances in the historical conversations are connected into a text sequence in chronological order, then an encoder is used for semantic encoding, and finally a decoder is used for response generation.
[0017] Furthermore, the encoder is implemented using a bidirectional gated neural unit.
[0018] Furthermore, the method for the jump reader to generate responses based on historical conversations is: first, the latest utterance in the historical conversation is used as an anchor point, and the remaining utterances are regarded as contexts; then a hierarchical coding method is used to perform hierarchical semantic encoding on the anchor point and the context respectively; then, based on the anchor point semantics, an integration mechanism is used to integrate the context semantic encoding, and the context integrated semantics is output; finally, a decoder is used to generate responses based on the context integrated semantics and the anchor point semantics.
[0019] Furthermore, the integration mechanism includes: a self-attention mechanism, an anchor point attention mechanism and a feedforward neural network layer; the input of the self-attention mechanism is the contextual semantic encoding, the output of the self-attention mechanism and the anchor point semantic encoding serve as the input of the anchor point attention mechanism, the output of the anchor point attention mechanism serves as the input of the feedforward neural network layer, and the output of the feedforward neural network layer is the contextual integration semantics output by the integration mechanism.
[0020] Furthermore, the method for the jump reader to generate responses based on historical conversations is: first, the latest utterance in the historical conversation is used as an anchor point, and the remaining utterances are regarded as contexts; then a hierarchical encoding method is used to perform hierarchical semantic encoding on the anchor point and the context respectively; then an absorption mechanism is used to enrich the anchor point semantics using context semantics, and the context-enriched anchor semantics is output; finally, a decoder is used to generate responses based on the context-enriched anchor semantics.
[0021] Furthermore, the absorption mechanism includes: a self-attention mechanism, a contextual attention mechanism and a feedforward neural network layer; the input of the self-attention mechanism is the anchor semantic encoding, the output of the self-attention mechanism and the contextual semantic encoding serve as the input of the contextual attention mechanism, the output of the contextual attention mechanism serves as the input of the feedforward neural network layer, and the output of the feedforward neural network layer is the context-rich anchor semantics output by the attraction mechanism.
[0022] A context-adaptive intelligent dialogue response generation device, comprising:
[0023] The dialogue classification module is used to: determine the length type of the historical dialogue: long type or short type according to the number of utterances included in the historical dialogue;
[0024] Sequential reader for: response generation based on short-type historical conversations;
[0025] Skip reader for response generation based on long type history conversations.
[0026] Further, the jump reader includes: an anchor point partitioning module, a layered encoder, an integration mechanism and a decoder;
[0027] The anchor point division module is used to: take the latest utterance in the historical conversation as the anchor point and the remaining utterances as the context;
[0028] The hierarchical encoder is used to: perform hierarchical semantic encoding on anchor points and contexts;
[0029] The integration mechanism is used to: integrate the context semantic encoding according to the anchor semantics, and output the context integrated semantics;
[0030] The decoder is used to generate a response based on context integration semantics and anchor semantics.
[0031] Further, the skip reader includes: an anchor point partitioning module, a layered encoder, an absorption mechanism and a decoder;
[0032] The anchor point division module is used to: take the latest utterance in the historical conversation as the anchor point and the remaining utterances as the context;
[0033] The hierarchical encoder is used to: perform hierarchical semantic encoding on anchor points and contexts;
[0034] The absorption mechanism is used to: use context semantics to enrich anchor semantics, and output context-enriched anchor semantics;
[0035] The decoder is used to generate responses based on context-rich anchor semantics.
[0036] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the method for generating a context-adaptive intelligent dialogue response described in any one of the above items is implemented.
[0037] Compared with the prior art, the present invention has the following beneficial effects:
[0038] The present invention first determines whether the historical conversation is a long type or a short type according to the number of utterances included in the historical conversation; if the historical conversation is a short type conversation, a sequential reader is used to generate a response according to the historical conversation; if the historical conversation is a long type conversation, a jump reader is used to generate a response according to the historical conversation. After the jump reader hierarchically encodes the anchor point and context of the historical conversation, it uses an integration mechanism to integrate the context using the anchor point, or uses an absorption mechanism to enrich the semantics of the anchor point using the context; and then uses a decoder to generate a response according to the processed anchor point and context. The present invention can adaptively use different response generation methods according to the length of the historical conversation, has good flexibility, and can filter noise in long conversations and extract focus information, so that the accuracy of response generation is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a non-hierarchical conversation history modeling approach;
[0040] Figure 2 It is a hierarchical conversation history modeling approach;
[0041] Figure 3 It is the context-adaptive response generation framework described in the embodiment of the present invention;
[0042] Figure 4 It is the integration mechanism and absorption mechanism described in the embodiment of the present invention;
[0043] Figure 5 is the basic decoder described in the embodiment of the present invention;
[0044] Figure 6 is the SR decoder described in the embodiment of the present invention;
[0045] Figure 7 The JR-I decoder according to the embodiment of the present invention;
[0046] Figure 8 The JR-A decoder according to the embodiment of the present invention;
[0047] Fig. 9 is a list of prediction results of each model in the experiment described in the embodiment of the present invention;
[0048] Fig.10 These are two cases in the case analysis of each model of the experiment described in the embodiments of the present invention. DETAILED DESCRIPTION
[0049] The following is a detailed description of an embodiment of the present invention. This embodiment is based on the technical solution of the present invention, and provides a detailed implementation method and a specific operation process to further explain the technical solution of the present invention.
[0050] The present invention provides a context-adaptive intelligent dialogue response generation method for an open domain dialogue system, which is implemented based on a constructed context-adaptive response generation (CARG) framework. The framework adaptively uses different response generation methods to generate responses according to different dialogue histories.
[0051] Figure 3 The CARG framework of the method of the present invention is demonstrated. First, the conversation history is classified into short or long types according to the number of utterances contained in it. Then, a Sequential Reader (SR) is used to generate responses for short conversations, and a Jumping Reader (JR) is used to generate responses for long conversations. The CARG framework includes two response generation models: one is a Sequential Reader, which is specialized in processing short conversations. It connects the historical conversation utterances into a text sequence according to the time order, uses an encoder to semantically encode the conversation history, and then uses a SR-specific decoder for response generation; the other is a Jumping Reader, which is specialized in processing long conversations. It uses the user's latest utterance in the conversation history as an anchor point and refers to the anchor point for selective context utilization. In the Jumping Reader, a hierarchical encoding method is used to obtain the historical conversation for semantic representation, and an optional integration mechanism or absorption mechanism is provided to achieve selective context utilization, and finally a dedicated decoder is used for response generation.
[0052] 1. Formal Definition of Intelligent Dialogue Response Generation
[0053] Given a historical dialogue X = {X1,...,X |X|}, contains |X| utterances and |X|≥1, the task of response generation in the open domain dialogue system is to generate response Y by calculating the conditional probability P(Y|X). Considering that Y contains |Y| words, that is, Y={y1,...,y |Y|}, P(Y|X) can be realized by autoregression as follows:
[0054]
[0055] where y <n It can be seen that response generation consists of two key subtasks: (1) dialogue history modeling, i.e., semantic representation of X; (2) response decoding, i.e., decoding the response based on X and y. <n Generate y n .
[0056] 2. Sequential Reader
[0057] Sequential readers are used for short dialogue response generation. Compared with long dialogues, short dialogues involve fewer interaction turns and less topic drift. However, due to the lack of sufficient dialogue history, this increases the difficulty of characterizing the dialogue context and may lead to irrelevant responses. To solve this problem, the present invention follows a non-hierarchical dialogue history modeling framework, concatenates the entire dialogue history into a sequence and provides it to the "encoder-decoder" framework.
[0058] Specifically, given a dialogue history X = {X1,...,X |X|}, utterance X m (m=1,...,|X|) contains |X m | words, i.e. In this embodiment, the sequential reader concatenates all the utterances in X into a word sequence in chronological order, that is,
[0059]
[0060] Here Then, S is input into the encoder to obtain the semantic representation of the conversation history. The encoding process is formalized as follows:
[0061]
[0062] Here is word x s (x s ∈S), is word x s Through the encoder, S is encoded into a vector sequence, namely In specific practice, this embodiment uses a bidirectional gated recurrent unit (BiGRU) to implement the encoder. seq The implementation is as follows:
[0063]
[0064]
[0065]
[0066] where e t represents the input vector at the tth time step, and is the output vector of the encoder at the tth time step.
[0067] 3. Skip Reader
[0068] Compared with short conversations, long conversations usually have sufficient contextual information. However, since multiple topics are involved in a multi-turn conversation, it is very challenging to filter out the noise and select the context relevant to the current conversation focus. Inspired by the way humans understand long conversations, the skip reader uses the user's latest utterance as a guide and makes selective contextual utilization based on this.
[0069] Specifically, the given conversation history X is decomposed into two parts, where the user’s latest utterance X |X| Represented as anchor point, the rest of X <|X| The present embodiment first adopts a hierarchical coding framework to obtain semantic representations of context and anchor points respectively. Then, two different mechanisms are provided to achieve selective context utilization, wherein the integrating mechanism aims to focus on integrating context, while the absorbing mechanism attempts to enrich anchor points with relevant context information.
[0070] 3.1 Layered Coding
[0071] Given a utterance X m ∈X(m=1,...,|X|), the hierarchical coding framework first uses a discourse encoder to obtain X m Then use a context encoder to get X m Chapter-level representation: Both the discourse encoder and the context encoder are implemented using BiGRU.
[0072] Specifically, for any term x n,m ∈X m (n=1,...,|X m |), speech encoder Enc utt Translates this into:
[0073]
[0074] in Represents x n,m The word vector of X m is represented as Moreover, considering Contains the semantics of the entire utterance, which is set to X in this embodiment m The semantic representation of
[0075] Then, for any utterance in the context, X m ∈X <|X| , context encoder Enccon Further coding:
[0076]
[0077] Here Represents X m The representation at the discourse level not only contains the semantics of the discourse itself, but also benefits from the semantics of neighboring discourses.
[0078] Finally, the semantic representation of anchor points and context can be obtained through hierarchical encoding, namely and Notably, this hierarchical encoding can simultaneously learn the semantics of the conversation and the sequential topic flow, which is also shown to help alleviate the long-term dependency problem existing in long conversations.
[0079] 3.2 Integration Mechanism
[0080] The goal of the integration mechanism is to semantically integrate the importance of each utterance in the context, thereby highlighting the important utterances and weakening the unimportant utterances. Figure 4 As shown in (a), the integration mechanism mainly consists of three layers: self-attention mechanism, anchor attention mechanism and feedforward neural network layer. Among them, the self-attention mechanism performs the first round of integration according to the mutual importance of each discourse in the context; the anchor attention mechanism further integrates the anchor semantics, where the anchor actually represents the current topic focus of the conversation.
[0081] (1) Self-attention mechanism
[0082] for This embodiment uses multi-head self-attention to perform encoding as follows:
[0083]
[0084]
[0085] Here It can be formally defined as:
[0086]
[0087] head h =Attention(q h ,k h ,v h ),h=1,...,H
[0088]
[0089] Here d is the dimension of the vector representation. head hRefers to the result of the h-th attention mechanism, and H refers to the number of heads of the multi-head attention mechanism. is the linear mapping matrix. q, k and v are q h , k h and v h The general representation of , which represents the query vector, key vector and value vector of the attention mechanism respectively.
[0090] (2) Anchor Point Attention Mechanism
[0091] Next, we continue to use an anchor attention mechanism to introduce the semantics of the anchor into the context representation. The process is as follows:
[0092]
[0093]
[0094] Here and Achieve process consistency.
[0095] (3) Feedforward neural network layer
[0096] The feedforward neural network layer contains two fully connected network layers. The first layer uses ReLU as the activation function, and the second layer is a linear layer. The calculation process is as follows:
[0097]
[0098] Among them FF IM The implementation process is as follows:
[0099]
[0100] Here are all trainable parameters.
[0101] Through the above operations, the context is represented Integrated into The relatively more important words will be enhanced, and the semantics of anchor points are also introduced.
[0102] 3.3 Absorption mechanism
[0103] The purpose of the absorption mechanism is to allow the anchor to absorb relevant contextual information. Compared with the integration mechanism, the absorption mechanism advocates that the anchor is the most critical input for response generation, because the response to be generated is fundamentally a feedback to the anchor. Figure 4 (b),The structure of the absorption mechanism is similar to that of the integration mechanism, with the main difference being the input of the attention mechanism.
[0104] Given an anchor point representation First, it is input into a self-attention mechanism layer Then we use a contextual attention mechanism layer To introduce the relevant semantics in the context into the anchor point representation, and finally obtain a context-rich anchor point representation. The calculation process is as follows:
[0105]
[0106]
[0107]
[0108]
[0109]
[0110] Here Both are multi-head attention mechanisms. AM is a feed-forward neural network layer. Represents the context-enriched anchor representation output by the absorption mechanism.
[0111] 4. Decoder
[0112] The decoder generates responses in an autoregressive manner. This embodiment adopts an attention-enhanced recurrent decoder as the basic decoding framework, on which the input is adjusted and finally three decoders are provided for the sequential reader, as well as the integration mechanism and absorption mechanism in the skip reader.
[0113] 4.1 Basic Decoder
[0114] This embodiment uses a unidirectional gated recurrent unit (GRU) and an attention mechanism to construct a basic decoder. Figure 5 As shown, the basic decoder has two inputs, Input1 represents the initial state of GRU at step 0, and Input2 is a vector sequence.
[0115] The decoding process can be expressed as:
[0116]
[0117] Here Dec can be decomposed into the following steps:
[0118] First, in the nth step of the GRU, the attention mechanism calculates each vector in Input2 relative to the hidden state in the (n-1)th step The importance of Input2 is calculated and Input2 is integrated into c according to the importance. The specific process is as follows:
[0119] c=Attention(q,k,v)
[0120] Attention(q,k,v)=∑αv
[0121] α=Softmax(MLP(q,k))
[0122]
[0123] Then, GRU is calculated as follows
[0124]
[0125] Here, is the word generated in step (n-1) The word vector of .
[0126] The final predicted word probability at step n is
[0127]
[0128] W dec is a mapping matrix that can be The dimension is transformed into |V|, where V is a pre-defined dictionary. The word with the highest probability value in the dictionary will be used as the predicted word in the nth step
[0129] The above process is repeated cyclically, generating word by word in an autoregressive manner
[0130] 4.2SR Decoder
[0131] SR decoder, that is, the decoder of the sequential reader, has a basic structure as follows Figure 6 In the sequential reader, the semantic representation of the conversation history is adopted As the decoder's Input2, then the last hidden vector As Input1. The decoding process is formally described as follows:
[0132]
[0133] Decoded This is the response output of the SR decoder.
[0134] 4.3JR-I Decoder
[0135] The JR-I decoder is the decoder corresponding to the integration mechanism in the jump reader. The basic structure is as follows Figure 7 In the skip reader, for the integration mechanism, the decoder is set as follows:
[0136]
[0137] in is the last hidden state represented by the anchor point, is the contextual representation of the output of the integration mechanism.
[0138] 4.4JR-A Decoder
[0139] The JR-A decoder is the decoder corresponding to the absorption mechanism in the jump reader. The basic structure is as follows Figure 8 In the skip reader, for the absorption mechanism, the decoder is set as follows:
[0140]
[0141] in It is the anchor point representation after context supplementation.
[0142] 5. Loss Function
[0143] For each predicted response The loss function L of the model adopts the cross entropy form, which is The negative log-likelihood of is calculated as:
[0144]
[0145] Where P(y n ) represents the one-hot vector of the real word at the nth step, is the probability value of the predicted word at the nth step, for Length.
[0146] 6. Performance Testing
[0147] In order to verify the effectiveness of the present invention, two recognized dialogue data sets were used to perform performance tests on the present invention and typical prior art solutions to demonstrate the technical effect of the present invention.
[0148] 6.1 Experimental Setup
[0149] 6.1.1 Dataset and Preprocessing
[0150] This experiment selected two widely used datasets, DailyDialog and PersonaChat, for experimental verification, where:
[0151] DailyDialog contains about 10k conversations between people from daily life, covering different topics such as culture, travel, etc.
[0152] PersonaChat contains more than 12k character-conditioned conversations. Each conversation is produced by two crowdsourced workers assuming a predefined role.
[0153] Both datasets are chat corpora containing natural multi-round interactions between people. To some extent, compared with PersonaChat, the topics in DailyDialog are more diverse and the language style is closer to real life.
[0154] First, the original dataset is preprocessed. For the two corpora, the official public training / test sets are used. Given the dialogues in the training set (or test set), that is, {X1,...,X M}(M>1), {X1,...,X m-1} As a conversation history, X m as the true response, where 1<m≤M. For each sample, the maximum number of utterances in the conversation history is set to 20, and the maximum number of words in each utterance is set to 50. Any sample that does not meet the above restrictions will be truncated. For each dataset, the average value of the number of utterances is used as the threshold, and the conversation samples are divided into two categories, namely short conversations and long conversations. For example, for each conversation in the DailyDialog dataset, if its conversation history contains more than 5 utterances, it is classified as a long conversation type; otherwise, it is classified as a short conversation type. The threshold for the PersonaChat dataset is 7.
[0155] 6.1.2 Baseline Model
[0156] In order to compare the performance, this experiment uses the following typical existing methods as baseline models:
[0157] Seq2Seq-RNN is a classic baseline model that uses RNN to implement Seq2Seq. A large number of studies have demonstrated its excellent performance in response generation. This paper uses the notation of S2S-R for simplicity.
[0158] Seq2Seq-Transformer replaces the RNN of S2S-RNN with the Transformer structure, aiming to utilize the Transformer's powerful long text sequence modeling capabilities. This article uses S2S-T for simplified representation.
[0159] T5 is a generative pre-trained model that converts natural language processing tasks into a text generation format. Take the pre-trained T5-small version and fine-tune it on the pre-processed dialogue dataset.
[0160] SD-HRED adopts a hierarchical encoding framework to encode the dialogue, proposes a static attention mechanism to model the importance of each context, and proposes a dynamic attention mechanism to model the importance of each context relative to the response to be generated.
[0161] HRAN proposes a hierarchical attention framework for response generation tasks, which models the importance of each utterance and the importance of each context word.
[0162] CCTA is a context-controlled and topic-aware response generation model. It models conversations at both the word and topic levels.
[0163] 6.1.3 Evaluation Metrics
[0164] Five indicators are used to evaluate the performance of the proposed CARG and baseline models.
[0165] BLEU-4. BLEU is a commonly used indicator for response generation, which is used to evaluate the overlap between the real response and the generated response on N-grams, where N-gram represents the number of consecutive words. BLEU-4 is used as a representative of the BLEU score because the calculation process of BLEU-4 has taken into account the influence of all N-grams (N=1,2,3,4).
[0166] BERTScore. Compared with BLEU-4, which focuses on word overlap, BERTScore can measure semantic relevance in the embedding space. It uses BERT pre-trained word vectors to represent the words of the generated response and the real response, and then calculates their mutual cosine similarity.
[0167] ·H u .H u , which is the average entropy of the bigrams at the utterance level, measures the amount of information in the generated response. u The higher it is, the more informative the response is.
[0168] Distinct-2. Distinct-2 measures the percentage of distinct bigrams in the predicted response. Higher values of Distinct-2 indicate that the model can generate more diverse responses.
[0169] Since dialogue evaluation is a complex task, this experiment uses the above indicators to provide comprehensive evaluation from different perspectives. BLEU-4 and BERTScore can indicate the relevance and appropriateness of the generated responses, H u It focuses on the information content at the sentence level, while Distinct-2 is used for lexical diversity at the corpus level.
[0170] 6.2 Experimental Results and Discussion
[0171] 6.2.1 Results and analysis of automatic evaluation indicators
[0172] Performance comparisons are performed between CARG and baselines. Specifically, the prediction results of various models on DailyDialog and PersonaChat datasets evaluated according to automatic metrics are listed in Fig. 9 In the table shown, CARG-I indicates that the jump reader adopts the integration mechanism, and CARG-A indicates that the jump reader adopts the absorption mechanism.
[0173] (1) On the DailyDialog dataset, in the baseline model:
[0174] S2S-R performs worst on BERTScore, while u This may be because without the conversation context, S2S-R generates irrelevant responses that contain a lot of noise.
[0175] Although S2S-T takes the conversation context into account, its improvement over S2S-R is not obvious, which indicates that the Transformer structure can handle longer text sequences but is not good at capturing the temporal order relationship in the conversation.
[0176] T5 performs well in terms of relevance metrics, namely BLEU-4 and BERTScore, while its u and Distinct-2. By manually inspecting the generated responses, we can find that T5 can usually predict accurate phrases, but it is insensitive to the current conversation focus and tends to give repeated responses to samples with similar conversation history. This is because the prior knowledge learned from pre-training gives T5 excellent text generation capabilities, but weak capabilities in conversation understanding.
[0177] For the models adopting hierarchical encoding framework, i.e., SD-HRED, HRAN, and CCTA, it can be found that most of them perform better than the non-hierarchical models (S2S-R, S2S-T, and T5). In particular, CCTA, which explicitly considers the dynamic topic flow, achieves the best performance in terms of BLEU-4 and Distinct-2. This means that in multi-turn dialogues, it is important to capture the dialogue structure and dynamic topic drift.
[0178] (2) On the DailyDialog dataset, compared with the baseline model:
[0179] CARG-I and CARG-A achieve substantial gains on BERTScore and report impressive performance on BLEU-4 and Distinct. u It obtains the highest value on , but its performance on the relevance indicators (i.e., BLEU-4 and BERTScore) is obviously poor. This confirms the effectiveness of the proposed solution on the response generation task and shows that the proposed method is superior to the baseline model in balancing the relevance and information content of the response.
[0180] (3) In the PersonaChat dataset, it can be seen that the models of the proposed method (CARG-I and CARG-A) always show good performance in various indicators.
[0181] In particular, CARG-A beats the best baseline, i.e., SD-HRED, in terms of BLEU-4 and BERTScore, and shows comparable performance on the remaining metrics. CARG-I can beat most baselines on most metrics.
[0182] The above results verify the effectiveness of the method of the present invention from the perspective of larger-scale data and longer conversation history.
[0183] ·In addition, it can be noted that all models in PersonaChat perform better than DailyDialog on relevance metrics (BLEU-4 and BERTScore), while the opposite is true for diversity metrics (Distinct-2). This may be because the conversations in PersonaChat are generated by crowdsourced workers who have a strong purpose when conducting conversations, that is, to understand the personal characteristics of the other party. Therefore, the discourse in PersonaChat is generally more meaningful and informative than that in DailyDialog. This provides a semantically clear language style, making it easier for the model to generate relevant responses. However, since all interlocutors have the same conversation goal, the conversations in PersonaChat are not as diverse as those in DailyDialog, which may explain the poor performance of Distinct-2.
[0184] (4) On both datasets, CARG-A outperforms CARG-I for BLEU-4 and BERTScore, but outperforms CARG-I for H uThe performance is comparable to that on Distinct-2. Considering that CARG-I applies all contexts to generate responses for long conversations, while CARG-A only uses context-rich anchor representations, we can conclude that: on the one hand, context can be beneficial to the amount and diversity of information generated in responses; on the other hand, utilizing all contexts without careful filtering may introduce noise, which further impairs response relevance.
[0185] 6.2.2 Case Analysis
[0186] To gain a deeper understanding of how the CARG framework works, Fig.10 Examples of responses generated by various models are shown in .
[0187] exist Fig.10 In the first case shown, the dialogue history is very short and contains only one utterance. Due to the richness of natural language, there may be multiple possible responses to the dialogue history. It can be seen that the responses generated by S2S-T, T5, SD-HRED, HRAN, CCTA and the models of the present invention (CARG-I and CARG-A) are suitable as feedback for a given dialogue history. At the same time, it can also be found that all generated responses are not consistent with the real response, except that the response provided by S2S-T shows a little textual similarity. This may be because the amount of information in a given dialogue history is limited and lacks sufficient context constraints, resulting in diverse responses. It is worth mentioning that the responses generated by CCTA are considerable, appropriate, informative, and more importantly, reflect human nature.
[0188] exist Fig.10 In the second case shown, the given conversation history involves multiple rounds of interactions and shows obvious topic drift. The overall context of this conversation is "reporting intrusions", while its local focus transitions from "when" to "where". In this case, the responses of T5, SD-HRED, and HRAN fail to capture the ongoing conversation focus and incorrectly answer "when". Although S2S-R captures the focus of "where", its response is semantically contradictory. S2S-T gives appropriate feedback from the perspective of human understanding, but deviates from the true response. CCTA fails to generate relevant responses for the given conversation history. For the proposed solution models CARG-I and CARG-A, polarized performance can be found. CARG-I's response is irrelevant, while CARG-A accurately captures the current conversation focus, i.e., "where", and gives a reasonable reply. CARG-A's absorption mechanism can filter out noise and enrich anchor points with relevant context, resulting in good performance in response relevance.
[0189] The above embodiments are preferred embodiments of the present application. Ordinary technicians in this field can also make various changes or improvements on this basis. Without departing from the overall concept of the present application, these changes or improvements should fall within the scope of protection required by the present application.
Claims
1. A context-adaptive intelligent dialogue response generation method, characterized in that: include: According to the number of utterances included in the historical dialogue, determine the length type of the historical dialogue: long type or short type; If the historical dialogue is a short type dialogue, a sequential reader is used to generate responses based on the historical dialogue; If the historical dialogue is a long type dialogue, a jump reader is used to generate responses based on the historical dialogue; The method for the sequential reader to generate responses according to the historical dialogue is as follows: firstly, all the utterances in the historical dialogue are connected into a text sequence in chronological order, then an encoder is used for semantic encoding, and finally a decoder is used for response generation; The method for the jump reader to generate a response based on the historical dialogue is: First, the latest utterance in the historical conversation is taken as the anchor point, and the rest of the utterance is taken as the context; then, the anchor point and the context are hierarchically encoded using a hierarchical encoding method; then, according to the anchor point semantics, the context semantic encoding is integrated using an integration mechanism, and the context integrated semantics is output; finally, a decoder is used to generate a response based on the context integrated semantics and the anchor semantics; or, First, the latest utterance in the historical conversation is taken as the anchor point, and the rest of the utterance is regarded as the context. Then, a hierarchical encoding method is used to perform hierarchical semantic encoding on the anchor point and the context respectively. Then, an absorption mechanism is used to enrich the anchor point semantics with context semantics, and the output is the context-enriched anchor semantics. Finally, a decoder is used to generate a response based on the context-enriched anchor semantics.
2. The method according to claim 1, characterized in that The integration mechanism includes: a self-attention mechanism, an anchor point attention mechanism and a feedforward neural network layer; the input of the self-attention mechanism is the contextual semantic encoding, the output of the self-attention mechanism and the anchor point semantic encoding serve as the input of the anchor point attention mechanism, the output of the anchor point attention mechanism serves as the input of the feedforward neural network layer, and the output of the feedforward neural network layer is the contextual integration semantics output by the integration mechanism.
3. The method according to claim 1, characterized in that The absorption mechanism includes: a self-attention mechanism, a contextual attention mechanism and a feedforward neural network layer; the input of the self-attention mechanism is the anchor semantic encoding, the output of the self-attention mechanism and the contextual semantic encoding are used as the input of the contextual attention mechanism, the output of the contextual attention mechanism is used as the input of the feedforward neural network layer, and the output of the feedforward neural network layer is the context-rich anchor semantics output by the attraction mechanism.
4. A context-adaptive intelligent dialogue response generation device, characterized in that: include: A dialogue classification module, for: classifying historical dialogues into long types or short types according to the number of utterances included in the historical dialogues; The sequential reader is used to generate responses based on short historical conversations. First, all the utterances in the historical conversations are concatenated into a text sequence in chronological order, then an encoder is used for semantic encoding, and finally a decoder is used for response generation. Skip Reader for response generation based on long-type historical conversations; The skip reader includes: an anchor point partitioning module, a layered encoder, an integration mechanism and a decoder; The anchor point division module is used to: take the latest utterance in the historical conversation as the anchor point and the remaining utterances as the context; The hierarchical encoder is used to: perform hierarchical semantic encoding on anchor points and contexts; The integration mechanism is used to: integrate the context semantic encoding according to the anchor semantics, and output the context integrated semantics; The decoder is used to: generate a response according to context integration semantics and anchor semantics; Alternatively, the skip reader comprises: an anchor partitioning module, a layered encoder, an absorption mechanism and a decoder; The anchor point division module is used to: take the latest utterance in the historical conversation as the anchor point and the remaining utterances as the context; The hierarchical encoder is used to: perform hierarchical semantic encoding on anchor points and contexts; The absorption mechanism is used to: use context semantics to enrich anchor semantics, and output context-enriched anchor semantics; The decoder is used to generate responses based on context-rich anchor semantics.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.
