Conversation recommendation method and device based on user preference and medium
By extracting entities in the user's item interaction map and reorganizing the historical item matrix using attention mechanism, and combining the hierarchical self-attention coding structure to generate user vector representations, it solves the problem that existing dialogue recommendation systems are difficult to deeply explore user interest preferences and homogeneous recommendation results, and achieve more accurate and personalized recommendation results.
Patent Information
- Application Number
- CN202510063785.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-05-09
AI Technical Summary
When the existing dialogue recommendation system provides recommended items in a short time, it is difficult to deeply explore users' interest preferences for selected items, and the recommendation results have a trend of homogeneity, which can easily lead to adverse phenomena such as "information cocoon".
By extracting the target dialogue and entities in the historical dialogue in the user item interaction map, the attention distribution of the historical item matrix to the current context entity matrix is calculated using the bilinear model attention mechanism, and a reorganized historical item matrix based on context weight is obtained. Then, the recombinant historical item matrix is encoded using a hierarchical self-attention coding structure to obtain historically related user vectors, and the user vector and historical context entity matrix are fused to obtain user vector representation. Finally, multiple candidate items are recommended according to user vector representation.
By combining user historical behavior and current context information, users' interests and needs can be more comprehensive and accurate, improving the accuracy of recommendation results of dialogue recommendation systems, reducing homogeneity trends, and improving user experience.
Smart Images

Figure CN119961460A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device and medium for recommending a conversation based on user preference. Background Art
[0002] As a technical means, the recommendation system has been widely used in social networking, e-commerce, news and other fields in recent years. The recommendation system has become an important part of various online platforms. Taking the conversational recommendation system as an example, the conversational recommendation system is a system that can detect users' dynamic preferences through real-time multi-round conversations and make recommendations based on them. It combines the technologies of natural language processing and recommendation systems, aiming to better understand users' preferences through multi-round conversations.
[0003] However, existing conversational recommendation systems only model the current conversation, and in order to provide recommended items in a short period of time, the number of conversation turns needs to be controlled within a certain range. This limitation on the depth of interaction makes it difficult to deeply explore the user's interest preferences for the selected items. Secondly, user preferences are broad and multifaceted, and a single conversation only reflects one aspect of user preferences, resulting in a homogenized recommendation result, which is prone to undesirable phenomena such as "information cocoon".
[0004] Therefore, there is an urgent need for a method that can improve the accuracy of recommendation results of dialogue recommendation systems. Summary of the invention
[0005] Based on this, it is necessary to provide a conversation recommendation method, device and medium based on user preferences to address the above technical problems. This method can improve the accuracy of recommendation results of the conversation recommendation system.
[0006] The present invention adopts the following technical solutions:
[0007] The present invention provides a method for recommending conversations based on user preferences, comprising:
[0008] Extract entities from the target conversation and historical conversation in the user-item interaction graph to obtain the historical context entity matrix, current context entity matrix, and historical item matrix;
[0009] The bilinear model attention mechanism is used to calculate the attention distribution of the historical item matrix to the current context entity matrix, and a context-weighted reorganized historical item matrix is obtained; the reorganized historical item matrix reflects the most relevant part of the historical conversation to the current context;
[0010] A hierarchical self-attention encoding structure is used to encode the reorganized historical item matrix to obtain the historically related user vector, and the user vector is fused with the historical context entity matrix to obtain the user vector representation; the user vector representation includes the user's historical behavior and current context information;
[0011] Based on the user vector representation, multiple candidate items are recommended to obtain the dialogue recommendation results.
[0012] Preferably, the attention distribution of the historical item matrix to the current context entity matrix is calculated using a bilinear model attention mechanism to obtain a context-weighted reorganized historical item matrix, specifically including:
[0013] The attention score matrix between the historical item matrix and the current context entity matrix is calculated using a bilinear function. The attention score matrix is calculated as follows:
[0014] S=HW T C T ;
[0015] Among them, S is the attention score matrix, H is the historical item matrix, C is the current context entity matrix, and W is the weight matrix;
[0016] Normalize each row of the attention score matrix to obtain the attention distribution matrix. The calculation formula of the attention distribution matrix is:
[0017]
[0018] Among them, A ij is the attention weight between the historical items in the historical item matrix and the entities in the current context entity matrix, S ij is the bilinear attention score between historical item i in the historical item matrix and entity j in the current context entity matrix, m is the number of entities in the current context entity matrix; k is the temperature parameter of the Softmax function.
[0019] The historical item matrix is reorganized using the attention distribution matrix to obtain the reorganized historical item matrix. The calculation formula for the reorganized historical item matrix is:
[0020]
[0021] Among them, H' i is the i-th row of the reorganized historical item matrix, m is the number of entities in the current context entity matrix, C j is the jth column in the current context entity matrix, A ij is the attention weight between the historical items in the history item matrix and the entities in the current context entity matrix.
[0022] Preferably, a hierarchical self-attention encoding structure is used to encode the reorganized historical item matrix to obtain a history-related user vector, specifically including:
[0023] The calculation method of history-related user vector is:
[0024] H' (0) =H'
[0025] H' (l) =Attention(H' (l-1) ,A l )
[0026] U h =H' (L)
[0027] Among them, U h is the history-related user vector, A l is the attention weight matrix of the lth layer, H' (l-1) is the output matrix of the l-1th layer, l is the number of layers of the hierarchical self-attention encoding structure, H' (l) is the output matrix of the lth layer, H ,(0) is the first layer output of the hierarchical self-attention encoding structure, and H, is the historical item matrix.
[0028] Preferably, fusing the user vector and the historical context entity matrix to obtain the user vector representation includes: concatenating the user vector and the historical context entity matrix to obtain the user vector representation.
[0029] Preferably, multiple candidate items are recommended based on the user vector representation to obtain a dialog recommendation result, including:
[0030] Create a corresponding item vector matrix for each candidate item;
[0031] Calculate the similarity scores between the user vector representation and each item vector matrix respectively; sort multiple candidate items according to the similarity scores to obtain the sorting results;
[0032] Combine the user vector representation and the ranking result, and convert the combined result into a vocabulary bias matrix;
[0033] Incorporate the vocabulary bias matrix into the dialogue generation model to generate recommendation results.
[0034] Preferably, the calculation formula for the similarity score is:
[0035]
[0036] Among them, S iis the similarity score between the user vector representation and the item vector matrix of the i-th candidate item, U is the user vector representation, V i is the item vector matrix of the i-th candidate item.
[0037] Preferably, the calculation formula of the vocabulary bias matrix is:
[0038] B=W b U′+b b ;
[0039] Where B is the vocabulary bias matrix, W b and b b is the learning parameter, and U′ is the combined result.
[0040] Preferably, the dialogue generation model is based on a recurrent neural network or a variant of a recurrent neural network, and the vocabulary bias matrix is integrated into the dialogue generation model to generate recommendation results, specifically including:
[0041] When the dialogue generation model generates vocabulary, the vocabulary bias matrix is added to the product of the current hidden state and the vocabulary embedding, and the probability distribution of the vocabulary is calculated by the function. The probability distribution of the vocabulary is:
[0042] P(w t |h t )=softmax(h t W+b+B w );
[0043] Among them, h t is the current hidden state, W and b are model parameters, B w is the vocabulary bias matrix corresponding to the current predicted vocabulary;
[0044] The word with the largest probability value in the probability distribution is taken as the recommendation result.
[0045] The present invention provides a method and device for recommending a conversation based on user preference, comprising:
[0046] The extraction module is used to extract entities in the target dialogue and historical dialogue in the user-item interaction graph to obtain the historical context entity matrix, the current context entity matrix and the historical item matrix;
[0047] The calculation module is used to calculate the attention distribution of the historical item matrix to the current context entity matrix using the bilinear model attention mechanism, and obtain the reorganized historical item matrix based on context weighting; the reorganized historical item matrix reflects the part of the historical conversation that is most relevant to the current context.
[0048] The encoding module is used to encode the reorganized historical item matrix using a hierarchical self-attention encoding structure to obtain the historically related user vector, and fuse the user vector with the historical context entity matrix to obtain the user vector representation; the user vector representation includes the user's historical behavior and current context information;
[0049] The recommendation module is used to recommend multiple candidate items based on the user vector representation and obtain the dialogue recommendation results.
[0050] The present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned dialogue recommendation method based on user preference is implemented.
[0051] The present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for recommending conversations based on user preferences when executing the program.
[0052] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects:
[0053] First, the external knowledge graph is integrated when constructing the user-item interaction graph, and the user-item interaction graph is enhanced, which significantly improves the completeness, accuracy and application effect of the user-item interaction graph. Secondly, the bilinear model attention mechanism is used to calculate the attention distribution of the historical item matrix to the current context entity matrix, and the context-weighted reorganized historical item matrix is obtained. The reorganized historical item matrix fully considers the information in the historical dialogue and improves the accuracy of the recommendation. Thirdly, the hierarchical self-attention encoding structure is used to encode the reorganized historical item matrix to obtain the historically related user vector, and the user vector and the historical context entity matrix are fused to obtain the user vector representation. The user vector representation includes the user's historical behavior and the current context information, which can more comprehensively and accurately reflect the user's interests and needs. Finally, according to the user vector representation, multiple candidate items are recommended to obtain the dialogue recommendation result. Based on the consideration of the user's historical behavior, this method can improve the accuracy of the recommendation results of the dialogue recommendation system. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0055] Figure 1 An example of making movie recommendations ignoring user history information;
[0056] Figure 2A flowchart of a method for recommending a conversation based on user preferences provided by the present invention;
[0057] Figure 3 This is the structural diagram of the recommended module in the KGCR model;
[0058] Figure 4 Performance comparison of the NK, NG and KGCR models provided by the present invention on the Hit@50, MRR@50, NDCG@50 and SR@15 indicators;
[0059] Figure 5 Performance comparison of the four models provided by the present invention on the Hit@K index;
[0060] Figure 6 Performance comparison of the four models provided by the present invention on the MRR@K indicator;
[0061] Figure 7 Performance comparison of the four models provided by the present invention on the NDCG@K index;
[0062] Figure 8 Performance comparison of the four models provided by the present invention on the SR@15 index;
[0063] Fig. 9 Performance comparison of the four models provided by the present invention on AT indicators;
[0064] Fig.10 A schematic diagram of a conversation recommendation device based on user preference provided by the present invention;
[0065] Fig.11 A schematic diagram of a computer device for implementing a conversation recommendation method based on user preferences provided by the present invention. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0067] The devices for executing the solution of the present invention are such as desktop computers, notebook computers, servers, etc. For the convenience of description, the following description will only be made with the server as the execution subject.
[0068] With the rapid development of the Internet, recommendation systems have become an important part of various online platforms. However, traditional recommendation systems face some challenges, such as data sparsity and cold start problems. In order to solve these problems, researchers began to explore recommendation algorithms based on knowledge graphs to utilize the rich structured information in knowledge graphs to enhance the performance of recommendation systems.
[0069] In terms of the construction and application of knowledge graphs, the Complex Embeddings for SimpleLink Prediction (ComplEx) model can effectively use the multi-relational data in the knowledge graph for recommendation. The recommendation system based on the knowledge graph improves the accuracy and interpretability of the recommendation system by utilizing the entity and relationship information in the knowledge graph; Graph Neural Network (GNNs) has advantages in processing graph structured data, so it is also used in the recommendation system; the Graph Sample and Aggregate (GraphSAGE) model generates an embedded representation of a node by sampling the information of neighboring nodes. This method can be applied to the knowledge graph in the recommendation system; the Knowledge Graph Attention Network (KGAT) model combines the knowledge graph and the attention mechanism, while considering user-item interactions and high-order relationships in the knowledge graph.
[0070] However, recommendation algorithms based on knowledge graphs still face some challenges, such as the incompleteness of knowledge graphs and the scalability of recommendation systems. To address these issues, future research directions include developing more effective models to process large-scale knowledge graphs and improving the real-time and personalization level of recommendation systems.
[0071] As a technical means, the recommendation system has been widely used in many fields such as social networking, e-commerce, and news in recent years, and its commercial potential has gradually emerged. In traditional recommendation systems, recommendation tasks are mainly implemented based on the historical interaction records between users and items. For example, e-commerce websites recommend products based on users' click and purchase records. However, this method that relies on implicit feedback is difficult to accurately mine users' real preferences, which limits the improvement of the performance of the recommendation system. In order to solve this problem, conversational recommendation systems came into being. Such systems conduct multiple rounds of dialogues with users through natural language, gradually gaining a deeper understanding of users' personalized preferences, and thus providing high-quality recommendation results. Compared with traditional recommendation systems, conversational recommendation systems can obtain timely and explicit feedback in user interactions, more accurately reflect users' real needs, and create greater space for improving the performance of recommendation systems. In conversational recommendation systems, the design usually includes two parts: the recommendation module and the conversation module. The conversation module is responsible for understanding user intentions, providing information about user preferences to the recommendation module, and generating responses based on user feedback. The recommendation module searches for matching items in the item database based on the information provided by the conversation module to complete the recommendation task with higher quality. For example, in a movie recommendation scenario, the conversational recommendation system will pay attention to the types of movies that the user likes and provide recommended movies in the reply. When the user accepts the system's recommendation, the entire workflow ends. Figure 1 An example of making movie recommendations without considering user history information.
[0072] In this process, the system needs to complete two tasks, dialogue and recommendation, at the same time. Therefore, ensuring the effective connection and coordinated operation of the two modules is crucial to building an efficient dialogue recommendation system. Table 1 is a simplified example of the interaction of the dialogue recommendation system, the dialogue between user U and system S, showing an example of the interaction between the dialogue recommendation system and the user in the movie recommendation scenario, reflecting the synergy of the system in completing these two tasks.
[0073] Table 1
[0074]
[0075]
[0076] In recent years, conversational recommendation systems have gradually become a research hotspot. Researchers have proposed a variety of algorithms to meet different needs for different problem settings. The sentiment analysis module is introduced to more accurately obtain the user's preference for candidate items; the user-centered conversational recommendation system (UCCR) model innovatively considers the integration of user historical conversations and similar user information to understand users more comprehensively. UCCR models user interests more accurately in the Common Reporting Standard (CRS), while considering the user's entity preference, semantic preference, and consumption preference. Estimation-Action-Reflection (EAR) In the recommendation system stage, the system learns a conversation strategy to decide whether to ask questions about item attributes or recommend items. This decision is based on the results of the estimation stage and the conversation history. The goal of the action stage is to dynamically adjust the conversation to better understand user needs and ask questions or provide recommendations when appropriate. These works have improved the performance of conversational recommendation systems to a certain extent, but there are limitations. First, existing studies only model the current conversation, and in order to provide recommended items in a shorter time, the number of conversation turns needs to be controlled within a certain range. This limitation on the depth of interaction leads to a one-sided understanding of the system, making it difficult to deeply explore the user's interest in candidate items. Secondly, user preferences are broad and multifaceted, while a single conversation only reflects one aspect of user preferences, resulting in a homogenized recommendation result, which is prone to undesirable phenomena such as "information cocoons".
[0077] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0078] Figure 2 The flowchart of a method for recommending a conversation based on user preference in the present invention specifically includes the following steps:
[0079] S201: Extract entities in the target conversation and historical conversation in the user-item interaction graph to obtain a historical context entity matrix, a current context entity matrix, and a historical item matrix.
[0080] Specifically, we use Relational Graph Convolutional Networks ,R-GCN) encodes the knowledge graph to obtain a low-dimensional vector representation of the entity. The historical context entity set, current context entity set and historical item matrix in the target dialogue and historical dialogue are extracted, and the corresponding historical context entity matrix, current context entity matrix and historical item matrix are obtained. From the perspective of data enhancement, this method models environmental information through the knowledge graph, enhances the key information in the graph, designs an effective interaction strategy, and realizes an accurate and efficient active interactive recommendation algorithm.
[0081] Optionally, a user-item interaction graph is constructed and enhanced, entities in the target conversation and historical conversation in the enhanced user-item interaction graph are extracted to obtain a historical context entity matrix, a current context entity matrix, and a historical item matrix.
[0082] Optionally, a user-item interaction graph is constructed, and the user's historical interaction data is constructed into a user-item interaction graph, and an external knowledge graph is integrated to enrich the context information of the interaction environment; the user-item interaction graph is enhanced, and an active sampler and a negative sampler are designed for uncertainty and negative sample information in the user-item interaction graph. The active sampler focuses on fuzzy attribute samples in the user-item interaction graph, and the negative sampler focuses on high-quality negative samples in the user-item interaction graph. In order to improve the interaction efficiency of the system and the update efficiency of the recommendation model, the present invention adopts the following enhanced sampling strategy: First, for the attribute sample nodes representing user preferences, an active reinforcement sampler is used, which can output fuzzy samples with high information content, and these samples can be used in the interaction with the user. This can effectively improve the interaction efficiency of the system. Second, for the item sample nodes in the user-item interaction graph, a negative reinforcement sampler is used, which can output high-quality negative samples, and these samples can be used to assist sparse online data to update the recommender. This can improve the update efficiency of the recommendation model. These two parts assist each other, not only can the user's implementation preferences be efficiently obtained, but also the number of interaction rounds can be reduced, thereby reducing the user's interaction burden.
[0083] S202: Calculate the attention distribution of the historical item matrix to the current context entity matrix using the bilinear model attention mechanism to obtain a context-weighted reorganized historical item matrix; the reorganized historical item matrix reflects the part of the historical conversation that is most relevant to the current context.
[0084] In an exemplary embodiment, the attention distribution of the historical item matrix to the current context entity matrix is calculated using a bilinear model attention mechanism to obtain a context-weighted reorganized historical item matrix, specifically including: using a bilinear function to calculate an attention score matrix between the historical item matrix and the current context entity matrix, and the calculation method of the attention score matrix is:
[0085] S=HW T C T ;
[0086] Among them, S is the attention score matrix, H is the historical item matrix, C is the current context entity matrix, W is the weight matrix, C∈R m×d’ , m represents the number of current context entities, d' represents the feature dimension of each context entity, H∈R n×d , n represents the number of historical records, d represents the feature dimension of each historical record, W∈R d’×d , S∈R n×m .
[0087] Normalize each row of the attention score matrix to obtain the attention distribution matrix. The calculation formula of the attention distribution matrix is:
[0088]
[0089] Among them, A ij is the attention weight between the historical items in the historical item matrix and the entities in the current context entity matrix, S ij is the bilinear attention score between historical item i in the historical item matrix and entity j in the current context entity matrix, m is the number of entities in the current context entity matrix; k is the temperature parameter of the Softmax function, which is used to control the distribution degree of the output.
[0090] The historical item matrix is reorganized using the attention distribution matrix to obtain the reorganized historical item matrix. The calculation formula for the reorganized historical item matrix is:
[0091]
[0092] Among them, H' i is the i-th row of the reorganized historical item matrix, m is the number of entities in the current context entity matrix, C j is the jth column in the current context entity matrix, A ij is the attention weight between the historical items in the history item matrix and the entities in the current context entity matrix.
[0093] Specifically, a bilinear function is used to calculate the attention score matrix between the historical item matrix and the current context entity matrix, each row of the attention score matrix is normalized to obtain the attention distribution matrix, and the attention distribution matrix is used to reorganize the historical item matrix to obtain the reorganized historical item matrix. The reorganized historical item matrix is used to recommend items in the recommendation system.
[0094] S203: Use a hierarchical self-attention encoding structure to encode the reorganized historical item matrix to obtain a historically related user vector, and fuse the user vector with the historical context entity matrix to obtain a user vector representation; the user vector representation includes information about the user's historical behavior and current context.
[0095] In an exemplary embodiment, a hierarchical self-attention encoding structure is used to encode the reorganized historical item matrix to obtain a history-related user vector, specifically including: the history-related user vector is calculated as follows:
[0096] H' (0) =H'
[0097] H' (l) =Attention(H' (l-1) ,A l )
[0098] U h =H' (L)
[0099] Among them, U h is the history-related user vector, A l is the attention weight matrix of the lth layer, H' (l-1) is the output matrix of the l-1th layer, l is the number of layers of the hierarchical self-attention encoding structure, H' (l) is the output matrix of the lth layer, H' (0) is the first layer output of the hierarchical self-attention encoding structure, and H' is the historical item matrix.
[0100] The hierarchical self-attention encoding structure calculates the attention score for each layer separately.
[0101] In an exemplary embodiment, the user vector representation is calculated as follows:
[0102] U=Fuse(U h ,C);
[0103] Among them, U is the user vector representation, U h is the historically related user vector, and C is the current context entity matrix.
[0104] Specifically, after extracting historical information based on bilinearity, there is already a reorganized historical item matrix, which reflects the part of historical data that is most relevant to the current context. Using a hierarchical self-attention encoding structure, the historical item matrix is first encoded to obtain the historically relevant user vector, which is then fused with the context entity matrix to finally obtain the user vector representation.
[0105] S204: Recommend multiple candidate items based on the user vector representation to obtain a dialogue recommendation result.
[0106] In an exemplary embodiment, multiple candidate items are recommended according to the user vector representation to obtain a dialog recommendation result, including:
[0107] Create a corresponding item vector matrix for each candidate item;
[0108] The similarity scores between the user vector representation and each item vector matrix are calculated respectively. The calculation formula of the similarity score is:
[0109]
[0110] Among them, S i is the similarity score between the user vector representation and the item vector matrix of the i-th candidate item, U is the user vector representation, V i is the item vector matrix of the i-th candidate item;
[0111] Sort multiple candidate items according to similarity scores to obtain a sorting result;
[0112] The user vector representation and the ranking result are combined, and the combined result is converted into a vocabulary bias matrix. The calculation formula of the vocabulary bias matrix is:
[0113] B=W b U′+b b ;
[0114] Where B is the vocabulary bias matrix, W b and b b is the learning parameter, U′ is the combination result;
[0115] Incorporate the vocabulary bias matrix into the dialogue generation model to generate recommendation results;
[0116] When the dialogue generation model generates vocabulary, the vocabulary bias matrix is added to the product of the current hidden state and the vocabulary embedding, and the probability distribution of the vocabulary is calculated through the function. The probability distribution of the vocabulary is:
[0117] P(w t |h t )=softmax(h t W+b+B w );
[0118] Among them, h t is the current hidden state, W and b are model parameters, B w is the vocabulary bias matrix corresponding to the current predicted vocabulary;
[0119] The word corresponding to the maximum probability value in the probability distribution is taken as the recommendation result.
[0120] Specifically, an item vector matrix is created for each candidate item. There are many ways to obtain the item vector matrix, such as through the attribute characteristics of the item, historical interaction data, or through a pre-trained item embedding model. The similarity score between the user vector representation and each item vector matrix is calculated respectively, and the candidate items are sorted in descending order according to the similarity score. The user vector representation and the sorting result are combined, and the attention mechanism is used to dynamically combine the user vector representation and the sorted item vector matrix. The attention mechanism can calculate the weight according to the similarity between the user vector representation and the sorted item vector, and then apply the weight to the item vector to obtain a weighted item vector matrix. The weighted item vector matrix is concatenated or weighted summed with the user vector representation to obtain a new vector matrix, which is recorded as the combination result. The combination result is converted into a vocabulary bias matrix, and the vocabulary bias matrix is integrated into the dialogue generation model. The dialogue generation model is based on a recurrent neural network or a variant of a recurrent neural network. When the dialogue generation model generates vocabulary, the vocabulary bias matrix is added to the product of the current hidden state and the vocabulary embedding, and the probability distribution of the vocabulary is calculated through a function. Find the word corresponding to the maximum probability in the probability distribution, and feed it back to the user as a recommendation result in the dialogue recommendation system.
[0121] When applying the conversation recommendation method based on user preference provided by the present invention, it is not necessary to Figure 1 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs, and the present invention does not limit this.
[0122] In an exemplary embodiment, the present invention proposes a new algorithm framework - Knowledge Graph based user preference Conversational Recommender (KGCR). A core innovation of this framework is that it integrates the user's historical conversation data as context information into the user modeling process. In this way, KGCR can understand the user's interests and preferences more comprehensively.
[0123] Figure 3The structure of the recommendation module in the KGCR model, in which there are two main components: the baseline model and the modeling module based on historical dialogue. The baseline model is constructed based on the knowledge graph. This part is located on the right side of the figure. It calculates the similarity between users and recommended items and recommends users based on the results of the similarity calculation. This part introduces the knowledge graph as the environment. From the perspective of improving data quality, it designs interactive tasks to actively obtain user online feedback while minimizing the user burden, so as to achieve accurate and efficient dialogue recommendations based on high-quality and targeted user preference feedback. The other core module of KGCR, located on the left side of the figure, vectorizes the context entities and historical items to obtain the context entity matrix and the historical item matrix. The bilinear function is used to calculate the attention logic distribution between the historical item matrix and the context entity matrix to obtain the historical item matrix. The attention mechanism is used to encode the historical item matrix to obtain the user vector. The historical dialogue data is used to generate the user vector representation related to the history. These user vector representations not only enrich the expression ability of the user vector, but also can more accurately match the items in the item database, thereby improving the quality of the recommendation.
[0124] In an exemplary embodiment, the present invention selects a data set, sets evaluation indicators, sets experimental parameters, and compares experimental results to illustrate that the dialogue text generated by the KGCR model is more fluid and natural, and the user experience is better.
[0125] Specifically, the present invention selects the ReDial (Recommendation Dialogues, ReDial) dataset for dialogue recommendation to train and evaluate the model. The ReDial dataset is a dialogue dataset designed specifically for movie recommendation tasks. ReDial contains dialogues between users and recommendation systems, which involve movie recommendations, evaluations, and discussions. The ReDial dataset is characterized by its dialogue nature. Unlike traditional rating or comment datasets, ReDial provides richer and more dynamic user preference information. After preprocessing steps such as word segmentation, stop word removal, and tokenization, there are 16,093 dialogue data in the dataset, each of which has its corresponding user query and system response. There are 897 different query users, and 83% of the query users have 10 or more query records. These large number of active users have interacted with the system many times. Since most movie recommenders have more dialogue records, this provides a rich data foundation for completing personalized dialogue recommendation tasks. Personalized recommendation systems can use these dialogue records to understand user preferences and behavior patterns, thereby providing more accurate movie recommendations.
[0126] The present invention uses the knowledge graph of the movie rating website (MovieLens). The graph contains a large number of entities such as movies, actors, directors, genres and the relationships between them. This information can help users better understand the content of the movie, thereby providing more personalized recommendations. The MovieLens knowledge graph converts movie data into a graph form, making the data structured and convenient for in-depth analysis and research. In order to solve the cold start problem that may occur in the system, this study uses the Internet Movie Database (IMDb). The data set serves as an external knowledge base of the MovieLens knowledge graph. The data set covers various types of movies and TV series, which can increase the diversity and coverage of the knowledge graph, so that the recommendation system can better handle different types of content. At the same time, the data of IMDb is updated in real time, which enables the knowledge graph to promptly reflect the latest information and trends of film and television works.
[0127] Specifically, the present invention uses different metrics to evaluate these two tasks respectively. For the recommendation task, the evaluation method will be used to see whether it can accurately provide item recommendations. Therefore, Hit@K, MRR@K, and NDCG@K are used for evaluation (K=10, 30, 50), which respectively reflect the hit accuracy and ranking accuracy of the recommendation results. For the dialogue task, SR@T (T=15) is used to measure the system efficiency of the multi-round dialogue recommendation system, which means that in the Tth round, SR is the system recommendation success rate. At the same time, the average turn (AT) is used to evaluate the recommendation efficiency of the system. AT represents the average number of interaction rounds for the system to achieve a successful recommendation online.
[0128] Specifically, this study uses the Rasa open source framework to build a conversational interface. Rasa can be integrated with the recommendation system to collect user preferences through conversations and provide personalized recommendations based on them. It also combines Google's TensorFlow Recommender system (TensorFlowRecommenders) to provide a personalized recommendation framework. TensorFlow Recommenders is an open source library for building, evaluating, and deploying recommendation models. It can be integrated with the conversation system to provide recommendations based on user conversation content.
[0129] In the recommendation module, the embedding dimension is set to 128, that is, each word or entity is represented as a 128-dimensional vector. The number of layers of the Relation-GCN (R-GCN) module is 1, the negative sampling is 5, the active sampling rate is 10%, and the model contains 2 layers of attention mechanism. The L2 regularization term is set, and the regularization strength is set to 0.01. The study adopts the Adaptive Moment Estimation (Adam) optimizer, which has better convergence speed and robustness, and the learning rate is set to 0.001. In the dialogue module, it is responsible for understanding user intentions, generating replies, and conducting multiple rounds of dialogue with users. The hidden layer dimension is set to 512, that is, each hidden layer of the neural network model contains 256 neurons. The encoder and decoder dimensions of the generation model Seq2Seq are set to 256 respectively, and are constructed using a bidirectional LSTM structure. The batch size is 32, that is, 32 samples are used for training in each training iteration. Table 2 is a list of parameters involved in the KGCR model.
[0130] Table 2
[0131]
[0132] This paper mainly studies the recommendation effect part of the dialogue recommendation system, so the KGCR model is compared with the TransE, KGAT and NeuMF baseline models. By comparing the performance of the KGCR model with the above baseline models in the recommendation task and dialogue task on the ReDial dataset, the effectiveness and accuracy of the KGCR model can be evaluated.
[0133] (1) TransE: TransE is a classic knowledge graph based embedding method that can be fairly compared with the KGCR model.
[0134] (2) KGAT: KGAT is a recommendation model that combines knowledge graph and attention mechanism, which can effectively utilize high-order relations in knowledge graph and has a similar design concept to the KGCR model.
[0135] (3) NeuMF: NeuMF is a recommendation model that combines matrix factorization and deep learning. It can effectively learn the characteristics of users and items, which is similar to the user preference modeling method of the KGCR model.
[0136] Table 3 is a comparison table of experimental results.
[0137] Table 3
[0138]
[0139] As shown in Table 3, the KGCR model outperforms the TransE, KGAT, and NeuMF baseline models on the ReDial dataset, and achieves better results in both recommendation and dialogue tasks. For the recommendation task, the Hit@50 value of the KGCR model is 0.4351, which is much higher than 0.3461 of TransE, 0.3754 of KGAT, and 0.2944 of NeuMF, indicating that the KGCR model can more accurately recommend items that users may be interested in. The MRR@50 value of the KGCR model is 0.0871, which is also higher than other baseline models, indicating that the KGCR model can more effectively rank the items that users are most interested in at the top of the recommendation list. The NDCG@50 value of the KGCR model is 0.1945, which is also higher than other baseline models, indicating that the KGCR model can more reasonably allocate the ranking weights of items, making the recommendation results more in line with user preferences. For the dialogue task, the SR@15 value of the KGCR model is 0.8152, which is much higher than TransE's 0.6433, KGAT's 0.5101, and NeuMF's 0.5641, which shows that the KGCR model can more effectively generate responses related to user input. The AT value of the KGCR model is 10.69, slightly lower than TransE's 10.04, but higher than KGAT and NeuMF, which shows that the dialogue text generated by the KGCR model is more fluent and natural. The experimental results of the KGCR model on the ReDial dataset show that it can effectively combine user historical dialogue data and knowledge graph information to more comprehensively understand user preferences and provide more accurate and personalized recommendation results. At the same time, the KGCR model can also generate more fluent and natural dialogue texts to improve user experience.
[0140] In order to prove the effectiveness of combining historical information and knowledge graphs in this invention, two improved KGCR algorithms were designed for ablation experiments. The No-Knowledge (NK) algorithm has no historical information model, that is, the bilinear historical information extraction module in KGCR is removed, and only the current conversation information is used for recommendation. The No-Graph (NG) algorithm has no knowledge graph model, that is, the entity vector construction module based on the knowledge graph in KGCR is removed, and only the user's historical interaction data is used for recommendation.
[0141] Figure 4-Figure 9 The figure is an illustration of the experimental results, which shows the performance comparison of the KGCR model with the three baseline models of TransE, KGAT and NeuMF on the ReDial dataset, including indicators of both recommendation tasks and dialogue tasks.
[0142] Figure 4The performance comparison of the KGCR, NK and NG models provided by the present invention on the Hit@50, MRR@50, NDCG@50 and SR@15 indicators is shown in the figure. The horizontal axis is different models, such as KGCR, NK and NG, and the vertical axis is the performance of different models on the Hit@50, MRR@50, NDCG@50 and SR@15 indicators. Figure 4 It can be seen that the KGCR model performs better than the other three models in terms of the performance of the four indicators.
[0143] Figure 5 This is a performance comparison of the four models provided by the present invention on the Hit@K index. The horizontal axis is the KGCR, TransE, KGAT and NeuMF algorithms, and the vertical axis is the Hit@10, Hit@20 and Hit@30 index values corresponding to the KGCR, TransE, KGAT and NeuMF algorithms, respectively. Figure 5 The performance of the KGCR model is significantly better than that of the other three baseline models, indicating that the KGCR model can more accurately recommend items that users are interested in.
[0144] Figure 6 This is a performance comparison of the four models provided by the present invention on the MRR@K index. The horizontal axis is the KGCR, TransE, KGAT and NeuMF algorithms, and the vertical axis is the MRR@10, MRR@20 and MRR@30 index values corresponding to the KGCR, TransE, KGAT and NeuMF algorithms, respectively. Figure 6 It can be seen that the performance of the KGCR model is significantly better than the other three baseline models, indicating that the KGCR model can effectively put the items that users are interested in at the front of the recommendation list.
[0145] Figure 7 This is a performance comparison of the four models provided by the present invention on the NDCG@K index. The horizontal axis is the KGCR, TransE, KGAT and NeuMF algorithms, and the vertical axis is the NDCG@10, NDCG@20 and NDCG@30 index values corresponding to the KGCR, TransE, KGAT and NeuMF algorithms, respectively. Figure 7 It can be seen that the performance of the KGCR model is significantly better than the other three baseline models, indicating that the KGCR model can more reasonably allocate the ranking weights of items and make the recommendation results more in line with user preferences.
[0146] Figure 8 This is a performance comparison of the four models provided by the present invention on the SR@15 index. The horizontal axis is the KGCR, TransE, KGAT and NeuMF algorithms, and the vertical axis is the SR@15 index values corresponding to the KGCR, TransE, KGAT and NeuMF algorithms. Figure 8It can be seen that the performance of the KGCR model is better than the other three baseline models, indicating that the KGCR model can effectively generate responses related to user input.
[0147] Fig. 9 The performance comparison of the four models provided by the present invention on the AT index is shown in Figure 1. The horizontal axis is KGCR, TransE, KGAT and NeuMF algorithms, and the vertical axis is the AT index values corresponding to KGCR, TransE, KGAT and NeuMF algorithms. Fig. 9 It can be seen that the performance of the KGCR model is slightly lower than that of the KGAT model, but better than that of the TransE and NeuMF models, indicating that the dialogue text generated by the KGCR model is more fluent and natural.
[0148] The experimental results are shown in Table 4:
[0149] Table 4
[0150] algorithm Hit@50 MRR@50 NDCG@50 SR@15 NK 0.2415 0.0613 0.0792 0.4013 NG 0.1063 0.0127 0.0054 0.2504 KGCR 0.4351* 0.0871* 0.1945* 0.8152*
[0151] According to Table 4, the Hit@50 value of the NK algorithm is 0.2415, which is a decrease of about 44.3%. This shows that the removal of the historical information module causes the model to be unable to utilize the user's historical behavior data and cannot fully understand the user's interests and preferences, thereby reducing the accuracy of the recommendation results. The NK algorithm cannot effectively put the items that the user is most interested in at the top of the recommendation list like the KGCR model. The NDCG@50 value of the NK algorithm is 0.0792, which is a decrease of about 59.4%, indicating that the NK algorithm cannot reasonably allocate the ranking weights of items like the KGCR model, resulting in a decrease in the quality of the recommendation results. The SR@15 value of the NK algorithm is 0.4013, which is a decrease of about 50.8%. This shows that the NK algorithm cannot effectively generate responses related to user input like the KGCR model, resulting in a decrease in the quality of the conversation. The Hit@50 value of the NG algorithm is 0.1063, which is a decrease of about 75.4%. This shows that the removal of the knowledge graph module causes the model to be unable to utilize the attributes and relationship information of the items and cannot fully understand the items, thereby greatly reducing the accuracy of the recommendation results. The MRR@50 value of the NG algorithm is 0.0127, which is a decrease of about 85.2%. This shows that the NG algorithm cannot effectively put the items that the user is most interested in at the top of the recommendation list like the KGCR model. The NDCG@50 value of the NG algorithm is 0.0054, which is a decrease of about 97.2%. This shows that the NG algorithm cannot reasonably allocate the ranking weights of items like the KGCR model, resulting in a decrease in the quality of the recommendation results. The SR@15 value of the NG algorithm is 0.2504, which is a decrease of about 69.4%. This shows that the NG algorithm cannot effectively generate responses related to user input like the KGCR model, resulting in a decrease in the quality of the conversation. The ablation experiment results show that the design of combining user historical conversation information and knowledge graph in the KGCR model is effective. Removing any module will lead to a decrease in recommendation effect and conversation quality, which shows that historical information and knowledge graph are both key factors in improving recommendation effect. By combining historical information and knowledge graph, the KGCR model can more comprehensively understand user preferences and provide more accurate and personalized recommendation results. It can also generate more fluent and natural conversation texts to improve user experience.
[0152] The present invention proposes a method for dialogue recommendation based on user preference, which aims to solve the shortcomings of traditional dialogue recommendation systems in user preference modeling and recommendation result diversity. The KGCR model achieves more comprehensive and accurate user preference modeling through the following ways: historical dialogue data integration: (1) using the bilinear model attention mechanism and hierarchical self-attention encoding structure, the user's historical dialogue data is integrated into the user modeling process to better understand the user's interest preferences in different dialogues; (2) knowledge graph enhancement: integrating the external knowledge graph, enriching the context information of the interaction environment, and enhancing the uncertainty and negative sample information in the graph through active sampling and negative sampling strategies, so as to improve the update efficiency and interaction efficiency of the recommendation model; (3) hierarchical attention mechanism: using the hierarchical self-attention encoding structure, first integrating the items that have interacted with the user in the historical dialogue data, obtaining the user vector representation related to the history, and then integrating it with the entities appearing in the current dialogue to obtain the final user vector representation, thereby achieving fine modeling of user preferences. Experimental results show that the KGCR model performs better than the baseline model in both recommendation tasks and dialogue tasks, proving the effectiveness of this method.
[0153] The above is a method for recommending a conversation based on user preference provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding method for recommending a conversation based on user preference, such as Fig.10 shown.
[0154] Fig.10 A schematic diagram of a conversation recommendation device based on user preference provided by the present invention includes:
[0155] Extraction module 1001, used to extract entities in target conversations and historical conversations in the user-item interaction graph, and obtain a historical context entity matrix, a current context entity matrix, and a historical item matrix;
[0156] The calculation module 1002 is used to calculate the attention distribution of the historical item matrix to the current context entity matrix using the bilinear model attention mechanism to obtain a reorganized historical item matrix based on context weighting; the reorganized historical item matrix reflects the part of the historical conversation that is most relevant to the current context.
[0157] The encoding module 1003 is used to encode the reorganized historical item matrix using a hierarchical self-attention encoding structure to obtain a historically related user vector, and fuse the user vector with the historical context entity matrix to obtain a user vector representation; the user vector representation includes information about the user's historical behavior and current context;
[0158] The recommendation module 1004 is used to recommend multiple candidate items according to the user vector representation to obtain a dialogue recommendation result.
[0159] For the specific definition of a conversation recommendation device based on user preferences, please refer to the definition of a conversation recommendation method based on user preferences above, which will not be repeated here. Each module in the above-mentioned conversation recommendation device based on user preferences can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0160] The present invention also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 2 A conversation recommendation method based on user preferences is provided.
[0161] The present invention also provides Fig.11 The structural diagram of the computer device shown in FIG. Fig.11 As shown in the figure, at the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 2 A conversation recommendation method based on user preferences is provided.
[0162] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0163] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.
Claims
1. A method for recommending conversations based on user preferences, characterized in that: include: Extract entities from the target conversation and historical conversation in the user-item interaction graph to obtain the historical context entity matrix, current context entity matrix, and historical item matrix; The attention distribution of the historical item matrix to the current context entity matrix is calculated using a bilinear model attention mechanism to obtain a context-weighted reorganized historical item matrix; the reorganized historical item matrix reflects the most relevant part of the historical conversation to the current context; The reorganized historical item matrix is encoded using a hierarchical self-attention encoding structure to obtain a history-related user vector, and the user vector is fused with the historical context entity matrix to obtain a user vector representation; the user vector representation includes the user's historical behavior and the current context information; According to the user vector representation, multiple candidate items are recommended to obtain a dialogue recommendation result.
2. The method according to claim 1, characterized in that The use of the bilinear model attention mechanism to calculate the attention distribution of the historical item matrix to the current context entity matrix to obtain a context-weighted reorganized historical item matrix specifically includes: The attention score matrix between the historical item matrix and the current context entity matrix is calculated using a bilinear function. The calculation method of the attention score matrix is: S=HW T C T ; Wherein, S is the attention score matrix, H is the historical item matrix, C is the current context entity matrix, and W is the weight matrix; Each row of the attention score matrix is normalized to obtain an attention distribution matrix, and the calculation formula of the attention distribution matrix is: Among them, A ij is the attention weight between the historical items in the historical item matrix and the entities in the current context entity matrix, S ij is the bilinear attention score between historical item i in the historical item matrix and entity j in the current context entity matrix, m is the number of entities in the current context entity matrix; k is the temperature parameter of the Softmax function; The historical item matrix is reorganized using the attention distribution matrix to obtain the reorganized historical item matrix. The calculation formula of the reorganized historical item matrix is: Among them, H' i is the i-th row of the reorganized historical item matrix, m is the number of entities in the current context entity matrix, C j is the jth column in the current context entity matrix, A ij is the attention weight between the historical items in the historical item matrix and the entities in the current context entity matrix.
3. The method according to claim 1, characterized in that The hierarchical self-attention coding structure is used to encode the reorganized historical item matrix to obtain the history-related user vector, specifically including: The calculation method of the history-related user vector is: H'(0)=H, H’ (l) =Attention(H’ (l-1) ,A l ) U h =H, (L) Among them, U h is the history-related user vector, A l is the attention weight matrix of the lth layer, H' (l-1) is the output matrix of the l-1th layer, l is the number of layers of the hierarchical self-attention encoding structure, H' (l) is the output matrix of the lth layer, and the Attention function is based on the attention weight matrix A l For the input matrix H' (l-1) Weighted, H' (0) is the first layer output of the hierarchical self-attention encoding structure, and H' is the historical item matrix.
4. The method according to claim 1, characterized in that The fusing the user vector and the historical context entity matrix to obtain a user vector representation includes: The user vector and the historical context entity matrix are concatenated to obtain the user vector representation.
5. The method according to claim 1, characterized in that The step of recommending multiple candidate items according to the user vector representation to obtain a dialogue recommendation result includes: Create a corresponding item vector matrix for each candidate item; Calculating similarity scores between the user vector representation and each item vector matrix respectively; sorting the multiple candidate items according to the similarity scores to obtain a sorting result; Combining the user vector representation with the ranking result, and converting the combined result into a vocabulary bias matrix; The vocabulary bias matrix is integrated into the dialogue generation model to generate recommendation results.
6. The method according to claim 5, characterized in that The calculation formula of the similarity score is: Among them, S i is the similarity score between the user vector representation and the item vector matrix of the i-th candidate item, U is the user vector representation, V i is the item vector matrix of the i-th candidate item.
7. The method according to claim 5, characterized in that The calculation formula of the vocabulary bias matrix is: B=W b U′+b b ; Where B is the vocabulary bias matrix, W b and b b is the learning parameter, and U′ is the combination result.
8. The method according to claim 5, characterized in that The dialogue generation model is based on a recurrent neural network or a variant of the recurrent neural network, and the vocabulary bias matrix is integrated into the dialogue generation model to generate a recommendation result, specifically including: When the dialogue generation model generates vocabulary, the vocabulary bias matrix is added to the product of the current hidden state and the vocabulary embedding, and the probability distribution of the vocabulary is calculated by the function, and the probability distribution of the vocabulary is: P(w t |h t )=softmax(h t W+b+B w ); Among them, h t is the current hidden state, W and b are model parameters, B w is the vocabulary bias matrix corresponding to the current predicted vocabulary; The word corresponding to the maximum probability value in the probability distribution is taken as the recommendation result.
9. A conversation recommendation device based on user preference, characterized in that: include: The extraction module is used to extract entities in the target dialogue and historical dialogue in the user-item interaction graph to obtain the historical context entity matrix, the current context entity matrix and the historical item matrix; A calculation module is used to calculate the attention distribution of the historical item matrix to the current context entity matrix using a bilinear model attention mechanism to obtain a context-weighted reorganized historical item matrix; the reorganized historical item matrix reflects the most relevant part of the historical conversation to the current context An encoding module, configured to encode the reorganized historical item matrix using a hierarchical self-attention encoding structure to obtain a history-related user vector, and fuse the user vector with the historical context entity matrix to obtain a user vector representation; the user vector representation includes information about the user's historical behavior and the current context; The recommendation module is used to recommend multiple candidate items according to the user vector representation to obtain a dialogue recommendation result.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.