Recommendation method and system based on large language model enhancement and structured alignment
By generating deep semantic information through a large language model and combining it with graph topology, a high-quality positive sample set is constructed. This solves the problem of insufficient fusion of semantic and collaborative information in recommendation models, and improves recommendation accuracy and robustness, especially in performance under data sparsity and cold start scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-24
- Publication Date
- 2026-03-31
AI Technical Summary
Existing recommendation models lack sufficient fusion of semantic and collaborative information, resulting in poor performance, especially in scenarios with sparse data and cold starts. Traditional methods cannot effectively capture deep-seated user preferences, and the construction of positive samples through comparative learning is susceptible to noise.
We utilize large language models to generate deep semantic information, combine the topological structure of graphs to constrain collaborative embeddings through manifold optimization, construct a high-quality positive sample set, and improve the model's learning ability in data sparse and cold-start scenarios through multi-view subspace clustering and contrastive learning.
It significantly improves the accuracy and robustness of recommendations, enabling more precise identification of homogeneous node groups and enhancing the model's learning ability and generalization performance in scenarios with sparse data and cold start.
Smart Images

Figure CN121188292B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer technology and relates to a large language model enhancement graph recommendation method based on subspace self-expression. It is a recommendation method and system based on large language model enhancement and structured alignment, aiming to solve the problems of insufficient fusion of semantic and collaborative information and poor performance in data sparse scenarios in existing recommendation models. Background Technology
[0002] Recommender systems, as a key technology for information filtering, predict user preferences by analyzing historical user behavior and item attributes, playing a vital role in e-commerce, streaming media, and other fields. Existing recommendation methods can be mainly divided into collaborative filtering (CF) methods and generative recommendation methods. Graph neural network (GNN)-based collaborative filtering methods effectively capture the complex dependencies between users and items—the "collaborative signals"—by propagating and aggregating information on the user-item interaction graph, demonstrating excellent performance in mainstream recommendation tasks. However, these methods are highly dependent on the quantity and quality of interaction data. When faced with data sparsity or the cold start problem of new users / items, their performance often deteriorates significantly due to a lack of sufficient interaction information.
[0003] To alleviate the data sparsity and cold start problems in recommender systems, introducing semantic information describing user or item content is an important approach. In the early stages, researchers typically used traditional text feature extraction techniques to process the simple text inherent in the dataset, but these methods have limited semantic expressive power and struggle to capture deep-seated user preferences.
[0004] With technological advancements, researchers have begun leveraging pre-trained Large Language Models (LLMs) such as GPT to generate high-quality semantic embeddings. However, effectively aligning these powerful semantic embeddings with collaborative information learned through user IDs has become a new core challenge. Against this backdrop, contrastive learning, as a powerful knowledge alignment paradigm, has been naturally introduced. By bringing positive samples closer together and pushing negative samples further away, it can effectively align representations from different sources or different views. However, the success of contrastive learning heavily relies on the construction of its samples. Early contrastive learning methods typically only used the two different views of a node itself as positive sample pairs, which fails to allow nodes to learn from other information-rich nodes. Some improved methods attempt to introduce the node's graph neighbors or find nearest neighbors as extended positive samples by calculating the similarity between embedding vectors (such as cosine similarity). However, these methods all have significant drawbacks: graph neighbors may contain noise (e.g., accidental user clicks), and vector similarity is highly dependent on the current quality of the embeddings and cannot capture deep structural associations beyond feature similarity. Therefore, the quality of the positive samples constructed by these methods is limited, making it difficult to handle complex homogeneous relationships. Summary of the Invention
[0005] The purpose of this invention is to address the problems of insufficient fusion of semantic and collaborative information in existing recommendation technologies, and the sensitivity of contrastive learning positive sample construction methods to noise and their inability to capture deep structural relationships. This invention provides a recommendation method based on large language model enhancement and structured alignment, which significantly improves the accuracy and robustness of recommendations. The specific steps include: generating enhanced embedding representations: using a large language model (LLM) to generate deep semantic information as high-quality "anchors," and combining this with the graph's topological structure, manifold optimization is used to constrain and smooth the collaborative embeddings. This ensures that the final embedding representation retains a precise semantic kernel while adapting to the specific manifold structure of the recommendation task, thus obtaining a more expressive and task-adaptive high-quality representation. Furthermore, a high-quality positive sample set is constructed: based on the aforementioned high-quality enhanced embeddings, subspace clustering is introduced to calculate the similarity between nodes. This method does not calculate the similarity of local features, but rather dynamically discovers subspace relationships between nodes from a global perspective. This enables the invention to more robustly and accurately identify truly homogeneous node groups, and to construct a high-quality extended positive sample set. Then, contrastive learning is performed using the high-quality extended positive sample set constructed in the previous step. By enabling the model to learn representations of truly similar nodes, the training of the model is effectively guided, thereby greatly enhancing the model's learning ability, generalization performance, and final recommendation accuracy in challenging scenarios such as sparse data and cold starts.
[0006] The technical solution adopted in this invention is as follows: A recommendation method based on large language model enhancement and structured alignment, comprising the following steps:
[0007] Step 1: Obtain user-item interaction data and related text information, clean and preprocess them, and construct a user-item bipartite graph;
[0008] Step 2, construct the semantic embedding module: use a large language model to generate structured user preference and item attribute descriptions, and use text encoding and mapping networks to convert them into initial user semantic embeddings and initial item semantic embeddings, respectively;
[0009] Step 3, Construct the basic graph embedding module: Use any recommendation model based on graph neural network as the backbone encoder to aggregate information from the constructed bipartite graph and learn the basic user embedding and item embedding that reflect the collaborative filtering signal;
[0010] Step 4: Initialize a set of independent augmentation embedding parameters, design a manifold augmentation loss that includes a fidelity term, a smoothness term, and an interaction proximity term, and learn the user augmentation embedding and the item augmentation embedding by optimizing this manifold augmentation loss;
[0011] Step 5: Treat the three embeddings corresponding to users and the three embeddings corresponding to items as different views, construct the multi-view reconstruction loss, and then find the similar relationships between users and users, and between items by solving the self-expression coefficient matrices C and Z of the two subspaces, and generate the similar relationship weight matrix.
[0012] Step 6: Using semantic information of nodes of the same type in the weight matrix of the same type of relationship as extended positive samples, design a contrastive learning loss to bring the enhanced embedding and the extended positive samples closer together, while pushing them further away from other samples in the batch.
[0013] Step 7, Multi-objective joint training: Combine the main loss, manifold augmentation loss, multi-view reconstruction loss, contrastive learning loss, and regularization loss of the recommendation task to construct a unified multi-objective optimization function, and train all modules together end-to-end;
[0014] Step 8: After training is complete, use the final user-enhanced embeddings and item-enhanced embeddings to generate a personalized Top-K recommendation list for the target user.
[0015] Furthermore, in step 1, the user-item interaction dataset and the text attribute data of the items are obtained, and the K-core strategy is used to preprocess the interaction data to ensure data density. Let the cleaned user set be U and the item set be I. Based on the interaction records between users and items, a user-item bipartite graph G=(V, E) is constructed, where the node set... The edge set E represents the interaction behavior.
[0016] Furthermore, in step 2, a pre-trained text encoder BERT model is used for text encoding, and the mapping network is a multilayer perceptron network.
[0017] Furthermore, the specific implementation method of step 3 is as follows:
[0018] Step 31: For the lightweight graph convolutional network, compute the symmetric normalized adjacency matrix of the bipartite graph G. Where A represents the adjacency matrix of the bipartite graph G, and D represents the degree matrix;
[0019]
[0020] Step 32, with a set of trainable embedding matrices As input, neighborhood information is aggregated through L-layer linear information propagation, and its update rule is as follows: ;
[0021] Where Ā is the normalized adjacency matrix, It is the node embedding matrix of the previous layer. This is the updated embedding matrix of the k-th layer;
[0022] Step 33: After performing L-layer information propagation, a set of hierarchical embeddings containing multi-scale information is obtained. To obtain the final collaborative filtering representation, these hierarchical embeddings are fused into a single collaborative embedding matrix using mean pooling. :
[0023]
[0024] fused matrix It contains the final embedding vectors of all users and items, and finally, based on the preset user and item node indices, it is derived from... Extract the corresponding row vectors from each element to obtain the user embedding. and item embedding .
[0025] Furthermore, the specific calculation of the manifold enhancement loss in step 4 includes:
[0026] Step 41, initialize another set of learnable augmentation embedding parameters ,in and Let represent the learnable augmented embeddings for users and items, respectively, and optimize them using subsequent manifold augmentation loss;
[0027] Step 42: Design a manifold enhancement loss consisting of three parts. :
[0028] Fidelity loss : Ensure X is a cooperative embedding matrix Based on this, its formula is:
[0029]
[0030] and Let U and I represent user embedding and item embedding, respectively, and let I represent the user set and item set, respectively. Represents the square of the L2 norm;
[0031] Smoothing loss This is achieved by constructing a smooth similarity graph and penalizing distances in the augmentation space, as shown in the following formula:
[0032]
[0033] in, Represents the set of all nodes; Based on cooperative embedding matrix Calculated Gaussian kernel function This is the kernel function bandwidth hyperparameter. This represents the augmented embeddings corresponding to nodes i' and j';
[0034] Interaction close to loss Introducing graph structure information into the augmentation space ensures that interactive user-item pairs are closer to each other within the augmentation space. This loss directly minimizes the distance between interactive pairs in the augmentation space.
[0035] Where E is the set of all observed user-item interaction edges in the bipartite graph G;
[0036] Step 43: Sum the three parts of the loss with weights to obtain the final manifold enhancement loss:
[0037]
[0038] in and These are adjustable weight hyperparameters.
[0039] Furthermore, in step 5, for the user set, the loss function for user multi-view reconstruction is minimized. To solve for the coefficient matrix C:
[0040]
[0041] in This is the user embedding matrix for the m-th view, where M represents the number of views, M=3, and represents the user embeddings respectively. User-enhanced embedding User initial semantic embedding The first term is the total reconstruction error across all M views, with the goal of enabling each user to be linearly represented by other users based on the coefficient matrix C. The second term, Ω(C), is the elastic network regularization term, which combines L1 and L2 norm penalties, and its formula is:
[0042]
[0043] in, It is an L1 norm; It is the square of the Frobenius norm, equivalent to the L2 norm of a matrix. It is a hyperparameter that controls the overall strength of regularization;
[0044] For a set of items, its coefficient matrix Z is learned using the exact same method. The loss function for multi-view reconstruction of items is expressed as:
[0045]
[0046] in, It is the item embedding matrix under the m-th view;
[0047] Ultimately, the total multi-view reconstruction loss for:
[0048] .
[0049] Furthermore, the coefficient matrices C and Z are symmetricized and normalized to generate the final user-like relationship weight matrix, which can be used for subsequent comparative learning. Weight matrix of similarity between items The calculation formula is as follows:
[0050]
[0051]
[0052] Norm() represents row-by-row normalization.
[0053] Furthermore, the specific components of contrastive learning loss include:
[0054] Step 61: Expand the false negative samples into a set of positive samples for the anchor points, based on the calculated similarity weight matrix and the preset similarity threshold. For each user node, construct a user extended semantic positive sample set containing multiple positive samples. This positive sample set includes not only the initial semantic embedding of user node u itself. It also includes all nodes whose homogeneity with node u is higher than the threshold. Semantic embedding of other user nodes v Its construction formula is:
[0055]
[0056] in, and It is the initial semantic embedding of user nodes u and v. It is their weight matrix in the user-like relationship matrix The corresponding value in It is a hyperparameter used to filter high-quality homogeneous nodes; similarly, for a set of items, a set of positive samples with extended semantics can be obtained. ;
[0057] Step 62: Design a contrastive learning loss function that supports multiple positive samples. The goal of this contrastive learning loss function is to bring the user augmentation embeddings closer together for each user node. With the extended positive sample set The distance to the embeddings of all positive samples in the batch is calculated, while simultaneously increasing the distance between the embeddings and other samples in the batch. The final total contrastive learning loss for a user node is the average of the losses of all user nodes in that batch, and the loss is calculated as follows:
[0058]
[0059] in It refers to all user nodes within the batch, where u represents the batch. One of the users in, For the extended positive sample set of node u, This represents the size of the expanded positive sample set for user u. For batch The set of semantic embeddings corresponding to all users in the dataset. For the semantic embedding of a positive sample, For the semantic embedding of a negative sample, It is an enhanced embedding of user u, where exp is the exponential logarithm function, sim is the cosine similarity, and log is the natural logarithm function. This is a temperature hyperparameter, and it is a positive number.
[0060] Similarly, for a set of items, the final total contrastive learning loss for each item node can be obtained:
[0061]
[0062] in, It refers to all item nodes within the batch. Representative batch One of the items in For nodes The extended positive sample set, express The size of the expanded positive sample set, For batch The set of semantic embeddings corresponding to all items in the set. User Enhanced embedding;
[0063] The final total contrastive learning loss is:
[0064] .
[0065] Furthermore, the specific implementation method of step 8 is as follows:
[0066] Step 81, Calculate user-item preference score: After training convergence, for a given test user u, calculate the final learned embedding. Basic embedding with all candidate items i Perform inner product calculations to obtain the user's predicted preference score for each item:
[0067]
[0068] Step 82, Generate a sorted list: For each user u, sort all candidate items in descending order based on the calculated preference score to obtain an ordered list of items. ;
[0069] Step 83, Generate the Top-K Recommendation List: From the sorted list The top K items are selected to form the final recommendation list displayed to the user. , where K is the preset length of the recommendation list.
[0070] The present invention also provides a recommendation system based on large language model enhancement and structured alignment, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the program, implements the recommendation method based on large language model enhancement and structured alignment as described in the above technical solution.
[0071] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0072] This invention first utilizes a Large Language Model (LLM) to process the raw textual information of users and items, generating structured descriptions and introducing richer, deeper semantic information into simple textual features. Next, a multi-objective loss function combining fidelity, smoothness, and graph structure is used to integrate this high-quality semantic information into a learnable augmented embedding, which is then optimized to ensure it retains the semantic core while reflecting actual user interactions. Finally, a novel approach is taken to introduce multi-view subspace self-representation to find similar relationships between nodes. Based on this, an expanded positive sample set is constructed. Through contrastive learning, the augmented embedding of each node learns the features of its similar nodes, effectively solving the problem of a single supervision signal in traditional methods. This invention effectively combines the semantic information processed by the Large Language Model with the collaborative information learned by the graph model, achieving a significant improvement in recommendation accuracy, especially in challenging scenarios such as data sparsity and cold start. Attached Figure Description
[0073] Figure 1 This is a flowchart of an embodiment of the present invention;
[0074] Figure 2 This is a diagram of the overall model framework in this embodiment;
[0075] Figure 3 This is a flowchart of the detection process in this embodiment. Detailed Implementation
[0076] The present invention will be further described below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0077] This invention provides a recommendation method based on large language model enhancement and structured alignment, such as... Figure 1 As shown, it includes the following steps:
[0078] S1. Data Preprocessing and Graph Construction: Obtain user-item interaction data and related text information, clean and preprocess them, and construct a user-item bipartite graph.
[0079] The specific implementation is as follows: Obtain the user-item interaction dataset and the text attribute data of the items (such as title, category, description, etc.). A K-core strategy is used to preprocess the interaction data to ensure data density. Let the cleaned user set be U, and the item set be I. Based on these user-item interaction records, construct a user-item bipartite graph G=(V, E), where the node set... The edge set E represents the interaction behavior.
[0080] S2, Semantic Embedding Module: Utilizes a large language model to generate structured descriptions of user preferences and item attributes, and transforms them into an initial semantic embedding matrix through text encoding and mapping networks.
[0081] The semantic embedding module based on the large language model in step S2 is as follows:
[0082] S21, In order to leverage the reasoning capabilities of the Large Language Model (LLM), this step aims to guide the Large Language Model to systematically process the raw data of any entity into a structured preference profile text.
[0083] S22, firstly, for items, using the information contained in the original dataset, including: title, category, brand, description, and user reviews, this text information is integrated into an item description JSON file as input. The system prompt template is designed as follows:
[0084] S221, Item Attribute Generation: Analyze the following item information, extract key attributes, identify the core functions and features of the product from the title, description and category, extract all positive evaluation elements (such as quality, design, cost performance, etc.) from user reviews, identify all negative feedback elements (such as defects, shortcomings, problems, etc.) from user reviews, and if the description is insufficient, supplement general features based on the product category, and output as a list of positive attributes and a list of negative attributes of the item.
[0085] S222, Item Audience Analysis: Based on the attributes extracted in the previous step, analyze the target audience: Based on positive attributes, infer the characteristics of the user groups that will be attracted (age, occupation, lifestyle, etc.), based on negative attributes, identify the types of users who may be dissatisfied, analyze the main usage scenarios and applicable scope of the product, evaluate the acceptance of the product by different user groups, and output the target user profile and non-target user characteristics and describe the applicable scenarios.
[0086] S223, Item Feature Summary: Based on the results generated in the first two steps, extract the product's core value and competitive advantages, determine the key matching points between the product and the target users, and generate a structured product feature description, including key attributes, target audience, and usage scenarios. Output: A textual description of the item's comprehensive features. The final output format is:
[0087] { "Item ID": "1", "Item Characteristics": "The main features of this product are [core functional features], suitable for [target user group]. Its advantages lie in [positive attribute summary], but it may have shortcomings in [negative attributes]. It is best suited for use in [usage scenario]."};
[0088] S23, For users, utilize information about the user in the original dataset (including basic user attributes, historical interactive items, user ratings, and reviews):
[0089] S231, Historical Interaction Analysis: This involves analyzing the user's interactions with each historical item. For each item, basic information is first extracted, including category, brand, and main features. Then, user reviews are carefully analyzed to identify areas of satisfaction and areas of dissatisfaction or complaint. Combined with user ratings, a comprehensive assessment of the user's overall attitude towards the item is made. The analysis results for each item are recorded to prepare for subsequent pattern recognition.
[0090] S232, Preference Pattern Extraction: Based on the analysis of all historical interactions in the first step, we now need to identify cross-item preference patterns. First, observe whether all the items the user interacts with share common characteristics, such as being concentrated in certain categories, price ranges, or brands. Then, identify the positive features that the user repeatedly emphasizes in reviews of multiple items; these constitute the user's core preferences. Similarly, summarize the negative factors mentioned by the user across different items to form the user's avoidance feature set. Through this cross-item analysis, stable user preference patterns can be extracted.
[0091] S233, User Profile Generation: Based on the analysis results of the first two steps, construct a comprehensive user preference profile. Integrate the user's preference patterns displayed in all historical interactions to generate a descriptive text. This text should include the user's core preference characteristics, the factors most valued when choosing products, product attributes they tend to avoid, and potential interest directions predicted based on historical behavior. Ensure that the description accurately reflects the user's historical behavior patterns and also provides accurate predictions for the future.
[0092] S234, the final output format is:
[0093] The output is: { "User ID": "1", "User Characteristics": "This user tends to choose products with [Preference Feature Summary], and historically shows a particular preference for [Specific Category or Feature]. The user values [Key Decision Factors] while avoiding [Negative Features]. Based on the interaction history, the user may be interested in products of the [Predicted Interest] category."};
[0094] S24, input these prompt words into the large language model (represented as a function). Generate item feature text and user preference text :
[0095]
[0096]
[0097] S25, the description text generated by the model and Input a pre-trained text encoder (such as BERT) to obtain a high-dimensional raw semantic embedding. and .
[0098] S26, the original semantic embedding is mapped to the target embedding dimension d through a multilayer perceptron (MLP) network, and L2 normalization is performed to obtain the final initial semantic embedding matrix, which is represented by the user's initial semantic embedding. and item initial semantic embedding .
[0099] S3, Basic Graph Embedding Module: Using any graph neural network-based recommendation model as the backbone encoder, it aggregates information from the bipartite graph constructed in S1 and learns the basic user embedding representation and item embedding representation that reflect the collaborative filtering signal.
[0100] The basic graph embedding module described in step S3 is implemented as follows:
[0101] S31, the framework proposed in this invention has plug-and-play characteristics and can be applied to various collaborative filtering recommendation models based on graph neural networks. Taking a lightweight graph convolutional network as an example, the symmetric normalized adjacency matrix of the bipartite graph G is calculated. Where A represents the adjacency matrix of the bipartite graph G, and D represents the degree matrix:
[0102] ;
[0103] S32, with a set of trainable embedding matrices As input, neighborhood information is aggregated through L-layer linear information propagation, and its update rule is as follows: .
[0104] Where Ā is the normalized adjacency matrix, It is the node embedding matrix of the previous layer. This is the updated embedding matrix of the k-th layer.
[0105] S33, after performing L-layer information propagation, we obtain a set of hierarchical embeddings containing multi-scale information. To obtain the final collaborative filtering representation, we first fuse these hierarchical embeddings into a single embedding matrix using mean pooling. :
[0106]
[0107] This merged matrix This contains the final embedding vectors for all users and items. Finally, we use the preset user and item node indices from... The corresponding row vectors are extracted from each element to obtain the final user embedding representation. and item embedding representation , for use in subsequent tasks.
[0108] S4. Designing the Manifold Augmentation Loss: We initialize a set of independent augmentation embedding parameters and design a multi-objective optimization function that includes a fidelity term (ensuring the augmentation embedding is consistent with the semantic foundation), a smoothness term (keeping adjacent nodes close in the augmentation embedding space), and an interaction proximity term (strengthening the embedding association between the user and their interacting items). By optimizing this function, the model can learn user and item representations that are more adaptable to recommendation tasks and have stronger expressive power while preserving semantic information. Its specific implementation is as follows:
[0109] S41, To obtain a better representation that preserves the semantic kernel while integrating graph structure information, this module initializes another set of learnable augmented embedding parameters. ,in and Let represent the learnable augmented embeddings for users and items, respectively, and optimize them using subsequent manifold augmentation loss.
[0110] S42, Design a manifold enhancement loss consisting of three parts. :
[0111] Fidelity loss : Ensure X is co-embedded Based on this, its formula is:
[0112]
[0113] and Let U and I represent the collaborative filtering embeddings for users and items, respectively. Represents the square of the L2 norm;
[0114] Smoothing loss This ensures that similar nodes (including user-user, item-item, and user-item relationships) in the collaboration space remain close to each other in the augmentation space. This loss is achieved by constructing a smooth similarity graph and constraining the distances between corresponding node pairs in the augmentation space. The formula is as follows:
[0115]
[0116] in, This represents the set of all nodes (users and items). Here, i and j can be any node in the graph, representing [users and items]. Based on collaborative embedding Calculated Gaussian kernel function This is the kernel function bandwidth hyperparameter. This represents the enhanced embedding corresponding to nodes i and j.
[0117] Interaction close to loss Introducing structural information from the graph into the augmentation space ensures that interactive user-item pairs are closer to each other within the space. The loss directly minimizes the distance between interactive pairs in the augmentation space.
[0118]
[0119] Where E is the set of all observed user-item interaction edges in the bipartite graph G.
[0120] S43, the weighted sum of the above three losses yields the final manifold enhancement loss:
[0121]
[0122] in and These are adjustable weight hyperparameters.
[0123] S5. Designing the Multi-View Reconstruction Loss: We treat the three embeddings learned above as three different views, and then find the similarity relationships between users and between items by solving the self-expression coefficient matrices C and Z of the two subspaces, respectively, and generate the similarity relationship weight matrix. The specific implementation is as follows:
[0124] S51, this module aims to dynamically discover stable and deep-seated homogeneous relationships between nodes through a data-driven approach. Its core idea draws on subspace learning theory, where high-dimensional node embeddings are actually distributed across multiple low-dimensional subspaces. Nodes within the same subspace share similar characteristics (e.g., users have common interests, items have similar attributes), and therefore can be linearly reconstructed using other nodes within the subspace. We will utilize this "self-expressive" characteristic to measure the homogeneity between nodes:
[0125] To ensure that the discovered node affinity relationships are robust and unaffected by the randomness of a single view, we learn a shared, consistent subspace structure across multiple views generated by graph augmentation. Specifically, we learn a shared self-expression coefficient matrix C for both the user set U and the item set I, with dimensions ( ) and Z (dimension is Taking users as an example, we minimize the user multi-view reconstruction loss function. To solve for the coefficient matrix C:
[0126]
[0127] in This is the user embedding matrix for the m-th view, where M represents the number of views. In this model, M=3, representing the user embeddings... User-enhanced embedding User initial semantic embedding The first term is the total reconstruction error across all M views, with the goal of ensuring that each user can be linearly represented by other users based on the coefficient matrix C. The second term, Ω(C), is the Elastic Net Regularization term, which combines L1 and L2 norm penalties, and its formula is as follows:
[0128]
[0129] in, It is the L1 norm, used to encourage the sparsity of the coefficient matrix, so that the model only focuses on the most important node relationships; It is the square of the Frobenius Norm, equivalent to the L2 norm of a matrix, used to prevent coefficients from becoming too large and to make the model more stable. It is a hyperparameter that controls the overall strength of regularization, and at the same time, we impose constraints. (A node cannot be represented by itself) and (The affinity relationship is non-negative). For the item set, its coefficient matrix Z can be learned using the exact same method. The item multi-view reconstruction loss function is expressed as:
[0130]
[0131] Ultimately, the total multi-view reconstruction loss It is the sum of the user multi-view reconstruction loss function and the item multi-view reconstruction loss function, and it will be included as a whole in the final total loss function:
[0132]
[0133] This combined loss will be used as part of the multi-objective joint training in S7.
[0134] After obtaining the low-rank matrix and reconstructing the coefficient matrices C and Z through model optimization, we perform symmetry and normalization on them to generate the final class relation weight matrix that can be used for subsequent comparative learning. and The calculation formula is as follows:
[0135]
[0136]
[0137] Norm() represents row-wise normalization. The final matrix is... and The value in The probability or affinity that nodes i and j reside in the same subspace is quantified, and can be directly used as the weights for their homogeneity relationship. This weight matrix S will then be used to guide the contrastive learning process in S6.
[0138] S6. Design a contrastive learning loss function: Design a contrastive learning loss function guided by the relation weight matrix calculated in the previous step. This function utilizes semantic information from nodes of the same type as expanded positive samples to directly enhance the semantic expressive power of the final enhanced embedding used for recommendation. The specific implementation is as follows:
[0139] In S61, to overcome the problem of false negative samples in traditional contrastive learning, we expand the false negative samples discovered by the model into a set of positive samples for the anchor points. We use the similarity weight matrix S calculated in S5 and a preset similarity threshold. For each anchor node (taking user u as an example), construct an extended semantic positive sample set containing multiple positive samples. This set includes not only the initial semantic embedding of user node u itself. It also includes all nodes whose homogeneity with node u is higher than the threshold. Semantic embedding of other user nodes v Its construction formula is:
[0140]
[0141] in, and It is the initial semantic embedding of user nodes u and v. It is their weight matrix in the same category. The corresponding value in This is a hyperparameter used to filter high-quality homogeneous nodes. Similarly, for a set of items, we can obtain... .
[0142] S62. Extended Positive Sample Contrastive Learning Loss: We design a contrastive learning loss function that supports multiple positive samples. The goal of this loss function is to bring the enhanced embedding closer for each anchor point (i.e., user u). With the extended positive sample set The distance to the embeddings of all positive samples in the batch is calculated, while also extending the distance to other samples within the batch. The final total contrastive loss is the average of the losses of all nodes in the batch. For a single anchor point u, the loss is calculated as follows:
[0143]
[0144] in It refers to all user nodes within the batch, where u represents the batch. One of the users in, For the extended positive sample set of anchor point u, This represents the size of the expanded positive sample set for user u. For batch The set of semantic embeddings corresponding to all users (generated by the large language model in S2), For the semantic embedding of a positive sample, For the semantic embedding of a negative sample, This is the enhanced embedding of user u (obtained through optimization in S4), where exp is the exponential logarithm function, sim is the cosine similarity, and log is the natural logarithm function. This is the temperature hyperparameter, and it is a positive number.
[0145] Similarly, for objects, we can conclude that:
[0146]
[0147] in, It refers to all item nodes within the batch. Representative batch One of the items in For nodes The extended positive sample set, express The size of the expanded positive sample set, For batch The set of semantic embeddings corresponding to all items in the set. User Enhanced embedding;
[0148] The final total comparison loss is:
[0149] .
[0150] S7. Multi-objective Joint Training: This method combines the main loss (BPR loss), manifold augmentation loss, multi-view reconstruction loss, contrastive learning loss, and regularization loss of the recommendation task to construct a unified multi-objective optimization function. All modules are then trained end-to-end. The specific implementation is as follows:
[0151] S71, This step employs a multi-objective joint training strategy. First, a unified joint loss function is defined. This allows for end-to-end optimization of all parameters in the model.
[0152] S72, this function is derived from the main recommendation loss. manifold enhancement loss Multi-view reconstruction loss Comparative learning loss guided by a weight matrix of similar relationships and global regularization loss Weighted composition.
[0153] The main recommendation loss employs Bayesian Personalized Ranking Loss (BPR) to optimize the accuracy of the final recommendation. It achieves this by maximizing the probability that a user's predicted preference for interacted items is higher than that for uninterrupted items. The formula is:
[0154]
[0155] in, It is a set of triples sampled from the training data. Each triple contains a user u, a positive sample item i that the user has interacted with, and a negative sample item j that the user has not interacted with. It is the Sigmoid function.
[0156] Manifold Enhancement Loss As defined in step S4, the structure used to optimize and enhance the embedding space. Multi-view reconstruction loss. Improved contrastive learning loss for optimizing self-expression coefficients. As defined in step S6, this is used to inject global homogeneous knowledge into the enhanced embedding. L2 regularization loss. To prevent overfitting, L2 regularization is applied to all learnable embedding parameters, with the following formula:
[0157]
[0158] in For all learnable parameters of the model, Let f(x) denote the square of the Frobenius norm of the matrix.
[0159] S73, the final total loss function is:
[0160]
[0161] in These are hyperparameters that balance various losses, and all learnable parameters in the model are updated using gradient descent optimization algorithms (such as Adam).
[0162] S8. After training, the learned final embedding representation is used to generate a personalized Top-K recommendation list for the target user. The specific implementation is as follows:
[0163] S81, Calculate the user-item preference score. After training convergence, for a given test user u, calculate the final learned embedding. Basic embedding with all candidate items i Perform inner product calculations to obtain the user's predicted preference score for each item:
[0164]
[0165] S82, Generate a sorted list. For each user u, sort all candidate items in descending order based on the calculated preference score to obtain an ordered list of items. .
[0166] S83, generate a Top-K recommendation list. From the sorted list... The top K items are selected to form the final recommendation list displayed to the user. , where K is the preset length of the recommendation list.
[0167] To conduct a detailed evaluation of the model proposed in this invention, we performed performance evaluations on two public datasets, DouBan and Amazon, using RECALL (recall rate) and NDCG (normalized depreciation cumulative gain) as performance metrics. The performance comparison of the improved model with other existing methods is shown in Table 1.
[0168] Table 1. Performance comparison of the method of the present invention with other existing methods
[0169]
[0170] This table aims to measure the performance advantage of the proposed method compared to current mainstream methods using key recommendation system evaluation metrics—recall and normalized depreciation cumulative gain (NDCG). From the experimental data in Table 1, we can draw the following key conclusions: On both the DouBan and Amazon datasets, the proposed method achieves the best performance in both recall and NDCG metrics. This strongly demonstrates the overall superiority of the proposed model in improving recommendation accuracy and ranking quality. The model performs excellently on two public datasets with different domains and data densities, proving its good generalization ability and robustness. This indicates that the model not only finds relevant items but also ranks the items most likely to interest the user higher in the recommendation list. In summary, the experimental results show that the proposed method, by effectively fusing deep semantic information generated by a large language model with collaborative filtering signals learned from a graph model and employing innovative alignment and calibration mechanisms, can more accurately capture user preferences, and its overall performance surpasses that of many existing mainstream recommendation algorithms.
[0171] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0172] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. A recommendation method based on large language model enhancement and structured alignment, characterized in that, The method comprises the following steps: Step 1, obtaining user-item interaction data and related text information, cleaning and preprocessing, and constructing a user-item bipartite graph; Step 2, constructing a semantic embedding module: using a large language model to generate structured user preferences and item attribute descriptions, and converting them into user initial semantic embedding and item initial semantic embedding through text encoding and mapping network respectively; Step 3, constructing a basic graph embedding module: using any graph neural network-based recommendation model as the main encoder to aggregate information of the constructed bipartite graph, and learning to obtain basic user embedding and item embedding reflecting collaborative filtering signals; Step 3 comprises: step 31, for a light graph convolution network, calculating a symmetric normalized adjacency matrix of the bipartite graph G and obtaining basic user embedding and item embedding by aggregating the trainable embedding matrix and the normalized adjacency matrix, wherein A represents an adjacency matrix of the bipartite graph G, and D represents a degree matrix; ; Step 4, initializing a set of independent enhanced embedding parameters, designing a manifold enhancement loss including fidelity term, smoothing term and interaction proximity term, and learning to obtain user enhanced embedding and item enhanced embedding by optimizing the manifold enhancement loss; The specific calculation of the manifold enhancement loss in step 4 includes: Step 41, initialize another set of learnable enhanced embedding parameters where and denote the learnable enhanced embeddings for users and items, respectively, and are optimized through the subsequent manifold-enhanced loss. Step 5, regarding the three embeddings corresponding to the user and the three embeddings corresponding to the item as different views respectively, constructing a multi-view reconstruction loss, and then solving two subspace self-expression coefficient matrices C and Z to find the same relationship between users and users, and the same relationship between items and items respectively, and generating the same relationship weight matrix; Step 6, using the same node semantic information in the same relationship weight matrix as the extended positive sample, designing a contrastive learning loss to reduce the distance between the enhanced embedding and the extended positive sample, and at the same time, to increase the distance between the enhanced embedding and other samples in the batch; Step 7, multi-objective joint training: combining the main loss of the recommendation task, the manifold enhancement loss, the multi-view reconstruction loss, the contrastive learning loss and the regularization loss to construct a unified multi-objective optimization function, and training all modules end-to-end; Step 8, after training, using the final user enhanced embedding and item enhanced embedding to generate a personalized Top-K recommendation list for the target user.
2. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: In step 1, the user-item interaction dataset and the text attribute data of the items are obtained, and the K-core strategy is used to preprocess the interaction data to ensure the density of the data; the user set after cleaning is U, the item set is I, and based on the interaction record between the user and the item, a user-item bipartite graph G=(V, E) is constructed, wherein the node set V is composed of the user set U and the item set I, and the edge set E represents the interaction behavior. , the edge set E represents the interaction behavior.
3. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: In step 2, a pre-trained text encoder BERT model is used for text encoding, and the mapping network is a multi-layer perceptron network.
4. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: Step 3 further includes: Step 32, with a set of trainable embedding matrices As input, neighborhood information is aggregated by L-layer linear information propagation, whose update rule is: ; where Ā is the normalized adjacency matrix, is the node embedding matrix of the previous layer, is the updated k-th layer embedding matrix; Step 33, after performing L-layer information propagation, obtaining a set of hierarchical embeddings containing multi-scale information ; to obtain the final collaborative filtering representation, these hierarchical embeddings are fused into a single collaborative embedding matrix by mean-pooling : ; fused matrix It contains the final embedding vectors of all users and items, and finally, based on the preset user and item node indices, it is derived from... Extract the corresponding row vectors from each element to obtain the user embedding. and item embedding .
5. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: The specific calculation of the manifold enhancement loss in step 4 further includes: Step 42, design a manifold augmentation loss consisting of three parts : Fidelity loss : Ensuring X to be co-embedded in a matrix as a basis, whose formula is: ; and denote user embeddings and item embeddings, respectively, and U and I denote the set of users and the set of items, respectively, denotes the square of the L2 norm; smooth loss : is achieved by constructing a smooth similarity map and penalizing the distance in the augmented space, whose formula is: ; wherein, represents a set of all nodes; is a collaborative embedding matrix computed Gaussian kernel function is a kernel function bandwidth hyperparameter, represents an enhanced embedding for nodes i' and j'. interaction proximity loss : introducing graph structure information into the enhanced space such that user-item pairs with interactions are close to each other in the enhanced space, this loss directly minimizes the distance of interaction pairs in the enhanced space: ; Where E is the set of all observed user-item interaction edges in the bipartite graph G; Step 43, the three parts of the loss are weighted and summed to obtain the final manifold enhancement loss: ; wherein and are adjustable weight hyperparameters.
6. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: In step 5, the coefficient matrix C is solved for the set of users by minimizing the user multi-view reconstruction loss function over the set of users: ; where is the user embedding matrix under the mth view, where M represents the number of views, M = 3, and is the user enhanced embedding is the user initial semantic embedding is the first term, which is the total reconstruction error under all M views, and the goal is to let each user be linearly represented by other users based on the coefficient matrix C, and the second term Ω(C) is the elastic net regularization term, which combines the L1 and L2 norm penalties, and its formula is: ; wherein, is the L1 norm; is the square of the Frobenius norm, which is equivalent to the L2 norm of a matrix, is a hyperparameter that controls the overall strength of regularization; For the item set, the same method is used to learn its coefficient matrix Z, and the item multi-view reconstruction loss function is represented as: ; wherein, is the item embedding matrix under the mth view; Finally, the total multi-view reconstruction loss is: 。 7. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: Symmetrization and normalization are performed on the coefficient matrix C and Z to generate a final user category relationship weight matrix that can be used for subsequent contrastive learning and an item category relationship weight matrix The calculation formula is: ; ; Where Norm() represents the row normalization operation.
8. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: The contrastive learning loss specifically includes: Step 61, expand the false negative sample into an anchor point positive sample set based on the calculated homogeneity weight matrix and the preset similarity threshold , for each user node, construct a user extended semantic positive sample set containing multiple positive samples , the positive sample set not only includes the initial semantic embedding of the user node u itself , but also includes the semantic embedding of all other user nodes v with a high homogenization degree higher than the threshold to the node u , the construction formula is: ; in, and It is the initial semantic embedding of user nodes u and v. It is their weight matrix in the user-like relationship matrix The corresponding value in It is a hyperparameter used to filter high-quality homogeneous nodes; similarly, for a set of items, a set of positive samples with extended semantics can be obtained. ; Step 62, design a contrastive learning loss function that supports multiple positive samples The goal of the contrastive learning loss function is to, for each user node, pull its user-enhanced embedding closer to the embeddings of all positive samples associated with the expanded positive sample set while pushing it further away from the embeddings of all other samples in the batch. The final user node total contrastive learning loss is the average of the losses for all user nodes in the batch, which is computed as follows: ; where is the set of all user nodes within the batch, u represents a user within the batch , is the set of expanded positive samples for node u, represents the size of the set of expanded positive samples for user u, is the set of semantic embeddings corresponding to all users within the batch , is the semantic embedding of a positive sample, is the semantic embedding of a negative sample, is the enhanced embedding of user u, exp is the exponential logarithm function, sim is the cosine similarity, log is the natural logarithm function, is the temperature hyperparameter, which is a positive number; For the item set, the final total contrastive learning loss of the item nodes is obtained in the same way: ; wherein, is all item nodes within a batch, represents a certain item in a batch , is an extended positive sample set of nodes , denotes the size of the extended positive sample set of , is a set of semantic embeddings corresponding to all items in a batch , is an enhanced embedding of a user ; The final total contrastive learning loss is: 。 9. The recommendation method based on large language model enhancement and structured alignment according to claim 1, wherein: The specific implementation of step 8 is as follows: Step 81, Compute user-item preference scores: After training converges, for a given test user u, compute the inner product of its final learned embedding with the base embedding of all candidate items i to get the user's predicted preference score for each item. ; Step 82, generating ranked list: for each user u, rank all candidate items in descending order according to the computed preference scores, resulting in an ordered list of items ; Step 83, generating Top-K recommendation list: selecting the top K items from the sorted list to form the final recommendation list to be shown to the user , where K is the pre-set length of the recommendation list.
10. A recommendation system based on large language model enhancement and structured alignment, characterized in that: A computer program stored in the memory and executable on the processor, wherein the processor implements the recommendation method based on large language model enhancement and structured alignment according to any one of claims 1 to 9 when executing the program.
Citation Information
Patent Citations
Article recommendation method and device based on multiple modes and computer readable storage medium
CN118227891A
Intelligent news content recommendation method based on large language model and comparative learning
CN119669576A