Item recommendation method based on internal and external semantic fusion enhanced by large language model
By using an internal and external semantic fusion method based on a large language model, the problems of data sparsity and incomplete semantic coverage in e-commerce product recommendation are solved. This enables accurate understanding of user-item relationships and high-quality feature extraction, thereby improving the accuracy and personalization of the recommendation system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI AGRICULTURAL UNIVERSITY
- Filing Date
- 2026-04-08
- Publication Date
- 2026-07-14
AI Technical Summary
Existing recommendation systems suffer from data sparsity, incomplete semantic coverage, and modal heterogeneity in e-commerce item recommendations, resulting in low recommendation accuracy and efficiency. Furthermore, the noise processing and fusion effects of large language models are not good.
We employ an internal and external semantic fusion method based on a large language model. By constructing user-item triples and multimodal features, and combining external semantic enhancement, internal semantic enhancement, and a multimodal fusion network, we utilize BPR loss and knowledge graph pruning strategies to optimize user preference modeling and feature completion, thereby achieving accurate understanding of user-item relationships and high-quality feature extraction.
It improves the accuracy and personalization of the recommendation system, enhances its robustness to noisy data, solves the problems of data sparsity and incomplete semantic coverage, and improves the effectiveness and generalization ability of the recommendation model.
Smart Images

Figure CN122390832A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of recommendation technology based on large language model enhancement, specifically a method for item recommendation based on internal and external semantic fusion using large language model enhancement. Background Technology
[0002] In the field of e-commerce item recommendation, the performance of recommendation systems hinges on accurate modeling of user preferences. However, current mainstream recommendation methods are consistently constrained by two major issues: data sparsity and insufficient semantic quality. Traditional recommendation methods are mainly divided into two categories. One is collaborative filtering methods based on user-item interaction data, which rely solely on behavioral data to learn user preferences. In scenarios with few user interaction records and low item exposure, these methods are prone to biased preference modeling. The other is improved methods that integrate multi-source auxiliary information, attempting to alleviate the data sparsity problem by introducing user features, item attributes, and other information. However, these methods generally suffer from incomplete semantic coverage and are susceptible to data noise, leading to decreased model learning efficiency and accuracy. Furthermore, multi-source auxiliary information exhibits significant modal heterogeneity, making it difficult to effectively align the semantic spaces of different modalities. This severely hinders the effective fusion of cross-modal information, further limiting the improvement of recommendation performance.
[0003] In recent years, Large Language Models (LLMs) have become a research hotspot in the field of recommender systems due to their rich common-sense knowledge and powerful semantic reasoning capabilities. Existing LLM-enhanced recommender methods mainly apply large language models as direct recommenders, feature encoders, or data augmentation tools, which to some extent compensates for the semantic deficiencies of traditional methods. However, these methods still have significant technical shortcomings: on the one hand, there is a lack of effective filtering and processing mechanisms for noise in the data generated by large language models, and the generated noise information is easily introduced into the model, which reduces the recommendation accuracy; on the other hand, existing methods mostly treat large language models as independent tools and simply combine them with recommender models, without achieving deep integration with traditional collaborative filtering and other core recommender models. This makes it difficult to fully leverage the semantic enhancement value of large language models and fundamentally solve the semantic coverage and modal heterogeneity problems of recommender systems. Summary of the Invention
[0004] This invention addresses the shortcomings of existing technologies by proposing an internal and external semantic fusion-based item recommendation method based on a large language model. The aim is to accurately model potential user preferences and complete semantic features of items in practical e-commerce item recommendation scenarios, effectively mitigating recommendation bias caused by data sparsity, incomplete semantic coverage, and modal heterogeneity. This improves the accuracy and personalization of item recommendations on e-commerce platforms, while enhancing the robustness of the recommendation model to noisy data. It provides reliable technical support for the efficient implementation of e-commerce recommendation systems in real-world business, helping platforms optimize user shopping experiences and improve recommendation conversion efficiency.
[0005] To achieve the above-mentioned objectives, the present invention adopts the following technical solution: The present invention provides a method for recommending items based on internal and external semantic fusion using a large language model, characterized by the following steps: Step 1: Obtain basic user information, item attribute information, and historical interaction records between users and items from the e-commerce platform, and filter users. For items Effective positive interaction behaviors, thereby constructing a set of positive user-item interactions. ,in, For user sets, For a collection of items; extract User characteristics in Item attributes and The association features between users and items are analyzed to construct triples of "user-association-item", "user-association-user feature", and "item-association-item attribute", which together form the original knowledge graph for e-commerce scenarios. , in, A collection of entities consisting of user entities, item entities, user characteristic entities, and item attribute entities; It is a set of relationships, including: user-user feature relationships, item-item attribute relationships, and user-item interaction relationships; Step 2: Collect images and descriptions of items from e-commerce platforms and extract their features to form a multimodal feature set for the items. This includes: the visual characteristics of the item Textual features of items ; Using CNN network Perform vector encoding to obtain the visual embedding vector of the item. Among them, items The visual embedding vector is denoted as ; Using BERT network Perform vector encoding to obtain the text embedding vector of the item. Among them, items The text embedding vector is denoted as ; Step 3: Construct an external semantic enhancement network and base it on the user-item positive interaction set. For users The external semantic enhancement prompts are processed to obtain user information. For items Predicted preference score This allows us to construct the BPR loss value for all users. Used for updating and and get users Optimal embedding vector With items Optimal embedding vector In turn, gain users External preference embedding vector With the optimal potential preference item set Potential preferred items External preference embedding vector ; Step 4: Construct an internal semantic enhancement network and apply it to the original e-commerce knowledge graph. Chinese users Feature missing and items By addressing the missing attributes, an enhanced e-commerce knowledge graph is obtained. Pruning is then performed to construct a semantic consistency loss function for the knowledge graph. Used to train high-quality e-commerce knowledge graphs after pruning. To output user Internal semantic embedding vector and items Internal semantic embedding vector ; Step 5: Construct a multimodal fusion network for the items. Visual embedding vectors and items Text embedding vector By fusing, you can obtain items. Multimodal embedding vectors Thus, a multimodal BPR loss function is constructed. ; Step 6: Use equation (9) to obtain the user fused embedding vector With items fused embedding vector : (9) In equation (9), For external semantic fusion weights, Weights are used to fuse semantic features and multimodal features; Step 7: Construct the total loss function of the item recommendation network, which consists of an external semantic enhancement network, an internal semantic enhancement network, and a multimodal fusion network, using equation (10). : (10) In equation (10), For knowledge graph loss fusion weights, For multimodal loss fusion weights; Step 8, based on The AdamW optimizer is used to train the item recommendation network, resulting in a trained item recommendation model used to generate user recommendations. For each item, a predicted preference score is assigned and sorted in descending order. The top K items are then selected to obtain the user's preference score. The final recommendation list, where K is the preset number of recommendations.
[0006] The characteristic of the internal and external semantic fusion item recommendation method based on large language model enhancement described in this invention is that step 3 is performed as follows: Step 3.1: Build User Profile External semantic enhancement prompts , including: users Basic profile, users Items in historical interaction records and inferred user information Task instructions containing potentially preferred items and potentially unpreferred items; Will Input is processed in a large language model (LLM), and output is the user. Potential Preference Item Set With non-preference item set Thus forming users Item Enhancement Interaction Triples This leads to the complete set of enhanced interaction triples. ; Step 3.2: Generate users using a random initialization method. initial embedding vector With items initial embedding vector ; Step 3.3, using equation (1) to... and Perform inner product operations to obtain the user's... For items Predicted preference score : (1) Step 3.4, based on Calculate the user using equation (2) Set of items with potential preferences Average score of all items and the set of potentially unfavorable items Average score of all items : (2) In equation (2), Indicates user Potential Preference Item Set Potential preferred items in express The number of potential preferred items express The number of potential non-preference items in the middle. For users right Potential preferred items Predicted preference score For users right Potential non-preferred items Predicted preference scores; Step 3.5: Use equation (3) to construct the user... Item Enhancement Interaction Triples BPR loss value : (3) In equation (3), For the Sigmoid function; Step 3.6: Use equation (4) to obtain the overall BPR loss value of the external semantic augmentation network. : (4) In equation (4), This represents the total number of enhanced interaction triples for all users; Step 3.7, Utilize renew and Thus, the updated user Embedded vector With updated items Embedded vector ; Step 3.8: Set the pruning ratio For each user in D The item enhancement interaction triples are sorted in ascending order according to their corresponding BPR loss values, and the top three items in the sorted order are selected. The proportional item-enhanced interaction triples are used to extract user information. and Interaction relationship and Merge to obtain an enhanced interaction set ; Step 3.9, based on For users Rematch the corresponding potential preference item set With potential non-preference item set This forms a new item-enhanced interaction triplet. This leads to a new set of full-scale enhanced interaction triples. ; Will Assign to ,Will Assign to ,Will Assign to Then, return to step 3.3 and execute sequentially until the preset maximum number of updates is reached in the iteration rounds. or continuous wheel as a whole The amplitudes are all less than the preset minimum descent threshold. Thus, the optimal enhanced interaction set is obtained. ,user Optimal embedding vector With items Optimal embedding vector and users The optimal set of potential preferred items ; Step 3.10, based on , and Construct a user-item external graph And utilize graph neural networks (GNNs) to... Process and obtain user information. External preference embedding vector and the optimal potential preference item set Any potential preferred item External preference embedding vector .
[0007] Furthermore, step 4 is performed as follows: Step 4.1, targeting Chinese users Feature missing and items Missing attributes, building user Internal semantic enhancement prompts and items Internal semantic enhancement prompts ,in, Includes: users Basic profile completion prompts, user Historical interaction records and user completion Task instructions lacking features; Includes: items Attribute completion hints, items Existing attributes and completion items Task instructions with missing attributes; Will and The input is fed into an LLM for processing, and the corresponding user data is obtained. Attribute completion results With items Attribute completion results and will and The corresponding conversion to users triples and items triples Thus, user feature triples are obtained. and item attribute triples Then, it is integrated into the original knowledge graph. In the process, an enhanced e-commerce knowledge graph is obtained. ;in, For users User characteristic relationships, For items The relationship between item attributes, For users Featured entities, For items Attribute entities; Step 4.2: Traverse the augmented e-commerce knowledge graph any triplet As positive samples, select entities related to the head. Other head entities of the same type are denoted as And generate corresponding negative samples. Where the triple is a user feature triple, then , , users respectively User characteristic relationship and user characteristics When the triple is an item attribute triple, then , , items respectively Item attribute relationships and item attributes ; Step 4.3: Calculate positive samples using the TransE model. Score and negative samples Score Therefore, positive samples can be calculated using equation (4). Corresponding knowledge graph contrast loss value : (4) In equation (4), This represents the loss scaling factor. Represents a smooth activation function; Step 4.4: Calculate the positive samples using equation (5). semantic consistency score : (5) In equation (5), for Middle head entity Embedded vector, for China's related relationships Embedded vector, for Mid-tail entity Embedded vector, for The square of the norm; Step 4.5, Retain All knowledge graphs in the dataset have a contrastive loss value lower than the preset contrastive loss threshold. Furthermore, the semantic consistency score is also lower than the preset semantic consistency threshold. Positive samples are used to construct a high-quality e-commerce knowledge graph after pruning. ; Step 4.6: Calculate the semantic consistency loss of the knowledge graph using equation (6). ; (6) In equation (6), for The set of positive samples in yes The total number of neutral samples; Step 4.7, utilize right After training, The initial embedding vectors of all entities and relations are assigned to the entity embedding vector. With relation embedding vector And return to step 4.6 until Convergence, thus obtaining the trained knowledge graph. and from Extract users Internal knowledge embedding vector and items Internal knowledge embedding vector ; Step 4.8: Use a linear projection layer to... and Mapping is performed to obtain the user's information. Internal semantic embedding vector and items Internal semantic embedding vector .
[0008] Furthermore, step 5 is performed as follows: Step 5.1: Obtain the item using equation (7) Multimodal embedding vectors : (7) In equation (7), For multimodal fusion weights; Step 5.2: Construct the multimodal BPR loss function using equation (8). : (8) In equation (8), for The square of the norm; This is the regularization coefficient.
[0009] The present invention provides an electronic device, including a memory and a processor, characterized in that the memory is used to store a program supporting the processor in performing the method described therein, and the processor is configured to execute the program stored in the memory.
[0010] The present invention discloses a computer-readable storage medium storing a computer program, characterized in that the computer program is executed by a processor to perform the steps of the method described thereon.
[0011] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention designs external and internal semantic enhancement prompts for large language models based on prompt learning. On the one hand, through the structured design of user basic profiles, historical interaction records, and specific task instructions in the prompts, it guides LLM to infer potential user interaction relationships in the context and completes missing attributes of the knowledge graph. It combines BPR loss pruning and knowledge graph dual threshold pruning strategies to filter low confidence noise, reducing the proportion of high-score noise in the knowledge graph and effectively solving the problem of noise interference in LLM generated data in existing technologies. On the other hand, through standardized prompt output format, it directly extracts structured interaction triples and attribute triples, avoiding the complex processing of unstructured text by recommendation models and reducing the training difficulty and data redundancy interference of recommendation models.
[0012] 2. This invention fully utilizes the rich common sense knowledge and excellent semantic reasoning capabilities of large language models to accurately infer potential preferred item sets from users' historical interaction behaviors, and completes missing user features and item attributes from knowledge graphs. This achieves fine-grained semantic understanding of user-item relationships, improves the accuracy of semantic completion of user / item attributes, obtains high-quality structured semantic features, solves the problems of data sparsity and incomplete semantic coverage in existing recommendation systems, and improves the accuracy and reliability of downstream recommendation tasks.
[0013] 3. This invention designs a hierarchical weighted internal and external semantic and multimodal feature fusion mechanism. Through a linear projection layer, the knowledge graph's internal embeddings are mapped to a representation space unified with the external semantics. Adjustable weights are then used to adaptively balance the contributions of internal semantics, external preferences, and multimodal features. Simultaneously, a collaborative optimization model is constructed for the total loss function that integrates BPR loss and knowledge graph semantic consistency loss. This solves the problem of semantic space misalignment and poor information fusion effect caused by modal heterogeneity in existing technologies. It helps the model to more accurately capture users' true preferences, resulting in a significant improvement in recommendation results compared to traditional collaborative filtering and multimodal fusion methods in core metrics. Moreover, this enhancement strategy can be adapted to other different basic recommendation models, exhibiting both good effectiveness and generalization. Attached Figure Description
[0014] Figure 1 This is a framework diagram of the internal and external semantic fusion item recommendation method based on large language model enhancement according to the present invention. Detailed Implementation
[0015] In this embodiment, a method for item recommendation based on large language model enhancement and internal / external semantic fusion is presented, using a beauty e-commerce platform as a specific application scenario and the publicly available Beauty dataset as an example. Two prompts are designed to infer the user's potential preference / non-preference item set using the large language model, and to complete the missing user features and item attributes in the knowledge graph. External and internal semantic enhancement networks are used to learn the external preference embeddings and internal semantic embeddings of users and items, respectively. These are then combined with multimodal features to construct a fusion network. The recommendation model is trained using the total loss function, ultimately generating a personalized recommendation list. The framework diagram is shown below. Figure 1 As shown, the specific steps are as follows: Step 1: Obtain basic user information, item attribute information, and historical interaction records between users and items from the e-commerce platform, and filter users. For items Effective positive interaction behaviors, i.e., ratings of 4 stars or higher or purchase behaviors, are used to construct a user-item positive interaction set while reducing the amount of data and ensuring data quality. ,in, For user sets, It is a collection of items.
[0016] extract User characteristics in Item attributes and The association features between users and items are analyzed to construct triples of "user-association-item", "user-association-user feature", and "item-association-item attribute", which together form the original knowledge graph for e-commerce scenarios. ,at this time There are missing nodes such as "User-Skin Type-Unknown" or "Item-Ingredients-Missing". A collection of entities consisting of user entities, item entities, user characteristic entities, and item attribute entities; It is a set of relationships, including: user-user feature relationships, item-item attribute relationships, and user-item interaction relationships.
[0017] Step 2: Collect images and descriptions of items from e-commerce platforms and extract their features to form a multimodal feature set for the items. This includes: the visual characteristics of the item Textual features of items ; Using CNN network Perform vector encoding to obtain the visual embedding vector of the item. Among them, items The visual embedding vector is denoted as ; Using BERT network Perform vector encoding to obtain the text embedding vector of the item. Among them, items The text embedding vector is denoted as .
[0018] Step 3: Construct an external semantic enhancement network and base it on the user-item positive interaction set. For users Processing external semantic enhancement prompts, utilizing user... initial embedding vector With items initial embedding vector Get users External preference embedding vector With the optimal potential preference item set Potential preferred items External preference embedding vector And construct the BPR loss value for all users. .
[0019] Step 3.1: Build User Profile External semantic enhancement prompts , including: users Basic profile, users Items in historical interaction records and inferred user information Task instructions containing potential preferred items and potential unpreferred items; such as Figure 1 As shown in the "External Semantic Enhancement" module, the prompt word is designed as: "User..." (For those with sensitive skin) who have purchased products A and B, please infer which products they might like (potential preference) and which products they might dislike (potential non-preference).
[0020] Will Input is processed in a large language model (LLM), and output is the user. Potential Preference Item Set With non-preference item set Thus forming users Item Enhancement Interaction Triples This leads to the complete set of enhanced interaction triples. .
[0021] Step 3.2: Generate users using a random initialization method. initial embedding vector With items initial embedding vector ; Step 3.3, using equation (1) to... and Perform inner product operations to obtain the user's... For items Predicted preference score : (1) Step 3.4, based on Calculate the user using equation (2) Set of items with potential preferences Average score of all items and the set of potentially unfavorable items Average score of all items : (2) In equation (2), Indicates user Potential Preference Item Set Potential preferred items in express The number of potential preferred items express The number of potential non-preference items in the middle. For users right Potential preferred items Predicted preference score For users right Potential non-preferred items The predicted preference score.
[0022] Step 3.5: Use equation (3) to construct the user... Item Enhancement Interaction Triples BPR loss value : (3) In equation (3), This is the Sigmoid function.
[0023] Step 3.6: Summarize the BPR loss values of all users to obtain the overall BPR loss value of the external semantic augmentation network. : (4) In equation (4), This represents the total number of enhanced interaction triples for all users.
[0024] Step 3.7, Utilize renew and Thus, the updated user Embedded vector With updated items Embedded vector .
[0025] Step 3.8: Set the pruning ratio =0.8, for each user in D Enhanced item interaction triples based on corresponding Sort in ascending order and select the top few items in the sorted order. The proportional item-enhanced interaction triples are used to extract user information. and Interaction relationship and Merge to obtain an enhanced interaction set .
[0026] Step 3.9, based on For each user Rematch the corresponding potential preference item set With potential non-preference item set This forms a new item-enhanced interaction triplet. This leads to a new set of full-scale enhanced interaction triples. .
[0027] Will Assign to ,Will Assign to ,Will Assign to Then, return to step 3.3 and execute sequentially until the preset maximum number of updates is reached in the iteration rounds. or continuous wheel as a whole The amplitudes are all less than the preset minimum descent threshold. The optimal enhanced interaction set is obtained when the iteration rounds reach the preset maximum number of updates (1000 rounds) or the loss decreases by less than 1e-5 for 7 consecutive rounds. ,user Optimal embedding vector With items Optimal embedding vector and users The optimal set of potential preferred items .
[0028] Step 3.10, based on , and Construct a user-item external graph And utilize graph neural networks (GNNs) to... Process and obtain user information. External preference embedding vector and the optimal potential preference item set Any potential preferred item External preference embedding vector .
[0029] Step 4: Construct an internal semantic enhancement network and apply it to the original e-commerce knowledge graph. Process and obtain user information. Internal semantic embedding vector and items Internal semantic embedding vector And construct a semantic consistency loss for knowledge graphs. .
[0030] Step 4.1, targeting Chinese users Feature missing and items Missing attributes, building user Internal semantic enhancement prompts and items Internal semantic enhancement prompts ,in, Includes: users Basic profile completion prompts, user Historical interaction records and user completion The task instruction for missing features is as follows: Focus on the core dimensions of beauty recommendations for missing user features. Example prompts: "Basic user information: 28-year-old female, light luxury consumption; Historical interaction items: alcohol-free moisturizing cream, sensitive skin repair essence; Please complete the missing features of this user (skin type, skincare needs) and output them in the format of (user ID, relationship, feature value) triples, no further explanation required." Includes: items Attribute completion hints, items Existing attributes and completion items Task instructions with missing attributes; such as Figure 1 As shown, The prompt is: "Item: A certain brand of face cream; Known attribute: moisturizing; Please complete the ingredients, suitable skin type, and texture, outputting in the format of a triple (item ID, relationship, attribute value)." This prompt can achieve an item completion accuracy of 92.3%.
[0031] Will and The input is fed into an LLM for processing, and the corresponding user data is obtained. Attribute completion results With items Attribute completion results and will and The corresponding conversion to users triples and items triples Example of completed result: User u1003 For "(u1003, skin type, sensitive skin), (u1003, skincare needs, moisturizing and repairing)"; Item I205 (acne treatment essence) The formula is: "(I205, core ingredient, salicylic acid), (I205, suitable skin type, oily / combination skin), (I205, texture, refreshing gel)"; thus, the user characteristic tripartite combination is obtained. and item attribute triples And integrate the original knowledge graph In the process, an enhanced e-commerce knowledge graph is obtained. ;in, For users User characteristic relationships, For items The relationship between item attributes, For users Featured entities, For items Attribute entities.
[0032] Step 4.2: Traverse the augmented e-commerce knowledge graph any triplet As positive samples, select entities related to the head. Other head entities of the same type are denoted as And generate corresponding negative samples. Where the triple is a user feature triple, then , , users respectively User characteristic relationship and user characteristics When the triple is an item attribute triple, then , , items respectively Item attribute relationships and item attributes .
[0033] Step 4.3: Calculate positive samples using the TransE model. Score and negative samples Score Therefore, positive samples can be calculated using equation (4). Corresponding knowledge graph contrast loss value : (4) In equation (4), This represents the loss scaling factor. This represents the smooth activation function.
[0034] Step 4.4: Calculate the positive samples using equation (5). semantic consistency score : (5) In equation (5), for Middle head entity Embedded vector, for China's related relationships Embedded vector, for Mid-tail entity Embedded vector, for The square of the norm.
[0035] Step 4.5, Retain Comparison of loss values across all knowledge graphs Below the preset contrast loss threshold ,and It is also below the preset semantic consistency threshold. Positive samples constitute a high-quality e-commerce knowledge graph after pruning. After fusion, the knowledge graph The number of triples has increased compared to the original graph, and the semantic coverage has been significantly improved, solving the problems of the original graph. The semantic representation problem caused by missing attributes provides high-quality data support for subsequent internal semantic embedding learning.
[0036] Step 4.6: Calculate the semantic consistency loss of the knowledge graph using equation (6). ; (6) In equation (6), for The set of positive samples in yes The total number of positive samples.
[0037] Step 4.7, utilize right Conduct training, The initial embedding vectors of all entities and relations are assigned to the entity embedding vector. With relation embedding vector Return to step 4.6 until the loss converges, and obtain the trained result. ,from Extract users Internal knowledge embedding vector and items Internal knowledge embedding vector .
[0038] Step 4.8: Use a linear projection layer for the user Internal knowledge embedding vector and items Internal knowledge embedding vector Mapping is performed to obtain the user's information. Internal semantic embedding vector and items Internal semantic embedding vector .
[0039] Step 5: Construct a multimodal fusion network for the items. Visual embedding vectors and items Text embedding vector By fusing them together, we can obtain the item. Multimodal embedding vectors And construct a multimodal BPR loss function. ; Step 5.1: Obtain the item using equation (7) Multimodal embedding vectors : (7) In equation (7), For multimodal fusion weights, i.e. =0.5.
[0040] Step 5.2: Construct the multimodal BPR loss function using equation (8). : (8) In equation (8), for The square of the norm; =1e-4 is the regularization coefficient, used to prevent overfitting of visual and text embedding vectors.
[0041] Step 6: Use equation (9) to... and as well as and Perform weighted fusion to obtain user data. fused embedding vector With items fused embedding vector : (9) In equation (9), =0.2 represents the external semantic fusion weight. =0.6 represents the weight for the fusion of semantic features and multimodal features.
[0042] Step 7: Construct the total loss function of the item recommendation network, which consists of an external semantic enhancement network, an internal semantic enhancement network, and a multimodal fusion network, using equation (10). : (10) In equation (10), =0.3 represents the fusion weight of the knowledge graph loss. =0.2 represents the multimodal loss fusion weight.
[0043] Step 8, based on The AdamW optimizer is used to train the item recommendation network, resulting in a trained item recommendation model used to generate user recommendations. For each item, a predicted preference score is assigned and sorted in descending order. The top K items are then selected to obtain the user's preference score. The final recommendation list, where K is the preset number of recommendations.
[0044] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the methods described above, and the processor is configured to execute the program stored in the memory.
[0045] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.
Claims
1. A method for item recommendation based on internal and external semantic fusion enhanced by a large language model, characterized in that, Follow these steps: Step 1: Obtain basic user information, item attribute information, and historical interaction records between users and items from the e-commerce platform, and filter users. For items Effective positive interaction behaviors, thereby constructing a set of positive user-item interactions. ,in, For user sets, For a collection of items; extract User characteristics in Item attributes and The association features between users and items are analyzed to construct triples of "user-relationship-item", "user-relationship-user feature", and "item-relationship-item attribute", which together form the original knowledge graph for e-commerce scenarios. , in, A collection of entities consisting of user entities, item entities, user characteristic entities, and item attribute entities; It is a set of relationships, including: user-user feature relationships, item-item attribute relationships, and user-item interaction relationships; Step 2: Collect images and descriptions of items from e-commerce platforms and extract their features to form a multimodal feature set for the items. This includes: the visual characteristics of the item Textual features of items ; Using CNN network Perform vector encoding to obtain the visual embedding vector of the item. Among them, items The visual embedding vector is denoted as ; Using BERT network Perform vector encoding to obtain the text embedding vector of the item. Among them, items The text embedding vector is denoted as ; Step 3: Construct an external semantic enhancement network and base it on the user-item positive interaction set. For users The external semantic enhancement prompts are processed to obtain user information. For items Predicted preference score This allows us to construct the BPR loss value for all users. Used for updating and and get users Optimal embedding vector With items Optimal embedding vector In turn, gain users External preference embedding vector With the optimal potential preference item set Potential preferred items External preference embedding vector ; Step 4: Construct an internal semantic enhancement network and apply it to the original e-commerce knowledge graph. Chinese users Feature missing and items By addressing the missing attributes, an enhanced e-commerce knowledge graph is obtained. Pruning is then performed to construct a semantic consistency loss function for the knowledge graph. Used to train high-quality e-commerce knowledge graphs after pruning. To output user Internal semantic embedding vector and items Internal semantic embedding vector ; Step 5: Construct a multimodal fusion network for the items. Visual embedding vectors and items Text embedding vector By fusing, you can obtain items. Multimodal embedding vectors Thus, a multimodal BPR loss function is constructed. ; Step 6: Use equation (9) to obtain the user fused embedding vector With items fused embedding vector : (9) In equation (9), For external semantic fusion weights, Weights are used to fuse semantic features and multimodal features; Step 7: Construct the total loss function of the item recommendation network, which consists of an external semantic enhancement network, an internal semantic enhancement network, and a multimodal fusion network, using equation (10). : (10) In equation (10), For knowledge graph loss fusion weights, For multimodal loss fusion weights; Step 8, based on The AdamW optimizer is used to train the item recommendation network, resulting in a trained item recommendation model used to generate user recommendations. For each item, a predicted preference score is assigned and sorted in descending order. The top K items are then selected to obtain the user's preference score. The final recommendation list, where K is the preset number of recommendations.
2. The method for item recommendation based on internal and external semantic fusion using a large language model enhancement as described in claim 1, characterized in that, Step 3 is performed as follows: Step 3.1: Build User Profile External semantic enhancement prompts , including: users Basic profile, users Items in historical interaction records and inferred user information Task instructions containing potentially preferred items and potentially unpreferred items; Will Input is processed in a large language model (LLM), and output is the user. Potential Preference Item Set With non-preference item set Thus forming users Item Enhancement Interaction Triples This leads to the complete set of enhanced interaction triples. ; Step 3.2: Generate users using a random initialization method. initial embedding vector With items initial embedding vector ; Step 3.3, using equation (1) to... and Perform inner product operations to obtain the user's... For items Predicted preference score : (1) Step 3.4, based on Calculate the user using equation (2) Set of items with potential preferences Average score of all items and the set of potentially unfavorable items Average score of all items : (2) In equation (2), Indicates user Potential Preference Item Set Potential preferred items in express The number of potential preferred items express The number of potential non-preference items in the middle. For users right Potential preferred items Predicted preference score For users right Potential non-preferred items Predicted preference score; Step 3.5: Use equation (3) to construct the user... Item Enhancement Interaction Triples BPR loss value : (3) In equation (3), For the Sigmoid function; Step 3.6: Use equation (4) to obtain the overall BPR loss value of the external semantic augmentation network. : (4) In equation (4), This represents the total number of enhanced interaction triples for all users; Step 3.7, Utilize renew and Thus, the updated user Embedded vector With updated items Embedded vector ; Step 3.8: Set the pruning ratio For each user in D The item-enhanced interaction triples are sorted in ascending order according to their corresponding BPR loss values, and the top three items in the sorted order are selected. The proportion of items enhances the interaction triples, from which user data is extracted. and Interaction relationship and Merge to obtain an enhanced interaction set ; Step 3.9, based on For users Rematch the corresponding potential preference item set With potential non-preference item set This forms a new item-enhanced interaction triplet. This leads to a new set of full-scale enhanced interaction triples. ; Will Assign to ,Will Assign to ,Will Assign to Then, return to step 3.3 and execute sequentially until the preset maximum number of updates is reached in the iteration rounds. or continuous wheel as a whole The amplitudes are all less than the preset minimum descent threshold. Thus, the optimal enhanced interaction set is obtained. ,user Optimal embedding vector With items Optimal embedding vector and users The optimal set of potential preferred items ; Step 3.10, based on , and Construct a user-item external graph And utilize graph neural networks (GNNs) to... Process and obtain user information. External preference embedding vector and the optimal potential preference item set Any potential preferred item External preference embedding vector .
3. The method for item recommendation based on internal and external semantic fusion using a large language model enhancement as described in claim 2, characterized in that, Step 4 is performed as follows: Step 4.1, targeting Chinese users Feature missing and items Missing attributes, building user Internal semantic enhancement prompts and items Internal semantic enhancement prompts ,in, Includes: users Basic profile completion prompts, user Historical interaction records and user completion Task instructions lacking features; Includes: items Attribute completion hints, items Existing attributes and completion items Task instructions with missing attributes; Will and The input is fed into an LLM for processing, and the corresponding user data is obtained. Attribute completion results With items Attribute completion results and will and Correspondingly converted into users triples and items triples Thus, user feature triples are obtained. and item attribute triples Then, it is integrated into the original knowledge graph. In the process, an enhanced e-commerce knowledge graph is obtained. ;in, For users User characteristic relationships, For items The relationship between item attributes, For users Featured entities For items Attribute entities; Step 4.2: Traverse the augmented e-commerce knowledge graph any triplet As positive samples, select entities related to the head. Other head entities of the same type are denoted as And generate corresponding negative samples. Where the triple is a user feature triple, then , , users respectively User characteristic relationship and user characteristics When the triple is an item attribute triple, then , , items respectively Item attribute relationships and item attributes ; Step 4.3: Calculate positive samples using the TransE model. Score and negative samples Score Therefore, positive samples can be calculated using equation (4). Corresponding knowledge graph contrast loss value : (4) In equation (4), This represents the loss scaling factor. Represents a smooth activation function; Step 4.4: Calculate the positive samples using equation (5). semantic consistency score : (5) In equation (5), for Middle head entity Embedded vector, for China's related relationships Embedded vector, for Mid-tail entity Embedded vector, for The square of the norm; Step 4.5, Retain All knowledge graphs in the dataset have a contrastive loss value lower than the preset contrastive loss threshold. Furthermore, the semantic consistency score is also lower than the preset semantic consistency threshold. Positive samples are used to construct a high-quality e-commerce knowledge graph after pruning. ; Step 4.6: Calculate the semantic consistency loss of the knowledge graph using equation (6). ; (6) In equation (6), for The set of positive samples in yes The total number of neutral samples; Step 4.7, utilize right After training, The initial embedding vectors of all entities and relations are assigned to the entity embedding vector. With relation embedding vector And return to step 4.6 until Convergence, thus obtaining the trained knowledge graph. and from Extract users Internal knowledge embedding vector and items Internal knowledge embedding vector ; Step 4.8: Use a linear projection layer to... and Mapping is performed to obtain the user's information. Internal semantic embedding vector and items Internal semantic embedding vector .
4. The method for item recommendation based on internal and external semantic fusion enhanced by a large language model according to claim 3, characterized in that, Step 5 is performed as follows: Step 5.1: Obtain the item using equation (7) Multimodal embedding vectors : (7) In equation (7), For multimodal fusion weights; Step 5.2: Construct the multimodal BPR loss function using equation (8). : (8) In equation (8), for The square of the norm; is the regularization coefficient.
5. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports a processor in executing the method of any one of claims 1-4, the processor being configured to execute the program stored in the memory.
6. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the steps of the method according to any one of claims 1-4.