A multi-level knowledge enhanced dialogue recommendation method
By employing a multi-layered knowledge enhancement method that integrates entity-level and context-level knowledge representations, the problem of ignoring the semantic connections between entity information and context information in dialogue recommendation systems is solved, thereby improving the accuracy and quality of recommendation and generation tasks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING UNIV OF TECH
- Filing Date
- 2023-03-02
- Publication Date
- 2026-06-16
AI Technical Summary
Existing dialogue recommendation systems have shortcomings in handling users' dynamic interests and complex contextual information. They ignore the semantic connections between entity information and contextual information, resulting in inaccurate recommendations. Furthermore, they lack an understanding of external knowledge about words and sentences, which affects the quality of recommendations.
We employ a multi-layered knowledge enhancement approach, which integrates entity-level and context-level knowledge representations, utilizes R-GCN and RoBERTa models to obtain knowledge representations, and adaptively learns knowledge prompts through a semantic fusion model and a unified knowledge encoder to construct knowledge-enhanced prompt templates for dialogue recommendation and generation tasks.
This improves the quality of knowledge representation in the dialogue recommendation system, enables semantic cognition of different knowledge levels, reduces noise from manually designed prompts, and enhances the accuracy of recommendations and the quality of dialogue generation.
Smart Images

Figure CN116166784B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a dialogue recommendation method, and more particularly to a multi-level knowledge-enhanced dialogue recommendation method. Background Technology
[0002] With the increasing prevalence of intelligent assistants across various industries, conversational recommendation systems (CRS) have become an emerging research topic as a recommendation tool. Traditional recommendation systems primarily model user profiles from historical behavioral data and apply collaborative filtering or deep neural network models to predict items a user might like. In contrast, CRS has two major advantages: it understands the user's dynamic interests in real time during the conversation and provides convincing responses through natural language, giving it excellent commercial potential.
[0003] To improve recommendation quality, a primary goal of Knowledge Graph (KG)-based CRS is to accurately capture user preferences based on dialogue history. However, dialogue history contains limited information reflecting user preferences (e.g., user descriptions and feedback on items). To address this issue, KG-based CRS has been extensively studied, using entity information from dialogues and explicit entity relationships in the KG to model user preferences. Despite the progress made in KG-based CRS, several challenges remain.
[0004] The first problem is that contextual information in the dialogue is not well considered, and there is an over-reliance on entity information, especially when tracking changes in user interests. For example... Figure 1 As shown, Figure 1 The upper part is a dialogue example, where the movies mentioned are marked in red and important words are marked in blue. Figure 1 The lower half of the text refers to the relevant entities mentioned in the dialogue. The KG-based CRS seems unaware of the negative sentiment expressed by the user towards "R" and "Marvel Universe," instead simply recommending similar items (i.e., "Iron Manan (2008)") to the user via explicit paths in the KG (i.e., "The Matrix (1999) → The Hulk (2003) → Marvel Universe → Iron Manan (2008)") and "R → Iron Manan (2008)"). This is a candidate item with significant interest bias and not worthy of trust. The root cause of this problem may be the neglect of the semantic connections behind entity information and contextual information, leading to the consistent misinterpretation of mentioned entities as user preferences, which is inappropriate in real-world dialogue.
[0005] The second problem is the lack of external knowledge to understand complex contextual information, particularly for comprehending words and sentences. While KG's structured knowledge helps CRS understand specific items in a conversation, the conversation still contains many non-item words or sentences. For example, in Figure 1 Understanding the implicit referents in the third sentence, such as "oh no" and "not interested," is crucial for recommendation and dialogue generation tasks. However, due to the limited training corpus and the relatively simple and repetitive grammatical structures, most previous language models for CRS were not pre-trained or adequately trained on large-scale corpora, resulting in insufficient understanding of the semantic expression of words or sentences within contextual information. Summary of the Invention
[0006] This invention aims to at least solve the technical problems existing in the prior art, and in particular, it innovatively proposes a conversation recommendation system and method based on multi-level knowledge modeling improvement.
[0007] To achieve the above-mentioned objectives of this invention, this invention proposes a multi-level knowledge-enhanced dialogue recommendation method, comprising the following steps:
[0008] S1, the entity-level knowledge representation and the context-level knowledge representation are fused to obtain the fused knowledge-enhanced representation; wherein the entity-level knowledge representation and the context-level knowledge representation have semantics at multiple heterogeneous knowledge levels.
[0009] S2 employs a task-oriented unified knowledge encoder to adaptively learn knowledge hints from the fused knowledge-enhanced representation, effectively avoiding the hint noise introduced by manual design.
[0010] S3. Based on the learned knowledge prompts, construct a knowledge-enhanced prompt template, input the prompt template into PLM, and thus obtain recommended items and generate dialogues containing the recommended items.
[0011] Furthermore, the method is implemented based on a dialogue recommendation system, which includes:
[0012] Multi-level knowledge fusion module: By constructing an interaction mechanism between entities and context, the fused knowledge-enhanced representation is obtained; the multi-level knowledge fusion module enhances the representation capability of multi-level knowledge, enabling the knowledge representation to achieve semantic cognition of different knowledge levels.
[0013] A unified knowledge hint learning module: adaptively learns knowledge hints from the fused knowledge-enhanced representation;
[0014] Prompt Template Design Module: The learned knowledge prompts are used to build knowledge-enhanced prompt templates, and the same PLM is used to complete the dialogue generation and recommendation tasks, which is beneficial for model integration.
[0015] Furthermore, the entity-level knowledge representation is obtained through a knowledge graph, specifically including the following steps:
[0016] First, each item in the item set D is matched with an entity in the relational knowledge graph DBpedia to extract a subgraph G. Then, these items are linked to the entity set ε in the subgraph G. Finally, using R-GCN to aggregate node information through layer L, the structural and relational information is encoded into the hidden state representation of each entity e∈ε. Then, represent all entities in the obtained ε and a randomly initialized entity representation of a non-item entity. Concatenate to form a candidate entity representation dictionary
[0017] Then for all the tags in the dialogue Establish entity correspondence, w n This represents the nth marker in the dialogue, where n represents the number of markers in the dialogue; the correspondence is described as follows:
[0018] e i =f(w j (2)
[0019] Where e i Represents the i-th entity. Indicates entities mentioned in the dialogue history;
[0020] w j This represents the j-th marker in the dialogue history.
[0021] Finally from After searching through all project and non-project entities, an entity-level knowledge representation matrix was obtained. Where h n This represents the entity-level knowledge representation corresponding to the nth tag, where n represents the number of tags in the dialogue history.
[0022] Furthermore, the hidden state of entity e at layer (l+1) is represented by the node information aggregation using R-GCN through layer L:
[0023]
[0024] Where σ() represents the sigmoid activation function;
[0025] ε、 These represent the entity set and the entity relation set, respectively.
[0026] Represents the set of adjacent entities that are related to entity e by r;
[0027] This represents the learnable matrix used to transform the representations of neighboring entities with relation r in the l-th layer;
[0028] W (l) Let represent the learnable matrix used to transform the representation of entity e at level l;
[0029] This represents the hidden state of entity j at level l;
[0030] This represents the hidden state of entity e at level l.
[0031] Furthermore, the context-level knowledge representation is obtained through the RoBERTa model, specifically including the following steps:
[0032] A RoBERTa with a fixed parameter is used as the encoder to encode the tag sequence. Its description is as follows:
[0033]
[0034] in This is a context-level knowledge representation matrix, obtained at the top level of RoBERTa;
[0035] Represents all markers in the dialogue history;
[0036] RoBERTa indicates the use of the RoBERTa model;
[0037] w n This represents the nth marker in the dialogue history, where n represents the number of markers in the dialogue history.
[0038] Furthermore, the fusion is achieved through a semantic fusion model based on named entity phrases. This model includes multiple aggregators, where the output of the (i-1)th aggregator is the input of the ith aggregator. The vector calculated by the top aggregator is used as the final output representation of the semantic fusion model, denoted as follows: and This represents the fused entity-level knowledge representation. This represents the fused context-level knowledge representation. This represents the entity-level knowledge representation after the nth label has been fused by N aggregators. This represents the context-level knowledge representation of the nth tag after it has been fused by N aggregators.
[0039] Furthermore, each aggregator first integrates multi-level knowledge representations and then computes their output representations;
[0040] The integration and output process of the (i-1)th aggregator is as follows:
[0041]
[0042] Among them, z j It is a hidden state representation that integrates heterogeneous knowledge information corresponding to the j-th label;
[0043] Let i represent the entity-level knowledge representation obtained after the j-th label is fused by the (i-1)-th aggregator, where i ≥ 2;
[0044] This represents the context-level knowledge representation obtained after the j-th tag is fused by the (i-1)-th aggregator;
[0045] This represents the context-level knowledge representation obtained after the j-th tag is fused by the (i-2)-th aggregator;
[0046] W h and W s It is a learnable parameter matrix and is shared by all aggregators;
[0047] b (i-1) , This is a deviation.
[0048] Furthermore, S2 includes the following steps:
[0049] First, integrate using an integration mechanism. and for in For the fused entity-level knowledge representation, For the fused context-level knowledge representation, This represents the integrated knowledge representation, x n The integrated knowledge representation corresponding to the nth label:
[0050]
[0051] Where [;] represents a join operation;
[0052] This represents the entity-level knowledge representation after the nth tag is fused by N aggregators;
[0053] This represents the context-level knowledge representation after the nth tag is fused by N aggregators;
[0054] Then, Used as input to the gated loop unit to derive the state sequence v n The state representation of the nth marker:
[0055]
[0056] Next, the learned state representation matrix Divided into entity-level state representation matrices and context-level state representation matrices, respectively using... and express;
[0057] Finally, attention mechanisms are used to derive the entity-level super-label u from the two representation matrices mentioned above. (h) and context-level supermarkers u (s) :
[0058]
[0059] in The entity-level state representation matrix;
[0060] The content-level state representation matrix;
[0061] a and b are bias parameter matrices;
[0062] · This is the matrix transpose symbol;
[0063] W α and W β The learnable parameter matrix;
[0064] mask e This is an operation that sets all non-project entities and padding representations to -∞;
[0065] mask w This is an operation that sets all padding representations to -∞.
[0066] Furthermore, the PLM is the DialoGPT model, and S3 is the entity-level super-label u obtained based on the knowledge hint learning module. (h) and context-level supermarkers u (s) Knowledge-enhanced prompt templates were constructed for recommendation tasks and dialogue generation tasks, respectively; specifically, the following steps were included:
[0067] 3-1. To alleviate the problem of semantic space inconsistency between external knowledge from different sources, a knowledge enhancement prompt template for the recommendation task was customized for the pre-training task.
[0068] For pre-training tasks, knowledge-enhanced cue templates Includes: knowledge tips, original dialogue history (C), and original responses (R);
[0069] 3-2, For dialogue generation tasks, knowledge-enhanced prompt templates Θ gen Includes: knowledge tips, balance factor B gen The model generates a response template T containing placeholders after training the dialogue generation task, along with the original dialogue history C.
[0070] 3-3, For recommendation tasks, construct knowledge-enhanced prompt templates. Includes: knowledge tips, balance factor B rec The original dialogue history C and the generated response template T;
[0071] The knowledge hints include entity-level supermarkers u obtained based on the knowledge hint learning module. (h) and context-level supermarkers u (s) ;
[0072] 3-4, replace the placeholders in template T with the recommended task-generated products to obtain the final response. Further, the learning objective of the dialogue generation task is:
[0073]
[0074] Where M is the total number of input sequences;
[0075] Indicates in Θ gen Find c under the given conditions j,i ;
[0076] R i This represents the target response corresponding to the i-th input sequence;
[0077] Let represent the input sequence for the i-th knowledge enhancement;
[0078] Θ gen Used to refer to u (h) u (s) and B gen u (h) u (s) and B gen It is the only adjustable parameter;
[0079] Indicates in Θ gen w <i Find c under the given conditions j,i ;
[0080] l jIt is the length of the target response corresponding to the j-th input sequence;
[0081] c j,i This represents the i-th word in the target response corresponding to the j-th input sequence;
[0082] w <i This refers to the word preceding the i-th position;
[0083] The learning objective of the recommendation task is:
[0084]
[0085] in This indicates that entity e is recommended to the user. j The probability of;
[0086] e j Represents the j-th entity;
[0087] Let represent the input sequence for the i-th knowledge enhancement;
[0088] Θ rec Used to refer to u (h) u (s) and B rec u (h) u (s) and B rec It is the only adjustable parameter;
[0089] y i,j It is the binary truth label of the i-th input sequence;
[0090] This is the formula for calculating the recommendation probability.
[0091] In summary, due to the adoption of the above technical solution, the present invention has the following advantages:
[0092] (1) A semantic fusion model based on named entity phrases is proposed to fuse multi-level knowledge representations. Through the semantic association between entities and context information, fine-grained interaction of multi-level knowledge is realized, which improves the quality of prior knowledge.
[0093] (2) A task-oriented unified knowledge encoder was designed, which can adaptively learn knowledge prompts. It not only realizes the unified learning of CRS subtask prompt signals, but also eliminates the noise that may be caused by manually designed prompts.
[0094] 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
[0095] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0096] Figure 1 This is an example used to illustrate how existing KG-based methods ignore contextual information when recommending movies.
[0097] Figure 2 This is a schematic diagram of the overall architecture of the MKCRS framework of this invention. Detailed Implementation
[0098] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0099] To address these two issues, our main idea is to model the entity relation knowledge from the knowledge graph KG (DBpedia) and the contextual semantic knowledge from the pre-trained language model PLM (RoBERTa) as knowledge cues to enhance the final cue signal in cue learning, thereby stimulating the reasoning ability of the unified pre-trained language model PLM (DialoGPT) across different tasks. However, these two types of knowledge information with fundamentally different semantics are difficult to integrate and utilize for CRS. In fact, the external knowledge derived from entity and contextual information is not entirely independent; there are explicit semantic connections between them. Intuitively, entity information exists in text in the form of named entity phrases, and named entity phrases are part of the contextual information. Therefore, developing a practical CRS framework by modeling multi-layered external knowledge is crucial.
[0100] Inspired by this idea, we propose a novel fast learning framework, MKCRS, which improves CRS through multi-level knowledge modeling. Unlike previous CRS based on cue learning, we focus on fully modeling external data to obtain high-quality knowledge cues. More importantly, our model does not require manually designed cues for different task objectives. Specifically, based on entity and contextual information in the input text, we extract valuable knowledge—that is, entity- and context-related knowledge information—from KG and PLM, and derive entity-level and context-level knowledge representations for each token in the dialogue history, respectively. Considering the explicit semantic associations between entities and contextual information in the dialogue, we design a semantic fusion model based on named entity phrases. By establishing an interaction mechanism between entities and context, we enhance the representation capability of multi-level knowledge, enabling the knowledge representation to achieve semantic cognition at different knowledge levels. To effectively guide the unified PLM (DialoGPT) in reasoning on different subtasks of CRS, we design a task-oriented unified knowledge encoder for each subtask to adaptively learn subtask-specific knowledge cues from the fused knowledge representations, effectively avoiding cue noise introduced by manual design. Based on the learned knowledge prompts, we further construct knowledge-enhanced prompt templates for recommendation and dialogue generation tasks.
[0101] We propose a novel framework, MKCRS, to improve CRS through multi-layered knowledge modeling. The overall architecture of the framework is as follows: Figure 2 As shown: We first extract the sequence of mentioned entities from the original dialogue. The entity-level knowledge representation matrix was obtained by searching the entity representations pre-trained with R-GCN. Then, we will use the tag sequence corresponding to the original dialogue. To derive context-level knowledge representations from RoBERTa as input with fixed parameters. It is worth noting that in the above process, we used each tag Established with entities Correspondence function e i =f(w j This is done to obtain more structured knowledge. Finally, each tag... They all obtained entity-level knowledge representations. and context-level knowledge representation We use them as input to the multi-level knowledge fusion module.
[0102] Based on entity-level and context-level knowledge representations, and utilizing our established semantic fusion model based on named entity phrases, we obtain fused context-level and entity-level knowledge representations. and We concatenate these components and use them as input to the GRU model in the knowledge hint learning module. Then, we decompose the GRU output into entity-level state representation matrices. and context-level state representation We obtained u from their respective use of attention mechanisms to acquire the most important knowledge and information. (h) and u (s) .
[0103] Based on the obtained u (h) and u (s) We constructed knowledge-enhanced prompt templates for the recommendation and dialogue generation tasks, respectively, in the recommendation and generation modules. To mitigate the semantic space inconsistency between external knowledge from different sources, we specifically customized a prompt template for the recommendation task, tailored to the pre-training task. Notably, the dialogue generation task did not utilize parameters learned from the pre-training task.
[0104] For pre-training tasks, knowledge-enhanced cue templates It consists of three parts: knowledge prompts (learned information) (h) and u (s) ) and the original dialogue history C and the original reply R.
[0105] For dialogue generation tasks, knowledge-enhanced prompt templates Θ gen It consists of three parts: knowledge prompts (learned information) (h) and u (s) ), balance factor (B) gen The model generates a response template T containing the [ITEM] placeholder and the original dialogue history C. It is worth noting that after training for the dialogue generation task, we utilize the model to generate a response template T containing the [ITEM] placeholder to aid the recommendation task.
[0106] For recommendation tasks, construct knowledge-enhanced prompt templates. It consists of 4 parts: knowledge prompts (learned information) (h) and u (s) ), balance factor (B) rec We then generate the original dialogue history (C) and the generated template (T). Finally, we replace the [ITEM] placeholder in the template with the recommended task-generated product to obtain the final response.
[0107] The MKCRS framework consists of three modules: a multi-level knowledge fusion module, a knowledge hint learning module, and a hint template design module. We first introduce how to derive entity-level and context-level knowledge representations from external knowledge and explore how to enhance them using entity and contextual information from the dialogue. Then, we adaptively learn knowledge hints most relevant to the subtask by encoding the fused knowledge representations. Finally, we discuss how to utilize the acquired knowledge hints to construct hint templates for CRS subtasks.
[0108] 1. Multi-level knowledge integration
[0109] Since much of the external knowledge is irrelevant to the dialogue content, it cannot effectively aid DialoGPT in reasoning about the dialogue. Building upon previous research, we leverage entity and contextual information within the dialogue to extract valuable knowledge from external sources. Considering the close semantic relationship between entities and contextual information, we aim to improve the quality of knowledge representation by constructing a highly interactive semantic fusion model.
[0110] 1.1 Entity-level knowledge representation
[0111] To acquire knowledge related to entities in the dialogue, we introduce a knowledge graph (KG) that provides entity relation knowledge to derive entity-level knowledge representations. We first extract a subgraph G by matching each item in the item set D with entities in the relation knowledge graph DBpedia. Then, we link these items to the entity set ε in G. The hidden state of the (l+1)th level entity e is represented as:
[0112]
[0113] Where σ() represents the sigmoid activation function;
[0114] ε、 These represent the entity set and the entity relation set, respectively.
[0115] Represents the set of adjacent entities that are related to entity e by r;
[0116] This represents the learnable matrix used to transform the representations of neighboring entities with relation r in the l-th layer;
[0117] W (l) Let represent the learnable matrix used to transform the representation of entity e at level l;
[0118] This represents the hidden state of entity j at level l;
[0119] This represents the hidden state of entity e at level l;
[0120] After aggregating node information through layer L using R-GCN, structural and relational information is encoded into the hidden state representation of each entity e∈ε. Finally, the resulting ε contains all entity representations and a randomly initialized entity representation of a non-item entity. Concatenate to form a candidate entity representation dictionary For simplicity, we have omitted (L) in the following paragraphs.
[0121] Unlike previous methods, it does not directly model and extract entities. Where e k Let represent the k-th entity, where k represents the number of entities corresponding to all items (called named entity phrases) and special non-items in the original dialogue history. To gain more structured knowledge related to the dialogue, we define all tags in the dialogue history... An entity correspondence was established, where w n This represents the nth marker in the dialogue, where n represents the number of markers in the dialogue. The correspondence function is described as follows:
[0122] e i =f(w j (2)
[0123] Where e i Represents the i-th entity. w j This represents the j-th token. It is worth noting that tags from the same named entity phrase correspond to the same item entity, while the remaining tags correspond to non-item entity representations. Then, from... After searching through all project and non-project entities, we obtained an entity-level knowledge representation matrix. Where h n This represents the final representation corresponding to the nth token, where n represents the number of tokens in the dialogue history.
[0124] 1.2 Context-level knowledge representation
[0125] Since KG has very limited structural knowledge and can only explicitly model entities mentioned in the dialogue, we use contextual information to derive context-level knowledge representations from PLMs, which contain rich semantic knowledge, to overcome these limitations.
[0126] Given that RoBERTa's internal structure is a bidirectional encoder and it is pre-trained on a large unlabeled text corpus, inspired by previous work, multiple attention heads can enable each tag to fully learn contextual information and retain rich semantic knowledge within the model. Therefore, we use a RoBERTa with fixed parameters (i.e., RoBERTa does not participate in training, and its parameters remain unchanged) as the encoder to encode the same tag sequence. Its description is as follows:
[0127]
[0128] The context-level knowledge representation matrix It was obtained at the top level of Roberta.
[0129] w n This represents the nth marker in the dialogue history, where n represents the number of markers in the dialogue history.
[0130] 1.3 Semantic Fusion of Multi-Level Knowledge
[0131] Here, we argue that named entity phrases, entities, and content are closely semantically related in dialogue. Intuitively, entity information exists in text as named entity phrases, and named entity phrases are part of the contextual information. To this end, we design a semantic fusion model based on named entity phrases to fuse heterogeneous features from multi-level knowledge representations. This model consists of multiple aggregators, each of which first integrates multiple knowledge representations and then computes their output representations.
[0132] Unlike previous work, we achieve a unified integration approach by introducing non-project entity representations for projects without physical entities. Specifically, for any token w in the dialogue... j Both correspond to entity-level and context-level knowledge representations. and The integration and output process of the (i-1)th aggregator is as follows:
[0133]
[0134] Among them, z j It is a hidden state representation that integrates heterogeneous knowledge information corresponding to the j-th label;
[0135] Let i represent the entity-level knowledge representation obtained after the j-th label is fused by the (i-1)-th aggregator, where i ≥ 2;
[0136] This represents the context-level knowledge representation obtained after the j-th tag is fused by the (i-1)-th aggregator;
[0137] This represents the context-level knowledge representation obtained after the j-th tag is fused by the (i-2)-th aggregator;
[0138] W h and W s It is a learnable parameter matrix and is shared by all aggregators.
[0139] b (i-1) , This is a deviation.
[0140] Data transfer between aggregators proceeds from bottom to top, with the output of the (i-1)th aggregator serving as the input of the ith aggregator. The vector computed by the top aggregator is used as the final output representation of the semantic fusion model, denoted as follows: and This represents the fused entity-level knowledge representation. This represents the nth entity-level knowledge representation after N layers of semantic fusion. This represents the fused context-level knowledge representation. This represents the nth fused context-level knowledge representation after N layers of semantic fusion.
[0141] 2. Unified knowledge prompts for learning
[0142] To date, the knowledge representation fused by the multi-level knowledge fusion module (i.e. and This approach cannot directly guide a unified PLM to adapt to the different sub-task objectives of CRS. In this section, we further design a unified, task-oriented knowledge encoder to adaptively learn knowledge cues from the implicit relationships between knowledge. Previous works have manually designed specific cues from partial external knowledge for different CRS task objectives. However, this may overlook some key knowledge and generate significant cue noise, interfering with PLM reasoning.
[0143] To learn the potential connections between external knowledge, we first utilize a simple yet effective integration mechanism to integrate external knowledge. and for x n This represents the integrated knowledge representation corresponding to the nth label; its description is as follows:
[0144]
[0145] Where [;] represents a join operation. This represents the entity-level knowledge representation after the nth tag is fused by N aggregators; This represents the context-level knowledge representation after the nth tag is fused (aggregated) by N aggregators. Next, we further... Used as input to the gated recurrent unit (GRU) to derive the state sequence. v n The state representation of the nth marker is shown in the following formula:
[0146]
[0147] Where u t Indicates the update gate, r t Indicates resetting the door, W r W z W v and U r U z U v It is a learnable weight matrix.
[0148] Finally, in order to learn the knowledge most relevant to the sub-task objective, we use an attention mechanism to derive the entity-level super-label u. (h) and context-level supermarkers u (s) It is worth noting that the state representation matrix learned in Equation 6... Divided into two representation matrices and The derived formula is as follows:
[0149]
[0150] in The entity-level state representation matrix;
[0151] The content-level state representation matrix;
[0152] a and b are bias parameter matrices;
[0153] · This is the matrix transpose symbol;
[0154] W α and W β The learnable parameter matrix;
[0155] mask e This is an operation that sets all non-item entities and padding representations to -∞, mask. w This is an operation that sets all padding representations to -∞.
[0156] 3. Prompt Template Design
[0157] In this section, we describe in detail our method for designing knowledge-enhanced prompt templates using knowledge hints and trade-offs. Note that for the CRS subtask, we follow the prompt learning approach and omit the specific details of feature interactions after the input sequence enters the PLM (i.e., DialoGPT).
[0158] 3.1 Pre-training task
[0159] After semantic fusion and knowledge prompting, the learnable parameters involved in the recommendation module and dialogue generation module are respectively represented as Θ. fuse and Θ learn To mitigate the semantic space inconsistency between heterogeneous data, we redefine the input sequence as a knowledge-enhanced cue template. Its description is as follows:
[0160]
[0161] Where → indicates that the data originates from;
[0162] u (h) These are already learned entity-level supermarkers;
[0163] u (s) These are the context-level supertags that have already been learned;
[0164] C represents the original dialogue history;
[0165] R stands for the original response.
[0166] By performing an embedding lookup on C and R, we can obtain the embedding representation of the entire input sequence:
[0167]
[0168] Where |C| and |R| represent the number of tags in the original dialogue history and the number of tags in the original reply, respectively, and P 0,1 This represents the first token obtained after embedding lookup. After passing through a unified PLM, we obtain the final representation P of the sequence. L ={p L,1 ,...,p L,|C|+|R|}, p L,1 This represents the final representation of the first token after passing through L layers. Next, we use the final output representation of the last token as the user preference p. u And calculate the probability of recommending entity e to the user:
[0169]
[0170] in This represents the probability of recommending entity e to the user;
[0171] Θ fuse Θ learn These represent the parameters for the multi-level knowledge fusion module and the knowledge prompting learning module, respectively.
[0172] A prompt template to indicate knowledge enhancement;
[0173] · This is the matrix transpose symbol;
[0174] p u Indicates user preferences;
[0175] h e From The learned entity representation is searched. This is done to learn the parameter Θ. fuse and Θ learn We used cross-entropy loss. To pre-train these parameters:
[0176]
[0177] Where M is the total number of input sequences;
[0178] N is the total number of entities;
[0179] Let represent the input sequence for the i-th knowledge enhancement;
[0180] y i,j It is the binary true label of the i-th input sequence, when entity e j When it is the target entity, it equals 1.
[0181] Please note that in any input sequence, the response must contain at least one target entity. Although we only present one case: an input sequence containing only one target entity, it is straightforward to extend the above formula (12) to the case with multiple real entities.
[0182] 3.2 Dialogue Generation Task
[0183] The goal of the dialogue generation task is to generate human-like responses. Similar to formula (9), we also designed a knowledge-enhanced prompt template. The difference is the addition of a learnable balance factor B. gen Formalized as:
[0184]
[0185] Where → indicates that the data originates from;
[0186] u (h) These are already learned entity-level supermarkers;
[0187] u (s) These are the context-level supertags that have already been learned;
[0188] C represents the original dialogue history;
[0189] B gen B represents a learnable balance factor. gen Used to balance external knowledge (h) and u (s) The impact of the original dialogue history C on the unified PLM.
[0190] By performing an embedding lookup for C and randomly initializing the latent vector B gen We obtained the entire input sequence:
[0191]
[0192] Where |g| is the equilibrium factor B gen The number of P0. After P0 passes through a unified PLM, we utilize the final representation of the tag P. L ={p L,1 ,...,p L,|C|} and linear layers to compute their values with respect to the dictionary The probability distribution {c1,...,c |C|}, p L,1 c1 represents the final representation of the first tag, and c1 represents the mapping of the final representation of the first tag to a size of 1. The vector, i.e., the vector with respect to the dictionary. The probability distribution of p. |C| represents the number of tags in the original dialogue history and the number of tags in the original response. For example, p L,t After passing through this layer, it becomes c. t :
[0193]
[0194] in Indicates in Θ gen Find c under the given conditions t ;
[0195] A prompt template to indicate knowledge enhancement;
[0196] Θ gen Used to refer to u (h) u (s) and B gen u (h) u (s) and Bgen It is the only adjustable parameter;
[0197] softmax represents the softmax function;
[0198] p L,t This represents the final representation of the first marker in the PLM layer L.
[0199] W v and b v These are the weighting parameters and the bias term, respectively.
[0200] Ultimately, the only adjustable parameter u (h) u (s) and B gen Represented as Θ gen The learning objective of the dialogue generation task is:
[0201]
[0202] Where M is the total number of input sequences;
[0203] Indicates in Θ gen Find c under the given conditions j,i ;
[0204] R i This represents the target response corresponding to the i-th input sequence;
[0205] Let represent the input sequence for the i-th knowledge enhancement;
[0206] Θ gen Used to refer to u (h) u (s) and B gen u (h) u (s) and B gen It is the only adjustable parameter;
[0207] Indicates in Θ gen w <i Find c under the given conditions j,i ;
[0208] l j It is the length of the target response corresponding to the j-th input sequence;
[0209] c j,i Let represent the i-th word in the target response corresponding to the j-th input sequence.
[0210] w <i This represents the word preceding the i-th position.
[0211] 3.3 Recommended Tasks
[0212] The purpose of the recommendation task is to recommend items that the user may like. Similar to formulas (9) and (13), we have also designed knowledge-enhanced prompt templates. To enhance the reasoning ability of PLM in recommendation tasks, it is composed of entity-level super-labels u (h) Context-level supermarker u (s) Learnable balance factor B rec And a response template T generated in the dialogue generation task, formally described as:
[0213]
[0214] in A prompt template to indicate knowledge enhancement;
[0215] u (h) Represents an entity-level super tag;
[0216] u (s) Indicates a context-level supertag;
[0217] B rec B represents the learnable balance factor. rec Used to balance external knowledge (h) and u (s) The impact of the response template T and the original dialogue history C on the PLM. The response template T is generated by the trained dialogue generation module.
[0218] The subsequent steps are the same as for the pre-training task. Finally, the only adjustable parameter u... (h) u (s) and B rec Being used as Θ rec Similar to formula (12), the learning objective of the recommendation task is:
[0219]
[0220] in This indicates that entity e is recommended to the user. j The probability of;
[0221] e j Represents the j-th entity; Let represent the input sequence for the i-th knowledge enhancement;
[0222] Θ rec Used to refer to u (h) u (s) and B rec u (h) u(s) and B rec It is the only adjustable parameter;
[0223] y i,j It is the binary truth label of the i-th input sequence;
[0224] It is a formula for calculating the recommendation probability, which is calculated using the final representation of the last label, the learned entity representation, and the softmax function in a manner similar to that in formula (11).
[0225] 3.4 Parameter Learning
[0226] Our model has four sets of parameters: a multi-level knowledge fusion module, a knowledge hint learning module, a recommendation module, and a generation module, denoted by Θ. fuse ,Θ learn ,Θ gen and Θ rec It is worth noting that the PLM (i.e., RoBERTa and DialoGPT) parameters of all modules were not involved in the training.
[0227] Here, public ideas can be described using a transformation chain: original dialogue → deduced multi-level knowledge representation (i.e., and → Multi-layered knowledge representation of integration (i.e., and → Knowledge hints learned (i.e., u) (h) and u (s) )
[0228] Based on the learned knowledge prompts, we first constructed a prompt template. The pre-trained parameters Θ are obtained by calculating formula (12) and performing gradient descent. fuse and Θ learn Then, we constructed the prompt template. The parameter Θ is optimized by calculating formula (16) and performing gradient descent. gen Finally, a prompt template was built. Similar to the pre-training task above, optimize the parameters Θ. rec It is worth noting that the recommended task involves further parameter training on top of the parameters from the pre-trained task.
[0229] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A multi-layered knowledge-enhanced dialogue recommendation method, characterized in that, Includes the following steps: S1, fuse entity-level knowledge representation and context-level knowledge representation to obtain fused knowledge-enhanced representation; S2 employs a task-oriented unified knowledge encoder to adaptively learn knowledge hints from the fused knowledge-enhanced representation; Step S2 includes the following steps: First, integrate using an integration mechanism. and for ,in For the fused entity-level knowledge representation, For the fused context-level knowledge representation, This represents the integrated knowledge representation. Indicates the first The integrated knowledge representation corresponding to each label: (5) in Indicates a connection operation; Indicates the first A marker passed Entity-level knowledge representation after fusion by multiple aggregators; Indicates the first A marker passed The context-level knowledge representation after fusion of multiple aggregators; Then, Used as input to the gated loop unit to derive the state sequence , Indicates the first The state representation of each marker: (6) Next, the learned state representation matrix Divided into entity-level state representation matrices and context-level state representation matrices, respectively using... and express; Finally, attention mechanisms are used to derive entity-level supertags from the two representation matrices mentioned above. and context-level super tags : (7) (8) in The entity-level state representation matrix; and It is the bias parameter matrix; This is the matrix transpose symbol; and The learnable parameter matrix; This sets all non-project entities and filler representations to... Operation; It sets all the filled representations to Operation; S3. Based on the learned knowledge prompts, construct a knowledge-enhanced prompt template, and input the prompt template into the PLM, which is the DialoGPT model, to obtain recommended items and generate dialogues containing the recommended items.
2. The multi-level knowledge-enhanced dialogue recommendation method according to claim 1, characterized in that, The entity-level knowledge representation is obtained through a knowledge graph, specifically including the following steps: First, the project portfolio Each item in the graph is matched with an entity in the relational knowledge graph DBpedia to extract a subgraph. Then, link these items to the subgraph. Entity set in Up; then using R-GCN through The node information of the layer is aggregated, thereby encoding structural and relational information into each entity. Hidden state representation In the middle; then the obtained All entity representations and a randomly initialized entity representation of a non-item entity. Concatenate to form a candidate entity representation dictionary ; Then for all the tags in the dialogue Establish entity correspondence. Indicates the first in the dialogue One tag, This indicates the number of marks in the dialogue; the correspondence is described as follows: ,(2) in Indicates the first One entity, , Indicates entities mentioned in the dialogue history; Indicates the first in the history of the dialogue One tag, ; Finally from After searching through all project and non-project entities, an entity-level knowledge representation matrix was obtained. ,in Indicates the first Entity-level knowledge representation corresponding to each tag Indicates the number of markers in the dialogue history.
3. The multi-level knowledge-enhanced dialogue recommendation method according to claim 2, characterized in that, The use of R-GCN Layer node information aggregation, the first Layer Entity The hidden state is represented as: (1) in, This represents the sigmoid activation function; These represent the entity set and the entity relation set, respectively. Representation and entity Relationship The set of adjacent entities; Indicates the use of conversion of the first Layers have relationships The learnable matrix representing the neighboring entities; Indicates the use of conversion of the first Layer Entity The learnable matrix representing the representation; Indicates the first Layer Entity The hidden state; Indicates the first Layer Entity The hidden state.
4. The multi-level knowledge-enhanced dialogue recommendation method according to claim 1, characterized in that, The context-level knowledge representation is obtained through the RoBERTa model, specifically including the following steps: A RoBERTa with a fixed parameter is used as the encoder to encode the tag sequence. Its description is as follows: (3) in This is a context-level knowledge representation matrix, obtained at the top level of RoBERTa; Represents all markers in the dialogue history; Represents the RoBERTa model; Indicates the first in the history of the dialogue One tag, Indicates the number of markers in the dialogue history.
5. The multi-level knowledge-enhanced dialogue recommendation method according to claim 1, characterized in that, The fusion is achieved through a semantic fusion model based on named entity phrases, which includes multiple aggregators, the third... The output of the -1 aggregator is the first... The inputs to each aggregator, and the vectors computed by the top aggregator, are used as the final output representation of the semantic fusion model, denoted as follows: and , This represents the fused entity-level knowledge representation. This represents the fused context-level knowledge representation. Indicates the first A marker passed The entity-level knowledge representation after fusion by multiple aggregators Indicates the first A marker passed The context-level knowledge representation after fusion of multiple aggregators.
6. The multi-level knowledge-enhanced dialogue recommendation method according to claim 5, characterized in that, Each aggregator first integrates the knowledge representations, and then computes their output representations; No. The integration and output process of the aggregator is as follows: (4) in, It is the integration of the first The implicit state representation of heterogeneous knowledge information corresponding to each tag; Indicates the first The first marker passes through the... -1 entity-level knowledge representation obtained after merging aggregators ; Indicates the first The first marker passes through the... -Context-level knowledge representation obtained after fusing 1 aggregator; Indicates the first The first marker passes through the... -Context-level knowledge representation obtained by fusing two aggregators; , , and It is a learnable parameter matrix and is shared by all aggregators; , , This is a deviation.
7. The multi-level knowledge-enhanced dialogue recommendation method according to claim 1, characterized in that, S3 is an entity-level supermarker obtained based on the knowledge-hint learning module. and context-level super tags Knowledge-enhanced prompt templates were constructed for recommendation tasks and dialogue generation tasks, respectively; specifically, the following steps were included: 3-1, A knowledge-enhanced prompt template for the pre-training task was customized for the recommendation task; For pre-training tasks, knowledge-enhanced cue templates Includes: knowledge tips, original dialogue history and the original reply ; 3-2, Knowledge-enhanced prompt templates for dialogue generation tasks Includes: knowledge tips, balancing factors Dialogue with the original history Furthermore, after the dialogue generation task was trained, the model generated response templates containing placeholders. ; 3-3, For recommendation tasks, construct knowledge-enhanced prompt templates. Includes: knowledge tips, balancing factors Dialogue with the original history and the generated reply template ; The knowledge hints include entity-level supermarkers obtained based on the knowledge hint learning module. and context-level super tags ; 3-4, Replace the template with the recommended task-generated products. The placeholders in the code will receive the final response.
8. The multi-level knowledge-enhanced dialogue recommendation method according to claim 7, characterized in that, The learning objective of the dialogue generation task is: (16) in It is the total number of input sequences; Indicates in , Find under the given conditions ; Indicates the first The target response corresponding to each input sequence; Indicates the first A knowledge-enhanced input sequence; Used to refer to , and , , and It is the only adjustable parameter; Indicates in , , Find under the given conditions ; It is the first The length of the target response corresponding to each input sequence; Indicates the first The first input sequence corresponds to the target response in the first... One word; Indicates the first The word preceding the current position; The learning objective of the recommendation task is: (18) in This indicates recommending entities to users. The probability of; Indicates the first One entity; Indicates the first A knowledge-enhanced input sequence; Used to refer to , and , , and It is the only adjustable parameter; It is the first Binary truth labels for each input sequence; This is the formula for calculating the recommendation probability.