A personalized recommendation method and system based on graph neural network pre-training and prompt learning enhancement
Patent Information
- Application Number
- CN202610868761.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-09-25
AI Technical Summary
[0006]发明目的:针对现有技术中个性化推荐系统对用户-物品交互关系的高阶结构信息挖掘不足、预训练表示与下游推荐任务衔接不紧密、用户表示与物品表示缺少差异化增强机制以及离线训练结果难以有效服务在线推荐场景等问题,本发明提供了一种基于图神经网络预训练与提示学习增强的个性化推荐方法及系统
[0048]相较现有技术,本发明兼具图结构预训练的表示优势、提示学习增强的任务适配优势以及排序微调的优化优势,能够有效提高推荐结果的准确性、稳定性和可应用性,具有较好的推广前景,具体表现在以下几个方面:
Smart Images

Figure CN122817546A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and information processing technology, specifically relating to a personalized recommendation method and system based on graph neural network pre-training and prompting learning enhancement. Background Technology
[0002] With the continuous growth of information volume on internet platforms, it has become increasingly difficult for users to quickly obtain information that matches their personal preferences from massive amounts of content. Recommendation systems have therefore become an important technological means to improve information distribution efficiency, enhance user experience, and strengthen platform service capabilities. The core objective of a recommendation system is to predict a user's interest in candidate items based on historical user behavior data, content attribute data, and the interaction between the user and items, and then output personalized recommendation results to the user.
[0003] With the development of graph representation learning technology, modeling the interaction between users and items as a graph structure and using graph neural networks to learn representations of nodes and their neighborhood relationships has become an important direction for recommendation technology. However, existing recommendation methods based on graph neural networks still have the following problems.
[0004] First, many methods are trained directly for downstream recommendation tasks, failing to fully utilize the initial node representations. When faced with sparse interaction data, the models often struggle to learn stable and generalizable user and item representations. Second, existing methods typically employ a uniform feature transformation approach, lacking targeted representation modulation for different node types, resulting in limited adaptability to user interest patterns and item attribute features. Third, in downstream recommendation optimization, relying solely on single-stage training can easily lead to insufficient utilization of pre-trained knowledge, unstable parameter updates, and unsatisfactory transfer learning. Finally, while existing recommendation solutions can output ranking results, in practical deployments, they often lack close integration with online demos or service interfaces, hindering the transfer of models from offline training to online application scenarios.
[0005] Therefore, there is an urgent need for a recommended method that takes into account representation capabilities, transfer capabilities, and practical deployment availability. Summary of the Invention
[0006] Purpose of the invention: To address the problems in existing personalized recommendation systems, such as insufficient mining of high-order structural information of user-item interaction relationships, weak connection between pre-trained representations and downstream recommendation tasks, lack of differentiation enhancement mechanisms for user and item representations, and difficulty in effectively serving online recommendation scenarios with offline training results, this invention provides a personalized recommendation method and system based on graph neural network pre-training and prompting learning enhancement.
[0007] Technical solution:
[0008] On the one hand, this invention proposes a personalized recommendation method based on graph neural network pre-training and prompting learning enhancement, including:
[0009] Obtain user-item interaction data and construct a user-item bipartite graph; the user-item bipartite graph includes user nodes, item nodes, and edges representing user-item interaction data;
[0010] A pre-trained model is provided, and the user-item bipartite graph is input into the pre-trained model to obtain a pre-trained embedding including user node representations and item node representations;
[0011] A downstream recommendation model is constructed, including a cue transformation network to enhance node representations, a residual fusion operation layer, and a multi-layer graph neural network to calculate node matching scores; the pre-trained embeddings are used as initial node representations, and combined with the user-item bipartite graph to form the input graph of the downstream recommendation model; the downstream recommendation model calculates the matching scores between user node representations and item node representations based on the input graph;
[0012] The downstream recommendation model is fine-tuned based on the ranking loss function, and the trained downstream recommendation model is evaluated to save the optimal model parameters.
[0013] The downstream recommendation model is deployed online according to the optimal model parameters to provide personalized recommendations to online users.
[0014] Furthermore, the user-item interaction data includes user identifier, item identifier, rating, and timestamp. For each user, the dataset is divided according to the order of timestamps. When a user has only one interaction data, that interaction data is included in the training set. When a user has two interaction data, the first interaction data is included in the training set, and the second interaction data is included in the test set. When a user has at least three interaction data, the last interaction data is used as the test set, the second-to-last interaction data is used as the validation set, and the remaining interaction data is used as the training set.
[0015] Furthermore, the pre-trained model is a graph neural network, adopting the GraphSAGE structure, and outputs a full graph node embedding matrix as the pre-trained embedding; the pre-trained model constructs positive sample edges based on the edges of the user-item bipartite graph, constructs negative sample edges through negative sampling, and constructs the self-supervised link prediction loss of the pre-trained model based on the binary cross-entropy loss function.
[0016] Furthermore, the prompting transformation network is a multilayer perceptron module with shared parameters, comprising:
[0017] Initialize user prompt vector and item hint vector The user node representation correction is obtained by concatenating the pre-trained embedded node representations with the cue transformation network. Item nodes represent correction amounts. :
[0018] ,
[0019] ,
[0020] The symbol || represents the concatenation operation. For the pre-trained embedded user node representation, For the pre-trained embedded item node representation, This is to indicate the transformation process of the transformation network.
[0021] Furthermore, the residual fusion operation layer includes:
[0022] Provide a hint enhancement factor The user node represents the correction amount. Item nodes represent correction amounts. Residual fusion is performed with the pre-trained embedded node representations to obtain the enhanced user node representations. Enhanced item node representation :
[0023] ,
[0024] The enhanced node representations are normalized and combined into an enhanced node representation matrix:
[0025]
[0026] Enhance the node representation matrix The multi-layer graph neural network of the downstream recommendation model is input, in the input graph The execution node neighborhood aggregation and propagation are performed.
[0027] Furthermore, the multi-layer graph neural network adopts an L-layer GraphSAGE mean aggregation structure, and the propagation process of the l-th layer is represented as follows:
[0028]
[0029] in, This represents the GraphSAGE propagation operator based on mean aggregation. Represents a non-linear activation function;
[0030] After propagation through a multi-layer graph neural network, the full graph node representation matrix is obtained. The entire graph node representation matrix is divided according to the node number range to obtain the final user representation. and final item representation ;
[0031] The formula for calculating the matching score is as follows: ,in Items in the downstream recommendation model The corresponding bias parameters.
[0032] Furthermore, the fine-tuning training of the downstream recommendation model based on the ranking loss function includes:
[0033] Construct triples , This refers to a specific target user; The positive sample item is the item that the target user has interacted with in the training set. This represents negative sample items, which are candidate items randomly sampled from all item nodes for the target user.
[0034] Minimize the ranking loss function until the downstream recommendation model converges or reaches a preset training round threshold. Represented as:
[0035]
[0036] in, This is the Sigmoid function.
[0037] Furthermore, the process of performing model evaluation on the trained downstream recommendation model includes:
[0038] On the validation set, the downstream recommendation model is used to calculate the matching score. Evaluation metrics are selected to evaluate the calculation results of the validation set. If the evaluation metrics are better than the historical best value and the improvement exceeds a preset threshold, the model parameters of the current downstream recommendation model are saved as the optimal model parameters. The evaluation metrics include hit rate and normalized discount cumulative gain.
[0039] Furthermore, the online deployment of the downstream recommendation model includes:
[0040] The system reads the item metadata file and establishes an item metadata dictionary and a candidate item set. The online service receives the user identifier and the number of recommendations K, and establishes a set of items that the user has interacted with. The system calls the downstream recommendation model to calculate the user's score for the candidate item set, sorts the items by score from high to low, filters items belonging to the user's interacted item set, and outputs the top K uninteracted items. The system maps the top K uninteracted items to the item metadata dictionary to obtain the item name, category, and matching score, and displays them through a web interface.
[0041] On the other hand, this invention also proposes a personalized recommendation system based on graph neural network pre-training and prompting learning enhancement, comprising:
[0042] The bipartite graph construction module is used to acquire user-item interaction data and construct a user-item bipartite graph; the user-item bipartite graph includes user nodes, item nodes, and edges representing user-item interaction data;
[0043] A pre-trained model is used to input the user-item bipartite graph into the pre-trained model to obtain a pre-trained embedding that includes user node representations and item node representations;
[0044] The downstream recommendation model includes a cue transformation network to enhance node representations, a residual fusion operation layer, and a multi-layer graph neural network to calculate node matching scores; the pre-trained embedding is combined with the user-item bipartite graph to form an input graph, and the matching score between user node representations and item node representations is calculated based on the input graph;
[0045] The fine-tuning training module is used to fine-tune the downstream recommendation model based on the ranking loss function, perform model evaluation on the trained downstream recommendation model, and save the optimal model parameters.
[0046] The online deployment module is used to deploy the downstream recommendation model online according to the optimal model parameters, and to make personalized recommendations to online users.
[0047] Beneficial effects:
[0048] Compared with existing technologies, this invention combines the representational advantages of graph structure pre-training, the task adaptation advantages of cue learning enhancement, and the optimization advantages of ranking fine-tuning. It can effectively improve the accuracy, stability, and applicability of recommendation results and has good prospects for promotion. Specifically, it is reflected in the following aspects:
[0049] This invention constructs a user-item graph and pre-trains a graph neural network, which can make fuller use of the higher-order relationships between users and items, and is no longer limited to shallow similarity calculation. Therefore, it has stronger representation ability and better generalization performance in sparse interaction scenarios.
[0050] Compared to techniques that directly train downstream recommendations using only graph neural networks, this invention improves the transferability of node representations and reduces instability issues that easily arise when the model is directly trained for downstream tasks through a two-stage approach of pre-training and fine-tuning. This invention introduces a differentiated prompting learning mechanism for user nodes and item nodes, which, compared to existing unified representation transformation schemes, can more accurately characterize the matching relationship between user preferences and item features, thereby improving recommendation accuracy and ranking quality.
[0051] Compared with existing recommendation technologies that only have offline model training and lack online application capabilities, this invention connects the trained model to an online service interface, realizing a complete chain of candidate item scoring, interactive item filtering, and recommendation result display, thus having higher practical value in engineering deployment and practical application. Attached Figure Description
[0052] Figure 1 This is a flowchart of the method of the present invention;
[0053] Figure 2 This is a schematic diagram of a bipartite graph structure and the pre-trained node embedding and loading process;
[0054] Figure 3 This is a schematic diagram of the hint learning enhancement structure of the RecPrompt recommendation model;
[0055] Figure 4 This is a flowchart of the fine-tuning training process for the downstream recommendation model based on the ranking loss function;
[0056] Figure 5 This is a flowchart of the rating process for candidate items in an online recommendation service. Detailed Implementation
[0057] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments. Figure 1 The diagram shows a flowchart of a personalized recommendation method based on graph neural network pre-training and prompting learning enhancement according to the present invention, which specifically includes the following steps:
[0058] Step 1: Obtain user-item interaction data and construct a user-item bipartite graph.
[0059] The system acquires historical user interaction data for items, which includes at least user ID, item ID, rating, and timestamp. In this embodiment, the historical interaction data is selected from the MovieLens-1M dataset.
[0060] The raw interaction data is filtered, and interaction records that meet preset conditions are used as valid positive feedback, with scores not less than a threshold. The interaction is considered a valid interaction. In this embodiment... Let the set of users be 4. The collection of items is User ID and item identification Perform continuous remapping separately, where the user node number ranges from 0 to... The item node number range is to This is used to form the input of a graph neural network in a unified node space.
[0061] This leads to the construction of a user-item bipartite graph. ,in This indicates that all nodes in the graph are composed of the user node set. With item node set Together they form a set of edges. This represents the effective interaction relationships between user nodes and item nodes. It is achieved by unifying the set of user nodes and the set of item nodes into the same vertex set. It can construct a user-item bipartite graph in a unified node space, which can be used as the graph input for subsequent graph neural network pre-training and downstream recommendation modeling.
[0062] If user With items If valid interactions exist, then establish edges in graph G. To accommodate the message passing process in graph neural networks, reverse edges are preferably added to form a bidirectional propagation graph structure. The dataset is divided according to the interaction time sequence of each user. When a user has only one interaction, that interaction is added to the training set; when a user has two interactions, the first interaction is added to the training set and the second to the test set; when a user has at least three interactions, the last interaction is used as the test set, the penultimate interaction as the validation set, and the remaining interactions as the training set.
[0063] Step 2: Perform graph neural network pre-training based on the user-item bipartite graph.
[0064] A pre-trained model is provided. Based on the user-item bipartite graph constructed in step 1, pre-trained representation learning is performed on the nodes in the graph to obtain the pre-trained embeddings of user nodes and item nodes. The specific process is as follows: Figure 2 As shown.
[0065] The pre-trained model employs a graph neural network, specifically a GraphSAGE structure. In this embodiment, the pre-training phase uses the following parameters: 50 training epochs, and a certain number of hidden dimensions. The learning rate is The batch size is 500. Specifically, in this embodiment, the basic user-item bipartite graph constructed in step 1 is used. Add a self-loop to get This is used to input the graph neural network so as to preserve the node's own information and enhance the node's neighborhood aggregation and propagation effect during the pre-training process.
[0066] The pre-training representation learning process includes: assuming any node in the user-item bipartite graph... In the pre-trained model The layer is represented as Its neighborhood node set is ,node The neighborhood aggregation result is represented as follows:
[0067]
[0068] No. Layer nodes are represented as:
[0069]
[0070] in, For the first Layer learnable parameters, It is a non-linear activation function.
[0071] After multiple propagations, the full graph node embedding matrix is obtained:
[0072]
[0073] in, To hide the dimension, 128 is used in this embodiment.
[0074] In the aforementioned pre-training representation learning process, to enable the pre-trained model to learn the effective connection relationships between user nodes and item nodes, positive sample edges are constructed based on the real interaction edges in the user-item bipartite graph, and negative sample edges are constructed through negative sampling. The scores for positive and negative sample edges are calculated according to the matching relationship between user node representations and item node representations, and a self-supervised link prediction loss is constructed based on the binary cross-entropy loss function (BCE Loss) to optimize the parameters of the pre-trained model. This invention also utilizes the indirect connection information formed by multi-hop neighborhood aggregation and propagation in the graph structure to form higher-order association relationships. By minimizing the self-supervised link prediction loss, the pre-trained model can distinguish between real interaction edges and negative sample edges, thereby improving the ability of node embeddings in the pre-training stage to represent direct user-item connection relationships and higher-order association relationships.
[0075] After pre-training, the full graph node embedding matrix is then used. Save it as a pre-trained feature file to serve as the initial representation for subsequent downstream recommendation models.
[0076] Step 3: Construct a downstream recommendation model with cue learning enhancement.
[0077] The full graph node embedding matrix obtained in step 2 Based on this, a downstream recommendation model is constructed, and cue vectors are introduced for user nodes and item nodes respectively. In this embodiment, the downstream recommendation model is specifically the RecPrompt recommendation model, which includes a graph input part, a pre-trained representation loading part, a cue parameter part, a cue transformation network part, a residual fusion part, a multi-layer graph neural network part, and an item bias parameter part required for recommendation scoring.
[0078] The downstream recommendation model loads the pre-trained feature file output in step 2 and embeds the full-graph node into the matrix. Using the initial embedding parameter matrix of the whole graph nodes, combined with the user-item bipartite graph G constructed in step 1, we obtain the input graph used in the downstream fine-tuning stage. .
[0079] Embed the full graph nodes output in step 2 into the matrix. The nodes are divided into user node number ranges and item node number ranges to obtain the initial representation of each user node. Initial representation of item nodes Specifically: the pre-trained node embedding matrix obtained in step 2 is M represents the number of user nodes, N represents the number of item nodes, and d represents the node embedding dimension; the full graph node embedding matrix is constructed according to the node number range. The initial embedding matrix is divided into user node initial embedding matrix and item node initial embedding matrix, denoted as follows: ,in, , .
[0080] In this embodiment, they are user nodes. and item nodes Set the learnable cue vector. Specifically, set the cue parameter matrix. The first row corresponds to the user prompt vector. The second row corresponds to the item hint vector. The user prompt vector Extending to all user nodes yields the user prompt matrix. The item hint vector Extending to all item nodes yields the item hint matrix. The prompt parameter matrix The parameters are randomly initialized during the downstream recommendation model initialization and updated synchronously with other model parameters during fine-tuning training.
[0081] Initial embedding matrix of user nodes With user prompt matrix Perform feature concatenation to initially embed the item nodes into the matrix. With Item Hint Matrix Feature concatenation is performed, and the results are used as shared cue transformation networks. Input: , , where the symbol || represents the concatenation operation.
[0082] The prompt transformation network is preferably a multilayer perceptron module with shared parameters, adopting a "linear layer-ReLU-linear layer" structure, and its transformation process is expressed as follows:
[0083]
[0084] in, , , , Learnable parameters for the shared cue transformation network. The cue transformation network is used to obtain corrections for user node representations and item node representations, respectively:
[0085] ,
[0086] in, , .
[0087] Furthermore, based on the cue enhancement coefficient The indicated correction amount , Embedded with the original node respectively , Residual fusion is performed to obtain enhanced user node representations and enhanced item node representations:
[0088] ,
[0089] in, To indicate the enhancement factor, a value of 0.3 is used in this embodiment. The enhanced node representations are then normalized and recombined into a full-graph enhanced node representation matrix:
[0090]
[0091] The full-graph enhancement node representation matrix The propagation layer of the downstream recommendation model is input into the input graph. The process involves neighborhood aggregation and propagation of nodes. In this embodiment, the graph neural network propagation layer adopts an L-layer GraphSAGE mean aggregation structure, and the propagation process of the l-th layer can be represented as follows:
[0092]
[0093] in, This represents the GraphSAGE propagation operator based on mean aggregation. This represents a non-linear activation function. After multiple propagation layers, the final full-graph node representation matrix is obtained. Then, the final full-graph node representation matrix is segmented according to the node number range to obtain the final user representation used for recommendation scoring. and item representation They are respectively denoted as:
[0094] ,
[0095] Through the above processing, this invention sets independent cue vectors for user nodes and item nodes respectively, generates representation correction quantities through a cue transformation network, and then fuses them with the original node embeddings. Unlike existing technologies that directly use pre-trained embeddings for downstream recommendation, this invention enables the general representation obtained from pre-training to better adapt to downstream recommendation tasks.
[0096] Step 4: Perform downstream fine-tuning training based on the ranking loss function.
[0097] User representation obtained in step 3 and item representation Based on this, construct a triplet of user-positive sample item-negative sample item. .in, Indicates the target user. Indicates user Items that have been actually interacted with in the training set are used as positive sample items; This means that during the downstream fine-tuning training process, candidate items randomly sampled from within the item node number range for the target user are used as negative sample items. In this embodiment, the total number of item nodes is assumed to be... Then negative sample items Through the interval It is obtained by random sampling within the sample, and multiple negative sample items can be further sampled for each positive sample.
[0098] The flowchart of the fine-tuning training process of the downstream recommendation model based on the ranking loss function is as follows: Figure 4 As shown, the specific steps include:
[0099] (1) At the beginning of each training round, first determine the current round. Is it less than the number of pre-trained node embedding freeze rounds? If yes, freeze the pre-trained node embedding parameters and train only downstream related parameters such as cue vectors, cue transformation networks, multi-layer graph neural network propagation layers, and item biases; if no, unfreeze the pre-trained node embedding parameters and continue to participate in subsequent training.
[0100] (2) Read the current training batch samples, construct negative sample items based on the user-positive sample item training pairs, and obtain the user-positive sample item-negative sample item training triplet. .
[0101] (3) During the forward propagation phase, the current input graph is... The data is fed into the downstream recommendation model to calculate the full graph node representation, and then further segmented to obtain the final user representation. and final item representation Based on the user representation, positive sample item representation, negative sample item representation, and item bias term, the positive sample score and negative sample score are calculated respectively, and the Bayesian personalized ranking loss is calculated accordingly. .
[0102] Specifically, the formula for calculating the matching score of a user for an item is as follows:
[0103]
[0104] in, For items The corresponding learnable bias parameters are derived from the item bias vectors in the downstream recommendation model. , This represents the total number of item nodes. In this embodiment, the item bias vector... The downstream recommendation model is initialized with zero values and updated synchronously with node representations, cue vectors, and cue transformation network parameters during fine-tuning training based on BPR ranking loss to compensate for baseline differences in recommendation scores for different items.
[0105] Based on the above scores Construct the Bayesian Personalized Ranking (BPR) loss function:
[0106]
[0107] in, The sigmoid function is used. The BPR ranking loss is used to ensure that users score positive items higher than negative items, thereby improving the model's ranking ability in the Top-K recommendation task.
[0108] (4) During the backpropagation phase, gradient backpropagation is performed on the ranking loss, and the model parameters are updated. In one implementation, the gradient norm is also pruned to improve the stability of the training process.
[0109] (5) After each training round, the performance of the current model is evaluated based on the validation set. If the current model performs better than the historical best model, the current model parameters are saved as the optimal recommended model parameters. If the preset number of early stop rounds is not reached for several consecutive training rounds, the early stop condition is met and training ends. Otherwise, the next training round continues.
[0110] In this embodiment, the sorting fine-tuning training uses the following parameters: 60 training epochs, 128 hidden dimensions, and a learning rate of... Batch size is 500, recommended cutoff value The number of negative samples is 3, indicating an enhancement coefficient. The number of wheels that stop early is 10, and the performance improvement threshold is... The number of pre-trained node embedding freeze rounds is 0.
[0111] This invention performs sorting fine-tuning by providing enhanced representations and can further combine early stopping strategies, phased freezing and unfreezing strategies, and learning rate adjustment strategies to improve the stability and effectiveness of transferring pre-trained knowledge to downstream recommendation tasks.
[0112] Step 5: Perform model evaluation and save the optimal model parameters.
[0113] During fine-tuning training, evaluation metrics are selected to periodically assess the validation set. For each validator... First, the predicted scores for all candidate items by the user are calculated. Then, the scores of the positions corresponding to the interacted items in the training set are masked. Finally, the top-scoring items are selected from the remaining candidate items. These items are used as the current user's recommended list. .
[0114] The evaluation metric used is the hit rate. and normalized discount cumulative gain The hit rate is defined as follows:
[0115]
[0116] The normalized discount cumulative gain is defined as:
[0117]
[0118] In the formula Represents the set of users for the validation set. Indicates user Verify the target item. This indicates that the target item is in the recommended list. The sorting position in; when Not appeared In the middle, the corresponding user's NDCG is recorded as 0.
[0119] The overall evaluation metric of the current model on the validation set is obtained by averaging the hit rate and normalized discount cumulative gain of all validating users. In this embodiment, the following method is used. As the primary evaluation metric for preserving optimal model parameters, if the current When the current model parameters are better than the historical best and the improvement exceeds a preset threshold, the current model parameters are saved as the optimal recommended model parameters.
[0120] Step 6: Execute the online recommendation output.
[0121] Deploy the optimal recommendation model saved in step 5 to the online recommendation service module. The online service receives the user identifier and recommendation quantity parameters, and calls the trained recommendation model to calculate the matching score of the target user for the candidate item set. The specific process is as follows: Figure 5 As shown.
[0122] Before executing online recommendation output, the item metadata file is first read, and an item metadata dictionary is built based on fields such as item identifier, item name, and item category. This dictionary is used for attribute mapping and display of subsequent recommendation results. The item metadata processing branch and the candidate item evaluation branch are set up in parallel. After the candidate items are filtered and sorted, the recommended item identifiers are matched with the item metadata dictionary, integrating the corresponding item name and category information.
[0123] Let the target user be Its final score vector is:
[0124]
[0125] in, Represent all items as a matrix. This is the item bias vector. The elements in this score vector that belong to the target user's historical interaction set... Filter the items, then sort them by score from highest to lowest, and output the first... The system identifies non-interactive items. Finally, these items are mapped to an item metadata dictionary to obtain the item name, category, and matching score, which are then displayed through a web interface.
[0126] In this embodiment, let an anonymous target user be... The user representation obtained after model inference is as follows:
[0127]
[0128] Suppose the user currently has four candidate items, with their item representations and bias terms as follows:
[0129]
[0130] According to the scoring formula Results obtained:
[0131]
[0132] Filter interacted items and generate Top-K recommendation results, assuming a target user. Historical interactive items collection During the recommendation phase, items will be... Remove from the candidate set. The remaining candidate items are sorted from highest to lowest score as follows: When the number of recommendations is set to At that time, the final Top-2 recommendation results are: .
Claims
1. A personalized recommendation method based on graph neural network pre-training and prompting learning enhancement, characterized in that, include: Acquire user-item interaction data and construct a user-item bipartite graph; The user-item bipartite graph includes user nodes, item nodes, and edges representing user-item interaction data; A pre-trained model is provided, and the user-item bipartite graph is input into the pre-trained model to obtain a pre-trained embedding including user node representations and item node representations; A downstream recommendation model is constructed, including a cue transformation network to enhance node representations, a residual fusion operation layer, and a multi-layer graph neural network to calculate node matching scores; the pre-trained embeddings are used as initial node representations and combined with the user-item bipartite graph to form the input graph of the downstream recommendation model; The downstream recommendation model calculates the matching score between user node representations and item node representations based on the input graph; The downstream recommendation model is fine-tuned based on the ranking loss function, and the trained downstream recommendation model is evaluated to save the optimal model parameters. The downstream recommendation model is deployed online according to the optimal model parameters to provide personalized recommendations to online users.
2. The personalized recommendation method according to claim 1, characterized in that, The user-item interaction data includes user identifiers, item identifiers, ratings, and timestamps; for each user, the dataset is divided according to the order of the timestamps. When a user has only one interaction data point, the interaction data point is included in the training set; when a user has two interaction data points, the first interaction data point is included in the training set and the second interaction data point is included in the test set; when a user has at least three interaction data points, the last interaction data point is used as the test set, the second to last interaction data point is used as the validation set, and the remaining interaction data points are used as the training set.
3. The personalized recommendation method according to claim 2, characterized in that, The pre-trained model is a graph neural network with a GraphSAGE structure, and outputs a full graph node embedding matrix as the pre-trained embedding. The pre-trained model constructs positive sample edges based on the edges of the user-item bipartite graph, constructs negative sample edges through negative sampling, and constructs the self-supervised link prediction loss of the pre-trained model based on the binary cross-entropy loss function.
4. The personalized recommendation method according to claim 3, characterized in that, The prompting transformation network is a multilayer perceptron module with shared parameters, including: Initialize user prompt vector and item hint vector The user node representation correction is obtained by concatenating the pre-trained embedded node representations with the cue transformation network. Item nodes represent correction amounts. : , , The symbol || represents the concatenation operation. For the pre-trained embedded user node representation, For the pre-trained embedded item node representation, This is to indicate the transformation process of the transformation network.
5. The personalized recommendation method according to claim 4, characterized in that, The residual fusion operation layer includes: Provide a hint enhancement factor The user node represents the correction amount. Item nodes represent correction amounts. Residual fusion is performed with the pre-trained embedded node representations to obtain the enhanced user node representations. Enhanced item node representation : , The enhanced node representations are normalized and combined into an enhanced node representation matrix: Enhance the node representation matrix The multi-layer graph neural network of the downstream recommendation model is input, in the input graph The execution node neighborhood aggregation and propagation are performed.
6. The personalized recommendation method according to claim 5, characterized in that, The multilayer graph neural network adopts Layer GraphSAGE mean aggregation structure, the first The layer propagation process is represented as: in, This represents the GraphSAGE propagation operator based on mean aggregation. Represents a nonlinear activation function; After propagation through a multi-layer graph neural network, the full graph node representation matrix is obtained. The entire graph node representation matrix is divided according to the node number range to obtain the final user representation. and final item representation ; The formula for calculating the matching score is as follows: ,in Recommending items in the downstream model The corresponding bias parameters.
7. The personalized recommendation method according to claim 6, characterized in that, The fine-tuning training of the downstream recommendation model based on the ranking loss function includes: Construct triples , This refers to a specific target user; The positive sample item is the item that the target user has interacted with in the training set. This represents negative sample items, which are candidate items randomly sampled from all item nodes for the target user. Minimize the ranking loss function until the downstream recommendation model converges or reaches a preset training round threshold. Represented as: in, This is the Sigmoid function.
8. The personalized recommendation method according to claim 7, characterized in that, The process of performing model evaluation on the trained downstream recommendation model includes: On the validation set, the downstream recommendation model is used to calculate the matching score. Evaluation metrics are selected to evaluate the calculation results of the validation set. If the evaluation metrics are better than the historical best value and the improvement exceeds a preset threshold, the model parameters of the current downstream recommendation model are saved as the optimal model parameters. The evaluation metrics include hit rate and normalized discount cumulative gain.
9. The personalized recommendation method according to claim 8, characterized in that, The online deployment of the downstream recommendation model includes: The system reads the item metadata file and establishes an item metadata dictionary and a candidate item set. The online service receives the user identifier and the number of recommendations K, and establishes a set of items that the user has interacted with. The system calls the downstream recommendation model to calculate the user's score for the candidate item set, sorts the items by score from high to low, filters items belonging to the user's interacted item set, and outputs the top K uninteracted items. The system maps the top K uninteracted items to the item metadata dictionary to obtain the item name, category, and matching score, and displays them through a web interface.
10. A personalized recommendation system based on graph neural network pre-training and prompting learning enhancement, characterized in that, include: The bipartite graph construction module is used to acquire user-item interaction data and construct a user-item bipartite graph. The user-item bipartite graph includes user nodes, item nodes, and edges representing user-item interaction data; A pre-trained model is used to input the user-item bipartite graph into the pre-trained model to obtain a pre-trained embedding that includes user node representations and item node representations; The downstream recommendation model includes a cue transformation network to enhance node representations, a residual fusion operation layer, and a multi-layer graph neural network to calculate node matching scores; the pre-trained embedding is combined with the user-item bipartite graph to form an input graph, and the matching score between user node representations and item node representations is calculated based on the input graph; The fine-tuning training module is used to fine-tune the downstream recommendation model based on the ranking loss function, perform model evaluation on the trained downstream recommendation model, and save the optimal model parameters. The online deployment module is used to deploy the downstream recommendation model online according to the optimal model parameters, and to make personalized recommendations to online users.