Calculation method and system for collaborative large model and recommendation small model
By employing a computational method for large and small models that works collaboratively on both the cloud and the device, the high cost of deploying and training large language models on devices is addressed, enabling efficient, real-time, and personalized recommendations for recommendation systems.
Patent Information
- Application Number
- CN202411120312.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2044-08-15
AI Technical Summary
In existing technologies, large language models (LLMs) are costly to deploy and train on devices and have difficulty accessing user behavior data in real time, which limits the performance and real-time nature of recommendation systems; small recommendation models (SRMs) have limitations in recommendation accuracy.
The method employs a collaborative large model and recommendation small model computation approach. By pre-training a large language model and a sequence recommendation model on the cloud side, a candidate list is generated in the cloud after collaborative training, and then retrained and re-ranked on the device. The consistency is evaluated by combining an intelligent request mechanism, and the model calls are dynamically adjusted.
It improves the performance and real-time capabilities of the recommendation system, reduces device resource consumption, enables efficient deployment of large models and flexible use of small models, and enhances recommendation accuracy and user experience.
Smart Images

Figure CN119046538A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of recommendation systems and machine learning, and in particular to a method and system for collaborative large model and recommendation small model calculation. Background Art
[0002] In today's recommendation systems, large language models (LLMs) such as GPT (Generative Pre-trained Transformer) have demonstrated excellent performance, especially in natural language understanding and generation. However, there are some challenges in deploying these large models on devices. Among them, the behavioral data generated by users on the device poses an important challenge to the deployment of the model. These data may involve users' browsing history, click behavior, purchase history, etc., which are crucial for personalized recommendations of recommendation systems. Since the data involves user privacy, it needs to be anonymized. At the same time, factors such as the communication burden between the device and the cloud and the limitations of cloud computing resources also restrict the access and processing capabilities of large models to real-time data. In addition, since LLMs have more parameters and complex structures than traditional small models, their training and inference costs are high, which is not conducive to frequent use on devices.
[0003] Sequential recommendation system is an important subfield of recommendation system. Its goal is to predict the user's next behavior based on the user's historical behavior sequence (such as click, purchase, browse, etc.) to achieve personalized recommendation. There are many mature sequential recommendation models, such as DIN (Deep Interest Network), GRU4Rec (Gated Recurrent Unit for Recurrent Neural Network), SASRec (Self-Attentive Sequential Recommendation), etc. These models usually have fewer parameters and efficient calculation characteristics.
[0004] In the existing technology, there are certain differences between large language models (LLMs) and small recommendation models (SRMs). LLMs usually have stronger reasoning and generalization capabilities, but face the problem of high deployment and training costs; while SRMs are more suitable for on-device deployment and frequent use, but may have certain limitations in recommendation accuracy.
[0005] Specifically, the disadvantages of the prior art are:
[0006] (1) The deployment of LLMs on devices faces practical constraints, mainly because the behavioral data generated by users on devices makes it difficult to deploy larger models. In addition, data anonymization, the communication burden between devices and the cloud, and cloud computing capacity limitations all hinder large models from accessing real-time data.
[0007] (2) LLMs are much more expensive to train and infer relative to smaller models, which makes it complicated and expensive to frequently use LLMs on-device for training and inference. Summary of the invention
[0008] The purpose of the present invention is to solve the problems existing in the prior art and to provide a method and system for collaborative large model and recommended small model calculation.
[0009] In order to achieve the above-mentioned invention object, the present invention specifically adopts the following technical solutions:
[0010] In a first aspect, the present invention provides a method for collaboratively calculating a large model and a small recommendation model, for making personalized recommendations of commodities to users, comprising the following steps:
[0011] S1. Pre-training the large language model and the sequence recommendation model respectively using the user history behavior dataset on the cloud side to obtain a pre-trained large language model and a pre-trained sequence recommendation model with independent recommendation capabilities; wherein the user history behavior dataset is composed of user history behavior data and the real labels of the user history behavior data, and each user history behavior data includes a user ID, a product ID, and a user's historical click sequence;
[0012] S2. On the cloud side, the pre-trained large language model and the pre-trained sequence recommendation model obtained in S1 are collaboratively trained. In the collaborative training, the parameters of the pre-trained large language model are fixed, and the optimized sequence recommendation model is obtained after the collaborative training on the cloud side.
[0013] S3. Deploy the pre-trained large language model on a cloud-side device, deploy the optimized sequence recommendation model on a terminal-side device, and retrain the optimized sequence recommendation model on a user real-time behavior dataset to obtain a retrained sequence recommendation model.
[0014] S4. The cloud side inputs the real-time user behavior data to be predicted into the pre-trained large language model, outputs the initial ranking result and the initial candidate list, and sends the initial ranking result and the initial candidate list to the client side. The client side inputs the initial candidate list into the retrained sequence recommendation model, re-ranks the initial candidate list according to the user interaction probability, obtains the re-ranking result and the sorted list of product IDs corresponding to the re-ranking result, and merges the normalized initial ranking result and the normalized re-ranking result to obtain the final ranking result.
[0015] S5. The client subtracts the initial candidate list from the product ID sorted list according to the index number, and calculates the inconsistency score based on the absolute value of the subtraction result. If the inconsistency score is greater than the preset inconsistency threshold, the client uploads the latest user real-time behavior data to the cloud, and the cloud pre-trains the large language model to process the latest user real-time behavior data. The cloud outputs a new initial ranking result and a new initial candidate list and sends them to the client, and the client retrains the sequence recommendation model to output a new final ranking result. If the inconsistency score is less than or equal to the preset inconsistency threshold, the client directly outputs the final ranking result.
[0016] Based on the above scheme, each step can be implemented in the following preferred specific manner.
[0017] Preferably, in step S1, the large language model and the sequence recommendation model use the same loss function when they are pre-trained.
[0018] Preferably, in step S2, in each iteration round of collaborative training, the user historical behavior data set is input into the pre-trained large language model, each user historical behavior data obtains a candidate list, the candidate list is split into a preset number of tokens, the generated tokens are randomly combined to form a token list, the token list and the candidate list constitute a token-enhanced product ID candidate list, the product ID candidate list is input into the pre-trained sequence recommendation model, the product ID candidate list is re-ranked according to the size of the user interaction probability, and a re-ranked list is obtained; wherein the candidate list is composed of a preset number of items selected from the prediction labels generated by the large language model.
[0019] Preferably, in step S4, when merging the normalized initial ranking result and the normalized re-ranking result, the normalized re-ranking result is first merged. Filter and get the ranking results after filtering
[0020]
[0021] After normalization and filtering, the normalized initial ranking results are merged by adjusting the hyperparameter α And the ranking results after filtering To get the final ranking results
[0022]
[0023] Among them, p represents the probability of the normalized re-ranking result; τ a With τ b Both represent preset thresholds.
[0024] Preferably, in step S5, the calculation method of the inconsistency score c is as follows:
[0025]
[0026] in, Represents the initial candidate list and a sorted list of product IDs The elements in are exactly the same, only the order is different; pos k (q) represents the function of the position of element q in list k, Indicates that element o is in the initial candidate list The position in Indicates that element o is in the sorted list of product IDs The position in; n represents the initial candidate list Or a sorted list of product IDs The number of elements in .
[0027] In a second aspect, the present invention provides a system for collaborative large model and recommended small model calculation, characterized in that it includes an end-side device and a cloud-side device, and the end-side device and the cloud-side device are communicatively connected to implement a method for collaborative large model and recommended small model calculation as described in any of the schemes of the first aspect above.
[0028] Preferably, the terminal side device includes a computer.
[0029] Preferably, the cloud-side device includes a server.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] (1) The method LSC4Rec of the present invention improves the performance of the recommendation system in a synergistic manner by integrating a large language model and a small recommendation model, which may be difficult to achieve in traditional small recommendation models or large language models.
[0032] (2) By using a large language model in the cloud to generate a candidate list and then using a small recommendation model on the device for optimization, the method LSC4Rec of the present invention effectively utilizes the advantages of both while avoiding excessive consumption of device resources by large-scale parameters.
[0033] (3) Through collaborative work on the cloud side and the end side, the method LSC4Rec of the present invention maintains the real-time nature of the recommendation system while providing advanced capabilities, enabling it to more flexibly adapt to the real-time behavior of users.
[0034] (4) In order to solve the challenges faced by large language models in deployment, the method of the present invention achieves a more feasible and efficient deployment by allocating the tasks of recall and re-ranking to the cloud side and the terminal side. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 Flowchart of the LSC4Rec method of the present invention, wherein (a) is a schematic diagram of collaborative training; (b) is a schematic diagram of collaborative reasoning; (c) is a schematic diagram of intelligent request;
[0036] Figure 2 1 is a comparison diagram of the method LSC4Rec of the present invention and the existing recommendation paradigm; wherein, (a) is a schematic diagram of the existing recommendation system paradigm; (b) is a schematic diagram of the method of the present invention; and (c) is a schematic diagram of a specific example of the method of the present invention. DETAILED DESCRIPTION
[0037] In order to make the above-mentioned purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation mode of the present invention is described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. The technical features in each embodiment of the present invention can be combined accordingly without conflicting with each other.
[0038] In view of the above-mentioned shortcomings, the technical problem to be solved by the present invention is:
[0039] (1) The method of the present invention combines the large model in the cloud with the small model on the device through collaborative training and collaborative reasoning. The large model in the cloud generates a candidate list and an initial ranking, while the small model on the device dynamically re-ranks according to real-time data, thereby overcoming the problem that the large model cannot access data in a timely manner.
[0040] (2) The method of the present invention introduces intelligent requests to evaluate the consistency between the initial ranking of the large model and the re-ranking of the small model. If a difference is found, the candidate list and ranking are regenerated from the cloud by requesting to make up for the defect that the large model cannot access data in time.
[0041] The main function of the method of the present invention is to focus on the application of contemporary large-scale language models in recommendation systems, coordinate the cooperation of large and small models, improve the recommendation performance through collaborative training, collaborative inference and intelligent request, so as to realize end-cloud collaboration in recommendation tasks.
[0042] In the actual application of LLM4Rec, due to the heavy end-cloud communication load and high training and inference consumption, it is impossible to perform training and fine-tuning based on the full amount of real-time data. Figure 1 As shown, in a preferred implementation of the present invention, a method for collaborative large model and recommendation small model calculation LSC4Rec (Device-Cloud Large and Small ModelCollaborative Recommendation Framework) is proposed for personalized recommendation of products to users. The method aims to design a recommendation model framework for end-cloud collaboration by working collaboratively between the device and the cloud, giving full play to the advantages of large and small models, thereby improving the performance and practicality of the recommendation system. Specifically, the method of the present invention includes three key parts: collaborative training, collaborative reasoning, and collaborative decision requests (intelligent requests). Through collaborative training and reasoning, a large cloud-based model generates a candidate list and an initial ranking, while the small model on the device dynamically reorders these lists based on the latest user real-time data. The intelligent request evaluates the consistency between the initial ranking of the large model and the re-ranking of the small model to determine whether it is necessary to further request the large model to generate a new candidate list. In this way, the method LSC4Rec of the present invention combines the feature extraction capability of a large language model with the convenience of a small recommendation model, improving the practicality of deploying a large model on the device.
[0043] The above method for calculating a coordinated large model and a recommended small model includes the following steps S1 to S5, and the specific implementation process thereof is described in detail below.
[0044] 1. Collaborative Training
[0045] 1) Train the large language model and sequence recommendation model separately
[0046] S1. Using the user historical behavior dataset on the cloud side The large language model LLM (Large Language Model) and the sequence recommendation model SRM (Sequential Recommendation Model) are pre-trained respectively to obtain the pre-trained large language model LLM4Rec and the pre-trained sequence recommendation model SRM4Rec with independent recommendation capabilities. The user historical behavior data set consists of user historical behavior data and the real labels of the user historical behavior data. Each user historical behavior data contains the user ID, product ID and the user's historical click sequence.
[0047] It should be noted that, in the present invention, the complexity of the existing sequential recommendation graph is first introduced: the paradigm of sequential recommendation is to ignore the data textualization process required by the large language model LLM during the training phase. When the large language model LLM and the sequence recommendation model SRM are pre-trained separately, the loss function L of the large language model LLM and the sequence recommendation model SRM is ind The form is the same as follows:
[0048]
[0049] Among them, u represents the user ID; v represents the product ID; s represents the user's historical click sequence; y represents the real label of the user's historical behavior data; Represents the predicted label generated by the large language model LLM or the sequence recommendation model SRM; Represents the large language model LLM or sequence recommendation model SRM, Represents the output of the large language model LLM or the sequence recommendation model SRM when · is used as input; Represents the loss function for independent training of a single user's historical behavior data.
[0050] like Figure 1 As shown in (a), during the gradient back-propagation, the large language model LLM and the sequence recommendation model SRM are slightly different. The large language model LLM can choose to update instructions, prompts, and the large language model itself, while the sequence recommendation model SRM usually focuses on updating itself. The gradient back-propagation of the sequence recommendation model SRM can be formalized as Among them, θ S Represents a sequential recommendation model Based on the prior knowledge, the present invention keeps the instructions and prompt words of the large language model LLM unchanged, and then fine-tunes the parameters of the large language model. Similarly, the gradient back propagation of the large language model LLM can also be formalized as Among them, θ L Representing a large language model Parameters.
[0051] In the prior art, the pre-trained large language model LLM4Rec and the pre-trained sequence recommendation model SRM4Rec can be used for reasoning. In the reasoning stage, if the data textualization process required by the pre-trained large language model LLM4Rec is ignored, the reasoning process of the two is basically the same.
[0052] 2) Collaboratively train large language models and sequence recommendation models
[0053] S2. On the cloud side, the pre-trained large language model LLM4Rec and the pre-trained sequence recommendation model SRM4Rec obtained in S1 are collaboratively trained. During the collaborative training, the parameters of the pre-trained large language model LLM4Rec are fixed, and the optimized sequence recommendation model SRM4Rec is obtained after collaborative training on the cloud side.
[0054] like Figure 1 As shown in (a), in each iteration of collaborative training, the user historical behavior dataset is The candidate list is input into the pre-trained large language model, and each user's historical behavior data is used to obtain a candidate list. The candidate list is split into a preset number of tokens, and the generated tokens are randomly combined to form a token list. The token list and the candidate list constitute a token-enhanced product ID candidate list. The product ID candidate list is input into the pre-trained sequence recommendation model SRM4Rec, and the product ID candidate list is re-ranked according to the size of the user interaction probability to obtain a re-ranked list S Rerank . The candidate list is composed of a preset number of items selected from the prediction labels generated by the large language model.
[0055] It should be noted that after the large language model LLM and the sequence recommendation model SRM are trained separately, in order to make up for the difference between the candidate list generated by the large language model LLM and the user historical behavior data set, collaborative training is required. In collaborative training, the user historical behavior data is input into the pre-trained large language model LLM4Rec to obtain the inference result (the prediction label generated by the large language model). For each user historical behavior data x = (u, v, s), the present invention takes N from the prediction label generated by the large language model. candidate Items, forming a candidate list S candidate :
[0056]
[0057] In which, Sort represents a sorting operation. In addition, items that are difficult to distinguish by the pre-trained large language model, i.e., items with similar tags, are randomly combined to obtain a token list S token :
[0058] Stoken =Augment(S candidate )
[0059] Among them, Augment represents the data augmentation operation. Then, the token-enhanced product ID candidate list S is composed of the token list and the candidate list. Aug :
[0060] S Aug ={S candidate ,S token}
[0061] After that, the above product ID candidate list S Aug Input into the pre-trained sequence recommendation model SRM4Rec, so that the pre-trained sequence recommendation model SRM4Rec is in the above product ID candidate list S Aug The prediction labels generated by the sequence recommendation model are expressed as Then we get the rearranged list S Rerank :
[0062]
[0063] At this time, in collaborative training, the loss function of the sequence recommendation model SRM is:
[0064]
[0065] in, Represents the loss function of the sequence recommendation model SRM when a single user's historical behavior data is used for collaborative training. The present invention fixes the model parameters of the pre-trained large language model LLM4Rec so that the gradient generated by the loss is only back-propagated to the pre-trained sequence recommendation model SRM4Rec, so the optimization function is Finally got L col Large language model LLM4Rec and optimized sequence recommendation model SRM4Rec.
[0066] 3) Real-time training sequence recommendation model SRM4Rec
[0067] S3. Deploy the pre-trained large language model LLM4Rec on the cloud-side device, and deploy the optimized sequence recommendation model SRM4Rec on the end-side device. The optimized sequence recommendation model is retrained to obtain the retrained sequence recommendation model SRM4Rec.
[0068] It should be noted that after the training of the large language model LLM and the sequence recommendation model SRM is completed, the pre-trained large language model LLM4Rec and the retrained sequence recommendation model SRM4Rec are obtained, and the pre-trained large language model LLM4Rec is deployed on the cloud, and the retrained sequence recommendation model SRM4Rec is deployed on the end device. However, as mentioned in the previous section, due to network bandwidth limitations and device-side data processing delays, it is difficult for the pre-trained large language model LLM4Rec to obtain real-time data. Even if it can access this data, its huge number of parameters makes rapid training and model deployment difficult.
[0069] Therefore, the sequence recommendation model SRM4Rec needs to be trained based on the real-time user behavior dataset on the end device, and the optimization goal is The loss function L used by the sequence recommendation model during retraining retrain as follows:
[0070]
[0071] in, Represents the predicted label generated by the retrained sequence recommendation model; Represents the retraining loss of a single user's real-time behavior data.
[0072] 2. Collaborative Reasoning
[0073] S4. The cloud side inputs the real-time user behavior data to be predicted into the pre-trained large language model and outputs the initial ranking result And the initial candidate list The cloud side will initially rank the results and the initial candidate list The initial candidate list is sent to the client. Input into the retrained sequence recommendation model, and sort the initial candidate list according to the probability of user interaction Re-ranking is performed, and the client side obtains the re-ranking result And the sorted list of product IDs corresponding to the re-ranking results The client side normalizes the initial ranking results And the normalized re-ranking results Merge to get the final ranking results
[0074] It should be noted that if Figure 1 As shown in (b), when the normalized initial ranking result and the normalized re-ranking result are combined, the normalized re-ranking result is first Filter and get the ranking results after filtering
[0075] And (p>τ a or p<τ b )}
[0076] Among them, p represents the probability of the normalized re-ranking result; τ a With τ b After normalization and screening, the normalized initial ranking results are merged by adjusting the hyperparameter α. And the ranking results after filtering To get the final ranking results
[0077]
[0078] It should be noted that after the collaborative training is completed, the pre-trained large language model and the retrained sequence recommendation model are deployed on the cloud and the end-side device respectively. The following describes how the end-side normalizes the initial ranking results in the inference phase. And the normalized re-ranking results Merge to get the final ranking result Since the pre-trained large language model and the retrained sequence recommendation model have different ranking principles, the pre-trained large language model is generative, while the retrained sequence recommendation model is non-generative, so their ranking scales are different, resulting in different ranking scales. Therefore, it is necessary to normalize the initial ranking results and the re-ranking results on the end side. Put the initial ranking results and the re-ranking results on the same scale to better merge the ranking results. The normalization process can be formalized as follows:
[0079]
[0080] in, Represents the minimum value in the initial ranking results; Indicates the maximum value in the initial ranking results; Represents the minimum value in the re-ranking results; Indicates the maximum value among the re-ranking results.
[0081] In addition, the normalized re-ranking results of the sequence recommendation model SRM4Rec output First filter it and set the threshold τ a and τ b To filter out the most certain positive and negative samples identified by the sequence recommendation model, and obtain the filtered ranking results
[0082] And (p>τ a or p<τ b )}
[0083] It should be noted that after collaborative training and collaborative reasoning, a complete framework is formed, and the retrained sequence recommendation model is deployed on the end-side device. The retrained sequence recommendation model can compensate for the performance degradation caused by the difficulty of the pre-trained large language model to obtain real-time data as much as possible, making the retrained sequence recommendation model more effective in the end-cloud system than using a large language model or a sequence recommendation model alone. However, it should be noted that when the retrained sequence recommendation model should call the pre-trained large language model LLM4Rec to provide new reasoning results based on real-time data has not yet been resolved. To fill this gap, the present invention designs a collaborative decision request function for the retrained sequence recommendation model. The collaborative decision request can be used to determine the timing of calling the pre-trained large language model LLM4Rec, calling the pre-trained large language model LLM4Rec on the cloud-side device for reasoning when necessary, and repeating step S4 to obtain the final ranking result and output it.
[0084] 3. Collaborative decision-making request (smart request)
[0085] S5. Figure 1 As shown in (c), the client side lists the initial candidate list according to the index number. and a sorted list of product IDs Subtract, and calculate the inconsistency score based on the absolute value of the subtraction result. If the inconsistency score is greater than the preset inconsistency threshold, the latest user real-time behavior data is uploaded from the client side to the cloud side, and the cloud side pre-trains the large language model to process the latest user real-time behavior data. The cloud side outputs a new initial ranking result and a new initial candidate list and sends them to the client side, and the client side retrains the sequence recommendation model to output a new final ranking result. If the inconsistency score is less than or equal to the preset inconsistency threshold, the client side directly outputs the final ranking result.
[0086] It should be noted that the present invention uses the same element in the initial candidate list and a sorted list of product IDs The inconsistency score c is calculated by the ranking position difference, that is, the client side sorts the initial candidate list according to the index sequence number. and a sorted list of product IDs Subtract, and calculate the inconsistency score by the absolute value of the subtraction result. The calculation method of the inconsistency score c can be formalized as follows:
[0087]
[0088] in, Represents the initial candidate list and a sorted list of product IDs The elements in are exactly the same, only the order is different; pos k (q) represents the function of the position of element q in list k, Indicates that element o is in the initial candidate list The position in Indicates that element o is in the sorted list of product IDs The position in; n represents the initial candidate list Or a sorted list of product IDs The number of elements in .
[0089] It should be noted that, in the present invention, when the inconsistency score is greater than the preset inconsistency threshold, the client side will request the cloud side for a new initial ranking result and a new initial candidate list below the cloud side:
[0090]
[0091] in, is an indicator function; Threshold indicates the preset inconsistency threshold; Request indicates that the end side sends a request to the cloud side.
[0092] It should be noted that in this embodiment, in order to obtain the inconsistency threshold, this embodiment collects real-time user behavior data for a period of time, then obtains the inconsistency score c corresponding to these data in the cloud and sorts them, and then sets the inconsistency threshold according to the load of the cloud server. That is to say, the inconsistency threshold can be obtained during training. For example, if the load of the cloud server needs to be reduced by 90%, that is, when the load is only 10% of the previous value, only the minimum 10% position value needs to be sent to each device as the inconsistency threshold. During the reasoning process, each device determines whether it is necessary to upload the user's real-time behavior data to the large language model for reasoning according to the above two formulas. This is to ensure that the optimal large language model calling strategy is achieved under any device-cloud communication resources and large language model calling resources.
[0093] The present invention will now use a specific example to demonstrate the application effect of a method for collaborative large model and recommended small model calculation described in S1 to S5 in the above embodiments on a specific data set, so as to facilitate understanding of the essence of the present invention.
[0094] Example
[0095] The specific implementation process of the method for calculating a collaborative large model and a small recommendation model used in this embodiment is as described above and will not be repeated here. The following Tables 1, 2 and 3 show the performance comparison of the method of the present invention with the SRM on the device and the LLM on the cloud in three data sets corresponding to the commodity personalized recommendation scenario. Since the SRM is directly deployed on the device, they are able to use real-time data for reasoning. In contrast, due to the limitations mentioned above, the LLM on the cloud cannot process real-time data. In order to establish a relatively ideal situation for the baseline model, this embodiment allows the LLM to receive data that is only two clicks delayed from the real-time data. According to Table 1, the following points can be observed: (1) Compared with the SRM, although the LLM cannot access real-time data, its performance is still stronger, which highlights the necessity of calling the LLM on the cloud. (2) The performance of the method of the present invention on the three data sets is significantly improved. Specifically, when the LLM is set to P5 and the SRM is set to SASRec, LSC4Rec improves by an average of 16.18% on the Beauty data set, 10.62% on the Toys data set, and 9.38% on the Yelp data set. When LLM is set to POD and SRM is set to SASRec, LSC4Rec improves by an average of 16.75% on the Beauty dataset, 15.85% on the Toys dataset, and 12.63% on the Yelp dataset.
[0096] Tables 1, 2 and 3 below are performance comparisons of different methods, with the best performance marked in bold. In the experimental results of each data set, the last row shows the improvement of the method LSC4Rec of the present invention relative to the best baseline model.
[0097] Table 1 Performance comparison of different methods on NDCG index
[0098]
[0099]
[0100]
[0101] Table 2 Performance comparison of different methods on HR indicators
[0102]
[0103]
[0104]
[0105] Table 3 Performance comparison of different methods on the Precision index
[0106]
[0107]
[0108] Compared with the closest prior art, the advantages of the present invention are:
[0109] 1. The method LSC4Rec of the present invention adopts a device-cloud large and small model collaborative recommendation framework, which effectively solves the challenges faced by large language models (LLMs) and small recommendation models (SRMs) in practical applications. By using a large model in the cloud to generate candidate lists and initial rankings, and using a small model on the device to dynamically re-rank, the method LSC4Rec of the present invention fully utilizes the advantages of both models and improves the performance and practicality of the recommendation system.
[0110] 2. The method of the present invention introduces an intelligent request protocol to determine whether it is necessary to re-acquire data from the cloud by evaluating the consistency of the ranking results between the large model and the small model. This mechanism ensures the accuracy and real-time nature of the recommendation results and improves the user experience.
[0111] 3. Compared with using a large model alone for training and reasoning, the small model in the LSC4Rec method of the present invention has lower training and reasoning costs and can be operated more frequently. In this way, even if the large model cannot access data in real time, the recommendation system can be continuously optimized with the assistance of the small model.
[0112] 4. Through comprehensive experimental verification, the effectiveness of each module of the method LSC4Rec of the present invention is proved. The experimental results show that under the condition that LLMs cannot access data in time, the method LSC4Rec of the present invention can achieve more than 10% performance improvement, which further verifies its effectiveness in solving existing challenges.
[0113] like Figure 2 As shown, it is a comparison diagram between the method LSC4Rec of the present invention and the existing recommended paradigm; wherein, Figure 2 (a) Describes the traditional SRM4Rec and LLM4Rec diagrams respectively. Figure 2 (b) is an overview of the method LSC4Rec proposed in this invention, which is a device-cloud collaboration framework including collaborative training, collaborative reasoning strategy and collaborative decision request. Figure 2 (c) is a specific example of the method LSC4Rec of the present invention, demonstrating effective collaborative reasoning and collaborative decision-making requests.
[0114] In summary, for the recommendation problem, the present invention proposes a method LSC4Rec for collaborative large model and recommendation small model calculation, which includes three key parts: collaborative training, collaborative reasoning and collaborative decision request. The method LSC4Rec of the present invention aims to improve the performance of the recommendation system through the synergy of large and small models, especially when the large model cannot use real-time data. A comprehensive experimental analysis of the method LSC4Rec of the present invention verifies the effectiveness of each module. It is particularly noteworthy that in scenarios where LLMs have difficulty accessing timely data, the method LSC4Rec of the present invention achieves a performance improvement of more than 10%, which further confirms the practicality and effectiveness of the method of the present invention. In the collaborative training stage, the results of the large language model and the small recommendation model are merged. In order to set the inconsistency threshold of the collaborative decision request, the method of the present invention collects user data over a period of time, calculates the consistency corresponding to these data, and sets the threshold according to the load of the cloud server during training, which ensures that the optimal LLM call strategy is achieved under any device-cloud communication resources and LLM call resources.
[0115] It should also be noted that a method for calculating a collaborative large model and a recommended small model in the above embodiment can essentially be executed by a computer program or module. Therefore, similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a system for calculating a collaborative large model and a recommended small model corresponding to the method for calculating a collaborative large model and a recommended small model provided in the above embodiment, which includes an end-side device and a cloud-side device, and the end-side device and the cloud-side device are communicatively connected to implement a method for calculating a collaborative large model and a recommended small model as described in the above embodiment. The end-side device includes a computer. The cloud-side device includes a server.
[0116] The above-described embodiment is only a preferred solution of the present invention, but it is not intended to limit the present invention. A person skilled in the relevant technical field may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, any technical solution obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present invention.
Claims
1. A method for collaborative large model and recommended small model calculation, characterized in that: It is used to make personalized recommendations of products to users, including the following steps: S1. Pre-training the large language model and the sequence recommendation model respectively using the user history behavior dataset on the cloud side to obtain a pre-trained large language model and a pre-trained sequence recommendation model with independent recommendation capabilities; wherein the user history behavior dataset is composed of user history behavior data and the real labels of the user history behavior data, and each user history behavior data contains a user ID, a product ID, and a user's historical click sequence; S2. On the cloud side, the pre-trained large language model and the pre-trained sequence recommendation model obtained in S1 are collaboratively trained. In the collaborative training, the parameters of the pre-trained large language model are fixed, and the optimized sequence recommendation model is obtained after the collaborative training on the cloud side. S3. Deploy the pre-trained large language model on a cloud-side device, deploy the optimized sequence recommendation model on a terminal-side device, and retrain the optimized sequence recommendation model on a user real-time behavior dataset to obtain a retrained sequence recommendation model. S4. The cloud side inputs the real-time user behavior data to be predicted into the pre-trained large language model, outputs the initial ranking result and the initial candidate list, and sends the initial ranking result and the initial candidate list to the client side. The client side inputs the initial candidate list into the retrained sequence recommendation model, re-ranks the initial candidate list according to the user interaction probability, obtains the re-ranking result and the sorted list of product IDs corresponding to the re-ranking result, and merges the normalized initial ranking result and the normalized re-ranking result to obtain the final ranking result. S5. The client subtracts the initial candidate list from the product ID sorted list according to the index number, and calculates the inconsistency score based on the absolute value of the subtraction result. If the inconsistency score is greater than the preset inconsistency threshold, the client uploads the latest user real-time behavior data to the cloud, and the cloud pre-trains the large language model to process the latest user real-time behavior data. The cloud outputs a new initial ranking result and a new initial candidate list and sends them to the client, and the client retrains the sequence recommendation model to output a new final ranking result. If the inconsistency score is less than or equal to the preset inconsistency threshold, the client directly outputs the final ranking result.
2. A method for collaborative large model and recommended small model calculation as claimed in claim 1, characterized in that: In step S1, the large language model and the sequence recommendation model use the same loss function when they are pre-trained.
3. A method for collaborative large model and recommended small model calculation as claimed in claim 1, characterized in that: In step S2, in each iteration round of collaborative training, the user historical behavior data set is input into the pre-trained large language model, each user historical behavior data obtains a candidate list, the candidate list is split into a preset number of tokens, the generated tokens are randomly combined to form a token list, the token list and the candidate list constitute a token-enhanced product ID candidate list, the product ID candidate list is input into the pre-trained sequence recommendation model, the product ID candidate list is re-ranked according to the size of the user interaction probability, and a re-ranked list is obtained; wherein the candidate list is composed of a preset number of items selected from the prediction labels generated by the large language model.
4. A method for collaborative large model and recommended small model calculation as claimed in claim 1, characterized in that: In step S4, when merging the normalized initial ranking result and the normalized re-ranking result, the normalized re-ranking result is first Filter and get the ranking results after filtering After normalization and filtering, the normalized initial ranking results are merged by adjusting the hyperparameter α And the ranking results after filtering To get the final ranking results Among them, p represents the probability of the normalized re-ranking result; τ a With τ b Both represent preset thresholds.
5. A method for collaborative large model and recommended small model calculation as claimed in claim 1, characterized in that: In step S5, the calculation method of the inconsistency score c is as follows: in, Represents the initial candidate list and a sorted list of product IDs The elements in are exactly the same, only the order is different; pos k (q) represents the function of the position of element q in list k, Indicates that element o is in the initial candidate list The position in Indicates that element o is in the sorted list of product IDs The position in; n represents the initial candidate list Or a sorted list of product IDs The number of elements in .
6. A system for collaborative large model and recommended small model calculation, characterized in that: It includes a terminal-side device and a cloud-side device, and the terminal-side device and the cloud-side device are communicatively connected to implement a method for collaborative large model and recommended small model calculation as described in any one of claims 1 to 5.
7. A system for collaborative large model and recommended small model calculation as claimed in claim 6, characterized in that: The terminal side device includes a computer.
8. A system for collaborative large model and recommended small model calculation as claimed in claim 6, characterized in that: The cloud-side device includes a server.
Citation Information
Patent Citations
End-cloud collaborative recommendation system and method and electronic equipment
CN114662006A
Information recommendation method, device and equipment, storage medium and program product
CN116452263A
Resource recommendation method and device, equipment, medium and program product
CN116992123A
Recommendation model pre-training method, adjustment method, recommendation method and related products
CN117216553A
Article recommendation method and device, equipment and storage medium
CN117370657A
Cited By
Information service platform recommendation method of model fusion agent technology
CN120256740A
