Session recommendation method based on intention perception constraint
By combining local and global relationship encoders with position encoding, a global intent layer and session constraint layer were designed, which solved the problems of noise interference and dynamic changes in user intent in conversational recommendation systems and improved recommendation accuracy.
Patent Information
- Application Number
- CN202510864461.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2025-10-14
AI Technical Summary
Existing conversational recommendation systems have problems such as noise interference affecting user preference expression and high computational cost when dealing with noise items and dynamic changes in user intentions. In addition, existing methods find it difficult to accurately capture user interests.
By adopting local relation encoder and global relation encoder, fusing local feature vectors and global feature vectors and combining position encoding information, we designed a global intent layer, session constraint layer and feature fusion layer to suppress noise interference and dynamically learn user intent.
It effectively reduces the impact of noise items on user interest learning, improves the accuracy and efficiency of the recommendation system, and accurately mines items of user interest.
Smart Images

Figure CN120780907A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of recommendation systems, and in particular to a conversation recommendation method based on intent-aware constraints. Background Art
[0002] In the era of information overload, personalized recommendation systems have become an important tool for effectively filtering information. Currently, users attach more importance to personal privacy. Therefore, session-based recommendation (SBR) has become a hot research topic in recommendation systems. SBR only requires short-term interaction records of anonymous users to predict the next item that the user may interact with. SBR is very practical in various scenarios such as e-commerce, music, and movies. The main technologies include: (1) Session recommendation technology based on traditional machine learning methods, which mainly uses machine learning algorithms such as matrix decomposition, kNN, and Markov chain to design recommendation methods; (2) Session recommendation technology based on deep learning, which mainly uses deep learning theories such as recurrent neural networks, attention networks, and graph neural networks to design recommendation methods; (3) Intent-based recommendation methods, which mainly establish the relationship between user intentions and items and combine deep learning methods to achieve recommendations.
[0003] However, there are still some challenges in the existing technology: (1) Noise interference. In the SBR task, user behavior is recorded in the conversation sequence, which provides key information for inferring user interests. To this end, RNN can be used to capture the evolution of user interests in the conversation sequence. GNN can simulate the correlation between items, or use intent variables to represent the association between intent and items. However, for conversation sequences containing noise items, the noise items will eventually affect the expression of user preferences through the item representation vector. (2) Dynamic changes. Incorporating user intentions into the SBR task is a popular practice recently. However, the user's intention for a given item will change dynamically over time, and the intentions of different users are also different, which increases the difficulty of inferring user preferences. Some studies use multi-view strategies of intent variables to improve the accuracy of user preference prediction. Although the multi-view method enhances representation diversity and effectively solves the complexity of user intentions, it cannot fully capture the dynamic characteristics of user intentions and will result in high computational costs. In addition, some studies use the most recently clicked items as user interests. Although this method is simple and efficient, it is easily affected by noise. Summary of the Invention
[0004] In view of the above-mentioned deficiencies in the prior art, the present invention provides a conversation recommendation method based on intent-aware constraints.
[0005] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:
[0006] A conversation recommendation method based on intent-aware constraints includes the following steps:
[0007] S1. Generate a conversation graph based on the conversation sequence of a given user;
[0008] S2, extract the local feature vectors and global feature vectors of items and sessions respectively;
[0009] S3. Fusing the extracted local feature vectors of items and sessions with the global feature vector to obtain item features and session features;
[0010] S4. Add location information to item features and session features respectively, calculate user preferences, and output recommendation probability distribution based on user preferences and item features.
[0011] Furthermore, the specific method of extracting the local feature vectors of items and conversations in S2 is:
[0012] S201. Calculate the feature vector of the current session based on the feature vectors of the items in the session graph. The calculation method is:
[0013]
[0014] Where s is the feature vector of the current session, v i is the feature vector of the i-th item in the current session; L represents the session length, i.e., a total of L items;
[0015] S202: Based on the attention mechanism, the item feature vector is updated according to the current session feature vector and the item feature vector to obtain a local feature vector. The calculation method is:
[0016]
[0017] Where, is the local feature vector of the item, Represents all neighbor nodes of node i; represents neighbor node j; α ij represents the normalized weight of the j-th item vector;
[0018] S203: Based on the attention mechanism, the session feature vector is updated in combination with the local feature vector of the item to obtain the local feature vector of the session. The calculation method is:
[0019]
[0020] Where s local is the local feature vector of the session, m is the total number of local feature vectors of items, π i is the weight coefficient and:
[0021]
[0022] Where W s is a learnable parameter; d is the vector dimension, and s represents the feature vector of the current session; is the transpose operation.
[0023] Furthermore, the specific method of extracting the global feature vectors of items and conversations in S2 is:
[0024] S211, perform intent modeling and calculate the global intent distribution matrix;
[0025] S212. Calculate the intent key matrix and the intent value matrix based on the global intent distribution matrix and normalize them. Fuse the intent and item information based on the calculated intent key matrix and intent value matrix, and output item features and session features.
[0026] S213. Calculate the global feature vector of the item and the global feature vector of the session using the feature fusion layer.
[0027] Furthermore, in said S212:
[0028] The specific calculation method of the intent key matrix is:
[0029]
[0030] Where, is the intent key matrix, represents the transpose operation, represents the item feature matrix in the t-1 layer session, D K Indicates the use The normalized intention distribution matrix of and:
[0031]
[0032] Where softmax(·) represents the activation function; W K1 represents the first learnable parameter matrix; W K2 represents the second learnable parameter matrix; C represents the intention feature;
[0033] The specific calculation method of the intention value matrix is:
[0034]
[0035] Where, is the intention value matrix, D V Indicates the use The normalized intention distribution matrix of and:
[0036]
[0037] Where W V1 represents the third learnable parameter matrix; W V2 represents the fourth learnable parameter matrix, Represents the previous layer session feature matrix.
[0038] Furthermore, the global feature vector of the item in S213 is expressed as:
[0039]
[0040] Where, is the item feature matrix in the current session before inputting the attention layer; is the item feature matrix output after calculation by the last attention layer; H τ is the gating matrix; calculated After that, each row is the global feature vector of item i in the current session.
[0041] The global features of a session are expressed as:
[0042]
[0043] Where, is the session feature matrix in the current session before inputting the attention layer, is the session feature matrix output after the last attention layer is calculated; After calculating , taking one of the rows can get the global feature vector of the current session
[0044] Furthermore, the S4 specifically includes the following steps:
[0045] S41, adding position coding information to the item feature and the session feature respectively, and calculating the current session feature after the position information is introduced;
[0046] S42: Calculate user preferences based on the current session features obtained by introducing location information, and output recommendation probability distribution based on user preferences and item features.
[0047] Furthermore, the item features and session features after adding the position coding information in S41 are respectively expressed as:
[0048] z i =v′ i +p L-i+1
[0049] z s =s′+p f
[0050] Where z i is the feature vector z of the i-th item after adding position encoding information i , v' i is the item feature, p L-i+1 is the reverse position code of the i-th item in the current session, L is the session length; z s is the current session feature after introducing position encoding information, s' is the session feature, and p f Encodes information about the current session's location and:
[0051]
[0052] Where p u is the shared position vector, p i The normal position encoding for the current session.
[0053] Furthermore, the specific calculation method of the user preference in S42 is:
[0054]
[0055] Where u f is user preference, β i is the item weight of the i-th item in the previous session, v' i is the item feature, p f is the position encoding information of the current session, and L is the session length.
[0056] Furthermore, the specific calculation method of the recommendation probability distribution in S42 is:
[0057]
[0058] Where u f Indicates user preferences, represents the transposition operation, softmax(·) represents the activation function, V represents the item feature, is the recommendation probability of all items.
[0059] The present invention has the following beneficial effects:
[0060] The method of the present invention innovatively designs a local relation encoder and a global relation encoder. In the local relation encoder, it is proposed to model the representation vector of the conversation separately and use it as a constraint when calculating the feature vector of the item. This method effectively suppresses the interference caused by noise items. In addition, in the global relation encoder, an innovative design is made of a global intent layer, a conversation constraint layer, and a feature fusion layer. The global intent layer enables intent sharing. The global intent layer and the conversation constraint layer promote the learning of dynamic intent while imposing necessary constraints on the conversation. Through these innovative designs, the present invention can reduce the impact of noise items on user interest learning, solving the problem that existing methods cannot handle noise items well. At the same time, the position encoding is innovatively introduced in the user preference reader to enhance the user's interest perception ability, accurately discover items of interest to the user, and improve recommendation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 Technical block diagram of the conversation recommendation method based on intent-aware constraints. DETAILED DESCRIPTION
[0062] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.
[0063] A conversation recommendation method based on intent-aware constraints, such as Figure 1 As shown, the following steps are included:
[0064] S1. Generate a conversation graph based on the conversation sequence of a given user;
[0065] The item set in the recommendation system is defined as in is the total number of items. The browsing history of an anonymous user is defined as a session S, which is the sequence of items clicked by the user. Therefore, a session can be defined as a set of items, that is, Where L is the session length, subscript t1 represents the number of the first clicked item, t2 represents the number of the second clicked item, and t L The item number of the Lth clicked item. The session recommendation task is to recommend the k+1th item to the user given the first k clicked item sequence.
[0066] A given user's session sequence The resulting session graph in is the set of items in the conversation sequence; represents an edge set; when item i and item j are in adjacent relationship in the sequence, then they are connected by an edge in the session graph, and the corresponding edge is represented as e i is connected with v j , and the corresponding edge is represented as e ij .
[0067] S2, respectively extract the local feature vector and the global feature vector of the item and the session;
[0068] The embodiment specifically includes the following steps:
[0069] S201, calculate the feature vector of the current session based on the item feature vector in the session graph, and the calculation method is:
[0070]
[0071] In the formula, s is the feature vector of the current session, v i is the feature vector of the i-th item in the current session; L represents the session length, that is, there are L items in total;
[0072] S202, update the item feature vector based on the attention mechanism according to the current session feature vector and the item feature vector to obtain the local feature vector, and the calculation method is:
[0073]
[0074] In the formula, is the local feature vector of the item, indicates all neighbor nodes of node i; indicates neighbor node j; a ij indicates the normalized weight of the j-th item vector:
[0075]
[0076] In the formula, exp(·) represents an exponential function, r ij indicates the attention weight of the j-th item vector:
[0077]
[0078] In the formula, σ(·) represents a sigmoid function; a ij , b ij are all learnable parameters; v i indicates the feature vector of item i; v j indicates the feature vector of item j; is a transpose operation; and represents vector dot multiplication. s represents the feature vector of the current session.
[0079] S203, based on the attention mechanism, the local feature vector of the item is combined to update the session feature vector, to obtain the local feature vector of the session, and the calculation method is:
[0080]
[0081] In the formula, s local is the local feature vector of the session, m is the total number of item local feature vectors, π i is a weight coefficient and:
[0082]
[0083] In the formula, W s is a learnable parameter; d is the vector dimension, and s represents the feature vector of the current session; is a transpose operation.
[0084] In this embodiment, a global encoder module composed of a global intent layer, a session constraint layer and a feature fusion layer is designed to realize feature learning of items and sessions. Through the session constraint layer, the interference of noise items is effectively reduced, and accurate perception of user intent is realized, which includes the following steps:
[0085] S211, intent modeling is performed to calculate a global intent distribution matrix;
[0086] In this embodiment, the global intent layer realizes intent modeling, and the calculation method of the global intent C is as follows:
[0087]
[0088] In the formula, V represents all item feature matrices; D represents an item corresponding intent distribution matrix, and the calculation method is:
[0089]
[0090] In the formula, softmax(·) represents an activation function; W represents a learnable parameter matrix; represents a transpose operation.
[0091] S212, the intent key matrix and the intent value matrix are calculated according to the global intent distribution matrix and are normalized, the intent and item information are fused according to the calculated intent key matrix and intent value matrix, and the item feature and session feature are output;
[0092] The session constraint layer realizes feature learning of items and sessions. The innovation of the session constraint layer is that the application designs it as a multi-layer architecture based on the attention mechanism, which uses the session feature to constrain the representation learning of the item feature in each layer. The purpose is to make the global features of all items in the current session as consistent as possible with the features of the current session, so as to avoid the interference of noise items.
[0093] The working principle of the session constraint layer is as follows:
[0094] 1. Intent key matrix The calculation is represented as:
[0095]
[0096] In the formula, denotes the transpose operation; D K denotes the first learnable parameter matrix; W denotes the normalized intent distribution matrix (which integrates intent and item information) for
[0097]
[0098] In the formula, denotes the transpose operation; softmax(·) denotes the activation function; W K1 denotes the second learnable parameter matrix; W K2 denotes the third learnable parameter matrix; W V2 denotes the fourth learnable parameter matrix; C denotes the intent feature.
[0099] 2. Intent value matrix The calculation is represented as:
[0100]
[0101] In the formula, D V denotes the normalized intent distribution matrix (which integrates intent and item information) for
[0102]
[0103] In the formula, denotes the transpose operation; softmax(·) denotes the activation function; W V1 denotes the second learnable parameter matrix; W V2 denotes the third learnable parameter matrix; W V2 denotes the fourth learnable parameter matrix; C denotes the intent feature.
[0104] 3. According to the intent key matrix and the intent value matrix, the item feature is calculated. Taking the tth layer as an example, the item feature of the tth layer is
[0105]
[0106] In the formula, denotes the transpose operation; d is the vector dimension, and the calculation method of the tth layer item query matrix
[0107]
[0108] Where, represents the transpose operation; W Q1 is the learnable parameter matrix, is the feature of the item in the t-1th layer.
[0109] 4. Calculate the session features based on the intent key matrix and intent value matrix. Taking the tth layer as an example, the session features of the tth layer are
[0110]
[0111] Where, represents the transpose operation; d is the vector dimension, the t-th layer session query matrix The calculation method is:
[0112]
[0113] Where, represents the transpose operation; W Q2 is the learnable parameter matrix, is the session feature of the t-1th layer.
[0114] S213, using the feature fusion layer to calculate the global features of the item and the global features of the session,
[0115] The feature fusion layer calculates the global features of the items and the global features of the session. In the present invention, the feature fusion layer uses a high-speed network module to achieve feature fusion of the session constraint layer.
[0116] The feature fusion layer works as follows:
[0117] 1. Calculate the global features of the item
[0118] First calculate the global features of all items in the current session
[0119]
[0120] Where, is the item feature matrix in the current session before inputting the attention layer; is the item feature matrix output after calculation by the last attention layer; H τ is the gating matrix, which is calculated as:
[0121]
[0122] Where, is a learnable parameter, which is a shared parameter, that is, when calculating the global session feature matrix This parameter is also adopted in this paper; σ(·) represents sigmoid function.
[0123] After the calculation of , where each row is the global feature vector of item i in the current session
[0124] 2. Calculate the global feature of the session
[0125] First, calculate the global session feature matrix
[0126]
[0127] In the formula, is the session feature matrix in the current session before the input attention layer; is the session feature matrix output after the calculation of the last attention layer; H s is the gating matrix, which is calculated as follows:
[0128]
[0129] In the formula, σ(·) represents sigmoid function, which uses shared parameters
[0130] After the calculation of , taking one row can get the global feature vector of the session in the current session
[0131] S3. Fuse the extracted item and session local feature vectors and global feature vectors to obtain item features and session features.
[0132] In this embodiment, the global and local features of the item are fused, and the global and local features of the session are fused. The calculation process is as follows:
[0133]
[0134] s' = s local + s global
[0135] S4. Add position information to the item features and session features respectively, and calculate user preference, and output recommendation probability distribution based on user preference and item features.
[0136] In this embodiment, a user preference reader is designed to calculate user preference, and the process is as follows:
[0137] S41, add position information in the item feature and the session feature respectively, and calculate the current session feature after introducing the position information;
[0138] Position information embedding. Add position information in the item feature and the session feature respectively. Considering the importance of the position information of the item in the session for inferring the user interest, the application introduces position reverse encoding information, denoted as Then the position code of the i-th item in the current session is p L-i+1 , where l is the length of the current session (the maximum session length in the system is denoted as L max , and the subscript L-i+1 is used to achieve the position reverse. Therefore, in the current session, the calculation method of the feature vector z i of the i-th item after introducing the position code information is as follows:
[0139] z i = v' + p i L-i+1
[0140] Similarly, the calculation method of the current session feature z s after introducing the position code information is as follows:
[0141] z s = s' + p f
[0142] In the formula, p u is the shared position vector, and p i is the normal position code of the current session.
[0143] S42, calculate the user preference according to the obtained current session feature after introducing the position information, and output the recommendation probability distribution based on the user preference and the item feature.
[0144] The calculation method of the user preference u f is as follows:
[0145]
[0146] In the formula, the calculation formula of the item weight β i is as follows:
[0147]
[0148] In the formula, σ(·) represents a sigmoid function, represents a transposition operation, W1, W2 and W3 are all learnable coefficient parameters, q and b are all learnable linear parameters, and z mean represents the item feature mean vector after introducing the position code information.
[0149] Based on user preferences and the global item feature matrix, we can recommend items that users are interested in. The calculation method is:
[0150]
[0151] Where u f Indicates user preferences, represents the transposition operation, softmax(·) represents the activation function, and V represents the item feature. is the recommended probability of all items, and the user can select the one with the highest probability or the top k items to recommend to the user as needed.
[0152] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0153] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0154] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0155] The principles and implementation manners of the present application are described by using specific examples in the present application, and the above examples are only used for helping to understand the method of the present application and its core idea; meanwhile, for the ordinary skilled in the art, according to the idea of the present application, the specific implementation manners and application ranges can be changed, and the above description should not be understood as the limitation of the present application.
[0156] Those skilled in the art will understand that the examples described herein are for the purpose of understanding the principles of the present application and should be understood as not limiting the scope of protection of the present application. Those skilled in the art can make various other specific modifications and combinations according to the technical inspiration disclosed in the present application without departing from the essence of the present application, and these modifications and combinations are still within the scope of protection of the present application.
Claims
1. A conversation recommendation method based on intent-aware constraints, characterized in that: The steps include: S1. Generate a conversation graph based on the conversation sequence of a given user; S2, extract the local feature vectors and global feature vectors of items and sessions respectively; S3. Fusing the extracted local feature vectors of items and sessions with the global feature vector to obtain item features and session features; S4. Add location information to item features and session features respectively, calculate user preferences, and output recommendation probability distribution based on user preferences and item features.
2. The conversation recommendation method based on intent-aware constraints according to claim 1, characterized in that The specific method of extracting the local feature vectors of items and conversations in S2 is: S201. Calculate the feature vector of the current session based on the feature vectors of the items in the session graph. The calculation method is: Where s is the feature vector of the current session, v i is the feature vector of the i-th item in the current session; L represents the session length, i.e., a total of L items; S202: Based on the attention mechanism, the item feature vector is updated according to the current session feature vector and the item feature vector to obtain a local feature vector. The calculation method is: Where, is the local feature vector of the item, Represents all neighbor nodes of node i; represents neighbor node j; α ij represents the normalized weight of the j-th item vector; S203: Based on the attention mechanism, the session feature vector is updated in combination with the local feature vector of the item to obtain the local feature vector of the session. The calculation method is: Where s local is the local feature vector of the session, m is the total number of local feature vectors of items, π i is the weight coefficient and: Where W s is a learnable parameter; d is the vector dimension, and s represents the feature vector of the current session; is the transpose operation.
3. The conversation recommendation method based on intent-aware constraints according to claim 1, characterized in that The specific method of extracting the global feature vectors of items and sessions in S2 is: S211, perform intent modeling and calculate the global intent distribution matrix; S212. Calculate the intent key matrix and the intent value matrix based on the global intent distribution matrix and normalize them. Fuse the intent and item information based on the calculated intent key matrix and intent value matrix, and output item features and session features. S213. Calculate the global feature vector of the item and the global feature vector of the session using the feature fusion layer.
4. The conversation recommendation method based on intent-aware constraints according to claim 3, characterized in that In the S212: The specific calculation method of the intent key matrix is: Where, is the intent key matrix, represents the transpose operation, represents the item feature matrix in the t-1 layer session, D K Indicates the use The normalized intention distribution matrix of and: Where softmax(·) represents the activation function; W K1 represents the first learnable parameter matrix; W K2 represents the second learnable parameter matrix; C represents the intention feature; The specific calculation method of the intention value matrix is: Where, is the intention value matrix, D V Indicates the use The normalized intention distribution matrix of and: Where W V1 represents the third learnable parameter matrix; W V2 represents the fourth learnable parameter matrix, Represents the previous layer session feature matrix.
5. The conversation recommendation method based on intent-aware constraints according to claim 3, characterized in that The global feature vector of the item in S213 is expressed as: Where, is the item feature matrix in the current session before inputting the attention layer; It is the item feature matrix output after the last attention layer calculates; H τ is the gating matrix; calculated After that, each row is the global feature vector of item i in the current session. The global features of a session are expressed as: Where, is the session feature matrix in the current session before inputting the attention layer, It is the session feature matrix output by the last attention layer; Calculated After calculating , taking one of the rows can get the global feature vector of the current session 6. The conversation recommendation method based on intent-aware constraints according to claim 1, characterized in that The S4 specifically includes the following steps: S41, adding position coding information to the item feature and the session feature respectively, and calculating the current session feature after the position information is introduced; S42: Calculate user preferences based on the current session features obtained by introducing location information, and output recommendation probability distribution based on user preferences and item features.
7. The conversation recommendation method based on intent-aware constraints according to claim 6, characterized in that The item features and session features after adding the position coding information in S41 are respectively expressed as: with i =v′ i +p L-i+1 z s =s′+p f Where z i is the feature vector z of the i-th item after adding position encoding information i , v′ i is the item feature, p L-i+1 is the reverse position code of the i-th item in the current session, L is the session length; z s is the current session feature after introducing position encoding information, s' is the session feature, and p f Encodes information about the current session's location and: Where p u is the shared position vector, p i The normal position encoding for the current session.
8. The conversation recommendation method based on intent-aware constraints according to claim 6, characterized in that The specific calculation method of the user preference in S42 is: Where u f is user preference, β i is the item weight of the i-th item in the previous session, v′ i is the item feature, p f is the position encoding information of the current session, and L is the session length.
9. The conversation recommendation method based on intent-aware constraints according to claim 6, characterized in that The specific calculation method of the recommendation probability distribution in S42 is: Where u f represents user preference, T represents transposition operation, softmax(·) represents activation function, V represents item feature, is the recommendation probability of all items.