Recommendation model training method and device based on large language model and recommendation method
Through the recommendation model training method based on large language models, the accuracy and user experience problems of traditional recommendation systems in the case of "cold startup" are solved, and higher recommendation accuracy and user experience are achieved.
Patent Information
- Application Number
- CN202411671243.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-21
AI Technical Summary
Traditional recommendation systems face "cold start" problems when dealing with new users or sparse data, resulting in inaccurate recommendation content and poor user experience.
The recommendation model training method based on a large language model is adopted. By collecting user interaction behavior data and text data, the similarity between users and projects is calculated, the user behavior data of the target project is predicted, the user behavior characteristics are determined, and the recommended model is trained.
It improves the accuracy of recommendations, alleviates the problem of sparse data, better understands user preferences, and improves user experience.
Smart Images

Figure CN119598193A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of recommendation technology, and in particular to a recommendation model training method, device and recommendation method based on a large language model. Background Art
[0002] With the development of Internet technology, personalized recommendation systems have become an indispensable part of many online platforms. However, traditional recommendation systems face challenges when dealing with new users or sparse data, which is often referred to as the "cold start" problem, resulting in inaccurate recommendations and poor user experience. In summary, how to improve the accuracy of recommendations and thus improve user experience is a problem that needs to be solved urgently. Summary of the invention
[0003] In view of this, the purpose of this application is to provide a recommendation model training method, device and recommendation method based on a large language model, which can improve the accuracy of recommendations and thus improve user experience. The specific scheme is as follows:
[0004] In a first aspect, the present application discloses a recommendation model training method based on a large language model, comprising:
[0005] Collecting user interaction behavior data and text data in the target domain, wherein the user interaction behavior data is behavior data generated by the interaction between the user and the items in the target domain, and the text data is text data corresponding to the items in the target domain;
[0006] Calculate the similarity between different users based on the user interaction behavior data to obtain a first similarity and the similarity between different items to obtain a second similarity;
[0007] Predicting user behavior data corresponding to a target item based on the first similarity and the second similarity, and determining user behavior features based on the user behavior data corresponding to the target item, wherein the target item is an item for which no corresponding user behavior exists for any user;
[0008] Extracting text features corresponding to the text data using a target large language model;
[0009] Merging the user behavior feature and the text feature into a comprehensive feature;
[0010] The comprehensive features are used as training samples to train the preset network model to obtain a recommendation model.
[0011] Optionally, predicting user behavior data corresponding to the target item based on the first similarity and the second similarity includes:
[0012] Determine a similar user corresponding to the target user based on the first similarity, wherein the target user is a user who has the target item;
[0013] Determining a similar project corresponding to the target project based on the second similarity;
[0014] The user behavior data corresponding to the target item of the target user is predicted based on the user behavior data corresponding to the target item of the similar users and the user behavior data corresponding to the similar items.
[0015] Optionally, predicting the user behavior data corresponding to the target item of the target user based on the user behavior data corresponding to the target item of the similar users and the user behavior data corresponding to the similar items includes:
[0016] When there are multiple similar users, weighted calculation is performed on the user behavior data corresponding to the target items of the multiple similar users to obtain user prediction data;
[0017] When there are multiple similar projects, weighted calculation is performed on the user behavior data corresponding to the multiple similar projects to obtain project prediction data;
[0018] The user prediction data and the item prediction data are weightedly calculated based on the weight adjustment parameter to obtain user behavior data corresponding to the target item of the target user.
[0019] Optionally, calculating the similarities between different users to obtain a first similarity and the similarities between different items to obtain a second similarity based on the user interaction behavior data includes:
[0020] Creating an interaction matrix between users and projects based on the user interaction behavior data, wherein rows in the interaction matrix represent users and columns represent projects or columns represent users and rows represent projects, and elements in the interaction matrix are user behavior data of the user corresponding to the element for the project corresponding to the element;
[0021] Based on the interaction matrix, similarities between different users and similarities between different projects are calculated to obtain a user similarity matrix and a project similarity matrix, wherein the elements in the user similarity matrix are first similarities, and the elements in the project similarity matrix are second similarities;
[0022] Accordingly, predicting the user behavior data corresponding to the target item based on the first similarity and the second similarity includes:
[0023] The user behavior data corresponding to the target project is predicted based on the user similarity matrix and the project similarity matrix.
[0024] Optionally, also include:
[0025] Acquire a text training sample set, wherein the text training samples in the text training sample set are text data corresponding to projects in the target field;
[0026] The large language model is trained using the text training sample set to obtain the target large language model.
[0027] Optionally, the fusing the user behavior feature and the text feature into a comprehensive feature includes:
[0028] The user behavior feature and the text feature are fused into a comprehensive feature based on a first weight parameter corresponding to the user behavior feature and a second weight parameter corresponding to the text feature.
[0029] In a second aspect, the present application discloses a recommendation method, comprising:
[0030] Acquire target user interaction behavior data and target text data in a target domain, wherein the target user interaction behavior data is behavior data generated by the user interacting with the items in the target domain, and the target text data is text data corresponding to the items in the target domain;
[0031] Determine the user behavior features corresponding to the target user interaction behavior data and the text features corresponding to the target text data, and merge the user behavior features and the text features into comprehensive features;
[0032] The recommendation model is used to output the recommended items based on the comprehensive features, wherein the recommendation model is trained based on the aforementioned large language model-based recommendation model training method.
[0033] In a third aspect, the present application discloses a recommendation model training device based on a large language model, comprising:
[0034] A data collection module, used to collect user interaction behavior data and text data in the target domain, wherein the user interaction behavior data is behavior data generated by the interaction between the user and the items in the target domain, and the text data is text data corresponding to the items in the target domain;
[0035] A similarity calculation module, configured to calculate the similarities between different users based on the user interaction behavior data to obtain a first similarity and the similarities between different items to obtain a second similarity;
[0036] A data prediction module, configured to predict user behavior data corresponding to a target item based on the first similarity and the second similarity; wherein the target item is an item for which no corresponding user behavior exists for any user;
[0037] A behavior feature determination module, used to determine user behavior features based on user behavior data corresponding to the target item;
[0038] A text feature extraction module, used to extract text features corresponding to the text data using a target large language model;
[0039] A feature fusion module, used to fuse the user behavior feature and the text feature into a comprehensive feature;
[0040] The recommendation model training module is used to train the preset network model using the comprehensive features as training samples to obtain the recommendation model.
[0041] In a fourth aspect, the present application discloses an electronic device, including a memory and a processor, wherein:
[0042] The memory is used to store the computer program;
[0043] The processor is used to execute the computer program to implement the aforementioned recommendation model training method based on a large language model and / or the aforementioned recommendation method.
[0044] In a fifth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned recommendation model training method based on a large language model, and / or the aforementioned recommendation method.
[0045] It can be seen from the above scheme that the present application provides a recommendation model training method based on a large language model, including: collecting user interaction behavior data and text data in a target field, wherein the user interaction behavior data is the behavior data generated by the interaction between the user and the project in the target field, and the text data is the text data corresponding to the project in the target field; based on the user interaction behavior data, calculating the similarity between different users to obtain a first similarity and the similarity between different projects to obtain a second similarity; predicting the user behavior data corresponding to the target project based on the first similarity and the second similarity, and determining the user behavior features based on the user behavior data corresponding to the target project, wherein the target project is a project for which no corresponding user behavior exists for any user; using the target large language model to extract the text features corresponding to the text data; fusing the user behavior features and the text features into comprehensive features; using the comprehensive features as training samples to train a preset network model to obtain a recommendation model.
[0046] It can be seen that the beneficial effects of the present application are: based on user interaction behavior data, the similarity between users and the similarity between projects are obtained, so as to predict projects without user behavior data, which can avoid the difficulty in recommendation caused by data sparsity, determine user behavior characteristics based on the user behavior data of the predicted projects, and use the large language model to extract text features, so as to better understand user preferences, and then after fusing them into comprehensive features, train the network model to obtain a recommendation model, so as to improve the accuracy of recommendations and thus improve user experience.
[0047] Correspondingly, the recommendation method, recommendation model training device based on a large language model, equipment and readable storage medium provided in this application also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0049] Figure 1 A flow chart of a recommendation model training method based on a large language model provided in an embodiment of the present application;
[0050] Figure 2 A flow chart of a recommendation model training method provided in an embodiment of the present application;
[0051] Figure 3 A flowchart of a recommended method provided for an embodiment of the present application;
[0052] Figure 4 A schematic diagram of the structure of a recommendation model training device based on a large language model provided in an embodiment of the present application;
[0053] Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] See also Figure 1As shown, the embodiment of the present application discloses a recommendation model training method based on a large language model, including:
[0056] Step S11: Collect user interaction behavior data and text data in the target domain, wherein the user interaction behavior data is behavior data generated by the interaction between the user and the items in the target domain, and the text data is text data corresponding to the items in the target domain.
[0057] The target domain can be any domain to be recommended, such as novels, movies, music, and online sales. The project in the novel domain is a certain novel, and the project in the movie domain is a certain movie. User interaction behavior data can be one or more of the user rating, click, favorite, browse, forward, and other behavior data. The text data is the text data related to the recommendation, which can be the basic information of the project and user-generated content. The basic information is such as name, description, category, tag, etc.; the user-generated content can include user evaluation, comments, feedback, and other texts.
[0058] Step S12: calculating the similarities between different users based on the user interaction behavior data to obtain a first similarity and the similarities between different items to obtain a second similarity.
[0059] In an optional embodiment, an interaction matrix between users and projects can be created based on user interaction behavior data, wherein rows in the interaction matrix represent users and columns represent projects or columns represent users and rows represent projects, and elements in the interaction matrix are user behavior data of the user corresponding to the element for the project corresponding to the element; the similarity between different users and the similarity between different projects are calculated based on the interaction matrix to obtain a user similarity matrix and a project similarity matrix, wherein the elements in the user similarity matrix are the first similarity and the elements in the project similarity matrix are the second similarity.
[0060] For example, data in different rows are data of different users, and the similarity between different users can be calculated using data in different rows. Data in different columns are data of different projects, and the similarity between different projects can be calculated using data in different columns. For example, the similarity can be calculated using the Pearson correlation coefficient. It can be understood that the rows and columns of the user similarity matrix are users, and the elements are the similarities between users. The rows and columns of the project similarity matrix are projects, and the elements are the similarities between projects. It should be pointed out that by constructing an interaction matrix and calculating the user similarity matrix and the project similarity matrix, the data calculation efficiency can be improved.
[0061] Step S13: predicting user behavior data corresponding to the target item based on the first similarity and the second similarity, and determining user behavior features based on the user behavior data corresponding to the target item, wherein the target item is an item for which no user has corresponding user behavior.
[0062] In an optional embodiment, similar users corresponding to the target user can be determined based on the first similarity, wherein the target user is a user who has the target project; similar projects corresponding to the target project can be determined based on the second similarity; and user behavior data corresponding to the target project of the target user can be predicted based on user behavior data corresponding to the target project of the similar users and user behavior data corresponding to the similar projects.
[0063] Among them, similar users can be understood as a first preset number of users with the highest first similarity, and the preset number can be 1 or more. Similar projects can be understood as a second preset number of projects with the highest second similarity, and the preset number can be 1 or more. The first preset number and the second preset number can be the same or different. The user behavior data corresponding to the target project of the similar users and the user behavior data corresponding to the similar projects can be weightedly calculated to obtain the user behavior data corresponding to the target project of the target user.
[0064] For example, if user A has not rated item x, the rating of item x by user A can be calculated based on the rating of item x by user B who is similar to user A and the user rating data of item y that is similar to item x. The user rating data of item y that is similar to item x can be the rating of user A or the weighted result of the ratings of user A and similar users.
[0065] When there are multiple similar users, the user behavior data corresponding to the target items of the multiple similar users are weighted to obtain user prediction data; when there are multiple similar items, the user behavior data corresponding to the multiple similar items are weighted to obtain item prediction data; based on the weight adjustment parameter, the user prediction data and the item prediction data are weighted to obtain the user behavior data corresponding to the target item of the target user. For example, the user behavior data is an item rating, or there is a characterization value of a certain behavior, such as clicked, which is represented by 1.
[0066] In an optional implementation, the user behavior data corresponding to the target item may be predicted based on the user similarity matrix and the item similarity matrix.
[0067] Furthermore, determining the user behavior features based on the user behavior data corresponding to the target project may include: supplementing the user behavior data corresponding to the target project with the user interaction behavior data, and determining the user behavior features corresponding to the supplemented user interaction behavior data. User behavior features are normalized features that can be fused with subsequent text features. User behavior features can be extracted by methods including but not limited to statistical methods, machine learning algorithms, or deep learning models. In this way, projects that are more in line with user preferences can be recommended.
[0068] Furthermore, determining the user behavior feature based on the user behavior data corresponding to the target item may include: extracting features of the user behavior data corresponding to the target item to obtain the user behavior feature. In this way, the recommendation probability of the non-appearing item can be increased.
[0069] Step S14: extracting text features corresponding to the text data using the target large language model.
[0070] In an embodiment of the present application, a text training sample set can be obtained, wherein the text training samples in the text training sample set are text data corresponding to projects in the target domain; the large language model is trained using the text training sample set to obtain the target large language model. A large language model (LLM) refers to a deep learning model trained using a large amount of text data, which can generate natural language text or understand the meaning of language text. In this embodiment, the text data corresponding to the projects in the target domain can be used to train a large speech model to obtain a large language model that can extract text features. In this embodiment, the text features can also be normalized to obtain features that can be integrated with user behavior features.
[0071] Step S15: Merge the user behavior feature and the text feature into a comprehensive feature.
[0072] This embodiment can fuse the user behavior feature and the text feature into a comprehensive feature based on the first weight parameter corresponding to the user behavior feature and the second weight parameter corresponding to the text feature. For example, the user behavior feature and the text feature can be concatenated into a high-dimensional feature vector based on the weight parameter.
[0073] Step S16: using the comprehensive features as training samples to train the preset network model to obtain a recommended model.
[0074] In this embodiment, the comprehensive features can be annotated to obtain the annotated comprehensive features, and the preset network model can be trained using the annotated comprehensive features to obtain a recommendation model. The annotated information can be the next interactive item corresponding to each user.
[0075] It can be seen that the embodiment of the present application obtains the similarity between users and the similarity between projects based on the user interaction behavior data, so as to predict projects without user behavior data, which can avoid the difficulty in recommendation caused by data sparsity. The user behavior characteristics are determined based on the user behavior data of the predicted projects, and the text features are extracted using a large language model, which can better understand user preferences. After being integrated into comprehensive features, the network model is trained to obtain a recommendation model. In this way, the accuracy of recommendations can be improved, thereby improving user experience.
[0076] For further information, see Figure 2 As shown, an embodiment of the present application discloses a method for training a recommendation model. First, data preparation and preprocessing are performed, including constructing a user-item interaction matrix and preprocessing text data; then, the collaborative filtering model and the large language model are trained separately, the former is used to calculate the similarity between users and items, and the latter is used to extract semantic features in the text; then, the features generated by the two models are fused to form a comprehensive feature representation; finally, the fused features are used to train the recommendation model, and the model performance is continuously optimized through online learning and user feedback mechanisms. In this way, the cold start problem existing in the traditional recommendation system and the lack of personalized and explainable recommended content are solved, which can improve the relevance, interactivity and explainability of the recommended content, reduce the impact of the cold start problem, and improve the user experience. The specific steps include:
[0077] S01: Data preparation and data preprocessing: Collect user behavior data (i.e. the aforementioned user interaction behavior data) and text data in the target field, and perform preprocessing operations, including but not limited to building a user-item interaction matrix, such as a rating matrix or a click matrix, and text data processing: word segmentation, stop word removal, stem extraction, vectorization, etc., to prepare high-quality text data sets for subsequent training of collaborative filtering models. Among them, user behavior data includes user rating, click, favorite, browse, forward and other behavior data.
[0078] In a specific implementation, text data can be collected to obtain text data sets that need to be classified, and a large amount of text data can be collected from the target field, including user behavior data and recommendation-related text data, to ensure the diversity and representativeness of the data. Recommendation-related text data includes: basic information of the recommended items, names, descriptions, categories, tags, etc.; user-generated content: user evaluations, comments, and feedback, etc. Preprocessing operations are performed on the collected text data: User behavior data preprocessing includes creating a user-item interaction matrix. If it is rating data, numerical representation can be used; if it is a click or browsing record, binary representation can be used; such as 1 means clicked, and 0 means no click. Text data preprocessing related to recommendation includes but is not limited to word segmentation: dividing the text into words or phrases; removing stop words: deleting common words that do not affect the semantics of the text; stemming: restoring the vocabulary to its basic form; vectorization: using methods such as bag-of-words model, TF-IDF (Term Frequency-Inverse Document Frequency, word frequency, inverse text frequency index) or word embedding to convert the text into a numerical vector, and finally performing data cleaning.
[0079] S02: Training collaborative filtering model: Based on the data set, a user-item rating matrix is constructed, where rows represent users, columns represent items, and the values in the matrix represent the user's rating of the item. The similarity between users is calculated. The similarity metric can be cosine similarity, Pearson correlation coefficient, etc. The similarity between items is calculated to obtain a similarity matrix, and the similarity matrix is used to predict the user's rating of the unevaluated item. Calculating similarity, predicting neighbors, and predicting ratings are the collaborative filtering model training process.
[0080] In a specific implementation, preprocessed user-item rating matrix data may be loaded; the similarity between users may be calculated using the Pearson correlation coefficient similarity measurement method: the Pearson correlation coefficient is a statistic that measures the strength and direction of the linear relationship between two variables. For user i and user j, the Pearson correlation coefficient is defined as:
[0081] ;
[0082] in, and , are the average ratings of user i and user j, n is the total number of items rated by user i and user j, k represents the kth item, r ij is the Pearson correlation coefficient, u i [k] is the rating of item k by user i, u j[k] is the rating of item k by user j. Use the Pearson correlation coefficient similarity metric to calculate the similarity between items in the same way; use the similarity matrix to predict ratings: Once you have the user-user similarity matrix and the item-item similarity matrix, you can use these matrices to predict the user's ratings for unevaluated items.
[0083] In this embodiment, the collaborative filtering model can be understood as an algorithm used in the process of calculating similarity, predicting neighbors, and predicting scores. In this embodiment, the score can be predicted by finding K neighbors based on similarity. The user similarity and the item similarity can be linearly combined, and the proportion of the two in the final prediction can be controlled by introducing a weight variable λ. The comprehensive score = λ Similarity score based on users + (1-λ) Similarity scoring results based on items. The value of λ can be adjusted according to actual data and business needs to optimize the quality of recommendations. The similarity scoring results based on users are to find the most similar K users, and use the scores of the nearest neighbor users to predict the target user's score for unrated items. The same is true for items. Determine user behavior characteristics based on collaborative filtering results. Collaborative filtering results can be understood as predicting the target user's score for unrated items. For example, this score is a linear combination of the scores of user u's neighbor users on item i and the scores of similar items of item i by user u.
[0084] S03: Train a large language model: Select a pre-trained large language model and fine-tune it using text data related to the recommendation system. Set training parameters: define batch size, learning rate, number of training rounds, etc. Perform fine-tuning: Fine-tune the pre-trained model using text data to make it more suitable for the task of the recommendation system. Use the large language model to extract semantic features from text such as item descriptions and reviews.
[0085] In a specific implementation, a large language model is trained: for the fine-tuning stage, some important hyperparameters need to be defined, including but not limited to batch size, learning rate, number of training rounds, optimizer, loss function, etc., and the pre-trained model is fine-tuned using the prepared data set to make it more suitable for the task of the recommendation system; once the model has been fine-tuned, it can be used to extract semantic features (text features) in texts such as item descriptions and comments: directly use the output of the last layer of the model as the vector representation of the text; or, average pool the outputs of all hidden layers to obtain the representation of the entire sequence; or, use the attention mechanism to weight the average output of the hidden layer. In addition, these features can also be used to build other components of the recommendation system, such as item similarity calculation or user interest model. For example, the last layer output and average pooling features can be combined to calculate the similarity between items, and the user's interest can be predicted by comparing the text data in the user's historical behavior with the vector representation of the candidate items. You can choose the BERT (Bidirectional Encoder Representations from Transformers, a pre-trained language representation model) large language model, define a loss function to measure the difference between the model prediction and the true target, and perform fine-tuning training on the task data. The pre-trained weights of the model will be gradually adjusted according to the task data to minimize the loss function.
[0086] S04: Feature fusion and integration: Use the fine-tuned large language model to extract semantic features (i.e., text features) from text data, and combine user behavior features (such as ratings, clicks, etc.) with text features to form a comprehensive feature representation. Text features and user behavior features can be fused in a weighted fusion manner. The recommendation results based on text features are the text features extracted by the large voice model. In this way, the results of collaborative filtering are combined with those based on text features to enhance the performance of the collaborative filtering model.
[0087] In a specific implementation, the text features extracted by the large language model can be combined with the results obtained by collaborative filtering to make comprehensive recommendations. This can be achieved through weighted fusion: different weights are assigned to text features and user behavior features based on experimental results or expert knowledge, and the weighted features are added or multiplied to form a comprehensive feature representation. Through the comprehensive feature representation, the text features can be combined with the results of collaborative filtering to make comprehensive recommendations, thereby enhancing the performance of the recommendation system.
[0088] S05: Model training: Use the fused features to train the recommendation model, and supervised learning methods can be used. This embodiment gives different weights to collaborative filtering and text features, performs comprehensive recommendations, and evaluates model performance through methods such as cross-validation, adjusts model parameters based on the evaluation results, performs feature selection and model tuning. In addition, the recommendation results can be dynamically adjusted based on the latest user behavior data, a user feedback mechanism can be established, and user satisfaction with the recommendation results can be collected to continuously optimize the recommendation algorithm, that is, the model can be updated based on new data.
[0089] This embodiment can use the fused features to train a supervised learning model. Model training includes dividing the data set into a training set, a validation set, and a test set; selecting a neural network supervised learning model and defining the model architecture; performing feature scaling, normalization, and other operations as needed; using the training set data to train the model; using the validation set to evaluate the model performance and make necessary parameter adjustments; and evaluating the final performance of the model on the test set. In order to evaluate the performance of the model and perform tuning, K-fold cross validation can be used to evaluate the model performance, and the model parameters can be adjusted based on the results of cross validation. Using online learning technology and user feedback mechanisms, the model is updated according to real-time data to dynamically adjust the recommendation results, further improve the model performance, and finally deploy the trained model to the production environment. The recommendation model can be a classifier.
[0090] Among them, operations such as feature scaling and normalization as needed can specifically include: selecting appropriate methods based on the characteristics of the data and algorithm. For minimum-maximum scaling, it is necessary to calculate the maximum and minimum values of each feature, apply the calculated parameters to the data set, and scale the features (scaling all features to a specified range (usually 0 to 1)) or normalize (normalization usually refers to scaling the data to unit norm). After the model training is completed, the new data is preprocessed with the same parameters to maintain consistency. It can improve algorithm performance and avoid numerical instability.
[0091] In this embodiment, a decision tree model can be selected to divide the data set into K parts, with K-1 parts used as training sets each time and the remaining 1 part used as a validation set. Repeat this process K times, using different data as validation sets each time. Record the performance indicators of the model such as accuracy for each training. Select the model with the highest average performance and the smallest standard deviation. Define the hyperparameter space: the depth of the decision tree. Use grid search combined with K-fold cross validation to traverse all possible combinations of hyperparameters and find the best hyperparameter combination. In order to ensure the reliability of the results, repeated K-fold cross validation can be used to further verify the performance of the best hyperparameter combination.
[0092] In addition, real-time user behavior data can be collected, such as clicks, browsing, and searching. This data can be used to update item features. User feedback on recommendation results (satisfaction or not) can be collected in real time. Models can be adjusted quickly and in real time based on user behavior and feedback, and recommendation results can be regenerated after the model is adjusted.
[0093] This embodiment uses a recommendation method that combines a large language model and collaborative filtering technology. By combining the advantages of the two models, the performance of the recommendation system can be improved in many aspects. By deeply understanding user preferences and content characteristics, the large language model can capture the subtle differences in the text and provide users with more accurate and diverse recommended content. Collaborative filtering technology makes full use of user historical behavior data and can predict the content that the target user may be interested in based on the behavior patterns of similar users. This method not only improves the relevance of recommendations, but also enhances the robustness of the recommendation system, enabling it to provide reasonable recommendations even when data is sparse. In addition, this method can effectively solve the cold start problem, and even new users or new projects can quickly build a recommendation foundation, thereby enhancing the user experience. Combining large language models and collaborative filtering technology can achieve the diversification and novelty of recommended content, and support rapid iterative optimization.
[0094] Large-scale language models can understand and generate high-quality natural language texts, which can be used to understand free text feedback, queries, comments, etc. provided by users, extract user interests and preferences, and even predict user future behavior. In addition, large language models can also help recommendation systems generate richer and more diverse reasons for recommendations, increasing the attractiveness of recommended content. Collaborative filtering technology can mine potential interest patterns from user behavior data. The recommendation method based on large language models and collaborative filtering in this embodiment solves the cold start problem in traditional recommendation systems and improves the relevance, interactivity and interpretability of recommended content. Specifically, the quality and personalization of recommended content are improved; the impact of cold start problems is reduced, and the recommendation effect for new users is improved; the interactivity and interpretability of recommended content are enhanced; the false alarm rate of the recommendation system is reduced, and the user experience is improved. The recommendation model provided by the embodiment of the present application can better understand user intent, improve recommendation accuracy and user experience.
[0095] See also Figure 3 As shown, the embodiment of the present application discloses a recommendation method, including:
[0096] Step S21: Acquire target user interaction behavior data and target text data in the target domain, wherein the target user interaction behavior data is behavior data generated by the user interacting with the items in the target domain, and the target text data is text data corresponding to the items in the target domain.
[0097] Step S22: determining the user behavior features corresponding to the target user interaction behavior data and the text features corresponding to the target text data, and fusing the user behavior features and the text features into comprehensive features.
[0098] In an optional embodiment, the similarity between different users can be calculated based on the target user interaction behavior data to obtain a first similarity and the similarity between different items can be calculated to obtain a second similarity; the user behavior data corresponding to the target item is predicted based on the first similarity and the second similarity, and the user behavior features are determined based on the user behavior data corresponding to the target item, wherein the target item is a project for which no corresponding user behavior exists for any user; and the text features corresponding to the text data are extracted using the target large language model.
[0099] Step S23: using the recommendation model and outputting the recommended items based on the comprehensive features, wherein the recommendation model is trained by the recommendation model training method based on the large language model disclosed in the above embodiment.
[0100] It can be seen that the embodiment of the present application makes recommendations based on the recommendation model trained by the model training method disclosed in the aforementioned embodiment, which can improve the accuracy of the recommendations and thus improve the user experience.
[0101] See also Figure 4 As shown, the present application discloses a recommendation model training device based on a large language model, comprising:
[0102] The data collection module 11 is used to collect user interaction behavior data and text data in the target domain, wherein the user interaction behavior data is the behavior data generated by the interaction between the user and the items in the target domain, and the text data is the text data corresponding to the items in the target domain.
[0103] The similarity calculation module 12 is used to calculate the similarities between different users based on the user interaction behavior data to obtain a first similarity and the similarities between different items to obtain a second similarity.
[0104] The data prediction module 13 is used to predict the user behavior data corresponding to the target project based on the first similarity and the second similarity; wherein the target project is a project for which no corresponding user behavior exists for any user.
[0105] The behavior feature determination module 14 is used to determine the user behavior features based on the user behavior data corresponding to the target item.
[0106] The text feature extraction module 15 is used to extract text features corresponding to the text data using the target large language model.
[0107] The feature fusion module 16 is used to fuse the user behavior feature and the text feature into a comprehensive feature.
[0108] The recommendation model training module 17 is used to train the preset network model using the comprehensive features as training samples to obtain a recommendation model.
[0109] The data prediction module 13 may include:
[0110] A similar user determination submodule, configured to determine similar users corresponding to a target user based on the first similarity, wherein the target user is a user who has the target item;
[0111] A similar project determination submodule, used to determine similar projects corresponding to the target project based on the second similarity;
[0112] A prediction submodule is used to predict the user behavior data corresponding to the target item of the target user based on the user behavior data corresponding to the target item of the similar users and the user behavior data corresponding to the similar items.
[0113] The prediction submodule can be specifically used for: when there are multiple similar users, weighted calculation is performed on the user behavior data corresponding to the target projects of the multiple similar users to obtain user prediction data; when there are multiple similar projects, weighted calculation is performed on the user behavior data corresponding to the multiple similar projects to obtain project prediction data; based on the weight adjustment parameter, weighted calculation is performed on the user prediction data and the project prediction data to obtain the user behavior data corresponding to the target project of the target user.
[0114] The similarity calculation module 12 is specifically used to create an interaction matrix between users and projects based on user interaction behavior data, wherein rows in the interaction matrix represent users and columns represent projects or columns represent users and rows represent projects, and elements in the interaction matrix are user behavior data of the user corresponding to the element for the project corresponding to the element; similarities between different users and similarities between different projects are calculated based on the interaction matrix to obtain a user similarity matrix and a project similarity matrix, wherein the elements in the user similarity matrix are first similarities, and the elements in the project similarity matrix are second similarities;
[0115] Correspondingly, the data prediction module 13 is specifically used to predict the user behavior data corresponding to the target project based on the user similarity matrix and the project similarity matrix.
[0116] The device also includes a target large language model training module, which is used to obtain a text training sample set, wherein the text training samples in the text training sample set are text data corresponding to projects in the target field; and the large language model is trained using the text training sample set to obtain the target large language model.
[0117] The feature fusion module 16 is specifically configured to fuse the user behavior feature and the text feature into a comprehensive feature based on the first weight parameter corresponding to the user behavior feature and the second weight parameter corresponding to the text feature.
[0118] It can be seen that the embodiment of the present application obtains the similarity between users and the similarity between projects based on the user interaction behavior data, so as to predict projects without user behavior data, which can avoid the difficulty in recommendation caused by data sparsity. The user behavior characteristics are determined based on the user behavior data of the predicted projects, and the text features are extracted using a large language model, which can better understand user preferences. After being integrated into comprehensive features, the network model is trained to obtain a recommendation model. In this way, the accuracy of recommendations can be improved, thereby improving user experience.
[0119] See also Figure 5 As shown, an embodiment of the present application discloses an electronic device 20, including a processor 21 and a memory 22; wherein the memory 22 is used to store a computer program; the processor 21 is used to execute the computer program, the recommendation model training method based on a large language model disclosed in the aforementioned embodiment, and / or the aforementioned recommendation method.
[0120] Regarding the above-mentioned recommendation model training method based on a large language model, and / or the specific process of the above-mentioned recommendation method, reference may be made to the corresponding contents disclosed in the above-mentioned embodiments, which will not be described in detail here.
[0121] Furthermore, the memory 22 as a carrier for storing resources may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.
[0122] In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input / output interface 25 and a communication bus 26; wherein the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input / output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0123] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, it implements the recommendation model training method based on a large language model disclosed in the aforementioned embodiment, and / or the aforementioned recommendation method.
[0124] Regarding the above-mentioned recommendation model training method based on a large language model, and / or the specific process of the above-mentioned recommendation method, reference may be made to the corresponding contents disclosed in the above-mentioned embodiments, which will not be described in detail here.
[0125] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0126] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0127] The above is a detailed introduction to the recommendation model training method, device and recommendation method based on a large language model provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A recommendation model training method based on a large language model, characterized in that: include: Collecting user interaction behavior data and text data in the target domain, wherein the user interaction behavior data is behavior data generated by the interaction between the user and the items in the target domain, and the text data is text data corresponding to the items in the target domain; Calculate the similarity between different users based on the user interaction behavior data to obtain a first similarity and the similarity between different items to obtain a second similarity; Predicting user behavior data corresponding to a target item based on the first similarity and the second similarity, and determining user behavior features based on the user behavior data corresponding to the target item, wherein the target item is an item for which no corresponding user behavior exists for any user; Extracting text features corresponding to the text data using a target large language model; Merging the user behavior feature and the text feature into a comprehensive feature; The comprehensive features are used as training samples to train the preset network model to obtain a recommendation model.
2. The recommendation model training method based on a large language model according to claim 1, characterized in that: The predicting the user behavior data corresponding to the target item based on the first similarity and the second similarity includes: Determine a similar user corresponding to the target user based on the first similarity, wherein the target user is a user who has the target item; Determining a similar project corresponding to the target project based on the second similarity; The user behavior data corresponding to the target item of the target user is predicted based on the user behavior data corresponding to the target item of the similar users and the user behavior data corresponding to the similar items.
3. The recommendation model training method based on a large language model according to claim 2, characterized in that: The predicting the user behavior data corresponding to the target item of the target user based on the user behavior data corresponding to the target item of the similar users and the user behavior data corresponding to the similar items includes: When there are multiple similar users, weighted calculation is performed on the user behavior data corresponding to the target items of the multiple similar users to obtain user prediction data; When there are multiple similar projects, weighted calculation is performed on the user behavior data corresponding to the multiple similar projects to obtain project prediction data; The user prediction data and the item prediction data are weightedly calculated based on the weight adjustment parameter to obtain user behavior data corresponding to the target item of the target user.
4. The recommendation model training method based on a large language model according to claim 1, characterized in that: Calculating the similarities between different users based on the user interaction behavior data to obtain a first similarity and calculating the similarities between different items to obtain a second similarity includes: Creating an interaction matrix between users and projects based on the user interaction behavior data, wherein rows in the interaction matrix represent users and columns represent projects or columns represent users and rows represent projects, and elements in the interaction matrix are user behavior data of the user corresponding to the element for the project corresponding to the element; Based on the interaction matrix, similarities between different users and similarities between different projects are calculated to obtain a user similarity matrix and a project similarity matrix, wherein the elements in the user similarity matrix are first similarities, and the elements in the project similarity matrix are second similarities; Accordingly, predicting the user behavior data corresponding to the target item based on the first similarity and the second similarity includes: The user behavior data corresponding to the target project is predicted based on the user similarity matrix and the project similarity matrix.
5. The recommendation model training method based on a large language model according to claim 1, characterized in that: Also includes: Acquire a text training sample set, wherein the text training samples in the text training sample set are text data corresponding to projects in the target field; The large language model is trained using the text training sample set to obtain the target large language model.
6. The recommendation model training method based on a large language model according to any one of claims 1 to 5, characterized in that: The step of fusing the user behavior feature and the text feature into a comprehensive feature includes: The user behavior feature and the text feature are fused into a comprehensive feature based on a first weight parameter corresponding to the user behavior feature and a second weight parameter corresponding to the text feature.
7. A recommendation method, characterized in that: include: Acquire target user interaction behavior data and target text data in a target domain, wherein the target user interaction behavior data is behavior data generated by the user interacting with the items in the target domain, and the target text data is text data corresponding to the items in the target domain; Determine the user behavior features corresponding to the target user interaction behavior data and the text features corresponding to the target text data, and merge the user behavior features and the text features into a comprehensive feature; A recommendation model is used to output recommended items based on comprehensive features, wherein the recommendation model is trained based on the recommendation model training method based on a large language model according to any one of claims 1 to 6.
8. A recommendation model training device based on a large language model, characterized in that: include: A data collection module, used to collect user interaction behavior data and text data in the target domain, wherein the user interaction behavior data is behavior data generated by the interaction between the user and the items in the target domain, and the text data is text data corresponding to the items in the target domain; A similarity calculation module, configured to calculate the similarities between different users based on the user interaction behavior data to obtain a first similarity and the similarities between different items to obtain a second similarity; A data prediction module, configured to predict user behavior data corresponding to a target item based on the first similarity and the second similarity; wherein the target item is an item for which no corresponding user behavior exists for any user; A behavior feature determination module, used to determine user behavior features based on user behavior data corresponding to the target item; A text feature extraction module, used to extract text features corresponding to the text data using a target large language model; A feature fusion module, used to fuse the user behavior feature and the text feature into a comprehensive feature; The recommendation model training module is used to train the preset network model using the comprehensive features as training samples to obtain the recommendation model.
9. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store the computer program; The processor is used to execute the computer program to implement the recommendation model training method based on a large language model as described in any one of claims 1 to 6, and / or the recommendation method as described in claim 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the recommendation model training method based on a large language model as described in any one of claims 1 to 6 and / or the recommendation method as described in claim 7 is implemented.
Citation Information
Patent Citations
Recommendation system effect enhancement method and device based on pre-training language model
CN113011195A
Recommendation model training method and device, recommendation method and device, electronic equipment and medium
CN114817734A
Personalized user recommendation method and device
CN115438262A
Personalized recommendation method and device, electronic equipment and readable storage medium
CN117992672A
Multi-behavior recommendation model training method, recommendation method and device of fusion graph neural network
CN118733868A