Collaborative filtering recommendation method for large language model semantic enhancement based on comparative learning
By combining a user-item bipartite graph with a large language model, and using graph neural networks and structured prompt templates to generate semantic neighborhood expansion and reconstruction views, we address the limited semantic expression of ID modeling and improve the accuracy and cold start capability of the recommendation system.
Patent Information
- Application Number
- CN202510851780.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-10-03
AI Technical Summary
The existing ID modeling semantic expression is limited and it is difficult to directly integrate it with the large language model in depth, resulting in insufficient accuracy and cold start capability of the recommendation system.
By constructing a user-item bipartite graph, using graph neural networks and large language models, and combining structured prompt templates and topological view enhancement strategies, we generate semantic neighborhood expansion and reconstruction views to achieve alignment and deep fusion of collaborative information and semantic information.
It significantly improves the accuracy and cold start capability of the recommendation system, alleviates the sparsity problem of traditional ID modeling, and achieves a deep integration of semantic and structural features.
Smart Images

Figure CN120744233A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of recommendation systems, and in particular to a collaborative filtering recommendation method based on contrastive learning and semantic enhancement of a large language model. Background Art
[0002] In recent years, recommender systems have demonstrated significant value in improving information screening efficiency. Graph neural networks (GNNs), in particular, have become a mainstream approach for user and item modeling, thanks to their ability to capture high-order structural relationships. However, under the influence of implicit feedback noise and the discrete nature of ID representations, traditional ID-based collaborative modeling has gradually exposed modeling biases and limited semantic expression. Previous research has attempted to mitigate these limitations through decoupled representation learning and contrastive learning, but these efforts have yet to completely bridge the gap between ID signals and the true semantic space. The development of large language models (LLMs) has provided a new opportunity to incorporate rich semantic knowledge, but direct application to recommender systems remains challenging due to limitations in inference efficiency, scalability, and input format. While methods such as RLMRec attempt to align semantic and collaborative representations through contrastive learning, the lack of optimization of interaction structure still results in semantic and structural inconsistencies. Further research (such as DaRec, LLaRD, and DisCo) has mitigated modal interference through feature space decoupling, but this also faces the dilemma of balancing the degree of decoupling with semantic integrity. Therefore, how to establish more coherent cross-modal semantic associations at the graph structure level and further promote the deep integration of collaborative signals and semantic knowledge has become an important direction for improving the robustness and expressiveness of recommendation systems. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning, aiming to solve the problem that the existing ID modeling semantic expression is limited and difficult to directly combine deeply with the large language model. Through collaborative graph structure learning and semantic enhancement, the accuracy and cold start capability of the recommendation system are significantly improved.
[0004] To solve the above technical problems, the technical solution adopted by the present invention is: a collaborative filtering recommendation method based on contrastive learning and semantic enhancement of a large language model, comprising the following steps:
[0005] S1. Constructing a user-item bipartite graph. Proposing user-item semantic information collaboration information through GNN: Based on user-item implicit feedback, extract the interaction intensity information of users or items whose interaction behaviors exceed a certain number in user behavior logs, and construct a user-item bipartite graph. Then, the aggregated features of neighbor nodes are normalized in the graph neural network through a message passing mechanism based on cross-layer symmetric normalization;
[0006] S2. Extracting user-item semantic information using prompt words: Using structured prompt template technology, the system converts unstructured textual information about users and items into quantifiable semantic vector representations.
[0007] S3, Deterministic Topology View Enhancement Strategy: This strategy uses a structure-aware mechanism to identify key nodes and connections in the interaction graph, dynamically adjusts the discard probability using a decay factor, and prioritizes the retention of high-value interaction information.
[0008] S4. Generate semantic neighborhood extended view: Based on the deterministic topology view enhancement strategy, selectively replace the non-semantic related edges in the user's original neighborhood, retain the original interaction edges that are weakly associated with the user's behavior, and introduce LLMs modeling to obtain semantic related edges;
[0009] S5. Generate a semantic neighborhood reconstruction view: This fully preserves the user's historical interaction neighborhoods and, based on the deterministic topology view enhancement strategy, selectively adds semantically related nodes to form a graph structure with higher information density.
[0010] S6. Collaboration and semantic information alignment: Design a contrastive distillation objective based on graph neural networks and large language models to align the collaboration information and semantic information representation of users and items in a shared space;
[0011] S7, Dual-view structural alignment: Based on the two graph structure views generated by semantic enhancement, a symmetric contrast loss function is constructed to ensure that the representations of the same user and item in different views maintain structural consistency;
[0012] S8. Overall training loss function: The overall training objective is achieved by integrating the basic ranking loss, regularization loss, collaborative and semantic information alignment loss, and dual-view structure alignment loss.
[0013] The further improvement of the technical solution of the present invention is that the specific steps of step S1 are as follows:
[0014] S11, the interaction graph G is constructed based on the interaction records between users and items in the recommendation, and the user node set in the graph G is The item node collection is and one type of undirected edge The undirected edges on the graph reflect the interaction between users and items, which are specifically represented as follows:
[0015] U s ={u1,u2,...,u i}, (1)
[0016] V q ={v1,v2,...,v i}, (2)
[0017]
[0018] S12. In the graph neural network, the aggregate features of neighbor nodes are normalized through a message passing mechanism based on cross-layer symmetric normalization: for any node, its embedding representation at layer l is updated according to the following formula:
[0019]
[0020] Among them, the neighbor set Follow the adjacency constraint of the bipartite graph, that is: if node i is a user node (i∈U s ), then its neighbor j must be an item node (j∈V q ); If node i is an item node (i∈V q ), then its neighbor j must be a user node (j∈U s ).
[0021] A further improvement of the technical solution of the present invention is that the specific steps of step S2 are as follows:
[0022] S21, encode unstructured text information into semantic vectors through structured prompt templates; for any user Its semantic feature vector By the large language model f LLM : Spawn, Item Semantic vector of By f LLM : Generate, specifically as follows:
[0023]
[0024] Among them, P user and P item It is a fixed prompt prefix in the structured prompt template. Profile(u) represents the user's profile, and Desc(v) represents the specific description of the item.
[0025] A further improvement of the technical solution of the present invention is that the specific steps of step S3 are as follows:
[0026] S31, using the K-core decomposition method, dynamically determine the core parameter search space of user nodes and item nodes, Q p (·) represents the p-th quantile function of node degree distribution, d u and d i Represent the degrees of user nodes and item nodes respectively, and are expressed as follows:
[0027]
[0028]
[0029] S32. For each set of coreness parameter combinations Perform iterative topology pruning, the initial adjacency matrix is A (0) , the adjacency matrix after each round of iterative pruning is specifically expressed as follows:
[0030]
[0031] Pruning operator The specific definitions are as follows:
[0032]
[0033] S33, the importance weight vector of the node is calculated by accumulating the number of times it survives in multiple rounds of pruning. is the indicator function, which is expressed as follows:
[0034]
[0035] If node v still exists in the graph after a round of pruning, it is counted as 1; finally, the user node importance weight vector can be obtained Item node importance weight vector
[0036] S34. The importance weight vector of the edge is calculated based on the importance weight vector of its connected nodes. For any edge e ui ∈ε, its importance weight is defined as follows:
[0037]
[0038] Among them, φ(x) is a nonlinear enhancement function;
[0039] S35. Finally, based on the edge weight, the inactivation probability of each edge is defined, which is specifically expressed as follows:
[0040]
[0041] where p dr (x) is the importance weight of the edge The less important the edge, the greater the probability of inactivation.
[0042] A further improvement of the technical solution of the present invention is that the specific steps of step S4 are as follows:
[0043] S41. In the semantic neighbor expansion mode, while retaining the original interaction edges, semantically related neighbor nodes generated by LLM are added to construct additional edges. That is, for user node u and item i, the semantically expanded edge set is defined as:
[0044]
[0045] in, represents the historical interaction neighbor set of user u, represents the historical interaction neighbor set of item i, Represents the user's global semantic node space Semantically related neighbors selected from Represents the global semantic node space of the item Semantically related neighbors selected from represents the original interaction nodes that are not selected as user semantic neighbors, Represents the original interaction nodes that are not selected as semantic neighbors of the item.
[0046] A further improvement of the technical solution of the present invention is that the specific steps of step S5 are as follows:
[0047] S51. In the semantic neighbor reconstruction mode, the local neighbor structure is selectively reconstructed, replacing some of the original neighbor nodes and injecting the semantically related nodes obtained by LLM reasoning. Specifically, the reconstructed edge set of user u and item i is defined as:
[0048]
[0049] in, represents the historical interaction neighbor set of user u, represents the historical interaction neighbor set of item i, Represents the user's global semantic node space Semantically related neighbors selected from Represents the global semantic node space of the item Semantically related neighbors are selected from .
[0050] A further improvement of the technical solution of the present invention is that the specific steps of step S6 are as follows:
[0051] S61. For each user or item, obtain two representations: Interactive feature representation based on GNN; Semantic feature representation based on LLM; each node has a set of embedding vectors of "interaction perspective" and "semantic perspective";
[0052] S62. Define sample categories and negative sample pools, and divide samples into three categories: user (u), item positive samples (+), and item negative samples (-). For each category of samples, construct a negative sample pool with the same category semantic feature representation. That is, other samples are selected from the semantic feature representation of the same category as negative examples;
[0053] S63, intra-batch contrastive learning brings the interaction representation and semantic representation of the same sample closer, while pushing away negative samples with similar semantic feature representations. The specific loss function is:
[0054]
[0055] s(·,·) represents the similarity calculation function (such as cosine similarity); τ is the temperature coefficient, which is used to control the smoothness of the distribution; is a set of sample categories; It represents a set of negative samples with the same semantic features.
[0056] A further improvement of the technical solution of the present invention is that the specific steps of step S7 are as follows:
[0057] S71. Extract node semantic features and use the frozen parameter LLM to encode the user portrait text and item description text to obtain the node semantic feature matrix:
[0058]
[0059] φ LLM (·) represents a pre-trained large language model; is the node text description matrix; is the total number of nodes and d is the output dimension.
[0060] S72. Concatenate the original interaction initial feature Z0 with the semantic feature S to generate the semantically enhanced initial embedding:
[0061]
[0062] This enhancement feature is used to initialize two structural enhancement views:
[0063]
[0064] S73. Use the GNN encoder to propagate and update features on two semantic enhancement graphs:
[0065]
[0066] represents the enhanced graph constructed based on semantic neighborhood reconstruction; represents the enhanced graph built based on semantic neighborhood expansion; is the node representation of the view m corresponding to the lth layer. Finally, the node representations output by the two views are: The encoded output Z ' ; from The encoding output is Z";
[0067] S74. Use symmetric contrast learning to make the representation of the same node in different perspectives close, while pushing other nodes away. Specifically, for a small batch of sample sets For each user node u or each item node i in , the loss function is defined as:
[0068]
[0069] where s(·,·) represents the cosine similarity function; τ is the temperature hyperparameter that controls the smoothness of the distribution; represents negative sample users; Represents negative sample items;
[0070] S75, the dual-view comparison alignment loss on the user side and the item side is summarized as:
[0071]
[0072] A further improvement of the technical solution of the present invention is that the specific steps of step S8 are as follows:
[0073] S81. The overall loss consists of the following components: A Bayesian personalized ranking loss based on ,used to model user preferences; Regularization loss for model parameters to prevent overfitting; Interaction-semantic distillation loss promotes alignment of representations in different spaces; It is a dual-view comparison alignment loss that improves the consistency of node representation;
[0074] S82. The final overall loss is defined as:
[0075]
[0076] where the hyperparameter α controls the distillation loss The weight of the hyperparameter β controls the dual-view contrast loss The weight of the hyperparameter λ is used to adjust the regularization term strength.
[0077] By adopting the above technical solution, the present invention achieves the following technical advancements: by setting up a structure-aware mechanism to identify key nodes and connections in the interaction graph, calculating the discard probability of edges in the interaction graph based on the node weights in the user-item interaction graph, and then dynamically adjusting the discard probability using a decay factor, it is possible to prioritize the retention of high-value interaction information;
[0078] By designing enhanced views of semantic neighborhood expansion and reconstruction, the input feature space of graph neural networks is enriched with the help of semantic neighborhood injection of LLMs, which can effectively alleviate the sparsity problem of traditional ID-based interaction data, thereby improving representation learning capabilities.
[0079] By setting up a three-view comparative learning method, it can effectively integrate the semantic information extracted by the large language model (LLM) into the graph structure, achieving a deep fusion of semantic and structural features. Compared with many state-of-the-art methods, this method has a competitive advantage. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0081] Figure 1 is a flow chart of the method recommended by the present invention;
[0082] Figure 2 Schematic diagram of the structure of the recommendation framework constructed according to the recommendation method of the present invention. DETAILED DESCRIPTION
[0083] The present invention is described in further detail below in conjunction with the embodiments:
[0084] like Figure 1 , Figure 2 , which is a schematic diagram of a collaborative filtering recommendation method based on contrastive learning and semantic enhancement of a large language model in this application. The specific steps are as follows:
[0085] S1. Constructing a user-item bipartite graph. Proposing user-item semantic information collaboration information through GNN: Based on user-item implicit feedback (such as clicks, browsing records), extract the interaction intensity information of users or items with more than 3 interactions in the user behavior log, and construct a user-item bipartite graph. The aggregated features of neighbor nodes are then normalized through a message passing mechanism based on cross-layer symmetric normalization in the graph neural network.
[0086] S11, the interaction graph G is constructed based on the interaction records between users and items in the recommendation, and the user node set in the graph G is The item node collection is and one type of undirected edge The undirected edges on the graph reflect the interaction between users and items, which are specifically represented as follows:
[0087] Us ={u1,u2,...,u i}, (1)
[0088] V q ={v1,v2,...,v i}, (2)
[0089]
[0090] S12. Normalize the aggregated features of neighbor nodes in the graph neural network through a message passing mechanism based on cross-layer symmetric normalization. Specifically, for any node, its embedding representation at layer l is updated according to the following formula:
[0091]
[0092] Among them, the neighbor set Follow the adjacency constraint of the bipartite graph, that is: if node i is a user node (i∈U s ), then its neighbor j must be an item node (j∈V q ); If node i is an item node (i∈V q ), then its neighbor j must be a user node (j∈U s ).
[0093] S2. Extracting user-item semantic information using prompt words: Using structured prompt template technology, the system converts unstructured textual information about users and items into quantifiable semantic vector representations.
[0094] S21, encode the unstructured text information into a semantic vector through the structured prompt template. Its semantic feature vector By the large language model f LLM : Generate. Similarly, items Semantic vector of By f LLM : Generate. The specific expression is as follows:
[0095]
[0096] Among them, P user and P item It is a fixed prompt prefix in the structured prompt template. Profile(u) represents the user's profile, and Desc(v) represents the specific description of the item.
[0097] S3, Deterministic Topology View Enhancement Strategy: This strategy uses a structure-aware mechanism to identify key nodes and connections in the interaction graph, dynamically adjusts the discard probability using a decay factor, and prioritizes the retention of high-value interaction information.
[0098] S31. Use the K-core decomposition method to dynamically determine the core parameter search space of user nodes and item nodes. p (·) represents the p-th quantile function of node degree distribution, d u and d i Represents the degree of user node and item node respectively. The specific representation is as follows:
[0099]
[0100] S32. For each set of coreness parameter combinations Perform iterative topology pruning. The initial adjacency matrix is A (0) , the adjacency matrix after each round of iterative pruning is specifically expressed as follows:
[0101]
[0102] Pruning operator The specific definitions are as follows:
[0103]
[0104] S33, the importance weight vector of the node is calculated by accumulating the number of times it survives in multiple rounds of pruning. is the indicator function, which is expressed as follows:
[0105]
[0106] If node v still exists in the graph after a round of pruning, it is counted as 1. Finally, the user node importance weight vector can be obtained Item node importance weight vector
[0107] S34. The importance weight vector of the edge is calculated based on the importance weight vector of its connected nodes. For any edge e ui ∈ε, its importance weight is defined as follows:
[0108]
[0109] Among them, φ(x) is a nonlinear enhancement function.
[0110] S35. Finally, based on the edge weight, the inactivation probability of each edge is defined, which is specifically expressed as follows:
[0111]
[0112] where p dr (x) is the importance weight of the edge The less important the edge, the greater the probability of inactivation.
[0113] S4. Generate semantic neighborhood extended view: Based on the deterministic topology view enhancement strategy, selectively replace the non-semantic related edges in the user's original neighborhood, retain the original interaction edges that are weakly associated with the user's behavior, and introduce LLMs modeling to obtain semantic related edges;
[0114] S41. In the semantic neighbor expansion mode, while retaining the original interaction edges, semantically related neighbor nodes obtained by LLM reasoning are added to construct additional edges. Specifically, for user node u and item i, the edge set after semantic expansion is defined as:
[0115]
[0116] in, represents the historical interaction neighbor set of user u, represents the historical interaction neighbor set of item i, Represents the user's global semantic node space Semantically related neighbors selected from Represents the global semantic node space of the item Semantically related neighbors selected from represents the original interaction nodes that are not selected as user semantic neighbors, Represents the original interaction nodes that are not selected as semantic neighbors of the item.
[0117] S5. Generate a semantic neighborhood reconstruction view: This fully preserves the user's historical interaction neighborhoods and, based on the deterministic topology view enhancement strategy, selectively adds semantically related nodes to form a graph structure with higher information density.
[0118] S51. In the semantic neighbor reconstruction mode, we selectively reconstruct the local neighbor structure, replacing some of the original neighbor nodes and injecting semantically related nodes obtained by LLM reasoning. Specifically, the reconstructed edge set of user u and item i is defined as:
[0119]
[0120] in, represents the historical interaction neighbor set of user u, represents the historical interaction neighbor set of item i, Represents the user's global semantic node space Semantically related neighbors selected from Represents the global semantic node space of the item Semantically related neighbors are selected from .
[0121] S6. Collaboration and semantic information alignment: Design a contrastive distillation objective based on graph neural networks and large language models to align the collaboration information and semantic information representation of users and items in a shared space;
[0122] S61. For each user or item, we obtain two representations: Interactive feature representation based on GNN. Semantic feature representation based on LLM. Each node has a set of embedding vectors of "interaction perspective" and "semantic perspective".
[0123] S62. Define sample categories and negative sample pools, and divide samples into three categories: user (u), item positive samples (+), and item negative samples (-). For each category of samples, construct a negative sample pool with the same category semantic feature representation. That is, other samples are selected from the semantic feature representation of the same category as negative examples.
[0124] S63, intra-batch contrastive learning brings the interaction representation and semantic representation of the same sample closer, while pushing away negative samples with similar semantic feature representations. The specific loss function is:
[0125]
[0126] s(·,·) represents the similarity calculation function (such as cosine similarity); τ is the temperature coefficient, which is used to control the smoothness of the distribution; is a set of sample categories; It represents a set of negative samples with the same semantic features.
[0127] S7, Dual-view structural alignment: Based on the two graph structure views generated by semantic enhancement, a symmetric contrast loss function is constructed to ensure that the representations of the same user and item in different views maintain structural consistency;
[0128] S71. Extract node semantic features and use the frozen parameter LLM to encode the user portrait text and item description text to obtain the node semantic feature matrix:
[0129]
[0130] φ LLM (·) represents a pre-trained large language model; is the node text description matrix; is the total number of nodes and d is the output dimension.
[0131] S72. Concatenate the original interaction initial feature Z0 with the semantic feature S to generate the semantically enhanced initial embedding:
[0132]
[0133] This enhancement feature is used to initialize two structural enhancement views:
[0134]
[0135] S73. Use the GNN encoder to propagate and update features on two semantic enhancement graphs:
[0136]
[0137] represents the enhanced graph constructed based on semantic neighborhood reconstruction; represents the enhanced graph built based on semantic neighborhood expansion; is the node representation of the view m corresponding to the lth layer. Finally, the node representations output by the two views are: The encoded output Z ' ; from The encoded output is Z".
[0138] S74, using symmetric contrast learning to make the representation of the same node in different perspectives as close as possible, while pushing other nodes away. Specifically, for a small batch of sample sets For each user node u or each user node i in , the loss function is defined as:
[0139]
[0140] where s(·,·) represents the cosine similarity function; τ is the temperature hyperparameter that controls the smoothness of the distribution; represents negative sample users; Represents negative sample items.
[0141] S75, the dual-view comparison alignment loss on the user side and the item side is summarized as:
[0142]
[0143] S8. Overall training loss function: The overall training objective is achieved by integrating the basic ranking loss, regularization loss, collaborative and semantic information alignment loss, and dual-view structure alignment loss.
[0144] S81. The overall loss consists of the following components: Based Bayesian Personalized Ranking Loss (BPRLoss) for modeling user preferences; Regularization Loss is the regularization loss of model parameters to prevent overfitting; Interaction-Semantic Distillation Loss, which promotes the alignment of representations in different spaces; Dual-View Contrastive Alignment Loss is used to improve the consistency of node representation.
[0145] S82. The final overall loss is defined as:
[0146]
[0147] where the hyperparameter α controls the distillation loss The weight of the hyperparameter β controls the dual-view contrast loss The weight of the hyperparameter λ is used to adjust the regularization term strength.
[0148] The embodiments described above are merely descriptions of preferred implementations of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should fall within the scope of protection determined by the claims of the present invention.
Claims
1. A collaborative filtering recommendation method based on contrastive learning and semantic enhancement of a large language model, characterized by: The following steps are involved: S1. Constructing a user-item bipartite graph. Proposing user-item semantic information collaboration information through GNN: Based on user-item implicit feedback, extract the interaction intensity information of users or items whose interaction behaviors exceed a certain number in user behavior logs, and construct a user-item bipartite graph. Then, the aggregated features of neighbor nodes are normalized in the graph neural network through a message passing mechanism based on cross-layer symmetric normalization; S2. Extracting user-item semantic information using prompt words: Using structured prompt template technology, the system converts unstructured textual information about users and items into quantifiable semantic vector representations. S3, Deterministic Topology View Enhancement Strategy: This strategy uses a structure-aware mechanism to identify key nodes and connections in the interaction graph, dynamically adjusts the discard probability using a decay factor, and prioritizes the retention of high-value interaction information. S4. Generate semantic neighborhood extended view: Based on the deterministic topology view enhancement strategy, selectively replace the non-semantic related edges in the user's original neighborhood, retain the original interaction edges that are weakly associated with the user's behavior, and introduce LLMs modeling to obtain semantic related edges; S5. Generate a semantic neighborhood reconstruction view: This fully preserves the user's historical interaction neighborhoods and, based on the deterministic topology view enhancement strategy, selectively adds semantically related nodes to form a graph structure with higher information density. S6. Collaboration and semantic information alignment: Design a contrastive distillation objective based on graph neural networks and large language models to align the collaboration information and semantic information representation of users and items in a shared space; S7, Dual-view structural alignment: Based on the two graph structure views generated by semantic enhancement, a symmetric contrast loss function is constructed to ensure that the representations of the same user and item in different views maintain structural consistency; S8. Overall training loss function: The overall training objective is achieved by integrating the basic ranking loss, regularization loss, collaborative and semantic information alignment loss, and dual-view structure alignment loss.
2. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S1 are as follows: S11, the interaction graph G is constructed based on the interaction records between users and items in the recommendation, and the user node set in the graph G is The item node collection is and one type of undirected edge The undirected edges on the graph reflect the interaction between users and items, which are specifically represented as follows: U s ={u1,u2,...,u i }, (1) V q ={v1,v2,...,v i }, (2) S12. In the graph neural network, the aggregate features of neighbor nodes are normalized through a message passing mechanism based on cross-layer symmetric normalization: for any node, its embedding representation at layer l is updated according to the following formula: Among them, the neighbor set Follow the adjacency constraint of the bipartite graph, that is: if node i is a user node (i∈U s ), then its neighbor j must be an item node (j∈V q ); If node i is an item node (i∈V q ), then its neighbor j must be a user node (j∈U s ).
3. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S2 are as follows: S21, encode unstructured text information into semantic vectors through structured prompt templates; for any user Its semantic feature vector By large language model Spawn, Item Semantic vector of pass Generate, specifically as follows: Among them, P user and P item It is a fixed prompt prefix in the structured prompt template. Profile(u) represents the user's profile, and Desc(v) represents the specific description of the item.
4. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S3 are as follows: S31, using the K-core decomposition method, dynamically determine the core parameter search space of user nodes and item nodes, Q p (·) represents the p-th quantile function of node degree distribution, d u and d i Represent the degrees of user nodes and item nodes respectively, and are expressed as follows: S32. For each set of coreness parameter combinations Perform iterative topology pruning, the initial adjacency matrix is A (0) , the adjacency matrix after each round of iterative pruning is specifically expressed as follows: Pruning operator The specific definitions are as follows: S33, the importance weight vector of the node is calculated by accumulating the number of times it survives in multiple rounds of pruning. is the indicator function, which is expressed as follows: If node v still exists in the graph after a round of pruning, it is counted as 1; finally, the user node importance weight vector can be obtained Item node importance weight vector S34. The importance weight vector of the edge is calculated based on the importance weight vector of its connected nodes. For any edge e ui ∈ε, its importance weight is defined as follows: Among them, φ(x) is a nonlinear enhancement function; S35. Finally, based on the edge weight, the inactivation probability of each edge is defined, which is specifically expressed as follows: where p dr (x) is the importance weight of the edge The less important the edge, the greater the probability of inactivation.
5. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S4 are as follows: S41. In the semantic neighbor expansion mode, while retaining the original interaction edges, semantically related neighbor nodes obtained by LLM reasoning are added to construct additional edges. That is, for user node u and item i, the semantically expanded edge set is defined as: in, represents the historical interaction neighbor set of user u, represents the historical interaction neighbor set of item i, Represents the user's global semantic node space Semantically related neighbors selected from Represents the global semantic node space of the item Semantically related neighbors selected from represents the original interaction nodes that are not selected as user semantic neighbors, Represents the original interaction nodes that are not selected as semantic neighbors of the item.
6. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S5 are as follows: S51. In the semantic neighbor reconstruction mode, the local neighbor structure is selectively reconstructed, replacing some of the original neighbor nodes and injecting the semantically related nodes obtained by LLM reasoning. Specifically, the reconstructed edge set of user u and item i is defined as: in, represents the historical interaction neighbor set of user u, represents the historical interaction neighbor set of item i, Represents the user's global semantic node space Semantically related neighbors selected from Represents the global semantic node space of the item Semantically related neighbors are selected from .
7. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S6 are as follows: S61. For each user or item, obtain two representations: Interactive feature representation based on GNN; Semantic feature representation based on LLM; each node has a set of embedding vectors of "interaction perspective" and "semantic perspective"; S62. Define sample categories and negative sample pools, and divide samples into three categories: user (u), item positive samples (+), and item negative samples (-). For each category of samples, construct a negative sample pool with the same category semantic feature representation. That is, other samples are selected from the semantic feature representation of the same category as negative examples; S63, intra-batch contrastive learning brings the interaction representation and semantic representation of the same sample closer, while pushing away negative samples with similar semantic feature representations. The specific loss function is: s(·,·) represents the similarity calculation function (such as cosine similarity); τ is the temperature coefficient, which is used to control the smoothness of the distribution; is a set of sample categories; It represents a set of negative samples with the same semantic features.
8. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S7 are as follows: S71. Extract node semantic features and use the frozen parameter LLM to encode the user portrait text and item description text to obtain the node semantic feature matrix: φ LLM (·) represents a pre-trained large language model; is the node text description matrix; is the total number of nodes and d is the output dimension. S72. Concatenate the original interaction initial feature Z0 with the semantic feature S to generate the semantically enhanced initial embedding: This enhancement feature is used to initialize two structural enhancement views: S73. Use the GNN encoder to propagate and update features on two semantic enhancement graphs: represents the enhanced graph constructed based on semantic neighborhood reconstruction; represents the enhanced graph built based on semantic neighborhood expansion; is the node representation of the view m corresponding to the lth layer. Finally, the node representations output by the two views are: The encoded output Z ' ; from The encoding output is Z"; S74. Use symmetric contrast learning to make the representation of the same node in different perspectives close, while pushing other nodes away. Specifically, for a small batch of sample sets For each user node u or each item node i in , the loss function is defined as: where s(·,·) represents the cosine similarity function; τ is the temperature hyperparameter that controls the smoothness of the distribution; represents negative sample users; Represents negative sample items; S75, the dual-view comparison alignment loss on the user side and the item side is summarized as:
9. The collaborative filtering recommendation method with semantic enhancement of a large language model based on contrastive learning according to claim 1, characterized in that: The specific steps of step S8 are as follows: S81. The overall loss consists of the following components: A Bayesian personalized ranking loss based on ,used to model user preferences; Regularization loss for model parameters to prevent overfitting; Interaction-semantic distillation loss promotes alignment of representations in different spaces; It is a dual-view comparison alignment loss that improves the consistency of node representation; S82. The final overall loss is defined as: where the hyperparameter α controls the distillation loss The weight of the hyperparameter β controls the dual-view contrast loss The weight of the hyperparameter λ is used to adjust the regularization term strength.
Citation Information
Cited By
Recommendation method and system based on large language model enhancement and structured alignment
CN121188292A
Recommendation method and device based on large language model and computer program product
CN121598037A
A recommendation method, device and computer program product based on a large language model
CN121598037B
Target analysis method and system for multi-modal information collaborative enhancement
CN122176333A