An item recommendation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202410609783.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2044-05-16
AI Technical Summary
[0004]有鉴于此,本申请提供了一种项目推荐方法、装置、电子设备及存储介质,以解决现有技术中项目推荐结果不够准确的问题
[0010]The system obtains users' historical interaction sequences through a project recommendation model, generates a project embedding matrix based on these sequences, and processes the matrix using a multi-query self-attention mechanism and a transfer-aware embedding distillation mechanism to obtain a collaborative embedding matrix and a target transfer embedding matrix. The multi-query self-attention mechanism can flexibly capture collaborative signals in the historical interaction sequences, representing users' diverse preferences, while the transfer-aware embedding distillation mechanism can capture transfer signals in the historical interaction sequences. It can accurately identify changes in users' interests while also calibrating collaborative signals to obtain a comprehensive representation of users' interests. The collaborative embedding matrix and the target transfer embedding matrix are then fused to obtain the final embedding matrix, which comprehensively represents users' interests. The final embedding matrix can then be processed through a multilayer perceptron to obtain the user's preference for each candidate item in the current scenario, thus obtaining the project recommendation probability distribution. Based on the probability distribution, candidate items with corresponding probabilities can be selected as the project recommendation results. Thus, the sequential recommendation method using multi-query self-attention and transfer-aware embedding distillation can effectively capture collaborative and transfer signals in the user's historical interaction sequence, thereby improving the performance and efficiency of the item recommendation model. Furthermore, by introducing an embedding fusion mechanism when fusing the collaborative embedding matrix and the target transfer embedding matrix, a comprehensive user interest representation can be obtained. This representation can not only consider the diverse interests of users but also their long-term and short-term interests, thereby obtaining a comprehensive and accurate user interest analysis and thus accurate item recommendation results.
Smart Images

Figure CN118535795B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a project recommendation method, apparatus, electronic device, and storage medium. Background Technology
[0002] A recommender system is an information filtering system that provides users with suitable items or services based on their historical behavior, preferences, and needs, helping them find content of interest amidst a sea of information. Recommender systems are widely used in e-commerce, social networks, entertainment, education, and other fields, playing a crucial role in improving user experience, increasing user engagement, and boosting business revenue. The core challenge of recommender systems is predicting user ratings or preferences for items and generating appropriate recommendation lists based on these ratings or preferences.
[0003] Currently, many engineers apply self-attention mechanisms to sequential recommendation methods. Self-attention is a powerful sequence modeling tool that captures long-term dependencies in a sequence by calculating the correlations between each element. However, when users have diverse interests, sequential recommendation methods based on self-attention mechanisms cannot accurately capture these preferences, leading to inaccurate item recommendations. Summary of the Invention
[0004] In view of this, this application provides a project recommendation method, apparatus, electronic device, and storage medium to solve the problem that the project recommendation results in the prior art are not accurate enough.
[0005] A first aspect of this application provides a project recommendation method, comprising: obtaining a project embedding matrix, the project embedding matrix including the embedding vector corresponding to each historical interaction item in the user's historical interaction sequence; processing the project embedding matrix based on a multi-query self-attention mechanism to capture collaborative signals in the historical interaction sequence, thereby obtaining a collaborative embedding matrix; processing the project embedding matrix based on a transfer-aware embedding distillation mechanism to capture transfer signals in the historical interaction sequence, thereby obtaining a target transfer embedding matrix; adding and fusing the collaborative embedding matrix and the target transfer embedding matrix to obtain a final embedding matrix; performing a multilayer perceptron operation on the final embedding matrix to obtain a recommendation probability distribution of candidate items, and obtaining a project recommendation result based on the recommendation probability distribution.
[0006] A second aspect of this application provides an item recommendation apparatus, comprising: an acquisition module configured to acquire an item embedding matrix, the item embedding matrix including an embedding vector corresponding to each historical interaction item in a user's historical interaction sequence; a self-attention module configured to process the item embedding matrix based on a multi-query self-attention mechanism to capture collaborative signals in the historical interaction sequence and obtain a collaborative embedding matrix; a distillation module configured to process the item embedding matrix based on a transfer-aware embedding distillation mechanism to capture transfer signals in the historical interaction sequence and obtain a target transfer embedding matrix; a fusion module configured to add and fuse the collaborative embedding matrix and the target transfer embedding matrix to obtain a final embedding matrix; and an output module configured to perform a multilayer perceptron operation on the final embedding matrix to obtain a recommendation probability distribution of candidate items and obtain an item recommendation result based on the recommendation probability distribution.
[0007] A third aspect of this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.
[0008] A fourth aspect of this application provides a storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0009] The above-mentioned technical solution adopted in this application can achieve the following beneficial effects:
[0010] The system obtains users' historical interaction sequences through a project recommendation model, generates a project embedding matrix based on these sequences, and processes the matrix using a multi-query self-attention mechanism and a transfer-aware embedding distillation mechanism to obtain a collaborative embedding matrix and a target transfer embedding matrix. The multi-query self-attention mechanism can flexibly capture collaborative signals in the historical interaction sequences, representing users' diverse preferences, while the transfer-aware embedding distillation mechanism can capture transfer signals in the historical interaction sequences. It can accurately identify changes in users' interests while also calibrating collaborative signals to obtain a comprehensive representation of users' interests. The collaborative embedding matrix and the target transfer embedding matrix are then fused to obtain the final embedding matrix, which comprehensively represents users' interests. The final embedding matrix can then be processed through a multilayer perceptron to obtain the user's preference for each candidate item in the current scenario, thus obtaining the project recommendation probability distribution. Based on the probability distribution, candidate items with corresponding probabilities can be selected as the project recommendation results. Thus, the sequential recommendation method using multi-query self-attention and transfer-aware embedding distillation can effectively capture collaborative and transfer signals in the user's historical interaction sequence, thereby improving the performance and efficiency of the item recommendation model. Furthermore, by introducing an embedding fusion mechanism when fusing the collaborative embedding matrix and the target transfer embedding matrix, a comprehensive user interest representation can be obtained. This representation can not only consider the diverse interests of users but also their long-term and short-term interests, thereby obtaining a comprehensive and accurate user interest analysis and thus accurate item recommendation results. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating a project recommendation method provided in an embodiment of this application;
[0013] Figure 2 This is a flowchart illustrating another project recommendation method provided in an embodiment of this application;
[0014] Figure 3 This is a schematic diagram of the structure of a project recommendation device provided in an embodiment of this application;
[0015] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0016] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0017] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0018] Furthermore, it should be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0019] A project recommendation method and apparatus according to an embodiment of this application will now be described in detail with reference to the accompanying drawings.
[0020] Figure 1 This is a flowchart illustrating a project recommendation method provided in an embodiment of this application. For example... Figure 2 As shown, the recommended methods for this project include:
[0021] S101, Obtain the item embedding matrix, which includes the embedding vector corresponding to each historical interaction item in the user's historical interaction sequence;
[0022] S102, The item embedding matrix is processed based on the multi-query self-attention mechanism to capture the collaborative signal in the historical interaction sequence and obtain the collaborative embedding matrix;
[0023] S103, The item embedding matrix is processed based on the transfer-aware embedding distillation mechanism to capture the transfer signals in the historical interaction sequence and obtain the target transfer embedding matrix;
[0024] S104, the cooperative embedding matrix and the target transition embedding matrix are added and fused to obtain the final embedding matrix;
[0025] S105, perform multilayer perceptron operation on the final embedding matrix to obtain the recommendation probability distribution of candidate items, and obtain the item recommendation result based on the recommendation probability distribution.
[0026] Specifically, in the item recommendation model, an input component can be used to receive the user's historical interaction sequence, i.e., a list of items the user has clicked or purchased in the past, such as [i1, i2, ..., i n Then, an item embedding component can be used to embed each item in the historical interaction sequence, obtaining the item embedding dimension. Next, a multi-query self-attention component and a transition-aware embedding distillation component are used respectively to capture the collaborative and transition signals of the historical interaction sequence, obtaining the collaborative embedding matrix and the target transition matrix.
[0027] Then, an embedding fusion component can be used to add the cooperative embedding matrix and the target transition matrix to obtain the final embedding matrix. This fuses the cooperative and transition signals to obtain a comprehensive user interest representation. Subsequently, a multilayer perceptron component is used to perform multilayer perceptron operations on the final embedding matrix to obtain a recommendation probability distribution, representing the user's preference for all candidate items.
[0028] Finally, the output component can be used to select the most likely next candidate item or multiple candidate items as the project recommendation result based on the recommendation probability distribution.
[0029] In this way, collaborative and transition signals can be extracted from historical interaction sequences, and the diverse interests and periodic changes of users' interests can be analyzed. Integrating collaborative and transition signals into the project recommendation process can improve the accuracy of project recommendation results. Finally, the recommendation probability distribution and project recommendation results can be obtained to provide personalized recommendations to users. This not only optimizes the performance of the project recommendation model by using multi-query self-attention components, transition-aware embedding distillation components, and embedding fusion components, but also obtains accurate project recommendation results by comprehensively considering the user's interest representation.
[0030] In some embodiments, obtaining the item embedding matrix includes: obtaining the number of all items in the current scene; constructing a first embedding matrix based on the number of all items and a preset first embedding dimension, the first embedding matrix including the embedding vectors of the historically interacted items and the non-interacted items in the current scene; retrieving a historical interaction sequence from a target database based on the user's unique identifier, using each historically interacted item in the historical interaction sequence as a query, obtaining the embedding vector of the historically interacted item from the first embedding matrix, and sorting the embedding vectors of the historically interacted items based on the historical interaction sequence to obtain the item embedding matrix.
[0031] Specifically, a trainable embedding matrix, namely the first embedding matrix, can be constructed based on all items in the current scene and a preset first embedding dimension. Where m can represent the total number of items, and d can represent the preset first embedding dimension. This first embedding matrix can then be used to embed each historical interaction item i from the pre-acquired historical interaction sequence. j The embedding vector mapped to a low-dimensional embedding space This leads to the project embedding matrix. Where n is the length of the user interaction sequence.
[0032] The formula for obtaining the item embedding matrix can be expressed as e j =E[i j ],X=[e1,e2,...,e n ] T T can represent the transpose of a matrix, which means arranging the embedding vectors of each item in the embedding matrix column-wise. The preset first embedding dimension can be determined based on experiments and model performance tuning, and can be selected according to the specific task and dataset. Therefore, no specific restrictions are imposed here, nor will we elaborate on it in detail.
[0033] Furthermore, the project recommendation model can identify the user's unique identifier (such as user ID) to retrieve the user's historical data stored in the target database or data storage to obtain the historical interaction sequence. This can be understood as follows: once the project recommendation model identifies the user ID, it can query the user's historical interaction sequence, which may include the user's interaction behavior with the project, such as clicks, purchases, ratings, etc.
[0034] Furthermore, for each historical interaction item, the corresponding embedding vector can be obtained from the first embedding matrix to acquire the feature and semantic information of the historical interaction items. The obtained embedding vectors are then sorted based on the historical interaction sequence to obtain the item embedding matrix. It should be understood that the sorting of embedding vectors can be accomplished using sorting algorithms or models. For example, collaborative filtering, deep learning models, etc., can be used to analyze and sort users' interest in historical interaction items, and the sorting can be based on timestamps. In this way, the item embedding matrix can be used for subsequent recommendation tasks to generate personalized recommendation lists.
[0035] Of course, the first embedding matrix can be trained during its construction; that is, the parameters embedded in the first embedding matrix can be adjusted using backpropagation and an optimizer to minimize the loss. In item recommendation systems, user interaction sequences can provide real interaction information between users and items, but the first embedding matrix E only learns the representation of items, not their association with users. Therefore, user-item interaction information can be combined with item embeddings to generate an item embedding matrix representing user interests and behavioral patterns.
[0036] According to the method of the above embodiments, the first embedding matrix is constructed based on the current scenario and the historical interaction sequence is obtained. Each item in the historical interaction sequence can be mapped to a corresponding embedding vector to obtain an item embedding matrix to represent the user's interests and behavior patterns. The item embedding matrix is then subjected to multi-query self-attention and transfer perception embedding distillation processing to obtain the final embedding matrix that expresses the user's comprehensive interests. This can help the item recommendation model to efficiently and accurately obtain the item recommendation probability distribution, thereby obtaining accurate personalized item recommendation results.
[0037] In some embodiments, the item embedding matrix is processed based on a multi-query self-attention mechanism to capture collaborative signals in historical interaction sequences and obtain a collaborative embedding matrix. This includes: using the entire item embedding matrix as an attention query to obtain the user's global interest representation; using a dynamic window size to obtain partial embeddings of the item embedding matrix, and using the partial embeddings as attention queries to obtain the user's local interest representation; fusing the global interest representation and the local interest representation to obtain a hybrid interest representation; and projecting the hybrid interest representation onto the original embedding space through a linear transformation matrix to obtain a collaborative embedding matrix, wherein the original embedding space corresponds to the vector space in the first embedding matrix.
[0038] Specifically, global and local interest representations corresponding to a user's historical interaction sequences can be extracted from the item embedding matrix and fused to obtain a hybrid interest. Then, a trainable linear transformation matrix can be used to project this hybrid interest representation onto the original embedding space to obtain a co-embedding matrix. This co-embedding matrix can characterize the user's hybrid interest representation, where the co-trainable linear transformation matrix can be expressed as: Where d represents the embedding dimension, which can also be obtained by model training.
[0039] Furthermore, the item embedding matrix can be used as an attention query, i.e., the entire user interaction sequence can be used as a long attention query to obtain the user's global interest representation. This takes into account the embedding representation of each item, and captures the user's interest by weighting the entire embedding matrix. The formula for capturing the global interest representation can be:
[0040] Q L =X,K L =V L =X, H L =A L V L
[0041] in, These represent the long query (i.e., the item embedding matrix), key, value, attention weights, and output matrix (i.e., the global interest representation), respectively. The attention weights can represent the user's global interest representation information, and then map them to the output matrix for subsequent interest fusion processing.
[0042] Furthermore, a partial matrix from the item embedding matrix can be obtained using a dynamically sized window as a short attention query to obtain a local interest representation. This can be understood as using a trainable window size w as the attention query. That is, the item recommendation model dynamically trains a window size based on the currently obtained historical interaction sequence to extract partial embeddings from the item embedding matrix. For example, the embedding matrix corresponding to the last w historical interaction items in the historical interaction sequence can be obtained as the attention query, which can be represented as Q. S =X[-w:] to capture the user's attention level to the last segment of the historical interaction sequence containing w historical interaction items. Thus, the formula for capturing local interest can be expressed as:
[0043] K S =V S =X, H S =A S V S
[0044] in, Let X[-w:] represent the short query (i.e., partial embedding), key, value, attention weight, and output matrix (i.e., local interest representation), respectively, and let X[-w:] represent the embedding matrix of the last w historical interaction items in the user interaction sequence.
[0045] Furthermore, the long query results and short query results can be concatenated and merged, that is, the global interest representation and the local interest representation can be merged to obtain a hybrid interest representation, as shown in the following formula: H = [H L H S ]in, This represents the concatenated output matrix (i.e., the hybrid interest representation).
[0046] Subsequently, a trainable linear transformation matrix can be used to project the mixed interests onto the original embedding space to obtain the co-embedding matrix, as shown in the following formula: Y = HW. Wherein, This can be represented as a collaborative embedding matrix. This allows us to obtain a collaborative embedding matrix that comprehensively represents user interests. Furthermore, by analyzing this collaborative embedding matrix, we can obtain the probability distribution of candidate items, thereby achieving accurate item recommendation results.
[0047] According to the method of the above embodiments, a global interest representation is obtained by using the entire user interaction sequence as an attention query. The user's historical behavior can be weighted by calculating attention weights to generate a global interest representation that includes the user's attention to the entire sequence. A trainable window size is also used as an attention query to obtain the local interest representation in the historical interaction sequence to obtain the user's attention to a segment of the historical interaction sequence. Then, the user's hybrid interest representation and co-embedding matrix are obtained. The global interest and local interest can be combined to obtain comprehensive interest features. This combination of the user's global interest and local interest can better capture the user's diverse preferences. The user interaction sequence can be flexibly processed through the long and short query self-attention mechanism. At the same time, interest features at different levels are combined through embedding splicing and projection, thereby improving the performance of the item recommendation model.
[0048] In some embodiments, the item embedding matrix is processed based on a transfer-aware embedding distillation mechanism to capture transfer signals in a historical interaction sequence and obtain a target transfer embedding matrix, including: constructing a second embedding matrix based on the number of all items and a preset second embedding dimension; mapping each item in the historical interaction sequence to a corresponding transfer embedding vector based on the second embedding matrix to obtain an initial transfer embedding matrix; and distilling the transfer signals in the initial transfer embedding matrix into the item embedding matrix to obtain the target transfer embedding matrix.
[0049] Specifically, a second embedding matrix can be constructed based on the number of all items in the current scenario and a preset second embedding dimension to map each item i in the user's historical interaction sequence.j Mapped to the corresponding transition embedding vector Obtain the initial transition embedding matrix
[0050] The methods for obtaining the preset second embedding dimension and the preset first embedding dimension can be the same, while the preset second embedding dimension and the preset first embedding dimension can be different. The selection is made through optimization of the project recommendation model. In application, the embedding dimension can be selected through methods such as cross-validation, that is, choosing the optimal dimension from a series of possible embedding dimensions, evaluating the performance of possible dimensions on the validation set, and finally selecting the best-performing embedding dimension. Alternatively, domain knowledge and experience can be combined to guide the selection of the embedding dimension. In this embodiment, the selection of the preset first embedding dimension and the preset second embedding dimension can be guided by the data characteristics of all project and user information in the current scenario.
[0051] As an example, in a home sales system, the characteristics of properties and users can first be determined. These characteristics may include the property's location, price, area, and type, as well as the user's search history, click history, and favorites history. Then, numerical and categorical features can be vectorized separately. For numerical features, the original values are directly used as part of the vector. For categorical features, a one-hot encoding method can be used to convert them into vectors. Thus, assuming the processed vector dimensions are: Numerical features (assuming each numerical feature occupies one dimension): 2 dimensions (price, area); Categorical features (assuming each categorical feature occupies one dimension): Property type: 3 dimensions (assuming apartments, villas, townhouses); User search history, click history, and favorites history: assuming each historical record has 10 possible values, therefore each historical record corresponds to a 10-dimensional dimension. Therefore, the total dimensions can be 2 + 3 + 10 + 10 + 10 = 35 dimensions, thus determining the embedding dimensions in the vector space. Therefore, a preset first dimension and a preset second dimension can be obtained through model analysis of the data features.
[0052] Optimizing the embedding representation based on the current scenario and data features can improve the performance and effectiveness of the project recommendation model. In the implementation of the project recommendation model, ensuring that the appropriate embedding dimension is selected can improve the accuracy and efficiency of the project recommendation model.
[0053] Furthermore, the transfer signals in the initial transfer embedding matrix can be distilled into the item embedding matrix to obtain the target transfer matrix. The distillation process can use a loss function based on knowledge distillation (KD). By minimizing this loss function, the transfer signals in the initial transfer matrix are distilled into the item embedding matrix, so that the item embedding can simultaneously reflect the user's collaboration and transfer preferences.
[0054] In other embodiments, the transfer signal in the initial transfer embedding matrix is distilled into the item embedding matrix to obtain the target transfer embedding matrix, including: obtaining the user's interest rating and transfer probability for historical interaction items, and constructing a first loss based on the interest rating and transfer probability; constructing a second loss based on the initial embedding matrix and the target embedding matrix; constructing a knowledge distillation loss function based on the first loss and the second loss, and distilling the transfer signal into the item embedding matrix based on minimizing the loss function to obtain the target transfer embedding matrix.
[0055] Specifically, the loss function for knowledge distillation can be constructed using cross-entropy loss and a regularization term, and the specific formula can be expressed as:
[0056] in, The loss function for knowledge distillation can be represented by σ, where σ represents the sigmoid function, μ represents the regularization coefficient, and Zj,i represents the loss function obtained by the user from item i. j The transition probability to item i, where Xj,i represents the user's interest rating of item i, and Zj′ represents the transition embedding vector t. j The projection into the project embedding space is the target embedding matrix, Z. j This represents the initial transition embedding matrix. It should be noted that the first loss function can be expressed as: The second loss function can be expressed as:
[0057] Furthermore, the Bayesian Personalized Ranking (BPR) loss function can be used to optimize the item transition probability, that is, to encourage the item recommendation model to predict whether a user will switch to item i. j The probability of switching to item i is greater than the probability of switching to other items, thus obtaining the ranking of switch probabilities in the item recommendation system, thereby improving the effect of personalized ranking in the item recommendation model. A user's interest rating for an item can represent the user's degree of preference for that item. This user interest can be mapped to the rating space of all items, i.e., a multilayer perceptron can be used to calculate the user's interest rating for each item.
[0058] It should also be understood that the regularization coefficient can be selected appropriately through cross-validation or grid search to control the complexity of the project recommendation model and prevent overfitting.
[0059] This allows us to calculate the loss function of knowledge distillation based on the obtained parameters. By minimizing the loss function, the transfer signal is distilled into the item embedding matrix, which enables the item embedding to simultaneously reflect the user's collaboration and transfer preferences.
[0060] In some embodiments, performing a multilayer perceptron operation on the final embedding matrix to obtain the recommendation probability distribution of candidate items includes: mapping the final embedding matrix to the original embedding space to obtain a new vector; and performing probability transformation and normalization on the new vector through a preset activation function to obtain the recommendation probability distribution.
[0061] Specifically, the recommendation probability distribution can be obtained using the following formula:
[0062]
[0063] in, Let represent the recommendation probability distribution, U represent the final embedding matrix, W2 and b2 represent the trainable parameters that can be obtained by training the item recommendation model, and m represent the number of candidate items, which can be all items in the current scene.
[0064] It should be noted that the final embedding matrix U can be obtained using the formula: U = Y + Z, where, This represents the final embedding matrix. Represents the cooperative embedding matrix, The term "transfer embedding matrix" can be understood as the fusion of cooperative signals and transfer signals to obtain a comprehensive representation of user interests.
[0065] In this way, user interest representations can be mapped to the rating space of all items, obtaining the user's preference for each item. The rating space of all items can be a higher-dimensional vector space of all items in the current scenario, in order to better capture user characteristics and preferences.
[0066] It should also be noted that W2 can represent a trainable parameter matrix of size (d×m) used to linearly transform the output of the multilayer perceptron. b2 can represent a trainable bias term vector of size m used to adjust the bias of each output dimension. Both W2 and b2 can be learned through the training process of the item recommendation model to maximize model performance.
[0067] Furthermore, the comprehensive user interest representation can be multiplied by the weight matrix W2 and linearly transformed, and a bias term b2 can be added to obtain a new vector, which represents the representation after the multilayer perceptron operation. Then, this new vector can be input into the Sfotmax function to convert each element of the new vector into a non-negative number and normalize it to a recommendation probability distribution that sums to 1.
[0068] According to the method in the above embodiments, the comprehensive user interest representation can be mapped to the rating space of all items through multilayer perceptron operation, and the recommendation probability distribution of the user's preference for each item can be obtained through the Softmax function. This can more intuitively reflect the user's preferences, and the recommendation probability distribution can be applied to generate the final recommendation list, thereby obtaining accurate item recommendation results.
[0069] In some embodiments, obtaining project recommendation results based on the recommendation probability distribution includes: selecting candidate projects with a recommendation probability greater than a preset value as project recommendation results based on the recommendation probability distribution; displaying the project recommendation results through a visual interface and accepting user operations on the project recommendation results.
[0070] Specifically, after obtaining the recommendation probability distribution, candidate items with a probability greater than a preset value (such as 0.5) can be selected as the final project recommendation results for output. The output project recommendation results are displayed on the visualization interface, and user actions such as clicking, refreshing, and commenting on the project recommendation results are accepted. After receiving these actions, the user's actions can be automatically stored and updated to the historical interaction sequence.
[0071] It should be noted that all items can also be output sequentially based on their probability, allowing users to scroll through the page to view them. Alternatively, a TopN mechanism can be used to select candidate items with higher probabilities as the recommended items. There are no restrictions on this.
[0072] According to the method in the above embodiments, by outputting the result of the recommendation probability distribution, the item recommendation result can be obtained. In this way, the user interest representation represented by the collaborative signal and the transition signal in the historical interaction sequence is further analyzed to obtain the recommendation probability distribution, so as to obtain the item recommendation result that can accurately represent the user's preferences. This improves the quality of the recommendation result and optimizes the user experience.
[0073] Figure 2 This is a flowchart illustrating another project recommendation method provided in this application embodiment. The following is a summary of the process. Figure 2 The embodiments of this application are further described below.
[0074] according to Figure 2 As can be seen, the project recommendation model can consist of multiple modules.
[0075] First, the item embedding module can be used to embed each item in the user's historical interaction sequence to obtain the item embedding matrix.
[0076] Then, a multi-query self-attention operation can be performed on the item embedding matrix using a multi-query self-attention module to obtain a collaborative embedding matrix. This dynamically focuses on different parts of the historical interaction sequence to better understand the collaborative signals in the historical interaction sequence. At the same time, a transfer-aware embedding distillation operation can be performed on the item embedding matrix using a transfer-aware embedding distillation module. Through knowledge distillation, the transfer signals are distilled into the item embedding matrix to obtain a transfer embedding matrix, which can improve the performance of the item recommendation model.
[0077] Then, the co-embedding matrix and the transition embedding matrix can be added together by the embedding fusion module to obtain the final embedding matrix. This integrates interest representations from different sources to obtain a comprehensive user interest representation, thereby improving the accuracy of project recommendation results.
[0078] Then, the final embedding matrix can be processed by a multilayer perceptron module to obtain the recommendation probability distribution.
[0079] Finally, the recommendation results module can select the most likely next item as the project recommendation result based on the recommendation probability distribution and output it to the user. This can transform the model output into actual project recommendation results, so as to provide users with personalized recommendations.
[0080] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.
[0081] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0082] Figure 3 This is a schematic diagram of a project recommendation device provided in an embodiment of this application. For example... Figure 3 As shown, the recommended device for this project includes:
[0083] The acquisition module 301 is configured to acquire the item embedding matrix, which includes the embedding vector corresponding to each historical interaction item in the user's historical interaction sequence.
[0084] The self-attention module 302 is configured to process the item embedding matrix based on a multi-query self-attention mechanism to capture collaborative signals in the historical interaction sequence and obtain a collaborative embedding matrix.
[0085] Distillation module 303 is configured to process the item embedding matrix based on a transfer-aware embedding distillation mechanism to capture transfer signals in historical interaction sequences and obtain the target transfer embedding matrix.
[0086] The fusion module 304 is configured to add and fuse the cooperative embedding matrix and the target transition embedding matrix to obtain the final embedding matrix;
[0087] The output module 305 is configured to perform a multilayer perceptron operation on the final embedding matrix to obtain the recommendation probability distribution of the candidate items, and to obtain the item recommendation result based on the recommendation probability distribution.
[0088] In some embodiments, the acquisition module 301 is specifically used to acquire the number of all items in the current scene; construct a first embedding matrix based on the number of all items and a preset first embedding dimension, the first embedding matrix including the embedding vectors of historically interacted items and non-interacted items in the current scene; retrieve the historical interaction sequence from the target database based on the user's unique identifier, use each historically interacted item in the historical interaction sequence as a query, acquire the embedding vector of the historically interacted item from the first embedding matrix, and sort the embedding vectors of the historically interacted items based on the historical interaction sequence to obtain the item embedding matrix.
[0089] In some embodiments, the self-attention module 302 is specifically used to obtain the user's global interest representation by using the entire item embedding matrix as an attention query; to obtain the partial embedding of the item embedding matrix using a dynamic window size, and to obtain the user's local interest representation by using the partial embedding as an attention query; to fuse the global interest representation and the local interest representation to obtain a hybrid interest representation; and to project the hybrid interest representation onto the original embedding space through a linear transformation matrix to obtain a co-embedding matrix, wherein the original embedding space corresponds to the vector space in the first embedding matrix.
[0090] In some embodiments, the distillation module 303 is specifically used to construct a second embedding matrix based on the number of all items and a preset second embedding dimension; based on the second embedding matrix, each item in the historical interaction sequence is mapped to a corresponding transition embedding vector to obtain an initial transition embedding matrix; and the transition signal in the initial transition embedding matrix is distilled into the item embedding matrix to obtain a target transition embedding matrix.
[0091] In some embodiments, the distillation module 303 is specifically used to obtain the user's interest rating and transition probability for historical interaction items, and construct a first loss based on the interest rating and transition probability; construct a second loss based on the initial embedding matrix and the target embedding matrix; construct a loss function for knowledge distillation based on the first loss and the second loss, and distill the transition signal into the item embedding matrix based on minimizing the loss function to obtain the target transition embedding matrix.
[0092] In some embodiments, the output module 305 is specifically used to map the final embedding matrix to the original embedding space to obtain a new vector; and to perform probability transformation and normalization on the new vector through a preset activation function to obtain the recommended probability distribution.
[0093] In some embodiments, the output module 305 is specifically used to select candidate items with a recommendation probability greater than a preset value as the project recommendation result based on the recommendation probability distribution; display the project recommendation result through a visual interface; and accept user operations on the project recommendation result.
[0094] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0095] Figure 4 This is a schematic diagram of the electronic device 4 provided in an embodiment of this application. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, it implements the steps in the various method embodiments described above. Alternatively, when the processor 401 executes the computer program 403, it implements the functions of each module / unit in the various device embodiments described above.
[0096] Electronic device 4 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 4 may include, but is not limited to, processor 401 and memory 402. Those skilled in the art will understand that... Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or different components.
[0097] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0098] The memory 402 can be an internal storage unit of the electronic device 4, such as a hard disk or RAM of the electronic device 4. The memory 402 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 4. The memory 402 can also include both internal and external storage units of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.
[0099] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0100] If integrated modules / units are implemented as software functional units and sold or used as independent products, they can be stored in a storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0101] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A project recommendation method, characterized in that, include: Obtain the item embedding matrix, which includes the embedding vector corresponding to each historical interaction item in the user's historical interaction sequence; The item embedding matrix is processed based on a multi-query self-attention mechanism to capture the collaborative signals in the historical interaction sequence and obtain a collaborative embedding matrix. The project embedding matrix is processed based on the transfer-aware embedding distillation mechanism to capture the transfer signals in the historical interaction sequence and obtain the target transfer embedding matrix. The collaborative embedding matrix and the target transfer embedding matrix are added and fused to obtain the final embedding matrix; A multilayer perceptron operation is performed on the final embedding matrix to obtain the recommendation probability distribution of candidate items, and the item recommendation result is obtained based on the recommendation probability distribution; The process of obtaining the project embedding matrix includes: Get the total number of all items in the current scene; A first embedding matrix is constructed based on the number of all items and a preset first embedding dimension. The first embedding matrix includes the embedding vectors of the historical interactive items and non-interactive items in the current scene. Based on the user's unique identifier, the historical interaction sequence is retrieved from the target database. Each historical interaction item in the historical interaction sequence is used as a query. The embedding vector of the historical interaction item is obtained from the first embedding matrix. The embedding vectors of the historical interaction items are sorted based on the historical interaction sequence to obtain the item embedding matrix. The process of processing the item embedding matrix based on the multi-query self-attention mechanism to capture collaborative signals in the historical interaction sequence and obtain a collaborative embedding matrix includes: The entire project embedding matrix is used as an attention query to obtain the user's global interest representation; By using a dynamic window size, partial embeddings of the item embedding matrix are obtained, and these partial embeddings are used as attention queries to obtain the user's local interest representation. The global interest representation and the local interest representation are fused to obtain a hybrid interest representation; The hybrid interest representation is projected onto the original embedding space using a linear transformation matrix to obtain the cooperative embedding matrix, wherein the original embedding space corresponds to the vector space in the first embedding matrix; The process of processing the item embedding matrix based on the transfer-aware embedding distillation mechanism to capture transfer signals in the historical interaction sequence and obtain the target transfer embedding matrix includes: Construct a second embedding matrix based on the number of all items and a preset second embedding dimension; Based on the second embedding matrix, each item in the historical interaction sequence is mapped to a corresponding transition embedding vector to obtain the initial transition embedding matrix; Obtain the user's interest rating and switching probability for the historical interaction items, and construct a first loss based on the interest rating and the switching probability; A second loss is constructed based on the initial transition embedding matrix and the target transition embedding matrix; A knowledge distillation loss function is constructed based on the first loss and the second loss, and the transfer signal is distilled into the item embedding matrix based on the minimization of the loss function to obtain the target transfer embedding matrix; The step of performing a multilayer perceptron operation on the final embedding matrix to obtain the recommendation probability distribution of candidate items includes: The final embedding matrix is mapped back to the original embedding space to obtain a new vector; The new vector is subjected to probability transformation and normalization using a preset activation function to obtain the recommended probability distribution.
2. The method according to claim 1, characterized in that, The process of obtaining project recommendation results based on the recommendation probability distribution includes: Based on the recommendation probability distribution, candidate items with a recommendation probability greater than a preset value are selected as the project recommendation results; The project recommendation results are displayed through a visual interface, and users can interact with the project recommendation results.
3. A project recommendation apparatus for performing the method of claim 1 or 2, characterized in that, include: The acquisition module is configured to acquire an item embedding matrix, which includes the embedding vector corresponding to each item in the user-item historical interaction sequence. The self-attention module is configured to process the item embedding matrix based on a multi-query self-attention mechanism to capture collaborative signals in the historical interaction sequence and obtain a collaborative embedding matrix. The distillation module is configured to process the item embedding matrix based on a transfer-aware embedding distillation mechanism to capture transfer signals in the historical interaction sequence and obtain the target transfer embedding matrix. The fusion module is configured to add and fuse the cooperative embedding matrix and the target transition embedding matrix to obtain the final embedding matrix; The output module is configured to perform a multilayer perceptron operation on the final embedding matrix to obtain the recommendation probability distribution of candidate items, and to obtain the item recommendation result based on the recommendation probability distribution.
4. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in claim 1 or 2.
5. A storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in claim 1 or 2.
Citation Information
Patent Citations
Recommendation method based on self-attention mechanism
CN113822742A
Systems and methods for recommendation of items and controlling an associated bias thereof
US20230169569A1