Determination method and recommendation method of recommendation model based on diffusion contrast and multi-hop negative sampling

CN122817643APending Publication Date: 2026-09-25LANZHOU JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611035019.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-13
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0002]推荐系统广泛应用于电子商务、社交网络等领域,协同过滤与图神经网络是主流方法,但仍面临数据稀疏、噪声干扰等问题,导致节点表示质量不高

Benefits of technology

本申请提供了一种基于扩散对比与多跳负采样的推荐模型的确定方法及推荐方法,引入扩散模型对基础嵌入执行前向加噪与反向去噪,利用用户节点的偏好引导条件信息(包括偏好语义特征和结构感知特征)来指导去噪过程,从而在保留原始图结构完整性的前提下生成富含语义和结构信息的增强嵌入,既避免了图结构破坏和语义丢失,又通过扩散过程的随机性与条件约束提升了表示的泛化能力,有效缓解了数据稀疏性。其次,直接以原始聚合得到的基础嵌入矩阵作为第一视图,以扩散增强后的嵌入矩阵作为第二视图,不再依赖启发式策略,而是通过对比学习损失最大化同一节点在两个视图间的一致性,实现了自适应、可学习的视图增强,显著提升了泛化能力。最后,通过挖掘多跳邻居信息,从高阶邻域中筛选未交互的项目构建负样本候选集,同时引入截断损失函数对负样本进行动态筛选,有效抑制了假阴性样本(即实际为正但被误作负的样本)的干扰,并提升了负样本的信息量。最终,联合优化推荐主任务损失、对比学习损失和反向去噪损失,使模型在迭代训练中同步增强节点表征质量、视图一致性与负样本鉴别能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122817643A_ABST
    Figure CN122817643A_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on diffusion contrast and multi-hop negative sampling recommendation model determination method and recommendation method, it is related to artificial intelligence and recommended system technical field, the method includes processing user-item interaction graph, obtains each node basic embedding and constitutes basic embedding matrix;By diffusion model, each basic embedding is executed forward noise, and enhanced node embedding matrix and reverse denoising loss are obtained;With basic embedding and enhanced embedding as two views respectively, the consistency of the same node under different views is maximized using contrastive learning loss;Based on the user-item interaction graph, user multi-hop neighbor information is mined, and negative sample candidate set is constructed by filtering non-directly interactive items from high-order neighborhood and dynamically excluding false negative samples combined with truncated loss function;Finally, the neural network is jointly optimized by fusing recommendation main task loss, contrastive learning loss and reverse denoising loss, to obtain a recommendation model.The application significantly improves the recommendation accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence and recommender system technology, and in particular to a method for determining a recommender model and a recommender method based on diffusion comparison and multi-hop negative sampling. Background Technology

[0002] Recommender systems are widely used in e-commerce, social networks and other fields. Collaborative filtering and graph neural networks are the mainstream methods, but they still face problems such as data sparsity and noise interference, resulting in low quality of node representation.

[0003] Existing contrastive learning methods largely rely on heuristic strategies to construct views, which easily disrupts graph structure, loses semantic information, lacks adaptability, and has limited generalization ability. Meanwhile, the false negative problem in negative sampling is difficult to suppress effectively, random negative samples have limited information content, and existing methods for constructing difficult negative samples still cannot avoid interference from false negative samples. Therefore, how to generate contrastive views with high generalization ability while avoiding disruption of graph structure and effectively suppressing the interference of false negative samples on negative sampling is a pressing technical problem that current recommender systems need to solve. Summary of the Invention

[0004] The purpose of this application is to provide a method for determining a recommendation model and a recommendation method based on diffusion comparison and multi-hop negative sampling, which can significantly improve recommendation accuracy.

[0005] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a method for determining a recommendation model based on diffusion comparison and multi-hop negative sampling, including: Multi-level neighborhood aggregation is performed on the user-project interaction graph to obtain the basic embedding of each node in the user-project interaction graph; the basic embeddings of each node constitute a basic embedding matrix; the user-project interaction graph is determined based on the interaction data between users and projects; the node is a user node or a project node.

[0006] The basic embedding of each user node is forward-denoised using a diffusion model to output a noisy embedding matrix. Then, the noisy embedding matrix is ​​reverse-denoised based on the preference guidance information of each user node to obtain an enhanced node embedding matrix. Subsequently, the reverse denoising loss is calculated using the enhanced node embedding matrix. The preference guidance information includes preference semantic features and structure-aware features.

[0007] Using the base embedding matrix and the enhanced node embedding matrix as the first view and the second view respectively, the contrastive learning loss is calculated using the contrastive learning loss function and the first and second views corresponding to each node; the contrastive learning loss function is used to maximize the consistency of the representation of the same node in the first view and the second view.

[0008] Based on the user-item interaction graph, multi-hop neighbor information of each user node is mined to obtain higher-order neighborhood information of each user node. Item nodes that do not directly interact with the corresponding user node are filtered from the higher-order neighborhood information to construct a negative sample candidate set for each user node. Negative samples are then sampled from the negative sample candidate set, and the negative samples are dynamically filtered using a truncation loss function to obtain a filtered sample set.

[0009] The joint loss value is calculated based on the recommendation task loss, contrastive learning loss, and reverse denoising loss. This joint loss value is then used to iteratively optimize the neural network until it converges, generating the recommendation model. The recommendation task loss is constructed based on the noisy embedding matrix calculated from the user-item interaction graph and the noisy embedding matrix calculated from the filtering result sample set. The input to the recommendation model is the user-item interaction data, and the output is the noisy embedding matrix for each node. The noisy embedding matrix for each node is used to determine the predicted interaction probability.

[0010] Secondly, this application provides a recommendation method based on a recommendation model using diffusion contrast and multi-hop negative sampling, including: Obtain user interaction data between the user and the project.

[0011] The user-project interaction data is input into the recommendation model to obtain the noisy embedding vector of each node; the node can be a project node or a user node.

[0012] Based on the noisy embedding vector of each user node and the noisy embedding vector of each item node, the interaction probability of each user node with any item node is determined, and the recommended items are determined based on all interaction probabilities.

[0013] According to the specific embodiments provided in this application, this application has the following technical effects: This application provides a method for determining and recommending a recommendation model based on diffusion contrastive analysis and multi-hop negative sampling. It introduces a diffusion model to perform forward denoising and backward denoising on the basic embeddings. User node preferences guide the denoising process using conditional information (including semantic features and structure-aware features), thereby generating enhanced embeddings rich in semantic and structural information while preserving the integrity of the original graph structure. This avoids graph structure destruction and semantic loss, and improves the generalization ability of the representation through the randomness and conditional constraints of the diffusion process, effectively alleviating data sparsity. Secondly, it directly uses the basic embedding matrix obtained from the original aggregation as the first view and the diffusion-enhanced embedding matrix as the second view. Instead of relying on heuristic strategies, it maximizes the consistency of the same node between the two views through contrastive learning loss, achieving adaptive and learnable view enhancement and significantly improving generalization ability. Finally, by mining multi-hop neighbor information, it selects non-interacting items from higher-order neighborhoods to construct a negative sample candidate set. Simultaneously, it introduces a truncation loss function to dynamically filter negative samples, effectively suppressing the interference of false negative samples (i.e., samples that are actually positive but mistakenly identified as negative) and increasing the information content of negative samples. Ultimately, by jointly optimizing the recommendation main task loss, contrastive learning loss, and reverse denoising loss, the model can simultaneously enhance the quality of node representations and view representations during iterative training. Figure 1 Consistency and negative sample discrimination ability. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments 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.

[0015] Figure 1 This is an application environment diagram of a method for determining a recommendation model based on diffusion comparison and multi-hop negative sampling in one embodiment of this application; Figure 2 A flowchart illustrating a method for determining a recommendation model based on diffusion comparison and multi-hop negative sampling, provided in an embodiment of this application; Figure 3 A schematic diagram of a recommendation method based on a recommendation model using diffusion contrast and multi-hop negative sampling, provided in an embodiment of this application; Figure 4 This is a schematic diagram of neighborhood aggregation based on LightGCN; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0017] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0018] The method for determining and recommending a recommendation model based on diffusion contrast and multi-hop negative sampling provided in this application can be applied to, for example, Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be set up independently, integrated into server 104, or placed in the cloud or on other servers. Terminal 102 can send a user-item interaction graph to server 104. Server 104 receives the user-item interaction graph and performs multi-level neighborhood aggregation on it to obtain the basic embedding of each node in the user-item interaction graph. The basic embeddings of each node constitute a basic embedding matrix. The user-item interaction graph is determined based on the interaction data between users and items. The nodes are user nodes or item nodes. Forward denoising is performed on the basic embedding of each user node using a diffusion model to output a noisy embedding matrix. Inverse denoising is then performed on the noisy embedding matrix based on the preference guidance information of each user node to obtain an enhanced node embedding matrix. Subsequently, the inverse denoising loss is calculated using the enhanced node embedding matrix. The preference guidance information includes preference semantic features and structure-aware features. Using the base embedding matrix and the enhanced node embedding matrix as the first and second views respectively, a contrastive learning loss is calculated using a contrastive learning loss function and the first and second views corresponding to each node. The contrastive learning loss function is used to maximize the consistency of the representation of the same node in the first and second views. Based on the user-item interaction graph, multi-hop neighbor information of each user node is mined to obtain the higher-order neighborhood information of each user node. Item nodes that do not directly interact with the corresponding user node are screened from the higher-order neighborhood information to construct a negative sample candidate set for each user node. Negative samples are sampled from the negative sample candidate set, and the negative samples are dynamically screened using a truncation loss function to obtain a filtered sample set. The joint loss value is calculated based on the recommendation task loss, contrastive learning loss, and reverse denoising loss. This joint loss value is then used to iteratively optimize the neural network until it converges, generating a recommendation model. The recommendation task loss is constructed based on the noisy embedding matrix calculated from the user-item interaction graph and the noisy embedding matrix calculated from the filtering result sample set. The input to the recommendation model is the user-item interaction data, and the output is the noisy embedding matrix for each node. The noisy embedding matrix for each node is used to determine the predicted interaction probability. The server 104 can feed back the obtained recommendation model to the terminal 102. Furthermore, in some embodiments, the method for determining the recommendation model based on diffusion contrastive and multi-hop negative sampling can also be implemented separately by the server 104 or the terminal 102. For example, the terminal 102 can directly process the user-item interaction graph, or the server 104 can obtain the user-item interaction graph from the data storage system and process it.

[0019] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, or it can be a cloud server.

[0020] In one exemplary embodiment, such as Figure 2 As shown, a method for determining a recommendation model based on diffusion contrast and multi-hop negative sampling is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is applied to... Figure 1 Taking server 104 as an example, the explanation includes the following steps 201 to 205. Wherein: Step 201: Perform multi-level neighborhood aggregation on the user-project interaction graph to obtain the basic embedding of each node in the user-project interaction graph; the basic embeddings of each node constitute a basic embedding matrix; the user-project interaction graph is determined based on the interaction data between users and projects; the node is a user node or a project node.

[0021] Step 202: Forward denoising is performed on the basic embedding of each user node using a diffusion model to output a noisy embedding matrix. Then, inverse denoising is performed on the noisy embedding matrix based on the preference guidance condition information of each user node to obtain an enhanced node embedding matrix. Subsequently, the inverse denoising loss is calculated using the enhanced node embedding matrix. The preference guidance condition information includes preference semantic features and structure-aware features.

[0022] Step 203: Using the base embedding matrix and the enhanced node embedding matrix as the first view and the second view respectively, calculate the contrastive learning loss using the contrastive learning loss function and the first and second views corresponding to each node; the contrastive learning loss function is used to maximize the consistency of the representation of the same node in the first view and the second view.

[0023] Step 204: Based on the user-item interaction graph, mine the multi-hop neighbor information of each user node to obtain the high-order neighborhood information of each user node. Filter out the item nodes that do not directly interact with the corresponding user node from the high-order neighborhood information, construct a negative sample candidate set for each user node, and sample negative samples from the negative sample candidate set. Dynamically filter the negative samples using a truncation loss function to obtain the filtered result sample set.

[0024] Step 205: Calculate the joint loss value based on the recommendation main task loss, contrastive learning loss, and reverse denoising loss. Iteratively optimize the neural network using the joint loss value until the optimized neural network converges, generating a recommendation model. The recommendation main task loss is constructed based on the noisy embedding matrix calculated from the user-item interaction graph and the noisy embedding matrix calculated from the filtering result sample set. The input to the recommendation model is the user-item interaction data, and the output of the recommendation model is the noisy embedding matrix for each node. The noisy embedding matrix for each node is used to determine the predicted interaction probability.

[0025] Implementing steps 201 to 205 above can effectively avoid the destruction of the original user-item interaction graph structure and the loss of semantic information caused by traditional heuristic view construction. By introducing user preference guidance information, the diffusion enhancement process becomes adaptive, improving generalization ability. At the same time, based on the high-order neighbor mining and truncation loss dynamic screening mechanism, the interference of false negative samples on negative sampling is effectively suppressed. The recommendation main task, contrastive learning and diffusion reconstruction loss are jointly optimized, improving recommendation performance while enhancing the quality of node representation.

[0026] In an exemplary embodiment, the specific implementation process of step 201 above is as follows: First, construct a user-item interaction graph. Obtain the original interaction data of the recommendation system and define the original interaction data as the interaction graph structure. Among them, the node set It includes a set of user nodes U and a set of project nodes I, and an edge set. This represents the historical interaction relationships between user nodes and project nodes. If user node u and project node i have an interaction, a corresponding edge is constructed in the graph. Simultaneously, the interaction matrix Y is represented as an edge index matrix E, used to store the topological structure of the user-project interaction graph.

[0027] Secondly, initialize the node embeddings by initializing a d-dimensional embedding vector e for each user node u and item node i in the user-item interaction graph. u0 and embedding vector e i0 The initial embedding matrix for all user nodes and project nodes is denoted as E0. The Xavier method can be used for initialization to ensure that the embedding vectors have appropriate variance in the initial stage.

[0028] Finally, basic embeddings are generated based on neighborhood aggregation using LightGCN. To capture higher-order cooperative signals, embodiments of this application employ LightGCN as the backbone network to perform multi-layer neighborhood aggregation on the initial embedding matrix. For example... Figure 4As shown, LightGCN propagates high-order cooperative signals along the edges and encodes them into node embeddings by stacking multiple neighborhood aggregation layers. LightGCN removes the nonlinear activation functions and feature transformation layers in traditional graph neural networks, retaining only the neighborhood aggregation mechanism to alleviate the oversmoothing problem and improve computational efficiency.

[0029] Specifically, for the l-th layer network, the embedding vector of user node u It is obtained by aggregating the embedding vectors of its first-order neighbors (i.e., the project nodes that have been interacted with), and the calculation formula is as follows: ; Similarly, the embedding vector of project node i The update is performed by aggregating the embedding vectors of the user nodes that interact with it, calculated using the following formula: ; in, This represents the set of project nodes that interact with user node u. This represents the set of user nodes that interact with project node i. This is a symmetric normalization term used to prevent the size of the embedding vector from expanding as the number of layers increases.

[0030] After completing the L-layer neighborhood aggregation, the embedding vectors output from each layer are weighted and fused to obtain the final basic embeddings of user nodes and item nodes. and final basic embedding The calculation formula is: ; ; Where L represents the total number of layers in the network. The final basic embeddings of all user nodes and all project nodes together constitute the basic embedding matrix E.

[0031] In another exemplary embodiment of this application, forward noise addition is performed on each of the basic embeddings using a diffusion model to output a noisy embedding matrix, specifically including: The diffusion model adds Gaussian noise to the data stepwise over T diffusion steps using a Markov chain. To avoid disrupting the sparse graph structure of the original user-item interaction graph, this embodiment performs the forward noise addition process in the embedding space (rather than the original graph space).

[0032] First, a preset noise scheduling strategy is used to determine the noise scale of the diffusion model at each diffusion step.

[0033] Set up a linear noise scheduling strategy and define hyperparameters. and hyperparameters The noise scale at step t Obtained through linear interpolation: ; There are a total of T diffusion steps, where t represents the t-th diffusion step; For the final noise scale; This is the initial noise scale.

[0034] According to the noise scale of each diffusion step Calculate the cumulative variance correlation coefficient for the corresponding diffusion step: in, The cumulative variance correlation coefficient at the t-th diffusion step; This serves as an index for virtual steps in the multiplication process; Let be the variance retention coefficient at step t'.

[0035] Based on the cumulative variance correlation coefficient, Gaussian noise is added to the basic embedding of each node in the basic embedding matrix (i.e., the basic embedding matrix E output in step 201) to obtain the noisy embedding corresponding to each diffusion step.

[0036] The noisy embeddings of each node are combined into a noisy embedding matrix and output.

[0037] The calculation method for the noisy embedding is as follows: ; in, For the noisy embedding at step t, Let be the cumulative variance correlation coefficient at step t; This serves as the basic embedding for a user node; Standard Gaussian noise; Standard Gaussian noise follows a standard normal distribution.

[0038] In an exemplary embodiment, the method for determining the preference semantic features of each user node in step 202 above is as follows: Perform the first operation on each user node to obtain the corresponding user node's preference semantic features; the first operation is: Based on the user node and the set of historical interaction item nodes corresponding to the user node, the normalized attention coefficient between the user node and each of its corresponding historical interaction item nodes is calculated; the set of historical interaction item nodes includes one or more historical interaction item nodes.

[0039] Based on the normalized attention coefficient, the basic embeddings of all historical interaction item nodes of the user node are weighted and aggregated to obtain the user node's preference semantic features.

[0040] The formula for calculating the normalized attention coefficient is as follows: ; in, The normalized attention coefficient between user node u and historical interaction item node j; ( ) is an exponential function; ( ) is the activation function; is the learnable attention weight vector; T is the transpose; The basic embedding for user node u; The basic embedding for the historical interactive project node j; The basic embedding for the historical interactive project node k; This is the set of historical interaction item nodes corresponding to user node u; The formula for determining the preference semantic features is as follows: ; in, The preference semantic features of user node u.

[0041] In an exemplary embodiment, the structure-aware features of each user node in step 202 above are determined as follows: Perform the second operation on each user node to obtain the structure-aware features of the corresponding user node; the second operation is as follows: Calculate the structural association weights between the user node and each of its corresponding first-order neighbor item nodes, and based on the structural association weights, perform weighted aggregation on the basic embeddings of all first-order neighbor item nodes corresponding to the user node to obtain the structural awareness features of the user node.

[0042] The formula for calculating the structural association weight is as follows: ; in, The structural association weights between user node u and its corresponding first-order neighbor item node v; For mapping functions; The representation of user node u in the first preset embedding space; The representation of a first-order neighbor item node v in the second preset embedding space.

[0043] The formula for calculating the structure-aware features is as follows: ; in, for Structural awareness features; set of first-order neighbor project nodes, The basic embedding for the first-order neighbor project node v.

[0044] The preference semantic features determined according to the above embodiments With structural perception features , will favor semantic features With structural perception features The information is fused using the Hadamard product to generate preference-guided condition information. : This preference guides conditional information. As a conditional input in the reverse denoising process, it is used to correct the denoising direction, so that the generated enhanced view can retain the graph structure information while more accurately maintaining the semantics of user preferences.

[0045] In another exemplary embodiment of this application, the user node's preference guidance condition information is obtained. Subsequently, this embodiment further performs inverse denoising on the noisy embedding matrix based on the preference guidance information of each user node, to obtain an enhanced node embedding matrix. Specifically, For each diffusion step, perform a reverse denoising operation until the last diffusion step, to obtain the enhanced node embedding matrix.

[0046] During the reverse denoising operation, the noisy embedding of each node in the noisy embedding matrix is ​​gradually restored to the embedding at step t-1 according to a Gaussian distribution; the embedding at step t-1 is determined by the noisy embedding at step t, the mean predicted by the basic denoising network, and the correction vector output by the conditional guidance network.

[0047] Specifically, the embedding x in step t-1 t-1 Given the noisy embedding x at the current t-th step t and preference guidance information Under these conditions, the probability distribution it follows is: ; in, For a noisy embedding at a given step t and user preference guidance information Under the condition that the embedding in step t-1 is The probability distribution it follows; y represents the preference guidance condition information; This refers to the embedding at step t-1 in the reverse denoising process; For the noisy embedding at step t; The mean value predicted by the base denoising network; To guide the intensity hyperparameter; This is the correction vector output by the conditionally guided network; Let be the variance of the reverse state transition; I is the identity matrix; The mean predicted by the basic denoising network is calculated in the following way: ; in, The mean value predicted by the base denoising network; Let be the cumulative variance correlation coefficient at step t; Let be the cumulative variance correlation coefficient at step t-1; For the noisy embedding at step t; Let t be the noise scale at step t; Clean embeddings predicted by the denoising network.

[0048] The diffusion model learns the denoising process by minimizing the reconstruction error. This application defines a diffusion reconstruction loss. The aim is to make the noise predicted by the diffusion model match the actual injected noise. Consistency, while introducing guiding terms, namely preference guiding condition information. Corrections are made. The diffusion reconstruction loss... The calculation formula is: ; in, For the spread and reconstruction losses; Let be the expectation symbol, representing the averaging over all possible forward diffusion processes; It is the conditional probability distribution of the forward process, which refers to the probability distribution of the noisy embedding xt at the t-th step given the original basic embedding x0. t Distribution; x is the square norm; x0 is the primitive fundamental embedding; This is the predicted output of the denoising network; To guide the intensity hyperparameter; This is the correction vector for the conditional guidance network.

[0049] In another exemplary embodiment of this application, the specific implementation process of step 203 above is as follows: First, two views are constructed for contrastive learning. The basic embedding matrix E output in step 201 is used as the first view (i.e., the original view), and the enhanced node embedding matrix generated after inverse denoising using the diffusion model in step 202 is used as the second view (i.e., the enhanced view). Then, the InfoNCE loss function is used as the contrastive learning loss function, aiming to maximize the consistency of the representation of the same node in the two views, while minimizing the similarity between different node representations, thereby improving the discriminativeness of node representations.

[0050] Specifically, the contrastive learning loss for user node u is: ; in, The contrastive learning loss is for user node u; A set of user nodes; The representation of user node u in the first view; The representation of user node u in the second view; The representation of user node m in the second view; ( ) represents the cosine similarity function; This is the temperature coefficient hyperparameter.

[0051] The contrastive learning loss for project nodes is calculated symmetrically with that for user nodes; the contrastive learning loss for project node i is: ; in, Let I be the contrastive learning loss for project node i; and let I be the set of project nodes. This is the representation of project node i in the first view; This is the representation of project node i in the second view; This is the representation of project node n in the second view.

[0052] Total contrastive learning loss The result is obtained by adding the contrastive learning loss of the user node and the contrastive learning loss of the project node: This contrastive learning task effectively preserves the structural and semantic information in the original graph by bringing the original view and the enhanced view of the same node closer together.

[0053] In another exemplary embodiment of this application, multi-hop neighbor information of each user node is mined based on the user-item interaction graph to obtain higher-order neighborhood information of each user node. Item nodes that do not directly interact with the corresponding user node are then selected from the higher-order neighborhood information to construct a negative sample candidate set for each user node. Specifically, this includes: Based on the user-item interaction graph, a graph neural network is used to aggregate information of each user node within a preset number of hops, and extract the high-order neighborhood information of each user node.

[0054] For each user node, project nodes that do not directly interact with the user node are selected from the user node's higher-order neighborhood information and identified as negative samples. The identified negative samples are then used to construct a negative sample candidate set for the user node.

[0055] An exemplary embodiment is provided, specifically: The graph neural network described in step 201 is used to aggregate information from each node within a preset hop count range, extracting high-order neighborhood information for each user node. In this embodiment, the preset hop count is 3, meaning that the multi-layer neighborhood aggregation output of the graph neural network is used to weightedly fuse the basic embeddings of item nodes from layer 1 to layer 3, or the basic embedding of item nodes in layer 3 is directly taken to represent the high-order neighborhood information of the user node within the 3-hop neighborhood. Specifically, for any user node u, the basic embeddings of its 1-hop, 2-hop, and 3-hop neighbors (i.e., the basic embeddings of the corresponding item nodes in the basic embedding matrix E output in step 201) can be obtained through the forward propagation of the graph neural network. These basic embeddings contain cooperative signals from low to high order.

[0056] Secondly, a negative sample candidate set is constructed for each user node. For any user node, among all item nodes in its 3-hop neighborhood, those that do not directly interact with the user node (i.e., are not 1-hop neighbors) are selected to form the negative sample candidate set C for that user. Although the item nodes in this negative sample candidate set have no direct edge connection to the user node in the user-item interaction graph, they are semantically close to the user node's preferences through higher-order propagation paths, and thus belong to potentially difficult negative samples. These negative samples can provide richer gradient information in subsequent training, helping to improve the model's discriminative ability.

[0057] In each training iteration, several project nodes are randomly sampled from the negative sample candidate set C as the negative sample set for the current batch, and the negative samples are dynamically filtered based on the subsequent truncation loss function to obtain the filtered result sample set, so as to suppress the interference of false negative samples.

[0058] In another exemplary embodiment of this application, negative samples are sampled from the negative sample candidate set, and the negative samples are dynamically filtered using a truncation loss function to obtain a filtered result sample set, specifically including: In each training iteration, M project nodes are sampled from the negative sample candidate set C as the negative sample set for the current batch.

[0059] Calculate the similarity between the enhanced node embedding of the user node and the enhanced node embedding of the positive sample item node, and calculate the similarity between the enhanced node embedding of the user node and the enhanced node embedding of the negative sample item node in the current batch; the positive sample item node is the item node directly connected to the user node.

[0060] The similarity is calculated using the following formula: ; ; in, User node u and positive sample item node i + Similarity score between them; For user node u and negative sample item node j - Similarity score between them; Enhanced node embedding for user node u; The enhanced node embedding for positive sample item node i+; The enhanced node embedding is for negative sample item node j-; T is the vector transpose. The negative sample item node is the item node sampled from the negative sample candidate set.

[0061] To prevent false negative samples (i.e., items that users are actually interested in but do not interact with) from interfering with training, a truncation loss function is introduced to dynamically filter negative samples.

[0062] A dynamic threshold is set. When the loss value of the recommendation main task corresponding to the negative sample item node in the current batch exceeds the dynamic threshold and the model predicts that the interaction probability of the user node with the negative sample item node in the current batch is higher than a preset threshold, the negative sample in the current batch is determined to be a false negative sample. After being determined to be a false negative sample, the loss of such samples is set to zero through a loss correction operation so that they do not participate in gradient update.

[0063] The mathematical expression for loss correction is as follows: ; ; Here, F represents the loss processing operation for the current triple (user node u, positive sample node i+, negative sample node j-). When both conditions on the right are met, F is assigned a value of 0, indicating that the loss of the negative sample node is set to zero, that is, the sample is ignored in this iteration and is not used for backpropagation to update the model parameters; u is the user node; + indicates a positive sample item node; This refers to the m-th negative sample item node sampled from the negative sample candidate set; This represents the BPR (Bayesian Personalized Ranking) loss value corresponding to the current triple; For dynamic thresholds; This indicates that the probability of the user interacting with the positive sample item is predicted to be 1.

[0064] Finally, negative samples with zeroed loss are removed from the current batch's negative sample set until all negative samples in the current batch have been traversed. The remaining negative samples in the current batch's negative sample set then constitute the current batch's filtered result sample set. This dynamic filtering mechanism effectively suppresses noise interference from false negative samples, ensuring that the model learns gradient information only from high-quality, difficult negative samples, thereby improving the model's discriminative ability and recommendation performance.

[0065] In another exemplary embodiment of this application, the specific implementation process of step 205 above is as follows: After obtaining the contrastive learning loss in step 203 Step 202 Inverse denoising loss After obtaining the sample set of the screening results through dynamic screening by truncation loss in step 204, this embodiment of the application further constructs a multi-task joint loss function and optimizes the model parameters through end-to-end training to finally generate a recommendation model.

[0066] First, based on the main recommendation task, define the Bayesian Personalized Ranking (BPR) loss L. bpr The loss function aims to improve recommendation ranking performance by ensuring that the predicted scores of positive samples (items that the user has interacted with in the past) are higher than those of negative samples (samples that the user has not interacted with and have been filtered).

[0067] The formula for calculating the Bayesian personalized ranking loss (recommendation main task loss) is as follows: ; in, The Bayesian personalized ranking loss for recommending the main task; Let be the set of positive sample item nodes for user node u; To filter the sample set of results; z is the embedding vector of node i in the positive sample project; u Let be the embedding vector of user node u; is the embedding vector of the negative sample item node j.

[0068] Then, the recommended main task loss will be... Comparative learning loss We weight the loss function with the diffusion reconstruction loss and add a regularization term to construct a joint loss function.

[0069] The formula for calculating the joint loss value is: ; in, To compare the learning loss weight hyperparameters; The weighting hyperparameters for the diffusion reconstruction loss; The regularization coefficient is used. The set of all trainable parameters of the model; For regularization terms; The Bayesian personalized ranking loss for recommending the main task; To compare learning loss; The losses were due to the spread of reconstruction.

[0070] During the model training phase, the Adam optimizer is used to optimize the joint loss function. Minimization optimization is performed. The gradients of the parameters of each module are calculated using the backpropagation algorithm, and the neighborhood aggregation parameters of LightGCN, the parameters of the base denoising network and conditional guidance network of the diffusion model, and the learnable parameters in the extraction of preference semantic features and structure-aware features are updated simultaneously. During training, steps 201 to 204 are executed for each batch, and calculations are performed. Then, the parameters are updated until the model's performance on the validation set no longer improves or reaches the preset number of training rounds. At this point, the model converges, and the final recommendation model is obtained.

[0071] In an exemplary embodiment, after iterative optimization of the joint loss function and model convergence, the trained recommendation model can be used to predict interaction probabilities and generate recommendation lists.

[0072] Specifically, for any user node u and any item node i, obtain the enhanced node embedding x of user node u output by the trained recommendation model. u And the enhanced node embedding x of project node i i .

[0073] The inner product operation is used to calculate the predicted interaction probability of user node u with project node i: ; in, This represents the predicted probability of interaction between user node u and project node i, reflecting the degree of preference of user node u for project node i; x u Enhanced node embedding for user node u; This is an enhanced node embedding for project node i. Based on the predicted interaction probability, the top k items are selected to form a recommendation list `List`, which is then output to the user. This recommendation list can then be used for personalized item recommendations in real-world scenarios.

[0074] This application uses three commonly used public datasets for model performance validation: Yelp2018, LastFM, and BeerAdvocate. All datasets are divided into training, validation, and test sets in a 7:2:1 ratio.

[0075] Table 1. Statistics of the dataset

[0076] This application also provides an application scenario in which the above-described method for determining a recommendation model based on diffusion contrast and multi-hop negative sampling is applied. Specifically, the method for determining a recommendation model based on diffusion contrast and multi-hop negative sampling provided in this embodiment can be applied to personalized recommendation scenarios in e-commerce platforms. This scenario includes data collection and preprocessing, personalized recommendation, and recommendation feedback and model optimization. The method for determining a recommendation model based on diffusion contrast and multi-hop negative sampling provided in this embodiment belongs to the personalized recommendation stage.

[0077] Based on the same inventive concept, embodiments of this application also provide a recommendation method based on a recommendation model of diffusion comparison and multi-hop negative sampling, such as... Figure 3 As shown, the recommended method includes: Step 301: Obtain user interaction data between the user and the project.

[0078] Step 302: Input the user-item interaction data into the recommendation model to obtain the noisy embedding vector of each node; the node can be an item node or a user node. The recommendation model is determined based on the method for determining the recommendation model based on diffusion contrast and multi-hop negative sampling described above.

[0079] Step 302: Based on the noisy embedding vector of each user node and the noisy embedding vector of each item node, determine the interaction probability of each user node with any item node, and determine the recommended items based on all interaction probabilities.

[0080] Based on the same inventive concept, embodiments of this application also provide a recommendation system based on diffusion contrast and multi-hop negative sampling, wherein the recommendation system specifically includes: The multi-hop neighbor negative sampling module is used to perform multi-layer neighborhood aggregation on the user-item interaction graph to obtain the basic embedding of each node in the user-item interaction graph; the basic embeddings of each node constitute a basic embedding matrix; the user-item interaction graph is determined based on the interaction data between users and items; the node is a user node or a item node.

[0081] The diffusion enhancement module is used to perform forward denoising on the basic embedding of each user node through a diffusion model, outputting a noisy embedding matrix, and then perform inverse denoising on the noisy embedding matrix based on the preference guidance condition information of each user node to obtain an enhanced node embedding matrix. Subsequently, the inverse denoising loss is calculated using the enhanced node embedding matrix. The preference guidance condition information includes preference semantic features and structure-aware features.

[0082] The contrastive learning module is used to calculate the contrastive learning loss using the base embedding matrix and the enhanced node embedding matrix as the first view and the second view, respectively, and the contrastive learning loss function and the first view and the second view corresponding to each node. The contrastive learning loss function is used to maximize the consistency of the representation of the same node in the first view and the second view.

[0083] The multi-hop negative sampling module is used to mine the multi-hop neighbor information of each user node based on the user-item interaction graph, obtain the high-order neighborhood information of each user node, filter the item nodes that do not directly interact with the corresponding user node from the high-order neighborhood information, construct the negative sample candidate set of each user node, sample negative samples from the negative sample candidate set, and dynamically filter the negative samples through the truncation loss function to obtain the filtered result sample set.

[0084] The joint optimization module is used to calculate a joint loss value based on the recommendation main task loss, contrastive learning loss, and reverse denoising loss. This joint loss value is then used to iteratively optimize the neural network until the optimized neural network converges, generating a recommendation model. The recommendation main task loss is constructed based on the noisy embedding matrix calculated from the user-item interaction graph and the noisy embedding matrix calculated from the filtering result sample set. The input to the recommendation model is the user-item interaction data, and the output is the noisy embedding matrix for each node. The noisy embedding matrix for each node is used to determine the predicted interaction probability.

[0085] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 5 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores user-item interaction diagrams. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a method for determining a recommendation model based on diffusion contrast and multi-hop negative sampling.

[0086] Figure 5The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0087] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0088] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0089] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations and be authorized by the owner of the corresponding device.

[0090] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0091] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0092] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0093] This application uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. In summary, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for determining a recommendation model based on diffusion contrast and multi-hop negative sampling, characterized in that, The determination method includes: Multi-level neighborhood aggregation is performed on the user-project interaction graph to obtain the basic embedding of each node in the user-project interaction graph; the basic embeddings of each node constitute a basic embedding matrix; the user-project interaction graph is determined based on the interaction data between users and projects; the node is a user node or a project node. The basic embedding of each user node is forward-denoised using a diffusion model to output a noisy embedding matrix. Then, the noisy embedding matrix is ​​reverse-denoised based on the preference guidance information of each user node to obtain an enhanced node embedding matrix. Subsequently, the reverse denoising loss is calculated using the enhanced node embedding matrix. The preference guidance information includes preference semantic features and structure-aware features. Using the base embedding matrix and the enhanced node embedding matrix as the first view and the second view respectively, the contrastive learning loss is calculated using the contrastive learning loss function and the first and second views corresponding to each node; the contrastive learning loss function is used to maximize the consistency of the representation of the same node in the first view and the second view. Based on the user-item interaction graph, multi-hop neighbor information of each user node is mined to obtain higher-order neighborhood information of each user node. Item nodes that do not directly interact with the corresponding user node are screened from the higher-order neighborhood information to construct a negative sample candidate set for each user node. Negative samples are sampled from the negative sample candidate set, and the negative samples are dynamically screened through a truncation loss function to obtain a set of screened sample results. The joint loss value is calculated based on the recommendation task loss, contrastive learning loss, and reverse denoising loss. This joint loss value is then used to iteratively optimize the neural network until it converges, generating the recommendation model. The recommendation task loss is constructed based on the noisy embedding matrix calculated from the user-item interaction graph and the noisy embedding matrix calculated from the filtering result sample set. The input to the recommendation model is the user-item interaction data, and the output is the noisy embedding matrix for each node. The noisy embedding matrix for each node is used to determine the predicted interaction probability.

2. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, The method for determining the preference semantic features of each user node is as follows: Perform the first operation on each user node to obtain the corresponding user node's preference semantic features; the first operation is: Based on the user node and the set of historical interaction item nodes corresponding to the user node, calculate the normalized attention coefficient between the user node and each of its corresponding historical interaction item nodes; the set of historical interaction item nodes includes one or more historical interaction item nodes. Based on the normalized attention coefficient, the basic embeddings of all historical interaction item nodes of the user node are weighted and aggregated to obtain the preference semantic features of the user node. The formula for calculating the normalized attention coefficient is as follows: ; In the formula, The normalized attention coefficient between user node u and historical interaction item node j; ( ) is an exponential function; ( ) is the activation function; is the learnable attention weight vector; T is the transpose; The basic embedding for user node u; The basic embedding for the historical interactive project node j; The basic embedding for the historical interactive project node k; This is the set of historical interaction item nodes corresponding to user node u; The formula for determining the preference semantic features is as follows: ; in, The preference semantic features of user node u.

3. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, The structure-aware features of each user node are determined as follows: Perform the second operation on each user node to obtain the structure-aware features of the corresponding user node; the second operation is as follows: Calculate the structural association weights between a user node and its corresponding first-order neighbor item nodes, and based on the structural association weights, perform weighted aggregation on the basic embeddings of all first-order neighbor item nodes corresponding to the user node to obtain the structural awareness features of the user node. The formula for calculating the structural association weight is as follows: ; in, The structural association weights between user node u and its corresponding first-order neighbor item node v; For mapping functions; The representation of user node u in the first preset embedding space; The representation of a first-order neighbor item node v in the second preset embedding space; The formula for calculating the structure-aware features is as follows: ; In the formula, For user nodes Structural perception features; For the set of first-order neighbor project nodes, The basic embedding for the first-order neighbor project node v.

4. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, The basic embedding of each user node is subjected to forward noise addition using a diffusion model, outputting a noisy embedding matrix, specifically including: A preset noise scheduling strategy is used to determine the noise scale of the diffusion model at each diffusion step; Calculate the cumulative variance correlation coefficient for each diffusion step based on the noise scale described in each diffusion step; Based on the cumulative variance correlation coefficient, Gaussian noise is added to the basic embedding of each node in the basic embedding matrix to obtain the noisy embedding corresponding to each diffusion step. The noisy embeddings of each node are combined into a noisy embedding matrix and output. The calculation method for the noisy embedding is as follows: ; in, For the noisy embedding at step t; Let be the cumulative variance correlation coefficient at step t; This serves as the basic embedding for a user node; Standard Gaussian noise; It is standard Gaussian noise and follows a standard normal distribution.

5. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 4, characterized in that, Based on the preference guidance information of each user node, inverse denoising is performed on the noisy embedding matrix to obtain an enhanced node embedding matrix, specifically including: For each diffusion step, perform a reverse denoising operation until the last diffusion step, to obtain the enhanced node embedding matrix; During the reverse denoising operation, the noisy embedding of each node in the noisy embedding matrix is ​​gradually restored to the embedding at step t-1 according to a Gaussian distribution; the embedding at step t-1 is determined by the noisy embedding at step t, the mean predicted by the basic denoising network, and the correction vector output by the conditional guidance network.

6. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, The contrastive learning loss function is the InfoNCE loss function; The contrastive learning loss for user node u is: ; in, The contrastive learning loss is for user node u; A set of user nodes; The representation of user node u in the first view; The representation of user node u in the second view; The representation of user node m in the second view; ( ) represents the cosine similarity function; This refers to the temperature coefficient hyperparameter. The contrastive learning loss for project nodes is calculated symmetrically with that for user nodes; the contrastive learning loss for project node i is: ; In the formula, Let I be the contrastive learning loss for project node i; and let I be the set of project nodes. This is the representation of project node i in the first view; This is the representation of project node i in the second view; This is the representation of project node n in the second view.

7. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, Based on the user-item interaction graph, multi-hop neighbor information of each user node is mined to obtain higher-order neighborhood information of each user node, specifically including: Based on the user-item interaction graph, a graph neural network is used to aggregate information of each user node within a preset number of hops, and extract the high-order neighborhood information of each user node.

8. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, Negative samples are sampled from the negative sample candidate set, and the negative samples are dynamically filtered using a truncation loss function to obtain a filtered result sample set, specifically including: In each training iteration, several project nodes are sampled from the negative sample candidate set as the negative sample set for the current batch; Calculate the similarity between the enhanced node embedding of the user node and the enhanced node embedding of the positive sample item node, and calculate the similarity between the enhanced node embedding of the user node and the enhanced node embedding of the negative sample item node in the current batch; the positive sample item node is the item node directly connected to the user node. A dynamic threshold is set. When the loss value of the recommendation main task corresponding to the negative sample item node in the current batch exceeds the dynamic threshold and the model predicts that the interaction probability of the user node with the negative sample item node in the current batch is higher than the preset threshold, the negative sample in the current batch is determined to be a false negative sample. Set the loss of negative samples that are judged as false negatives to zero; Negative samples with zero loss are removed from the current batch of negative samples until all negative samples in the current batch of negative samples have been traversed. The remaining negative samples in the current batch of negative samples then form the current batch of filtered result sample set. The final set of filtered results is obtained by summing up the sample sets of all batches.

9. The method for determining the recommendation model based on diffusion comparison and multi-hop negative sampling according to claim 1, characterized in that, The formula for calculating the loss of the recommended main task is as follows: ; in, The Bayesian personalized ranking loss for recommending the main task; Let be the set of positive sample item nodes for user node u; To filter the sample set of results; Let i be the embedding vector of the positive sample item node i; Let be the embedding vector of user node u; The embedding vector of the negative sample item node j; The formula for calculating the joint loss value is as follows: ; In the formula, To compare the learning loss weight hyperparameters; The weighting hyperparameters for the diffusion reconstruction loss; The regularization coefficient is used. The set of all trainable parameters of the model; For regularization terms; The Bayesian personalized ranking loss for recommending the main task; To compare learning loss; The losses were due to the spread of reconstruction.

10. A recommendation method based on a recommendation model using diffusion contrast and multi-hop negative sampling, characterized in that, The recommendation method includes: Obtain user interaction data between the user and the project; User-item interaction data is input into the recommendation model to obtain a noisy embedding vector for each node; the node can be an item node or a user node; the recommendation model is determined based on the method for determining the recommendation model based on diffusion contrast and multi-hop negative sampling as described in any one of claims 1-9; Based on the noisy embedding vector of each user node and the noisy embedding vector of each item node, the interaction probability of each user node with any item node is determined, and the recommended items are determined based on all interaction probabilities.