Common sense-enhanced multi-turn dialogue response sequencing method and device

CN116628159BActive Publication Date: 2026-08-14TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310575292.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-19
Publication Date
2026-08-14
Estimated Expiration
2043-05-19

AI Technical Summary

Technical Problem

但是要理解背景知识与对话上下文之间的关系往往还需要借助人类的常识进行有效的推理,而已有方法忽略了这一点

Benefits of technology

[0032]本发明实施例的常识增强的多轮对话应答排序方法和装置,可以更好地发挥其强大的语言表示和理解能力,对对话文本进行建模,多头注意机制可以充分捕捉上下文、以及应答候选对象每个词语之间的关系,从而对应答候选对象产生全面的理解。在线上预测过程中仅利用训练好的PLMs对应答候选集进行排序,省去GNN部分繁重的计算,提高应答集排序效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116628159B_ABST
    Figure CN116628159B_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for ranking responses in multi-turn dialogues using common sense enhancement. The method includes: extracting knowledge from a common sense knowledge graph based on first dialogue data to construct an entity subgraph using the extracted entities as context nodes; inputting the preprocessed first dialogue data and entity subgraph into a response network model to output two representation vectors for the context nodes; training and optimizing the response network model using the similarity between the two representation vectors and the loss between the predicted response output and the actual response output as objective functions to obtain a trained response network model; inputting second dialogue data into the trained response network model for multi-turn dialogue response output, and ranking the multi-turn dialogue response outputs to obtain a ranked response result. This invention can significantly improve the efficiency of ranking response candidates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of dialogue system technology, and in particular to a method and apparatus for sequencing responses in multi-turn dialogues with enhanced common sense. Background Technology

[0002] Ranking the candidate response set in multi-turn dialogues is one of the core operations of dialogue systems. For example, generative dialogue systems generate a set of statements as candidates based on the dialogue content using a generative model, while retrieval dialogue systems select statements from an existing corpus that match the current dialogue content as candidates, and then rank the existing candidate response sets. Existing methods based on neural networks and pre-trained language models can rank candidate response sets; however, for complex dialogues with long contexts and background information constraints, a certain amount of common-sense knowledge is often required to assist the dialogue.

[0003] One of the most important tasks of advanced artificial intelligence is to build dialogue systems capable of barrier-free communication with humans. Currently, dialogue systems are mainly divided into two types: generative and retrieval. Generative dialogue systems generate a set of candidate statements based on the dialogue content using a generative model, while retrieval dialogue systems select statements from an existing corpus that match the current dialogue content as candidate statements. Both types of dialogue systems require ranking the existing candidate response sets. Therefore, ranking the candidate response sets in multi-turn dialogues is an essential component of dialogue systems. Traditional methods focus on generating more comprehensive representations for both context and response, and obtaining the final matching score through a matching layer. With the rapid development of deep neural networks, researchers have utilized convolutional neural networks (CNNs), recurrent neural networks (RNNs), and self-attention mechanisms combined with multilayer perceptrons (MLPs) and pooling layers to learn effective representations. In recent years, researchers have proposed various model variants based on the attention mechanisms of pre-trained language models (PLMs) to more comprehensively learn the relationships between all context sentences and response candidates, addressing the response candidate ranking problem. At the same time, various methods utilizing dialogue contextual knowledge to improve performance have also been proposed, such as entity information boxes from Wikipedia. However, understanding the relationship between background knowledge and the context of a conversation often requires effective reasoning based on common sense, a point that existing methods have overlooked. Summary of the Invention

[0004] The present invention aims to at least partially solve one of the technical problems in the related art.

[0005] To address this, this invention proposes a common sense-enhanced multi-turn dialogue response ranking method. It combines a pre-trained language model with a graph neural network and designs a Siamese network box called SinLG. During online prediction, it only uses trained PLMs to rank the response candidate set, eliminating the heavy computation of the GNN part and achieving fast ranking of the response candidate set.

[0006] Another object of the present invention is to provide a common sense-enhanced multi-turn dialogue response sorting device.

[0007] To achieve the above objectives, this invention proposes a common-sense-enhanced multi-turn dialogue response ranking method, comprising:

[0008] Knowledge extraction is performed on the commonsense knowledge graph based on the first dialogue data, and the extracted entities are used as context nodes to construct an entity subgraph.

[0009] The preprocessed first dialogue data and entity subgraph are input into the response network model, and the output is two representation vectors of the context node.

[0010] The similarity between the two representation vectors and the loss value between the predicted response output and the actual response output obtained based on the response network model are used as objective functions to train and optimize the response network model, so as to obtain a trained response network model.

[0011] The second dialogue data is input into the trained response network model to generate multi-round dialogue response outputs, and the multi-round dialogue response outputs are sorted to obtain the response ranking results.

[0012] In addition, the common-sense-enhanced multi-turn dialogue response ranking method according to the above embodiments of the present invention may also have the following additional technical features:

[0013] Furthermore, in one embodiment of the present invention, the response network model includes a pre-trained language model; preprocessing the first dialogue data and entity subgraph includes:

[0014] The word segmentation results are concatenated to obtain the input sequence; and,

[0015] Each entity in the entity subgraph is input into the pre-trained language model, and a subgraph with initialized representation vectors is output.

[0016] Furthermore, in one embodiment of the present invention, the response network model further includes a graph neural network; the step of inputting the preprocessed first dialogue data and entity subgraph into the response network model and outputting two representation vectors of the context node includes:

[0017] The input sequence is fed into the pre-trained language model to obtain the first representation vector of the context node; and...

[0018] The subgraph is input into the graph neural network for calculation, and the second representation vector of the context node is output based on the calculation result.

[0019] Further, in one embodiment of the present invention, the step of using the similarity between the two representation vectors and the loss value between the predicted response output obtained based on the response network model output and the actual response output as the objective function to train and optimize the response network model to obtain a trained response network model includes:

[0020] Calculate the similarity between the first representation vector and the second representation vector;

[0021] The first representation vector is input into the graph neural network for calculation, and the output is used to obtain the response output prediction result.

[0022] Calculate the cross-entropy between the predicted response output and the actual response output, and preprocess the similarity and the cross-entropy to obtain the data preprocessing result;

[0023] The data preprocessing results are used as the objective function to train and optimize the pre-trained language model, so as to obtain a trained response network model based on the training and optimization results.

[0024] Furthermore, in one embodiment of the present invention, the step of extracting knowledge from the commonsense knowledge graph based on the first dialogue data, and constructing an entity subgraph using the extracted entities as context nodes, includes:

[0025] The first dialogue data is segmented into words to obtain the segmentation results.

[0026] Based on the word segmentation results and entity links, several related entities are extracted from the common sense knowledge graph, and an entity subgraph is constructed using these entities.

[0027] To achieve the above objectives, another aspect of the present invention provides a common-sense-enhanced multi-turn dialogue response sequencing device, comprising:

[0028] The knowledge extraction module is used to extract knowledge from the common sense knowledge graph based on the first dialogue data, and to construct an entity subgraph using the extracted entities as context nodes.

[0029] The vector representation module is used to input the preprocessed first dialogue data and entity subgraph into the response network model and output two representation vectors of the context node.

[0030] The model training module is used to train and optimize the response network model by using the similarity between the two representation vectors and the loss value between the predicted response output and the actual response output obtained based on the response network model as the objective function, so as to obtain a trained response network model.

[0031] The response ranking module is used to input the second dialogue data into the trained response network model to perform multi-round dialogue response output, and to rank the multi-round dialogue response output results to obtain the response ranking result.

[0032] The common-sense-enhanced multi-turn dialogue response ranking method and apparatus of this invention can better leverage its powerful language representation and understanding capabilities to model the dialogue text. The multi-head attention mechanism can fully capture the context and the relationships between each word in the response candidate, thereby generating a comprehensive understanding of the response candidate. During online prediction, only trained PLMs are used to rank the response candidate set, eliminating the heavy computation of the GNN part and improving the efficiency of response set ranking.

[0033] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0034] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0035] Figure 1 This is a flowchart of a common-sense-enhanced multi-turn dialogue response ranking method according to an embodiment of the present invention;

[0036] Figure 2 This is a flowchart of the model training process in the common sense-enhanced multi-turn dialogue response ranking method according to an embodiment of the present invention;

[0037] Figure 3 This is a schematic diagram of a common-sense-enhanced multi-turn dialogue response sorting device according to an embodiment of the present invention. Detailed Implementation

[0038] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0039] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0040] The following description, with reference to the accompanying drawings, describes a common-sense-enhanced multi-turn dialogue response sequencing method and apparatus according to embodiments of the present invention.

[0041] This invention combines pre-trained language models with graph neural networks (GNNs) to design a Siamese network framework called SinLG. It is well known that PLMs can accumulate a large amount of language principles and knowledge through pre-training due to their powerful memory capacity with their large number of parameters. PLMs possess strong language representation and comprehension capabilities, but their performance improvement may be limited compared to previous research due to improper application, especially when the target task requires specific background knowledge. Therefore, this invention proposes to improve the performance of PLMs by combining common sense from external knowledge graphs (KGs) with graph neural networks (GNNs), thereby stimulating the relevant knowledge memory of PLMs. The GNN is responsible for inferring useful common sense information from the additional knowledge graph and assisting in the fine-tuning of PLMs. With the addition of common sense knowledge, the performance of PLMs can be improved in more complex and challenging comprehension tasks. Instead of directly appending the representation vectors learned from the KG to the representation vectors of PLMs, this invention proposes KG-guided efficient inference training, using the similarity between the representation vectors of the GNN and PLMs as one of the self-supervised objective functions for optimization, helping PLMs achieve better performance. This approach not only transfers common-sense knowledge from GNNs to PLMs but also enhances the supervision signal, enabling the framework to generalize better on limited training data. PLMs can better leverage their powerful language representation and understanding capabilities to model dialogue text. The multi-head attention mechanism can fully capture the context and the relationships between each word in the response candidates, thus achieving a comprehensive understanding of the response candidates. In online prediction, only the trained PLMs are used to rank the response candidate set, eliminating the computationally intensive parts of GNNs, such as entity linking and concept ranking, which are time-consuming and lead to higher latency and a poorer user experience.

[0042] Figure 1 This is a flowchart of a common-sense-enhanced multi-turn dialogue response sorting method according to an embodiment of the present invention.

[0043] like Figure 1 As shown, the method includes, but is not limited to, the following steps:

[0044] S1, extract knowledge from the common sense knowledge graph based on the first dialogue data, and construct an entity subgraph using the extracted entities as context nodes.

[0045] S2, input the preprocessed first dialogue data and entity subgraph into the response network model, and output two representation vectors of the context node;

[0046] S3, the similarity between the two representation vectors and the loss value between the predicted response output obtained from the response network model and the actual response output are used as the objective function to train and optimize the response network model, so as to obtain a well-trained response network model.

[0047] S4. Input the second dialogue data into the trained response network model to generate multi-round dialogue response outputs, and sort the multi-round dialogue response outputs to obtain the response ranking results.

[0048] Figure 2 This is a flowchart illustrating the model training process in a common-sense-enhanced multi-turn dialogue response ranking method according to an embodiment of the present invention. Specifically, it requires overall training of the proposed SinLG Siamese network framework. Figure 2 As shown.

[0049] It is understandable that the problem to be solved by this invention can be formally defined as: the input is a dialogue dataset D = {D i :(P i C i R i Y i The dataset D is a commonsense knowledge graph G = (V, E, T), where i = {1, 2, ..., |D|} and C = {1, 2, ..., |D|}. P represents the persona information in the dialogue, C represents the dialogue context, R represents the set of response candidates, Y represents the set of reasonableness scores corresponding to the response candidates, and the dataset D has |D| sample data. V represents the set of |V| nodes, E represents the set of |E| edges, and T represents the |T| types of edges. E belongs to the set V×T×V obtained by the Cartesian product of node and edge types. The output is a ranking model, which can be represented as: f(P) i C i R i ,G)→Y i .

[0050] This invention's embodiment employs a common-sense-enhanced multi-turn dialogue response ranking technique, SinLG, which is based on a pre-trained language model (PLM). s ) and Graph Neural Networks (GNNs) s The twin network framework of PLM. s Attention mechanisms are used to learn the relationships between words in a sentence, essentially acting as an encoder. The input is the sentence, and the output is a representation vector of the sentence, which can typically be represented by the following function:

[0051] h p =f p (u),

[0052] Where u represents the input statement, h p The representation vector represents the statement; GNNs, on the other hand, utilize information passing mechanisms to enhance effective information through the continuous integration of neighbor information. Given a graph and a specified node, the output is the representation vector of that specified node, which can typically be represented by the following function:

[0053] h i =f g (G, v) i ),

[0054] Where G represents the input graph data, v i h represents the specified node. i Indicates v i The representation vector. We use a dialogue context and response candidate pair (P) i C i R i,k Y i,k For example, R i,k Y represents the k-th response candidate. i,k This indicates the corresponding label.

[0055] Specifically, obtain the dialogue dataset D and the commonsense knowledge graph G. Then, extract related entities from the knowledge graph as nodes based on the dialogue content to construct an entity subgraph.

[0056] In some embodiments of the present invention, based on dialogue data P i C i R i,k The word segmentation results are used to extract several related entities (e.g., 100) from the knowledge graph through entity links to construct an entity subgraph G. i,k The dialogue context is also used as a virtual node to connect with other entity nodes, and the weight is the relevance coefficient calculated by PLMs.

[0057] Understandably, word segmentation is the process of breaking down long sentences of dialogue into individual words or phrases. For example, the word segmentation result for "Do you like hot dog?" is: do; you; like; hot dog.

[0058] Understandably, this entity linking involves matching the word segmentation results of the dialogue data with entities in the knowledge graph.

[0059] Understandably, this correlation coefficient is used to measure the strength of the relationship between nodes in the entity subgraph and nodes in the dialogue context, that is, whether the knowledge extracted from the knowledge graph has a practical effect on the dialogue context, and the magnitude of that effect.

[0060] Furthermore, the dialogue data and the entity subgraphs obtained above are preprocessed and used as input data for the pre-trained language model and graph neural network.

[0061] In some embodiments of the present invention, the dialogue data P i C i R i,kThe word segmentation results are concatenated to form an input sequence A. i,k Input each entity of the entity subgraph into PLMs to obtain a subgraph G′ with an initialized representation vector. i,k The context virtual node is represented by the letter B.

[0062] Understandably, A i,k The composition is P i C i R i,k , where P i C i For the context of the dialogue, R i,k These are the candidate responses.

[0063] Furthermore, the results obtained from the data preparation operation are input into the pre-trained language model and the graph neural network, respectively, to obtain two representation vectors of the dialogue context.

[0064] In some embodiments of the present invention, sequence A is... i,k Inputting the pre-trained language model yields a representation vector h of the dialogue context and response candidates. A =f p (A i,k ), subgraph G′ i,k Input the graph neural network to obtain another representation vector h. B :

[0065] h B =f g (G′ i,k B).

[0066] Furthermore, the similarity between the two representation vectors obtained above is calculated as part of the objective function; the representation vectors calculated using the pre-trained language model are then passed through a fully connected layer to obtain the prediction result.

[0067] In some embodiments of the present invention, the similarity between two representation vectors is calculated as part of the objective function:

[0068] L cos =CosineSimilarity(h A h B ),

[0069] From the representation vector h A The calculated prediction result is the score for each response candidate. In other words, for online prediction, only trained PLMs are needed, where f... d Fully connected layer networks:

[0070]

[0071] Furthermore, the cross-entropy between the predicted results and the true values ​​is calculated (the true values ​​are the labels provided by the dataset; each response candidate is scored 1 when it matches the dialogue context and 0 when it does not). The calculated similarity is maximized and the cross-entropy is minimized. The combination of these two is used as the objective function to train and optimize the model.

[0072] In some embodiments of the present invention, the cross-entropy between the predicted result and the actual result is calculated:

[0073]

[0074] The similarity calculated above is combined with the model's similarity score and used as the final objective function for training and optimization.

[0075] L=αL bce +(1-α)L cos ,

[0076] Based on hyperparameter experimental analysis, the best results are achieved when α is 0.5 or 0.7.

[0077] Finally, the trained model is output, namely the trained response network model.

[0078] Therefore, the dialogue data of the new location is input into the trained response network model to generate multi-round dialogue response outputs, and the multi-round dialogue response outputs are sorted to obtain the response ranking results.

[0079] Furthermore, the experimental results of this invention are as follows:

[0080] To verify the effectiveness of SinLG, a commonsense-enhanced multi-turn dialogue response ranking technique, experiments were conducted on the PERSONA-CHAT multi-turn dialogue dataset. This dataset includes two datasets with different levels of difficulty: the original and the revised dataset. The revised dataset is rewritten and reorganized compared to the original, resulting in a higher difficulty level. Experimental results show that SinLG has a significant advantage over baseline models, especially on the more difficult dataset, achieving an improvement of more than 2%. The performance gain of SinLG compared to PLMs indicates that external commonsense knowledge can provide auxiliary information to improve its performance. This suggests that PLMs do not always exhibit optimal performance through fine-tuning; additional knowledge can help evoke relevant memories for certain tasks.

[0081] To ensure the efficiency of SinLG, a multi-turn dialogue response ranking technique enhanced by common sense, this invention designs the model for knowledge graph-guided training. Only during the training phase is GNNs used for effective knowledge introduction and guidance, while the prediction phase utilizes pre-trained PLMs. Experimental results show that for a single sample, the average, worst, and best computation times required to include both PLMs and GNNs are 1.8315s, 2.534s, and 1.5523s, respectively. Our proposed solution maintains the same computational efficiency as PLMs, with average, worst, and best computation times of 0.2271s, 0.221s, and 0.216s, respectively.

[0082] The common-sense-enhanced multi-turn dialogue response ranking method according to embodiments of the present invention can better leverage its powerful language representation and understanding capabilities to model the dialogue text. The multi-head attention mechanism can fully capture the context and the relationships between each word in the response candidate, thereby generating a comprehensive understanding of the response candidate. During online prediction, only trained PLMs are used to rank the response candidate set, eliminating the heavy computational burden of the GNN part and improving the efficiency of response set ranking.

[0083] To achieve the above embodiments, such as Figure 3 As shown, this embodiment also provides a commonsense-enhanced multi-turn dialogue response ranking device 10, which includes a knowledge extraction module 100, a vector representation module 200, a model training module 300, and a response ranking module 400.

[0084] The knowledge extraction module 100 is used to extract knowledge from the common sense knowledge graph based on the first dialogue data, and to construct an entity subgraph using the extracted entities as context nodes.

[0085] The vector representation module 200 is used to input the preprocessed first dialogue data and entity subgraph into the response network model and output two representation vectors of the context node.

[0086] The model training module 300 is used to train and optimize the response network model by taking the similarity between two representation vectors and the loss value between the response output prediction result obtained based on the response network model output and the actual response output result as the objective function, so as to obtain a trained response network model.

[0087] The response ranking module 400 is used to input the second dialogue data into the trained response network model to perform multi-round dialogue response output, and to rank the multi-round dialogue response output results to obtain the response ranking result.

[0088] Furthermore, the response network model, including a pre-trained language model, also includes a preprocessing module prior to the vector representation module 200, for preprocessing the first dialogue data and entity subgraph, including:

[0089] The word segmentation results are concatenated to obtain the input sequence; and,

[0090] Each entity in the entity subgraph is input into a pre-trained language model, and the output is a subgraph with initialized representation vectors.

[0091] Furthermore, the response network model also includes a graph neural network; the aforementioned vector representation module 200 is also used for:

[0092] The input sequence is fed into a pre-trained language model to obtain the first representation vector of the context node; and...

[0093] The subgraph is input into the graph neural network for computation, and the second representation vector of the context node is output based on the computation result.

[0094] Furthermore, the model training module 300 is also used for:

[0095] Calculate the similarity between the first representation vector and the second representation vector;

[0096] The first representation vector is input into the graph neural network for calculation, and the output is used to obtain the response output prediction result.

[0097] Calculate the cross-entropy between the predicted response output and the actual response output, and preprocess the similarity and cross-entropy to obtain the data preprocessing result;

[0098] The data preprocessing results are used as the objective function to train and optimize the pre-trained language model, so as to obtain a well-trained response network model based on the training and optimization results.

[0099] Furthermore, the knowledge extraction module 100 is also used for:

[0100] The first dialogue data is segmented into words to obtain the segmentation results.

[0101] Based on the word segmentation results and entity links, several related entities are extracted from the commonsense knowledge graph, and an entity subgraph is constructed using these entities.

[0102] The common-sense-enhanced multi-turn dialogue response ranking device according to embodiments of the present invention can better leverage its powerful language representation and understanding capabilities to model the dialogue text. The multi-head attention mechanism can fully capture the context and the relationships between each word in the response candidate, thereby achieving a comprehensive understanding of the response candidate. During online prediction, only trained PLMs are used to rank the response candidate set, eliminating the heavy computational burden of the GNN part and improving the efficiency of response set ranking.

[0103] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0104] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

Claims

1. A common-sense-enhanced multi-turn dialogue response ranking method, characterized in that, Includes the following steps: Knowledge extraction is performed on the commonsense knowledge graph based on the first dialogue data, and the extracted entities are used as context nodes to construct an entity subgraph. The preprocessed first dialogue data and entity subgraph are input into the response network model, and the output is two representation vectors of the context node. The similarity between the two representation vectors and the loss value between the predicted response output and the actual response output obtained based on the response network model are used as objective functions to train and optimize the response network model, so as to obtain a trained response network model. The second dialogue data is input into the trained response network model to generate multi-round dialogue response outputs, and the multi-round dialogue response outputs are sorted to obtain the response ranking results. The response network model includes a pre-trained language model; Preprocessing the first dialogue data and entity subgraph includes: The word segmentation results are concatenated to obtain the input sequence; and, Each entity in the entity subgraph is input into the pre-trained language model, and a subgraph with initialized representation vectors is output. The response network model further includes a graph neural network; the step of inputting the preprocessed first dialogue data and entity subgraph into the response network model and outputting two representation vectors of the context nodes includes: The input sequence is fed into the pre-trained language model to obtain the first representation vector of the context node; and... The subgraph is input into the graph neural network for calculation, and the second representation vector of the context node is output based on the calculation result.

2. The method according to claim 1, characterized in that, The step of using the similarity between the two representation vectors and the loss value between the predicted response output obtained from the response network model and the actual response output as the objective function to train and optimize the response network model to obtain a trained response network model includes: Calculate the similarity between the first representation vector and the second representation vector; The first representation vector is input into the graph neural network for calculation, and the output is used to obtain the response output prediction result. Calculate the cross-entropy between the predicted response output and the actual response output, and preprocess the similarity and the cross-entropy to obtain the data preprocessing result; The data preprocessing results are used as the objective function to train and optimize the pre-trained language model, so as to obtain a trained response network model based on the training and optimization results.

3. The method according to claim 1, characterized in that, The step of extracting knowledge from the commonsense knowledge graph based on the first dialogue data, and constructing an entity subgraph using the extracted entities as context nodes, includes: The first dialogue data is segmented into words to obtain the segmentation results. Based on the word segmentation results and entity links, several related entities are extracted from the common sense knowledge graph, and an entity subgraph is constructed using these entities.

4. A common-sense-enhanced multi-turn dialogue response ranking device, characterized in that, include: The knowledge extraction module is used to extract knowledge from the common sense knowledge graph based on the first dialogue data, and to construct an entity subgraph using the extracted entities as context nodes. The vector representation module is used to input the preprocessed first dialogue data and entity subgraph into the response network model and output two representation vectors of the context node. The model training module is used to train and optimize the response network model by using the similarity between the two representation vectors and the loss value between the predicted response output and the actual response output obtained based on the response network model as the objective function, so as to obtain a trained response network model. The response ranking module is used to input the second dialogue data into the trained response network model to perform multi-round dialogue response output, and to rank the multi-round dialogue response output results to obtain the response ranking result; The response network model includes a pre-trained language model; Before the vector representation module, a preprocessing module is also included for preprocessing the first dialogue data and entity subgraph, including: The word segmentation results are concatenated to obtain the input sequence; and, Each entity in the entity subgraph is input into the pre-trained language model, and a subgraph with initialized representation vectors is output. The response network model further includes a graph neural network; the vector representation module is also used for: The input sequence is fed into the pre-trained language model to obtain the first representation vector of the context node; and... The subgraph is input into the graph neural network for calculation, and the second representation vector of the context node is output based on the calculation result.

5. The apparatus according to claim 4, characterized in that, The model training module is also used for: Calculate the similarity between the first representation vector and the second representation vector; The first representation vector is input into the graph neural network for calculation, and the output is used to obtain the response output prediction result. Calculate the cross-entropy between the predicted response output and the actual response output, and preprocess the similarity and the cross-entropy to obtain the data preprocessing result; The data preprocessing results are used as the objective function to train and optimize the pre-trained language model, so as to obtain a trained response network model based on the training and optimization results.

6. The apparatus according to claim 4, characterized in that, The knowledge extraction module is also used for: The first dialogue data is segmented into words to obtain the segmentation results. Based on the word segmentation results and entity links, several related entities are extracted from the common sense knowledge graph, and an entity subgraph is constructed using these entities.

Citation Information

Patent Citations

  • Short text matching method and system based on global and local matching

    CN111666753A

  • Dialogue history modeling method based on graph attention mechanism

    CN112256857A