Recommendation model training method, device, electronic device and storage medium
By using the trained reference recommendation model to extract and train the content samples, the problems of slow inference and slow convergence of existing recommendation models are solved, faster inference and convergence are achieved, and machine resources are saved.
Patent Information
- Application Number
- CN202210610575.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2042-05-31
AI Technical Summary
Due to the large scale of the existing recommended models, the inference speed is slow, the convergence speed is slow, and it occupies a large amount of machine resources, limiting the deployment of larger AI models.
By using the trained reference recommendation model to extract the content sample, the content feature set is obtained, and these features are used to train the recommended model to narrow the deviation between the content feature sets until the constraints are met, and the target recommendation model is obtained.
The inference speed and convergence speed of the recommended model are improved, machine resources are saved, and the accuracy of the model is ensured.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a recommendation model training method, device, electronic device, storage medium and computer program product. Background Art
[0002] With the rapid development of deep learning technology, the neural network models used for deep learning are getting larger and larger, and the recommendation model's expressiveness is getting stronger and stronger. On the one hand, it is promoting the rapid implementation of artificial intelligence (AI) technology in scenarios such as image retrieval and speech recognition. However, on the other hand, the large size of the recommendation model also limits the deployment of larger AI models. As the recommendation model becomes larger and larger, more and more machine resources are required, the model inference speed is slow, and the model convergence is slow. Summary of the invention
[0003] The embodiments of the present disclosure provide a recommendation model training method, device, electronic device, storage medium and computer program product to at least solve the technical problems in the related art of improving the reasoning speed and convergence speed of the recommendation model and saving machine resources.
[0004] According to one aspect of an embodiment of the present disclosure, a recommendation model training method is provided, including:
[0005] Using the trained reference recommendation model, feature extraction is performed on each first content sample in the first content sample set to obtain a first content feature set; the first content feature set includes first content features corresponding to each first content sample; the first content features include features characterizing a recommendation attribute of the first content sample;
[0006] Performing a first training on a first recommendation model using the first content sample set and the first content feature set until a first constraint condition is satisfied, thereby obtaining a second recommendation model; wherein the first training is used to reduce the deviation between the first content feature set and the second content feature set, the second content feature set is obtained by performing feature extraction processing on each first content sample in the first content sample set using the first recommendation model, the second content feature set includes second content features corresponding to each first content sample, and the second content features include features characterizing a recommendation attribute of the first content sample;
[0007] The second recommendation model is subjected to second training using the second content sample set and a first classification sample set pre-set corresponding to the second content sample set until the second constraint condition is met to obtain a target recommendation model; wherein the second training is used to reduce the deviation between the first output sample set and the first classification sample set, the first classification sample set includes the recommendation labels of each second content sample in the second content sample set, and the first output sample set includes the recommendation attributes of each second content sample extracted by the second recommendation model.
[0008] In a possible implementation manner, before performing a second training on the second recommendation model using the second content sample set and the first classification sample set preset corresponding to the second content sample set, the recommendation model training method further includes:
[0009] Using the reference recommendation model, feature extraction is performed on each third content sample in the third content sample set to obtain a third content feature set, and a second classification sample set is obtained; the third content sample set includes third content features corresponding to each of the third content samples, the third content features include features characterizing the recommendation attributes of the third content samples, and the second classification sample set includes recommendation tags for each of the third content samples;
[0010] The second recommendation model is subjected to a third training using the third content sample set, the third content feature set and the second classification sample set until a third constraint condition is satisfied; wherein the third training is used to reduce the deviation between the third content feature set and the fourth content feature set, and the deviation between the second classification sample set and the second output sample set; the fourth content feature set is obtained by extracting features of each third content sample in the third content sample set using the second recommendation model, the fourth content feature set includes fourth content features corresponding to each third content sample, and the fourth content features include features characterizing the recommendation attributes of the third content samples; the second output sample set includes the recommendation attributes of each third content sample extracted by the second recommendation model;
[0011] The second recommendation model is trained using the second content sample set and the first classification sample set preset corresponding to the second content sample set until the second constraint condition is satisfied to obtain the target recommendation model, including:
[0012] The second recommendation model that has undergone the third training is subjected to the second training by using the second content sample set and the first classification sample set, until the second constraint condition is satisfied, thereby obtaining the target recommendation model.
[0013] In a possible implementation manner, performing a third training on the second recommendation model by using the third content sample set, the third content feature set, and the second classification sample set includes:
[0014] performing feature extraction processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the fourth content feature set, and performing classification processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the second output sample set;
[0015] comparing the third content feature in the third content feature set with the fourth content feature in the fourth content feature set, and determining a first deviation of the fourth content feature in the fourth content feature set relative to the third content feature in the third content feature set;
[0016] Comparing the recommended labels in the second classification sample set with the recommended attributes in the second output sample set, and determining a second deviation of the recommended attributes in the second output sample set relative to the recommended labels in the second classification sample set;
[0017] determining a combined deviation based on the first deviation and the second deviation;
[0018] The comprehensive deviation is reduced by adjusting the second recommendation model that has undergone the first training so as to perform the third training.
[0019] In a possible implementation manner, each recommendation tag in the second classification sample set is obtained by classifying each of the third content samples using the reference recommendation model, or each recommendation tag in the second classification sample set is pre-set corresponding to each of the third content samples.
[0020] In a possible implementation manner, determining a comprehensive deviation according to the first deviation and the second deviation includes:
[0021] The cumulative sum of the first deviation and the second deviation, or the weighted sum of the first deviation and the second deviation, is determined as the comprehensive deviation.
[0022] In a possible implementation manner, performing a first training on a first recommendation model using the first content sample set and the first content feature set includes:
[0023] Using the first recommendation model in the first training, performing feature extraction processing on each first content sample in the first content sample set to obtain the second content feature set;
[0024] comparing a first content feature in the first content feature set with a second content feature in the second content feature set, and determining a third deviation of the second content feature in the second content feature set relative to the first content feature in the first content feature set;
[0025] The first training is performed by adjusting the first recommendation model to reduce the third deviation.
[0026] In a possible implementation manner, the second training includes: fine-tuning the second recommendation model by reducing a learning rate of the second training.
[0027] In a possible implementation manner, the first content sample set, the second content sample set, and the third content sample set are all the same.
[0028] According to another aspect of an embodiment of the present disclosure, a recommendation model training device is provided, including:
[0029] a feature extraction module configured to perform feature extraction processing on each first content sample in the first content sample set using the trained reference recommendation model to obtain a first content feature set; the first content feature set includes first content features corresponding to each first content sample, and the first content features include features characterizing a recommendation attribute of the first content sample;
[0030] A first training module is configured to perform first training on a first recommendation model using the first content sample set and the first content feature set until a first constraint condition is satisfied to obtain a second recommendation model; wherein the first training is used to reduce the deviation between the first content feature set and the second content feature set, the second content feature set is obtained by extracting features from each first content sample in the first content sample set using the first recommendation model, the second content feature set includes second content features corresponding to each first content sample, and the second content features include features characterizing a recommendation attribute of the first content sample;
[0031] The second training module is configured to perform second training on the second recommendation model using a second content sample set and a first classification sample set pre-set corresponding to the second content sample set until a second constraint condition is met to obtain a target recommendation model; wherein the second training is used to reduce the deviation between the first output sample set and the first classification sample set, the first classification sample set includes the recommendation labels of each second content sample in the second content sample set, and the first output sample set includes the recommendation attributes of each second content sample extracted by the first recommendation model.
[0032] In a possible implementation manner, the recommendation model training device further includes:
[0033] a third training preparation module, configured to perform feature extraction processing on each third training sample in the third training sample set using the reference recommendation model to obtain a third content feature set, and obtain a second classification sample set; the third content sample set includes third content features corresponding to each third content sample, and the second classification sample set includes recommendation tags for each third content sample;
[0034] a third training module, configured to perform a third training on the second recommendation model using the third content sample set, the third content feature set and the second classification sample set until a third constraint condition is met;
[0035] The third training is used to reduce the deviation between the third content feature set and the fourth content feature set, and the deviation between the second classification sample set and the second output sample set; the fourth content feature set is obtained by performing feature extraction processing on each third content sample in the third content sample set by the second recommendation model, the fourth content feature set includes fourth content features corresponding to each third content sample, the fourth content features include features characterizing the recommended attributes of the third content samples, and the second output sample set includes the recommended attributes of each third content sample extracted by the second recommendation model;
[0036] The second training module performs second training on the second recommendation model using the second content sample set and the first classification sample set preset corresponding to the second content sample set until the second constraint condition is satisfied, and the target recommendation model is obtained, including:
[0037] The second recommendation model that has undergone the third training is subjected to the second training by using the second content sample set and the first classification sample set, until the second constraint condition is satisfied, thereby obtaining the target recommendation model.
[0038] In a possible implementation manner, the third training module performs third training on the second recommendation model using the third content sample set, the third content feature set, and the second classification sample set, including:
[0039] performing feature extraction processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the fourth content feature set, and performing classification processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the second output sample set; comparing the third content feature in the third content feature set with the fourth content feature in the fourth content feature set to determine a first deviation of the fourth content feature in the fourth content feature set relative to the third content feature in the third content feature set;
[0040] Comparing the recommended labels in the second classification sample set with the recommended attributes in the second output sample set, and determining a second deviation of the recommended attributes in the second output sample set relative to the recommended labels in the second classification sample set;
[0041] determining a combined deviation based on the first deviation and the second deviation;
[0042] The comprehensive deviation is reduced by adjusting the second recommendation model that has undergone the first training so as to perform the third training.
[0043] In a possible implementation manner, each recommendation tag in the second classification sample set is obtained by classifying each of the third content samples using the reference recommendation model, or each recommendation tag in the second classification sample set is pre-set corresponding to each of the third content samples.
[0044] In a possible implementation manner, the third training module determines a comprehensive deviation according to the first deviation and the second deviation, including:
[0045] The cumulative sum of the first deviation and the second deviation, or the weighted sum of the first deviation and the second deviation, is determined as the comprehensive deviation.
[0046] In a possible implementation manner, the first training module performs first training on the first recommendation model using the first content sample set and the first content feature set, including:
[0047] Using the first recommendation model in the first training, performing feature extraction processing on each first content sample in the first content sample set to obtain the second content feature set;
[0048] comparing a first content feature in the first content feature set with a second content feature in the second content feature set, and determining a third deviation of the second content feature in the second content feature set relative to the first content feature in the first content feature set;
[0049] The first training is performed by adjusting the first recommendation model to reduce the third deviation.
[0050] In a possible implementation manner, the second training performed by the second training module includes: fine-tuning the second recommendation model by reducing a learning rate of the second training.
[0051] In a possible implementation manner, the first content sample set, the second content sample set, and the third content sample set are all the same.
[0052] According to another aspect of an embodiment of the present disclosure, an electronic device for training a recommendation model is provided, including:
[0053] processor;
[0054] a memory for storing executable instructions for the processor;
[0055] Wherein, the processor is configured to execute the executable instructions to implement the recommendation model training method as described in any of the above embodiments.
[0056] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When at least one instruction in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device can implement the recommendation model training method described in any of the above-mentioned embodiments.
[0057] According to another aspect of an embodiment of the present disclosure, an electronic device for sample processing includes:
[0058] A processor for loading a target recommendation model trained by the recommendation model training method described in any one of the above embodiments;
[0059] a memory for storing executable instructions for the processor;
[0060] The processor is configured to process the input sample using the target recommendation model.
[0061] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When at least one instruction in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to load a target recommendation model trained by the recommendation model training method described in any of the above embodiments, and use the target recommendation model to process input samples.
[0062] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the recommendation model training method as described in any of the above embodiments.
[0063] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0064] The embodiment of the present disclosure uses a trained reference recommendation model to process a first content sample set to determine a first content feature set, thereby directly extracting a first content feature of the first content sample using the reference recommendation model; next, the first content sample set and the first content feature set are used to perform a first training on a target recommendation model, wherein the first content feature in the first content feature set is used as a supervisory signal for training, and the second content feature extracted using the target recommendation model is compared with the first content feature extracted using the reference recommendation model, so that the target recommendation model approaches the reference recommendation model; and the second content sample set is used to perform a second training on the target recommendation model, freeing it from the constraints of the reference recommendation model.
[0065] At the same time, the first training is carried out using content features. Compared with discrete and coarse-grained information such as recommendation attributes (i.e., classification soft labels), content features are associated with various content attributes including recommendation attributes, and carry more feature information of the input content samples. Therefore, when the first training is carried out with content features as the target, more information is available for the target recommendation model to learn in each iterative training, thereby accelerating the process of the target recommendation model approaching the reference recommendation model, improving the training speed of the target recommendation model, saving machine resources, and at the same time, utilizing the second training of the target recommendation model to break away from the constraints of the reference recommendation model, which can accelerate convergence while ensuring the accuracy of the target recommendation model.
[0066] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the embodiments of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the embodiments of the present disclosure, and do not constitute improper limitations on the embodiments of the present disclosure.
[0068] Figure 1 is a basic flow chart of a recommendation model training method according to an exemplary embodiment;
[0069] Figure 2 is a schematic diagram of a specific flow chart of a recommendation model training method according to an exemplary embodiment;
[0070] Figure 3 is a schematic diagram of a third training process according to an exemplary embodiment;
[0071] Figure 4 It is a basic structural diagram of a model training device according to an exemplary embodiment. DETAILED DESCRIPTION
[0072] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0073] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0074] The content feature involved in the embodiments of the present disclosure is to use a vector to "represent" an object (the object here refers to all things that can be recommended or their labels, such as goods, movies, music, news, etc.). At the same time, the content feature can express certain characteristics of the corresponding object, is associated with various attributes of the object, and the distance between vectors can also reflect the similarity between objects. Content features are widely used in various applications such as various recommendation systems, similar image retrieval, similar video retrieval, semantic recognition, etc. For example, the embedding feature is a typical content feature, which is the output of the Embedding layer in the neural network model.
[0075] Based on the characteristics of the above-mentioned content features (such as Embedding features), a typical application of this type of neural network model is usually to process the input samples and then output content features (such as Embedding features) for subsequent tasks such as video retrieval.
[0076] The training of this type of neural network model usually includes: inputting some original supervisory signals as input content samples into the neural network model for processing to obtain content features (such as Embedding features), and then continuing to process the classifier to obtain the recommended attributes of the input content samples (i.e., classification soft labels); comparing the recommended attributes of the actual output with the pre-configured recommended labels corresponding to the original supervisory signals, and determining the loss function to update the neural network model parameters until the neural network model converges. Among them, the content features include features used to characterize the recommended attributes of the content samples. When using the neural network model, the content samples to be processed can be input into the neural network model, and the content features (such as Embedding features) can be extracted and output.
[0077] The above neural network models can effectively output the content features of input content samples (such as Embedding features), so they are widely used in various applications such as recommendation systems, similar image retrieval, similar video retrieval, semantic recognition, etc. However, in order to achieve better performance and expression capabilities, the model size of such neural network models is usually getting larger and larger, which makes the reasoning speed slower and slower, and occupies more and more machine resources.
[0078] In view of this, the present embodiment provides a recommendation model training method, which can improve the reasoning speed, shorten the model training time, save machine resources, and ensure the model accuracy for the recommendation neural network model of output content features.
[0079] Figure 1 FIG. 1 is a basic flow chart of a recommendation model training method according to an exemplary embodiment. Figure 1 As shown, the method includes:
[0080] Step 101 : Using a trained reference recommendation model, feature extraction is performed on each first content sample in a first content sample set to obtain a first content feature set.
[0081] The recommendation neural network model of the output content features finally obtained by training is called the target recommendation model. The training process given in steps 101-102 is called the first training, and the training process given in step 103 is called the second training. In order to distinguish the recommendation models trained in different stages of training, the recommendation model trained in the first training is called the first recommendation model, and the recommendation model obtained after the first training is called the second recommendation model. Based on this, the second training is to train the second recommendation model, and the recommendation model obtained after the second training is the target recommendation model.
[0082] In order to improve the inference speed of the target recommendation model finally obtained by training, the first recommendation model is set as a neural network model with a smaller network scale. The solution of this embodiment uses the existing reference recommendation model with a larger network scale to train the small-scale first recommendation model in the first training, so that the processing effect of the small-scale first recommendation model is close to that of the large-scale reference recommendation model. In this way, on the one hand, the function of the large model can be realized, and on the other hand, since the network scale of the first recommendation model is small, the forward feedback time of each iteration during training is short, and the inference speed can be faster. Among them, the reference recommendation model is also a neural network model that outputs content features; the small network scale can, for example, mean that the parameter scale is relatively small and the amount of calculation required is relatively small.
[0083] In addition, as mentioned above, in the training of the existing neural network model that outputs content features, the recommended attributes of the content sample are usually output by the classifier to determine the loss function and update the parameters of the neural network model. In this embodiment, considering that the model can obtain the content features corresponding to the content sample when performing feature extraction processing (and the content features can be directly used as model output in some models), the content features are associated with the attributes of the content sample, including the recommended attributes of the content sample, and compared with the recommended attributes output by the classifier, the content features are more expressive and contain more information. Therefore, using content features for model training and updating the parameters of the neural network model accordingly can make the neural network model converge faster.
[0084] Specifically, in this step, the target recommendation model is trained using the reference recommendation model, and firstly, the content features output by the reference recommendation model are obtained.
[0085] Among them, the reference recommendation model uses the first content sample set as input, and the content samples included in the first content sample set are called first content samples, such as video clips, pictures, audio clips, etc. The first content sample is input into the reference recommendation model, and after feature extraction processing of the reference recommendation model, the content features corresponding to the first content sample are output to form the first content feature set. In other words, the first content feature set includes the content features of each first content sample in the content sample set extracted using the reference recommendation model. The content features output by the reference recommendation model are called first content features. For example, the first content feature can be the output result of the Embedding layer obtained after the first content sample is input into the reference recommendation model, that is, the Embedding feature.
[0086] Step 102: Perform a first training on the first recommendation model using the first content sample set and the first content feature set until a first constraint condition is satisfied, thereby obtaining a second recommendation model.
[0087] The first recommendation model in the first training process is used to perform feature extraction processing on each first content sample in the first content sample set, and content features corresponding to the first content samples output by the first recommendation model are obtained. The content features output by the first recommendation model in the first training are called second content features, and all second content features constitute a second content feature set. In other words, the second content feature set includes content features corresponding to each first content sample extracted after feature extraction processing is performed on each first content sample in the first content sample set using the first recommendation model in the first training.
[0088] It can be seen from the above processing that each first content sample in the first content sample set is input into the reference recommendation model on the one hand to obtain the first content feature, and is input into the first recommendation model on the other hand to obtain the second content feature. Compared with the discrete and coarse-grained representation of the recommended attribute (i.e., the classification soft label) output by the model, the content feature includes more information in the attributes of the content sample and can identify the corresponding recommended attribute accordingly. Therefore, in this step, the content features containing more information are used to supervise the training of the first recommendation model to achieve the approximation of the first recommendation model to the reference recommendation model, rather than using the recommended attribute for supervision. That is, for the same content sample used for training, the second content feature output by the first recommendation model is made as close as possible to the first content feature output by the reference recommendation model. Specifically, the first training is used to reduce the deviation between the content features in the first content feature set and the content features in the second content feature set.
[0089] Step 103 , performing second training on the second recommendation model using the second content sample set and the first classification sample set preset corresponding to the second content sample set, until the second constraint condition is satisfied, thereby obtaining a target recommendation model.
[0090] Through the first training performed in steps 101-102, the content feature extraction effect of the second recommendation model obtained is close to the reference recommendation model. In order to further improve the expression ability of the recommendation model and accelerate the trend of performance improvement, the second recommendation model is further trained using the second content sample set and the first classification sample set pre-set corresponding to the second content sample set. The second content sample set and the first content sample set may be different. Each second content sample included in the second content sample set may be a variety of multimedia resources, such as video clips, pictures, audio clips, etc. The first classification sample set includes the preset recommendation attributes (i.e., classification soft labels) of the second content samples.
[0091] Specifically, after the first training is completed, if the constraint of the reference recommendation model on the second recommendation model is maintained, the expression ability and improvement trend of the second recommendation model may be limited. Therefore, in the second training, the reference recommendation model is no longer learned, but the second training is completed by reducing the deviation between the first output sample set and the first classification sample set, so as to continue to train the second recommendation model independently from the reference model to improve the performance of the second recommendation model until the second recommendation model meets the preset requirements. Among them, the first output sample set includes the recommended attributes of each second content sample obtained by classifying each first content sample in the first content sample set through the first recommendation model, that is, the recommended attributes of each second content sample extracted by the second recommendation model. The recommendation model obtained after the second training is the trained target recommendation model, that is, the recommendation model obtained by the entire training in this embodiment.
[0092] Through the above Figure 1 The recommendation model training method shown in the figure directly uses the content features output by the reference recommendation model instead of the recommendation attributes as supervision during model training. Compared with the discrete and coarse-grained information of the recommendation attributes, the content features have richer information expression and carry more feature information of the attributes of the corresponding content samples. Therefore, when the first training of the first recommendation model is performed based on this, more information is provided for the first recommendation model to learn in each iterative training, thereby accelerating the process of the first recommendation model approaching the reference recommendation model, accelerating the convergence of the first recommendation model, saving machine resources, and discarding the constraints of the reference recommendation model through the second training to further improve the expression ability of the second recommendation model and accelerate the trend of performance improvement, thereby ensuring the accuracy of the target recommendation model finally obtained.
[0093] In some examples, in order to further improve the accuracy of the target recommendation model finally obtained, before performing the second training on the second recommendation model using the second content sample set, the following processing may be further included:
[0094] The reference recommendation model is used to perform feature extraction processing on each third content sample in the third content sample set, determine the third content feature set, and obtain the second classification sample set including each recommendation label of each third content sample; the third content sample set, the third content feature set and the second classification sample set are used to perform the third training on the second recommendation model until the third constraint condition is met. The third content sample set includes the third content features corresponding to each third content sample, and the third content features include features extracted by the second recommendation model that characterize the recommendation attributes of the third content sample.
[0095] In the third training described above, on the basis of using the content features associated with the content attributes as supervision, the recommended attributes of each third content sample in the third content sample set are simultaneously used as supervision for model training.
[0096] Among them, the content samples used for training that are input into the reference recommendation model and the second recommendation model in the third training are called third content samples, all third content samples constitute the third content sample set, and the recommended attributes (i.e., classification labels) of each third content sample are obtained, which can also be called second classification samples, and the recommended attributes output by the second recommendation model classifier in the third training are called second output samples. Based on this, the second classification sample set includes the recommended attributes of each third content sample in the third content sample set, and the second output sample set includes the recommended attributes output by the classifier after processing each third content sample using the second recommendation model in the third training. The second classification samples in the second classification sample set can be recommendation labels pre-labeled corresponding to the third content samples, or can be recommendation labels output by the classifier after the third content samples are classified and processed using the reference recommendation model. At the same time, the content samples used for training input into the reference recommendation model and the target recommendation model in the first training and the third training may be different, and therefore the corresponding extracted content features may also be different. In order to distinguish the content features of the input samples extracted using the reference recommendation model and the target recommendation model in two different training stages, the content features corresponding to the third content samples extracted using the reference recommendation model in the third training are called third content features, and the content features corresponding to the third content samples extracted using the second recommendation model in the third training are called fourth content features. Based on this, the third content feature set includes the third content features corresponding to each third content sample extracted using the reference recommendation model in the third training, and the fourth content feature set includes the fourth content features corresponding to each third content sample extracted in the third training using the second recommendation model in the third training.
[0097] As described above, in the third training, the content features and recommendation attributes corresponding to the content samples are used as supervision to train the second recommendation model. That is to say, the third training is used to reduce the deviation between the third content feature set and the fourth content feature set, and the deviation between the second classification sample set and the second output sample set. Specifically, when determining whether the third constraint condition is met, it is performed based on the comparison result of the third content feature in the third content feature set and the fourth content feature in the fourth content feature set. In addition, it is further performed based on the comparison result of the second classification sample in the second classification sample set and the second output sample in the second output sample set. Based on this, the second recommendation model is trained by using content features and classification sample supervision at the same time, which can improve the accuracy of the second recommendation model and further improve the accuracy of the target recommendation model finally obtained. At the same time, by using the recommendation attribute for supervision, the optimization of the classifier is also achieved, which can further improve the accuracy of the second recommendation model and the accuracy of the target recommendation model. As mentioned above, on the one hand, by optimizing the small model in stages, a better small model effect is achieved, which brings a better experience to users; on the other hand, the small model is trained based on the large reference recommendation model, which not only improves the reasoning speed of the model, but also ensures the effect of the model.
[0098] After the third training is completed, the second training described in the aforementioned step 103 is continued based on the second recommendation model after the third training to discard the constraints of the reference recommendation model and further improve the performance of the second recommendation model. In some examples, the second training may include fine tuning the second recommendation model. For example, the second recommendation model may be trained by reducing the learning rate to achieve fine tuning of the second recommendation model.
[0099] In the above description, the input content sample sets of the first training, the second training and the third training are the first content sample set, the second content sample set and the third content sample set respectively. The content samples in the first content sample set, the second content sample set and the third content sample set can be video clips, video covers, pictures, thumbnails, audio files, etc. In specific implementation, the first training, the second training and the third training can use the same input content sample set, that is, the first content sample set, the second content sample set and the third content sample set are all the same. At the same time, the reference recommendation model in the scheme of this embodiment is always unchanged, so when the content samples input by the reference recommendation model are the same, the content features of its output are also the same, so if the first content sample set and the third content sample set are the same, then the first content feature set and the third content feature set are also the same. However, for the recommendation model of the training, since the recommendation model will change in different training stages, even if the first content sample set and the third content sample set are the same, the second content feature set is not necessarily the same as the fourth content feature set. At the same time, the feature extraction processing of the first content sample set and the third content sample set using the reference recommendation model can be performed in advance, and the first content feature set and the third content feature set can be saved, and then the saved first content feature set and the third content feature set can be used to perform the first training of the target recommendation model; or, the feature extraction processing of the first content sample set and the third content sample set using the reference recommendation model can also be performed synchronously with the first recommendation model during the first training of the first recommendation model.
[0100] The specific implementation of the recommendation model training method in the above-mentioned embodiment of the present disclosure is explained below through a specific embodiment.
[0101] Figure 2 is a specific flow chart of a three-stage recommendation model training method according to an exemplary embodiment. In this embodiment, the training of the recommendation model includes three stages: first training, second training and third training. In order to maximize the simplification of processing and speed up the training of the target recommendation model, the first training, second training and third training use the same input content sample set. At the same time, in this embodiment, the content features of each input content sample are Embedding features, and it is assumed that the recommendation model is used for clothing recommendation. Figure 2 As shown in the figure, the specific process of the three-stage recommendation model training method includes:
[0102] Step 201: Obtain a content sample set.
[0103] In this step, a content sample set for training the recommendation model is obtained. The content sample set includes a large number of content samples for training. In this embodiment, the input content samples can be clothing pictures of various styles and colors.
[0104] Step 202: load the trained reference recommendation model and initialize the first recommendation model.
[0105] The reference recommendation model is a large-scale network model that has been trained, such as a large-scale image recommendation model, etc., and can be specifically a Teacher network model. The recommendation model to be trained is a small model obtained by compressing the large-scale network model through knowledge distillation, and can be specifically a Student network model.
[0106] In the first stage of training, the trained model is called the first recommendation model. This step is used to load the reference recommendation model and initialize the first recommendation model to prepare for the training of the first recommendation model.
[0107] Step 203: Use the reference recommendation model to perform feature extraction processing on each content sample in the content sample set to obtain a first content feature set.
[0108] The reference recommendation model performs the same processing on each content sample in the content sample set. Taking a content sample A as an example, the content sample A is input into the reference recommendation model, and the reference recommendation model extracts features from the content sample A, extracting the content features corresponding to the content sample A. In this embodiment, the Embedding features are the output of the Embedding layer, that is, the embedded features corresponding to the content sample A extracted using the reference recommendation model, which are referred to as the first content features. After extracting features from all content samples using the reference recommendation model, the first content features corresponding to each content sample are extracted. The first content feature set includes the first content features corresponding to all content samples. In this embodiment, the recommended attributes of the content sample may be clothing style, color, clothing category, etc., and the content features are associated with these recommended attributes.
[0109] Step 204: Perform a first training on the first recommendation model using the content sample set and the first content feature set until the first constraint condition is satisfied, thereby obtaining a second recommendation model.
[0110] This step is the first training, which is the first stage of training. Specifically includes:
[0111] 1) Using the first recommendation model in the first training to process the content samples in the content sample set, to obtain a second content feature set;
[0112] The first recommendation model processes each content sample in the same way. Taking content sample A as an example, content sample A is input into the first recommendation model. After the first recommendation model performs feature extraction on content sample A, content features corresponding to the content sample are extracted. In this embodiment, the Embedding features are the Embedding features output by the Embedding layer, i.e., the embedding features corresponding to content sample A extracted by the first recommendation model, which are referred to as second content features. The second content feature set includes the embedding features corresponding to each content sample extracted after the first recommendation model performs feature extraction on each content sample in the first content.
[0113] 2) comparing the embedded features in the first content feature set with the embedded features in the second content feature set, and determining a deviation of the embedded features in the second content feature set relative to the embedded features in the first content feature set;
[0114] Among them, when comparing embedded features, the first content feature and the second content feature corresponding to the same content sample are compared. The deviation of the second content feature relative to the first content feature determined by comparing the first content feature and the second content feature is called the third deviation, which can usually be represented by a loss function. The loss function can take various existing forms. For example, the above two embedded features can be normalized, and the loss function can be represented by the mean square error (MSE) loss, denoted as Loss_1. The loss function can characterize the distance between the first content feature and the second content feature in the Euclidean distance space. Of course, only MSE is used as an example to illustrate the loss function here. In specific implementation, a suitable loss function can be selected according to actual needs. This embodiment does not limit the type of loss function;
[0115] 3) reducing the third deviation by adjusting the target recommendation model to perform the first training until the first constraint condition is satisfied;
[0116] In the first training of the target recommendation model, the goal is to minimize the third deviation between the embedded features in the first content feature set and the embedded features in the second content feature set, and adjust the target recommendation model parameters through several iterations to continuously reduce the above third deviation.
[0117] At the end of each iteration, it is necessary to determine whether the first constraint condition is satisfied. If so, the training is terminated, otherwise, the training is continued. The method of determining whether the first constraint condition is satisfied may specifically include: if the third deviation obtained in 2) is within a preset threshold range, or the third deviation determined in the most recent N (N is a preset positive integer greater than 1) times is no longer reduced, then it is determined that the first constraint condition is satisfied and the first training is terminated; otherwise, it is determined that the first constraint condition is not satisfied and the first training is continued;
[0118] In more detail, for each second content feature in the second content feature set, the second content feature is extracted through the process of 1), the third deviation between the second content feature and its corresponding first content feature is calculated through the process of 2), and then whether the first constraint condition is satisfied is determined based on the third deviation through the process of 3). Such a series of processes for a second content feature is called an iterative process. If it is determined through the process of 3) that the first constraint condition is not satisfied, training continues, then the next iteration is started, and the processes of 1), 2), and 3) are executed on the next second content feature; if it is determined through the process of 3) that the first constraint condition is satisfied, training ends, then the first stage of training ends, and step 205 can be entered to continue the third training.
[0119] For the third deviation of the second content feature relative to the first content feature obtained for the same training sample in 2), if it is within a preset threshold range (that is, the second content feature has reached the set degree of proximity to the first content feature), or the third deviation determined in the last N times no longer decreases (that is, the distance between the second content feature and the first content feature in the last N iterations no longer continues to shrink, which means that the performance of the target recommendation model cannot be significantly improved if training continues), it is determined that the first constraint is met and the first training is terminated; otherwise, it is determined that the first constraint is not met, the first training is continued, and the next iteration is performed.
[0120] In this embodiment, the first training in the above step mainly calculates the loss function by embedding features, thereby utilizing the rich information of the embedded features to enable the first recommendation model to quickly approach the reference recommendation model by using the embedded features, thereby accelerating the convergence speed of the first recommendation model. The recommendation model obtained after the first training is called the second recommendation model.
[0121] After the first stage of training is completed, in some examples, in order to further improve the accuracy of the final target recommendation model, the third training is continued, that is, the following steps 205-206.
[0122] Step 205 , using the reference recommendation model to perform feature extraction and classification processing on the content samples in the content sample set, to obtain a first content feature set and a second classification sample set.
[0123] Entering the third training, the model will still be trained using embedded features. In addition, the recommended labels corresponding to the input content sample set will be further used for model training. Since the input content samples of the third training are the same as those of the first training, the embedded features corresponding to the content samples extracted using the reference recommendation model in the third training are also the same as those of the first training, and are still called the first content features, that is, the third content features referred to above.
[0124] At the same time, in this embodiment, the reference recommendation model is also a model with classifier processing, so after the content sample is processed including the classifier, the recommended label (i.e., the classification label) output by the classifier can be obtained. In this step, the output of the reference recommendation model through the classifier is obtained, which is called the second classification sample. That is to say, in this embodiment, the second classification sample is obtained by classifying the content sample set using the reference recommendation model. Specifically, the reference recommendation model is used to classify each content sample in the content sample set to determine the second classification sample set; the second classification sample set includes each recommended label output by the classifier after each content sample is processed using the reference recommendation model. Among them, the classifier can be of various types, such as the commonly used softmax classifier, and this embodiment does not limit the type of classifier. In this embodiment, the recommended label can be part of the aforementioned recommended attributes, such as clothing color and category.
[0125] In addition, as described above, the second classification samples in this embodiment are obtained by classifying the content sample set using the reference recommendation model. In fact, in other embodiments, the second classification samples in the second classification sample set may also be pre-set corresponding to each third content sample.
[0126] Step 206 , using the content sample set, the first content feature set, and the second classification sample set, a third training is performed on the second recommendation model obtained after the first training, until the third constraint condition is satisfied.
[0127] In the third training of this embodiment, the recommended attributes of the content samples output by the classifier are combined with the embedded features to train the model. The specific processing may include:
[0128] 1) Using the second recommendation model in the third training to perform feature extraction and classification processing on the content sample set, to determine a fourth content feature set and a second output sample set;
[0129] The third content is based on the second recommendation model obtained in the first training. In order to distinguish the recommendation models in different stages, the recommendation model trained in this step is called the second recommendation model in the third training. In fact, for the recommendation models trained in the same stage, the specific recommendation model parameters will change in each iteration, but no detailed distinction is made here. The second recommendation models of each iteration in the third training are uniformly referred to as the second recommendation model in the third training.
[0130] The second recommendation model in the third training is used to perform feature extraction and classification on the input content sample; the embedded features corresponding to the extracted content sample are called fourth content features, and all fourth content features constitute a fourth content feature set. Accordingly, the second recommendation model in the third training is used to classify the input content sample to obtain the output of the classifier, that is, the recommended attribute of the input content sample, which can also be called a second output sample, and all second output samples constitute a second output sample set;
[0131] 2) comparing the embedded features in the first content feature set with the embedded features in the fourth content feature set, and determining a first deviation of the embedded features in the fourth content feature set relative to the embedded features in the first content feature set;
[0132] As in the first training, the embedded features extracted using the reference recommendation model are compared with the embedded features extracted using the second recommendation model to determine the deviation between the two. The deviation can be represented by a loss function, such as Loss1.
[0133] 3) comparing the second classification sample in the second classification sample set with the second output sample in the second output sample set to determine a second deviation of the second output sample relative to the second classification sample;
[0134] When comparing the second classification sample and the second output sample, the second classification sample and the second output sample corresponding to the same content sample are compared. The deviation of the second output sample relative to the second classification sample determined by comparing the second classification sample and the second output sample is called the second deviation, which can also be represented by a loss function. To distinguish it from the loss function determined according to the embedded features, the loss function determined according to the classifier output is called Loss2. Loss2 and Loss1 can be of the same type or different types;
[0135] 4) determining a comprehensive deviation of the second recommendation model relative to the reference recommendation model according to the first deviation and the second deviation;
[0136] Since the third training considers two types of deviations, namely, embedded features and classifier output, the two types of deviations need to be merged before forward feedback to indicate the degree of deviation between the second recommendation model and the reference recommendation model for parameter adjustment. The specific way of merging the two deviations can be set according to actual needs, for example, the first deviation and the second deviation can be summed (i.e., cumulative sum), or the first deviation and the second deviation can be weighted summed;
[0137] 5) reducing the comprehensive deviation by adjusting the second recommendation model until the third constraint is met;
[0138] In the third training of the second recommendation model, the goal is to minimize the comprehensive deviation determined based on the deviation between the embedded features in the first content feature set and the embedded features in the fourth content feature set, and the deviation between the second classified samples in the second classified sample set and the second output samples in the second output sample set, and adjust the second recommendation model parameters through several iterations to continuously reduce the above-mentioned comprehensive deviation.
[0139] At the end of each iteration, it is necessary to determine whether the third constraint condition is satisfied. If so, the training is terminated, otherwise, the training is continued. The specific method for determining whether the third constraint condition is satisfied can be: if the comprehensive deviation is within a preset threshold range, or the comprehensive deviation determined in the most recent M (M is a preset positive integer greater than 1) times is no longer reduced, then it is determined that the third constraint condition is satisfied and the third training is terminated; otherwise, it is determined that the third constraint condition is not satisfied and the next iteration of the third training is continued.
[0140] In more detail, for the comprehensive deviation obtained for the training samples in 2), if it is within a preset threshold range (that is, the second recommendation model has reached the set degree of closeness to the reference recommendation model), or the deviation determined in the last M times no longer decreases (that is, the distance between the second recommendation model and the reference recommendation model no longer continues to shrink in the last M iterations, which means that the performance of the second recommendation model cannot be significantly improved if training continues), then it is determined that the third constraint is met and the third training is terminated; otherwise, it is determined that the third constraint is not met, and the third training is continued for the next iteration.
[0141] The third training of steps 205-206 is mainly to continue training the target recommendation model by embedding features combined with the recommended attributes output by the classifier, so as to make the second recommendation model closer to the reference recommendation model, improve the accuracy of the second recommendation model, and then improve the accuracy of the target recommendation model finally obtained. The process diagram of the third training is shown in FIG. Figure 3 shown.
[0142] Step 207 , performing a second training on the second recommendation model obtained after the third training by using the content sample set and a first classification sample set preset corresponding to the content sample set.
[0143] After the first and third trainings, the second recommendation model is close enough to the reference recommendation model. If the reference recommendation model continues to constrain the second recommendation model, it may limit the expressive ability and improvement trend of the recommendation model. Therefore, in the second training, the reference recommendation model is no longer learned. Instead, the second recommendation model is independently trained using the content samples in the second content sample set until the second recommendation model meets the preset requirements, thereby obtaining the final target recommendation model.
[0144] The second training can be performed using the existing model training method based on the second recommendation model obtained after the third training. Since the network size of the second recommendation model is relatively small, the inference speed using the existing method will also be relatively fast.
[0145] Specifically, the second training may include fine-tuning, for example, a lower learning rate than that of the first training and the third training may be used to further fine-tune the second recommendation model after the third training using the third content sample set.
[0146] In more detail, the second training may include: obtaining a first classification sample set pre-set for the corresponding input content sample set, the first classification sample set including recommended labels for each content sample in the content sample set, which may also be referred to as a first classification sample; using a second recommendation model in the second training to classify each content sample in the content sample set to obtain a recommended attribute output by the classifier, which is referred to as a first output sample, and all first output samples constitute a first output sample set; and completing the second training by reducing the deviation between the first output sample set and the first classification sample set.
[0147] The above is a specific implementation of the recommendation model training method in this embodiment. After the target recommendation model S is trained in the above manner, the target recommendation model S can be used to perform feature extraction processing to output content features of the sample (eg, Embedding features).
[0148] This embodiment also provides a recommendation model training device, which can be used to implement the above-mentioned recommendation model training method. Figure 4 Figure 1 is a basic structural diagram of the recommendation model training device. Figure 4 As shown, the device includes: a feature extraction module, a first training module and a second training module.
[0149] Specifically, the feature extraction module is configured to perform feature extraction processing on each first content sample in the first content sample set using the trained reference recommendation model to determine a first content feature set. The first content feature set includes first content features corresponding to each first content sample, the first content features including features of the recommendation attributes of the first content sample, and are obtained using the reference recommendation model.
[0150] The first training module is configured to perform a first training on the first recommendation model using the first content sample set and the first content feature set until the first constraint condition is satisfied to obtain a second recommendation model. The first training is used to reduce the deviation between the first content feature set and the second content feature set. The second content feature set is obtained by extracting features from each first content sample in the first content sample set using the first recommendation model. The second content feature set includes second content features corresponding to each first content sample. The second content features include features that characterize the recommendation attributes of the first content sample, and the second content features are obtained using the first recommendation model in the first training.
[0151] The second training module is configured to perform a second training on the second recommendation model using the second content sample set and the first classification sample set pre-set corresponding to the second content sample set until the second constraint condition is satisfied to obtain a target recommendation model. The second training is used to reduce the deviation between the first output sample set and the first classification sample set, the first classification sample set includes the recommendation labels of each second content sample, and the first output sample set includes the recommendation attributes of each second content sample obtained by classifying each first content sample in the first content sample set through the first recommendation model.
[0152] exist Figure 4 In the recommendation model training device shown, on the one hand, the content features associated with the recommendation attributes output by the reference recommendation model are directly used as supervision instead of the recommendation attributes. Compared with the discrete and coarse-grained information of the recommendation attributes, the content features have richer information expression and carry more feature information of the corresponding category content attributes. When the first training of the target recommendation model is performed based on this, more information is provided for the target recommendation model to learn in each iterative training, thereby accelerating the process of the target recommendation model approaching the reference recommendation model, accelerating the convergence of the target recommendation model, and saving machine resources. On the other hand, by discarding the constraints of the reference recommendation model through the second training, the expressive power of the target recommendation model is further improved and the trend of performance improvement is accelerated, thereby ensuring the accuracy of the target recommendation model.
[0153] In some examples, to further improve the accuracy of the target recommendation model, the model training device may further include:
[0154] The third training preparation module is configured to use the reference recommendation model to perform feature extraction processing on each third content sample in the third content sample set, determine a third content feature set, and obtain a second classification sample set. The third content sample set includes third content features corresponding to each third content sample, the fourth content features include features characterizing the recommendation attributes of the third content sample, and the second classification sample set includes recommendation tags for each third content sample;
[0155] A third training module is configured to perform a third training on the second recommendation model using a third content sample set, a third content feature set, and a second classification sample set until a third constraint condition is satisfied;
[0156] Among them, the third training is used to reduce the deviation between the third content feature set and the fourth content feature set, and the deviation between the second classification sample set and the second output sample set; the fourth content feature set is obtained by performing feature extraction processing on each third content sample in the third content sample set by the second recommendation model in the third training, the fourth content feature set includes fourth content features corresponding to each third content sample, the fourth content features include features characterizing the recommended attributes of the third content samples, and the second output sample set includes the recommended attributes of each third content sample extracted by the second recommendation model in the third training.
[0157] The second training module performs a second training on the second recommendation model using the second content sample set and the first classification sample set preset corresponding to the second content sample set until the second constraint condition is satisfied, and the target recommendation model is obtained, including:
[0158] The second recommendation model that has undergone the third training is subjected to a second training by using the second content sample set and the first classification sample set, until the second constraint condition is satisfied, thereby obtaining a target recommendation model.
[0159] The third training module is located between the first training module and the second training module, and the second training performed by the second training module is performed on the second recommendation model processed by the third training module.
[0160] By introducing the third training preparation module and the third training module, the content features associated with the recommended attributes and the recommended attributes output by the classifier are used as supervision to train the target recommendation model, thereby further improving the accuracy of the target recommendation model. As mentioned above, on the one hand, by optimizing the small model in stages, a better small model effect is achieved, bringing a better experience to users; on the other hand, the small target recommendation model is trained based on the large reference recommendation model, thereby improving the model's reasoning speed and ensuring the model's effect.
[0161] In some examples, the third training module uses the third content sample set, the third content feature set, and the second classification sample set to train the second recommendation model on the third content, which may specifically include:
[0162] Using the second recommendation model in the third training to perform feature extraction processing on each third content sample in the third content sample set to determine a fourth content feature set, and using the second recommendation model in the third training to perform classification processing on each third content sample in the third content sample set to obtain a second output sample set;
[0163] comparing the third content feature in the third content feature set with the fourth content feature in the fourth content feature set, and determining a first deviation of the fourth content feature in the fourth content feature set relative to the third content feature in the third content feature set;
[0164] Comparing the recommended labels in the second classification sample set with the recommended attributes in the second output sample set, and determining a second deviation of the recommended attributes in the second output sample set relative to the recommended labels in the second classification sample set;
[0165] Determining a comprehensive deviation of the target recommendation model relative to the reference recommendation model according to the first deviation and the second deviation;
[0166] By adjusting the second recommendation model after the first training, the comprehensive deviation is reduced to perform the third training.
[0167] In some examples, each recommendation label acquired by the third training preparation module is obtained by classifying each third content sample using a reference recommendation model, or each recommendation label is pre-set corresponding to each third content sample.
[0168] The specific method of combining the first deviation and the second deviation into a comprehensive deviation can be determined as needed. For example, the cumulative sum of the first deviation and the second deviation, or the weighted sum of the first deviation and the second deviation can be determined as the comprehensive deviation.
[0169] In some examples, each recommendation tag in the second classification sample set is obtained by classifying each third content sample using a reference recommendation model, or each recommendation tag in the second classification sample set is pre-set corresponding to each third content sample.
[0170] In some examples, the first training module performs a first training process on the first recommendation model using the first content sample set and the first content feature set, which may specifically include:
[0171] Using the first recommendation model in the first training, performing feature extraction processing on each first content sample in the first content sample set to obtain a second embedding feature set;
[0172] comparing a first content feature in the first content feature set with a second content feature in the second content feature set, and determining a third deviation of the second content feature in the second content feature set relative to the first content feature in the first content feature set;
[0173] The third deviation is reduced by adjusting the target recommendation model to perform the first training.
[0174] In some examples, the second training may include fine-tuning the second recommendation model by reducing a learning rate of the second training.
[0175] In some examples, the first set of content samples, the second set of content samples, and the third set of content samples may be the same.
[0176] It should be noted that: the above embodiment only illustrates the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0177] This embodiment also provides an electronic device for model training, which will be referred to as a model training electronic device hereinafter. Generally, considering the computing resources and computing requirements of the model training electronic device, the model training electronic device is usually a server or a terminal device with powerful processing capabilities. The recommendation model training electronic device includes at least one processor and at least one memory. The memory is used to store at least one instruction, and the at least one instruction is used to be executed by the processor to implement the recommendation model training method provided in this embodiment.
[0178] This embodiment further provides an electronic device for sample processing, which will be referred to as a sample processing electronic device hereinafter, and the sample processing electronic device may be a terminal or a server. The sample processing electronic device includes at least one processor and at least one memory. The processor is used to load a target recommendation model trained using the recommendation model training method provided in this embodiment; the memory is used to store executable instructions of the processor; the processor is configured to process the acquired sample to be processed using the target recommendation model.
[0179] Specifically, when the model training electronic device or the sample processing electronic device is a terminal, the terminal may be a smart phone, a tablet computer, a laptop computer or a desktop computer. The terminal may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0180] Typically, a terminal includes: a processor and a memory.
[0181] The processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0182] The memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices.
[0183] In some embodiments of the model training electronic device, the non-transitory computer-readable storage medium in the memory is used to store at least one instruction, which is used to be executed by the processor to implement the recommendation model training method provided in the embodiments of the present disclosure.
[0184] Those skilled in the art will appreciate that the above structure does not limit the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0185] When the model training electronic device or sample processing electronic device provided in this embodiment is a server, the server may have relatively large deviations due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) and one or more memories, wherein, for the model training electronic device, the memory stores at least one program code, which is loaded and executed by the processor to implement the recommendation model training method provided in the above-mentioned embodiments; for the sample processing electronic device, the memory stores at least one program code, which is loaded and executed by the processor to enable the sample processing electronic device to load the target recommendation model trained by the recommendation model training method provided in the above-mentioned embodiments, and use the target recommendation model to process the acquired samples to be processed. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be repeated here.
[0186] In an exemplary embodiment, a computer-readable storage medium including at least one instruction is also provided, such as a memory including at least one instruction. The at least one instruction can be executed by a processor in a computer device to complete the recommendation model training method provided in this embodiment.
[0187] In an exemplary embodiment, a computer-readable storage medium including at least one instruction is also provided, such as a memory including at least one instruction. The at least one instruction can be executed by a processor in a computer device to enable the image processing electronic device to load the target recommendation model trained by the recommendation model training method provided in the above embodiments, and use the target recommendation model to process the acquired samples to be processed.
[0188] Optionally, the above-mentioned computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may include ROM (Read-Only Memory), RAM (Random-Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk and optical data storage device, etc.
[0189] In an exemplary embodiment, a computer program product is also provided, including one or more instructions, which can be executed by a processor of a computer device to complete the recommendation model training method provided by the above-mentioned embodiments.
[0190] Those skilled in the art will readily appreciate other implementations of the disclosed embodiments after considering the specification and practicing the invention disclosed herein. The disclosed embodiments are intended to cover any variations, uses, or adaptations of the embodiments, which follow the general principles of the embodiments and include common knowledge or customary technical means in the art not disclosed in the embodiments. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the disclosed embodiments are indicated by the following claims.
[0191] It should be understood that the embodiments of the present disclosure are not limited to the precise structures described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the embodiments of the present disclosure is limited only by the appended claims.
Claims
1. A recommendation model training method, characterized in that: include: Using the trained reference recommendation model, feature extraction is performed on each first content sample in the first content sample set to obtain a first content feature set; the first content feature set includes first content features corresponding to each first content sample; the first content features include features characterizing a recommendation attribute of the first content sample; Performing a first training on a first recommendation model using the first content sample set and the first content feature set until a first constraint condition is satisfied, thereby obtaining a second recommendation model; wherein the first training is used to reduce the deviation between the first content feature set and the second content feature set, the second content feature set is obtained by performing feature extraction processing on each first content sample in the first content sample set using the first recommendation model, the second content feature set includes second content features corresponding to each first content sample, and the second content features include features characterizing a recommendation attribute of the first content sample; The second recommendation model is subjected to second training using the second content sample set and a first classification sample set pre-set corresponding to the second content sample set until the second constraint condition is met to obtain a target recommendation model; wherein the second training is used to reduce the deviation between the first output sample set and the first classification sample set, the first classification sample set includes the recommendation labels of each second content sample in the second content sample set, and the first output sample set includes the recommendation attributes of each second content sample extracted by the second recommendation model.
2. The recommendation model training method according to claim 1, characterized in that: Before performing the second training on the second recommendation model using the second content sample set and the first classification sample set preset corresponding to the second content sample set, the recommendation model training method further includes: Using the reference recommendation model, feature extraction is performed on each third content sample in the third content sample set to obtain a third content feature set, and a second classification sample set is obtained; the third content sample set includes third content features corresponding to each of the third content samples, the third content features include features characterizing the recommendation attributes of the third content samples, and the second classification sample set includes recommendation tags for each of the third content samples; The second recommendation model is subjected to a third training using the third content sample set, the third content feature set and the second classification sample set until a third constraint condition is satisfied; wherein the third training is used to reduce the deviation between the third content feature set and the fourth content feature set, and the deviation between the second classification sample set and the second output sample set; the fourth content feature set is obtained by extracting features of each third content sample in the third content sample set using the second recommendation model, the fourth content feature set includes fourth content features corresponding to each third content sample, and the fourth content features include features characterizing the recommendation attributes of the third content samples; the second output sample set includes the recommendation attributes of each third content sample extracted by the second recommendation model; The second recommendation model is trained using the second content sample set and the first classification sample set preset corresponding to the second content sample set until the second constraint condition is satisfied to obtain the target recommendation model, including: The second recommendation model that has undergone the third training is subjected to the second training by using the second content sample set and the first classification sample set, until the second constraint condition is satisfied, thereby obtaining the target recommendation model.
3. The recommendation model training method according to claim 2, characterized in that: The performing third training on the second recommendation model by using the third content sample set, the third content feature set and the second classification sample set includes: performing feature extraction processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the fourth content feature set, and performing classification processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the second output sample set; comparing the third content feature in the third content feature set with the fourth content feature in the fourth content feature set, and determining a first deviation of the fourth content feature in the fourth content feature set relative to the third content feature in the third content feature set; Comparing the recommended labels in the second classification sample set with the recommended attributes in the second output sample set, and determining a second deviation of the recommended attributes in the second output sample set relative to the recommended labels in the second classification sample set; determining a combined deviation based on the first deviation and the second deviation; The comprehensive deviation is reduced by adjusting the second recommendation model that has undergone the first training so as to perform the third training.
4. The recommendation model training method according to claim 2, characterized in that: Each recommendation tag in the second classification sample set is obtained by classifying each third content sample using the reference recommendation model, or each recommendation tag in the second classification sample set is pre-set corresponding to each third content sample.
5. The recommendation model training method according to claim 3, characterized in that: The determining a comprehensive deviation according to the first deviation and the second deviation comprises: The cumulative sum of the first deviation and the second deviation, or the weighted sum of the first deviation and the second deviation, is determined as the comprehensive deviation.
6. The recommendation model training method according to any one of claims 1 to 5, characterized in that: The performing a first training on the first recommendation model by using the first content sample set and the first content feature set includes: Using the first recommendation model in the first training, performing feature extraction processing on each first content sample in the first content sample set to obtain the second content feature set; comparing a first content feature in the first content feature set with a second content feature in the second content feature set, and determining a third deviation of the second content feature in the second content feature set relative to the first content feature in the first content feature set; The first training is performed by adjusting the first recommendation model to reduce the third deviation.
7. The recommendation model training method according to any one of claims 1 to 5, characterized in that: The second training includes: fine-tuning the second recommendation model by reducing a learning rate of the second training.
8. The recommendation model training method according to any one of claims 2 to 5, characterized in that: The first content sample set, the second content sample set and the third content sample set are all the same.
9. A recommendation model training device, characterized in that: include: a feature extraction module configured to perform feature extraction processing on each first content sample in the first content sample set using the trained reference recommendation model to obtain a first content feature set; the first content feature set includes first content features corresponding to each first content sample, and the first content features include features characterizing a recommendation attribute of the first content sample; A first training module is configured to perform first training on a first recommendation model using the first content sample set and the first content feature set until a first constraint condition is satisfied to obtain a second recommendation model; wherein the first training is used to reduce the deviation between the first content feature set and the second content feature set, the second content feature set is obtained by extracting features from each first content sample in the first content sample set using the first recommendation model, the second content feature set includes second content features corresponding to each first content sample, and the second content features include features characterizing a recommendation attribute of the first content sample; The second training module is configured to perform second training on the second recommendation model using a second content sample set and a first classification sample set pre-set corresponding to the second content sample set until a second constraint condition is met to obtain a target recommendation model; wherein the second training is used to reduce the deviation between the first output sample set and the first classification sample set, the first classification sample set includes the recommendation labels of each second content sample in the second content sample set, and the first output sample set includes the recommendation attributes of each second content sample extracted by the first recommendation model.
10. The recommendation model training device according to claim 9, characterized in that: The recommendation model training device also includes: A third training preparation module is configured to use the reference recommendation model to perform feature extraction processing on each third content sample in the third content sample set to obtain a third content feature set, and obtain a second classification sample set; the third content sample set includes third content features corresponding to each of the third content samples, the third content features include features representing the recommendation attributes of the third content samples, and the second classification sample set includes recommendation tags for each of the third content samples; a third training module, configured to perform a third training on the second recommendation model using the third content sample set, the third content feature set and the second classification sample set until a third constraint condition is met; The third training is used to reduce the deviation between the third content feature set and the fourth content feature set, and the deviation between the second classification sample set and the second output sample set; the fourth content feature set is obtained by performing feature extraction processing on each third content sample in the third content sample set by the second recommendation model, the fourth content feature set includes fourth content features corresponding to each third content sample, the fourth content features include features characterizing the recommended attributes of the third content samples, and the second output sample set includes the recommended attributes of each third content sample extracted by the second recommendation model; The second training module performs second training on the second recommendation model using the second content sample set and the first classification sample set preset corresponding to the second content sample set until the second constraint condition is satisfied, and the target recommendation model is obtained, including: The second recommendation model that has undergone the third training is subjected to the second training by using the second content sample set and the first classification sample set, until the second constraint condition is satisfied, thereby obtaining the target recommendation model.
11. The recommendation model training device according to claim 10, characterized in that: The third training module performs third training on the second recommendation model using the third content sample set, the third content feature set and the second classification sample set, including: performing feature extraction processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the fourth content feature set, and performing classification processing on each third content sample in the third content sample set by using the second recommendation model in the third training to obtain the second output sample set; comparing the third content feature in the third content feature set with the fourth content feature in the fourth content feature set to determine a first deviation of the fourth content feature in the fourth content feature set relative to the third content feature in the third content feature set; Comparing the recommended labels in the second classification sample set with the recommended attributes in the second output sample set, and determining a second deviation of the recommended attributes in the second output sample set relative to the recommended labels in the second classification sample set; determining a combined deviation based on the first deviation and the second deviation; The comprehensive deviation is reduced by adjusting the second recommendation model that has undergone the first training so as to perform the third training.
12. The recommendation model training device according to claim 10, characterized in that: Each recommendation tag in the second classification sample set is obtained by classifying each third content sample using the reference recommendation model, or each recommendation tag in the second classification sample set is pre-set corresponding to each third content sample.
13. The recommendation model training device according to claim 11, characterized in that: The third training module determines a comprehensive deviation according to the first deviation and the second deviation, including: The cumulative sum of the first deviation and the second deviation, or the weighted sum of the first deviation and the second deviation, is determined as the comprehensive deviation.
14. The recommendation model training device according to any one of claims 9 to 13, characterized in that: The first training module performs first training on the first recommendation model using the first content sample set and the first content feature set, including: Using the first recommendation model in the first training, performing feature extraction processing on each first content sample in the first content sample set to obtain the second content feature set; comparing a first content feature in the first content feature set with a second content feature in the second content feature set, and determining a third deviation of the second content feature in the second content feature set relative to the first content feature in the first content feature set; The first training is performed by adjusting the first recommendation model to reduce the third deviation.
15. The recommendation model training device according to any one of claims 9 to 13, characterized in that: The second training performed by the second training module includes: fine-tuning the second recommendation model by reducing a learning rate of the second training.
16. The recommendation model training device according to any one of claims 10 to 13, characterized in that: The first content sample set, the second content sample set and the third content sample set are all the same.
17. An electronic device, characterized in that: include: processor; a memory for storing executable instructions for the processor; Wherein, the processor is configured to execute the executable instructions to implement the recommendation model training method as described in any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that: When at least one instruction in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to implement the recommendation model training method as described in any one of claims 1 to 8.
19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the recommendation model training method as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Migration model training method and device based on artificial intelligence and storage medium
CN111026970A
Content recommendation model training method, content recommendation method and related equipment
CN113360777A