Recommendation model training method, device, equipment and storage medium

Through the methods of knowledge distillation and two-way learning, the problem that the model is difficult to converge rapidly in the target field in transfer learning is solved, and the rapid convergence and stable effect balance in the target field is achieved.

CN114330654BActive Publication Date: 2025-04-29MIGU CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111592784.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-23
Publication Date
2025-04-29
Estimated Expiration
2041-12-23

AI Technical Summary

Technical Problem

In the transfer learning process, it is difficult for the existing technology to balance the network structure and effect, which makes it difficult for the model to converge quickly in the target field and may have a ‘negative transfer’ phenomenon.

Method used

Through the knowledge distillation method, the student model is trained using the teacher model in the source field and the first target field sample in the target field to obtain the student model, and two-way learning is performed during knowledge distillation, and the loss function of the teacher model is adjusted to adapt to the student model's Logits, so that the student model can converge quickly.

Benefits of technology

While ensuring the stable effect of the model, the student model quickly converges in the target field, avoiding the phenomenon of "negative migration" and improving the model's adaptability in the target field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114330654B_ABST
    Figure CN114330654B_ABST
Patent Text Reader

Abstract

The present invention discloses a recommendation model training method, device, equipment and storage medium, the recommendation model training method comprises: determining source domain samples of a source domain and first target domain samples and second target domain samples of a target domain; wherein the source domain is a song recommendation domain and the target domain is a playlist recommendation domain; based on knowledge distillation, the source domain samples are used to train a teacher model of the source domain, and the first target domain samples and the source domain samples are used to train a student model of the target domain; during knowledge distillation, the teacher model and the student model are bidirectionally learned to obtain a target student model; the model structure of the target student model is transferred to the target domain, and the target student model is trained again using the second target domain samples to obtain a final recommendation model. The embodiment of the present invention can ensure that the student model converges quickly in the target domain while ensuring a stable effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular to a recommendation model training method, device, equipment and storage medium. Background Art

[0002] In the prior art, in order to transfer knowledge from a large-scale sample domain (source domain) to a small number of samples (target domain), a neural network structure in the source domain is obtained through transfer learning training, and then the network structure is used in the target domain and trained again with a small number of samples to obtain a model suitable for the target domain. However, the model is trained and pruned using data from the source domain to obtain a more streamlined model. The purpose is to obtain a model with a simpler structure for easy online deployment, or to obtain a simpler model structure for rapid convergence of the model during transfer training.

[0003] However, when there is more data in the source domain, a more complex network needs to be trained to achieve better results. Since there are fewer samples in the target domain, it is difficult to converge when fine-tuning the complex network, and the optimal model state cannot be obtained. Although the source domain model can be pruned to compress the model, pruning is to stop pruning when a certain effect is guaranteed. The final pruned model may not achieve the ideal compression level. If a simple model is obtained by forced pruning, the model effect is difficult to guarantee.

[0004] In short, it is difficult to achieve a balance between network structure and effect through pruning and compressing the model to ensure that the model converges quickly with a small number of samples. In addition, the current solution is usually to train the model with source domain data to obtain the model structure, and then fine-tune the model with target samples. The model training process in the source domain and the target domain is relatively independent. If the source domain and the target domain are very different, the effect may be reduced after migration. This phenomenon is called "negative migration", or it is difficult to converge in the target domain. Summary of the invention

[0005] In view of the above problems, embodiments of the present invention are proposed to provide a recommendation model training method, apparatus, device and storage medium that overcome the above problems or at least partially solve the above problems.

[0006] According to one aspect of an embodiment of the present invention, a recommendation model training method is provided, comprising:

[0007] Determine a source domain sample in a source domain and a first target domain sample and a second target domain sample in a target domain; wherein the source domain and the target domain are adjacent domains; wherein the source domain is a song recommendation domain, and the target domain is a playlist recommendation domain;

[0008] Based on knowledge distillation, the source domain samples are used to train a teacher model in the source domain, and the first target domain samples and the prediction data of the teacher model are used to train a student model in the target domain;

[0009] During knowledge distillation, bidirectional learning of the teacher model and the student model is performed to obtain a target student model;

[0010] The model structure of the target student model is transferred to the target domain, and the target student model is trained again using the second target domain samples to obtain a final recommendation model.

[0011] This embodiment ensures the stability of the effect while enabling the student model to converge quickly in the target domain.

[0012] Furthermore, the bidirectional learning of the teacher model and the student model during knowledge distillation includes:

[0013] The loss function of the teacher model is determined according to the unnormalized probability Logits of the student model so that the difference between the loss function and the Logits is less than a preset threshold, thereby enabling the teacher model to learn the student model.

[0014] Furthermore, determining the loss function of the teacher model according to the unnormalized probability Logits of the student model includes:

[0015] The loss function of the teacher model is determined according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the Logits of the student model.

[0016] In this embodiment, the loss function of the teacher model is used to fit the Logits of the student model, so that the teacher model learns the new student model, which can improve the learning ability of the teacher model for the target field.

[0017] Furthermore, determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the Logits of the student model includes:

[0018] Using the formula L teacher =H(y,f'(x))+f(p)*λ1*||z s-z t || 2 Determine the loss function of the teacher model; wherein,

[0019] Among them, H is the cross entropy loss function, f′() is the mapping function of the teacher model, y is the source domain sample, and Z t is the Logits of the teacher model, z s is the Logits of the student model, λ1 is the adjustment coefficient, and p is the ratio of the total number of samples in the first target domain to the total number of samples in the source domain.

[0020] Since the number of samples in the target domain is small, while the number of samples in the source domain is large, and the student model is not fully trained at the beginning, if the teacher model learns the Logits of the student model every time, it will cause the problem of insufficient training of both the teacher model and the student model. In this embodiment, the teacher model adjusts the loss function with probability p to learn the student model, so that the teacher model can learn the student model without causing underfitting of the model.

[0021] Furthermore, determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the Logits of the student model includes:

[0022] Determining a sample weighting coefficient according to the source domain sample and the first target domain sample;

[0023] The loss function of the teacher model is determined according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain, the Logits of the student model and the sample weight coefficient.

[0024] This embodiment obtains a sample-weighted loss function by weighting samples that are similar to the source domain and the target domain, so that the teacher model can also learn the characteristics of the target domain.

[0025] Further, determining a sample weighting coefficient according to the source domain sample and the first target domain sample includes:

[0026] Using the formula ∑|s teacher -s target | 2 Determine sample weighting coefficients;

[0027] Among them, S teacheris the source domain sample, S target This is the sample of the first target area.

[0028] This embodiment obtains a sample-weighted loss function by weighting samples that are similar to the source domain and the target domain, so that the teacher model can also learn the characteristics of the target domain.

[0029] Furthermore, determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain, the Logits of the student model and the sample weight coefficient includes:

[0030] Using the formula L teacher-new =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 +λ2*∑|s teacher -s target | 2 Determining a loss function of the teacher model;

[0031] Among them, λ2 is the similarity between the source domain sample and the first target domain sample.

[0032] In this embodiment, the teacher model adjusts the loss function with probability p to learn the student model, so that the teacher model can learn the student model without underfitting the model. In addition, by weighting the samples that are similar to the source domain and the target domain, a sample-weighted loss function is obtained, which enables the teacher model to learn the characteristics of the target domain.

[0033] According to another aspect of an embodiment of the present invention, a recommendation model training device is provided, comprising:

[0034] A sample determination module, used to determine a source domain sample in a source domain and a first target domain sample and a second target domain sample in a target domain; wherein the source domain and the target domain are adjacent domains;

[0035] A knowledge distillation module, configured to obtain a teacher model of the source domain by training the source domain samples based on knowledge distillation, and obtain a student model of the target domain by training the first target domain samples and the prediction data of the teacher model;

[0036] A bidirectional learning module, used for performing bidirectional learning of the teacher model and the student model during knowledge distillation to obtain a target student model;

[0037] The model training module is used to migrate the model structure of the target student model to the target domain, and use the second target domain samples to train the target student model again to obtain a final recommendation model.

[0038] According to another aspect of an embodiment of the present invention, there is provided a computing device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0039] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned recommendation model training method.

[0040] According to another aspect of an embodiment of the present invention, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned recommendation model training method.

[0041] According to the solution provided by the above embodiment of the present invention, in order to perform partial transfer learning while performing knowledge distillation, some target domain samples are added to adjust the student model so that the student model can learn the knowledge of the target domain. The student model then guides the training of the teacher model to perform two-way learning. Finally, the obtained student model structure is migrated to the target domain, and the student model is trained again with another part of the target domain samples. While ensuring the stability of the effect, the student model can also converge quickly in the target domain.

[0042] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation method of the embodiment of the present invention is specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the embodiments of the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0044] Figure 1 A flowchart of a recommendation model training method provided in Embodiment 1 of the present invention is shown;

[0045] Figure 2A schematic diagram of the joint training network structure in the recommendation model training method provided in the first embodiment of the present invention is shown;

[0046] Figure 3 A flowchart of a recommendation model training method provided in Embodiment 2 of the present invention is shown;

[0047] Figure 4 A schematic diagram of the structure of a computing device provided in Embodiment 4 of the present invention is shown. DETAILED DESCRIPTION

[0048] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0049] Embodiment 1

[0050] Figure 1 FIG. 1 is a flowchart of a recommendation model training method provided in Embodiment 1 of the present invention. Figure 1 As shown, the method comprises the following steps:

[0051] Step S110, determining a source domain sample in a source domain and a first target domain sample and a second target domain sample in a target domain; wherein the source domain and the target domain are adjacent domains; wherein the source domain is a song recommendation domain, and the target domain is a playlist recommendation domain.

[0052] The source domain and the target domain are adjacent domains, i.e., similar domains. The source domain may be a domain with large-scale sample data, and the target domain is a domain with a small amount of sample data. The source domain may be a song recommendation domain, and the corresponding source domain samples are song behavior data (e.g., song listening behavior). The target domain may be a playlist recommendation domain, and the corresponding first target domain samples and second target domain samples are playlist behavior data (e.g., playlist listening behavior).

[0053] Due to the number of users who listen to songs from playlists, the number of corresponding song listening behaviors, i.e., the number of song behavior data samples, is relatively small. If the playlist recommendation model is established by directly performing deep learning on the playlist behavior data, the effect is not ideal. However, the number of users who directly listen to songs is large, and the number of corresponding song listening behaviors, i.e., the number of song behavior data samples, is much larger than the number of users who listen to songs from playlists. The song recommendation model established by them is also more effective. Therefore, the knowledge of song recommendation can be transferred to the playlist recommendation scenario.

[0054] In this embodiment, the samples of the target domain are divided into two parts, namely, the first target domain samples and the second target domain samples, wherein the first target domain samples are used to guide the learning of the student model, and the second target domain samples are used to guide the training of the student model.

[0055] Step S120: Based on knowledge distillation, the source domain samples are used for training to obtain a teacher model in the source domain, and the first target domain samples and the prediction data of the teacher model are used for training to obtain a student model in the target domain.

[0056] In this embodiment, the teacher model in the source domain is a recommendation model in the song recommendation domain, i.e., a song recommendation model, and the student model in the target domain is a recommendation model in the playlist recommendation domain, i.e., a playlist recommendation model. Based on knowledge distillation, this embodiment uses song behavior data to train a song recommendation model, i.e., a teacher model, and uses the playlist behavior data and the prediction data of the teacher model, i.e., the recommendation result based on the song behavior data to train a playlist recommendation model. In this embodiment, knowledge distillation is a common method for model compression. Model compression refers to distilling the feature representation "knowledge" learned by the teacher model, i.e., the song recommendation model, which has a large number of samples and strong learning ability, in the teacher-student model framework, and passing it to the student model, i.e., the playlist recommendation model, which has a small number of samples and weak learning ability. Distillation can provide soft label information that the student model cannot learn in the one-shot label. These include inter-category information, as well as feature representation "knowledge" that the student model cannot learn but the teacher model can learn, so it can generally improve the accuracy of the student model. The specific process of knowledge distillation is as follows:

[0057] First, a large model with good performance and good generalization, namely the teacher model, is trained. All song behavior data is used to calculate the prediction data of the teacher model, namely the recommendation results. The entire data set with these predictions is called knowledge, and the predictions themselves are usually called soft targets. The previously acquired knowledge is then used to train a network with a smaller amount of sample data, called the student model.

[0058] In the fine ranking stage in the recommendation field, knowledge distillation is used, mainly using the method of joint training of teacher model and student model. The purpose is to use a complex teacher model to guide the training of the student model with a small amount of sample data, push the student model online, and increase the response speed of the recommendation model.

[0059] like Figure 2As shown in the figure, joint training is to add a complex Teacher model to assist the Student model when training the Student model offline. The two are trained at the same time, which is a kind of guidance in the training process. From the perspective of network structure, the Teacher model and the Student model share the underlying feature Embedding layer. The Teacher model has a multilayer perceptron (MLP) hidden layer with deeper layers and more neurons, while the Student model is composed of MLP hidden layers with fewer layers and neurons. The MLP parameters of the two are private. For all training data, the Teacher model and the Student model will be trained at the same time. For the Teacher model, it is a regular training process, with cross entropy as the loss function of the Teacher. For the Student model, the loss function consists of two parts. One sub-item is the cross entropy, which is a conventional loss function that forces the Student network to fit the training data. The other sub-item forces the Logits output by the Student model to fit the Logits output by the Teacher model. The so-called distillation is reflected in this loss function sub-item. In this way, the Teacher model can enhance the generalization ability of the Student model.

[0060] This embodiment not only expects the model to be easy to quickly converge in the target domain after transfer learning, but also expects to perform a portion of transfer learning while compressing the model, so that the Student model compressed in the source domain can adapt to the target domain. Specifically, during knowledge distillation, the student model learns the loss of the teacher model, and the loss of the teacher model remains unchanged, which is the cross entropy loss. In order to perform partial transfer learning while knowledge distillation, some samples of the target domain, namely the first target domain samples, are added to adjust the student model so that the student model learns the knowledge of the target domain. Step S130, perform two-way learning of the teacher model and the student model during knowledge distillation to obtain the target student model.

[0061] In this embodiment, the teacher model, i.e., the song recommendation model, and the student model, i.e., the playlist recommendation model, perform bidirectional learning, i.e., the student model learns the loss of the teacher model, and the student model then guides the training of the teacher model with a certain probability. At the same time, in order to improve the learning ability of the teacher model for the target domain, the loss function of the teacher model can be used to fit the Logits of the student model, so that the teacher model can learn the new student model, so that the teacher model can learn the student model without underfitting the model.

[0062] Step S140: Migrate the model structure of the target student model to the target domain, and use the second target domain samples to train the target student model again to obtain the final recommendation model.

[0063] In this embodiment, the model structure of the obtained target student model is migrated to the target domain, namely the playlist recommendation domain, and the student model is trained again with the remaining target domain samples, namely the second target domain samples, to obtain the final playlist recommendation model.

[0064] In order to perform partial transfer learning while distilling knowledge, this embodiment adds some target domain samples, namely, playlist behavior data, to adjust the student model, so that the student model can learn the knowledge of the target domain, namely, the playlist recommendation domain. The student model then guides the training of the teacher model to perform two-way learning. Finally, the obtained student model structure is transferred to the target domain, and the student model is trained again with another part of the target domain samples. While ensuring the stability of the effect, the student model can also converge quickly in the target domain, thereby improving the recognition effect of the recommendation model.

[0065] In an optional embodiment, step S130 specifically includes: determining the loss function of the teacher model based on the unnormalized probability Logits of the student model, so that the difference between the loss function and the Logits is less than a preset threshold, thereby enabling the teacher model to learn the student model and obtain the target student model.

[0066] Among them, the preset threshold can be set to a smaller value so that the loss function of the teacher model is closer to the Logits of the student model.

[0067] In this embodiment, since the student model will be migrated to the target domain, in order to enhance the student model's learning ability for the target domain, some target domain samples are added to the student model's training process. At the same time, in order to improve the teacher model's learning ability for the target domain, the teacher model's loss function is used to fit the student model's Logits, so that the teacher model learns the new student model. Specifically, the teacher model's loss function can be determined based on the ratio of the total number of samples of the first target domain samples to the total number of samples of the source domain samples and the student model's Logits.

[0068] In an optional embodiment, the step of determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the Logits of the student model specifically includes:

[0069] The formula L can be used teacher =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 Determine the loss function of the teacher model; where,

[0070] Among them, H is the cross entropy loss function, f′() is the mapping function of the teacher model, y is the source domain sample, and Z t is the Logits of the teacher model, z s is the Logits of the student model, λ1 is the adjustment coefficient, and p is the ratio of the total number of samples in the first target domain to the total number of samples in the source domain.

[0071] Since the number of target domain samples used to train the distillation model is small, while the number of source domain samples is large, and the student model is not fully trained at the beginning, if the teacher model learns the Logits of the student model every time, it will cause the problem that both the teacher model and the student model are not fully trained. Therefore, in this embodiment, the teacher model probability p adjusts the loss function to learn the student model, so that the teacher model can learn the student model without causing the model to be underfitted.

[0072] In an optional embodiment, the step of determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the Logits of the student model specifically includes:

[0073] Step A: determining a sample weighting coefficient according to the source domain sample and the first target domain sample.

[0074] The formula ∑|s teacher -s target | 2 Calculate the sample weighting coefficient;

[0075] Among them, S teacher is the source domain sample, S target It is the first target area sample.

[0076] Step B: Determine the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain, the Logits of the student model and the sample weight coefficient.

[0077] In this embodiment, in order to enable the teacher model to learn the characteristics of the target domain, the samples in the source domain that are similar to the target domain are weighted to obtain a sample weighted loss function. For example, the formula L can be used. teacher-new =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 +λ2*∑|s teacher -s target | 2 Determine the loss function of the teacher model;

[0078] Among them, λ2 is the similarity between the source domain sample and the first target domain sample.

[0079] Embodiment 2

[0080] Figure 3 FIG. 2 shows a structural diagram of a recommendation model training device provided by Embodiment 2 of the present invention. Figure 3 As shown, the device includes: a sample determination module 21, a knowledge distillation module 22, a two-way learning module 23 and a model training module 24; wherein,

[0081] The sample determination module 21 is used to determine a source domain sample in a source domain and a first target domain sample and a second target domain sample in a target domain; wherein the source domain and the target domain are adjacent domains; wherein the source domain is a song recommendation domain, and the target domain is a playlist recommendation domain;

[0082] The knowledge distillation module 22 is used to train a teacher model of the source domain using the source domain samples based on knowledge distillation, and train a student model of the target domain using the first target domain samples and the prediction data of the teacher model;

[0083] The bidirectional learning module 23 is used to perform bidirectional learning of the teacher model and the student model during knowledge distillation to obtain a target student model;

[0084] The model training module 24 is used to transfer the model structure of the target student model to the target domain, and use the second target domain samples to train the target student model again to obtain a final recommendation model.

[0085] Furthermore, the bidirectional learning module 23 is specifically used to determine the loss function of the teacher model based on the unnormalized probability Logits of the student model, so that the difference between the loss function and the Logits is less than a preset threshold, thereby enabling the teacher model to learn the student model to obtain a better migration effect.

[0086] Furthermore, the two-way learning module 23 is specifically used to determine the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the Logits of the student model.

[0087] Furthermore, the two-way learning module 23 is specifically used to: adopt the formula L teacher =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 Determine the loss function of the teacher model; wherein,

[0088] Among them, H is the cross entropy loss function, f′(x) is the mapping function of the teacher model, y is the source domain sample, and Z t is the Logits of the teacher model, z s is the Logits of the student model, λ1 is the adjustment coefficient, and p is the ratio of the total number of samples in the first target domain to the total number of samples in the source domain.

[0089] Furthermore, the bidirectional learning module 23 is specifically used to: determine the sample weighting coefficient based on the source domain samples and the first target domain samples; determine the loss function of the teacher model based on the ratio of the total number of samples of the first target domain samples to the total number of samples of the source domain samples, the Logits of the student model and the sample weighting coefficient.

[0090] Furthermore, the two-way learning module 23 is specifically used to: adopt the formula ∑|s teacher -s target | 2 Determine the sample weighting coefficient; where S teacher is the source domain sample, S target This is the sample of the first target area.

[0091] Furthermore, the two-way learning module 23 is specifically used to: adopt the formula L teacher-new =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 +λ2*∑|s teacher -s target | 2 Determine the loss function of the teacher model; wherein λ2 is the similarity between the source domain sample and the first target domain sample.

[0092] The recommendation model training device described in the embodiment of the present invention is used to execute the recommendation model training method described in the above-mentioned embodiment 1. Its working principle and technical effect are similar and will not be repeated here.

[0093] Embodiment 3

[0094] Embodiment 3 of the present invention provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the recommendation model training method in any of the above method embodiments.

[0095] Embodiment 4

[0096] Figure 4 A schematic diagram of the structure of a computing device provided in Embodiment 5 of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the computing device.

[0097] like Figure 4 As shown, the computing device may include: a processor, a communications interface, a memory, and a communication bus.

[0098] Wherein: the processor, the communication interface, and the memory communicate with each other via a communication bus. The communication interface is used to communicate with other devices such as a client or other server network elements. The processor is used to execute a program, specifically, to execute the relevant steps in the above-mentioned recommendation model training method embodiment for a computing device.

[0099] Specifically, the program may include program codes including computer operation instructions.

[0100] The processor may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the computing device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0101] The memory is used to store programs. The memory may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0102] The program can be specifically used to enable the processor to execute the recommendation model training method in any of the above method embodiments. The specific implementation of each step in the program can refer to the corresponding descriptions in the corresponding steps and units in the above recommendation model training method embodiments, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above-mentioned method embodiments, which will not be repeated here.

[0103] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the embodiment of the present invention described herein, and the description of the above specific language is to disclose the best mode of the embodiment of the present invention.

[0104] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0105] Similarly, it should be understood that in order to streamline the embodiments of the present invention and to aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present invention, the various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: that the claimed embodiments of the present invention require more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the single embodiment disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present invention.

[0106] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0107] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0108] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components according to the embodiments of the present invention. The embodiments of the present invention may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing an embodiment of the present invention may be stored on a computer-readable medium, or may have the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0109] It should be noted that the above embodiments illustrate rather than limit the present invention, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim listing a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A recommendation model training method, characterized in that: include: Determine a source domain sample in a source domain and a first target domain sample and a second target domain sample in a target domain; wherein the source domain and the target domain are adjacent domains; wherein the source domain is a song recommendation domain, and the target domain is a playlist recommendation domain; Based on knowledge distillation, the source domain samples are used to train a teacher model in the source domain, and the first target domain samples and the prediction data of the teacher model are used to train a student model in the target domain; During knowledge distillation, bidirectional learning of the teacher model and the student model is performed to obtain a target student model; wherein the loss function of the teacher model is determined according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the unnormalized probability Logits of the student model, so that the difference between the loss function and the Logits is less than a preset threshold, so that the teacher model learns the student model; The model structure of the target student model is transferred to the target domain, and the target student model is trained again using the second target domain samples to obtain a final recommendation model.

2. The method according to claim 1, characterized in that The determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the unnormalized Logits of the student model includes: Using the formula L teacher =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 Determine the loss function of the teacher model; wherein, Where H is the cross entropy loss function, f′(x) is the mapping function of the teacher model, y is the source domain sample, and X t is the Logits of the teacher model, z s is the Logits of the student model, λ1 is the adjustment coefficient, and p is the ratio of the total number of samples in the first target domain to the total number of samples in the source domain.

3. The method according to claim 1, characterized in that The determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the unnormalized Logits of the student model includes: Determining a sample weighting coefficient according to the source domain sample and the first target domain sample; The loss function of the teacher model is determined according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain, the Logits of the student model and the sample weight coefficient.

4. The method according to claim 3, characterized in that The determining of the sample weighting coefficient according to the source domain sample and the first target domain sample comprises: Using the formula ∑|s teacher -s target | 2 Determine sample weighting coefficients; Among them, S teacher is the source domain sample, S target This is the sample of the first target area.

5. The method according to claim 4, characterized in that The determining the loss function of the teacher model according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain, the Logits of the student model and the sample weight coefficient includes: Using the formula L teacher-new =H(y,f'(x))+f(p)*λ1*||z s -z t || 2 +λ2*∑|s teacher -s target | 2 Determining a loss function of the teacher model; Among them, λ2 is the similarity between the source domain sample and the first target domain sample.

6. A recommendation model training device, characterized in that: include: A sample determination module, used to determine a source domain sample in a source domain and a first target domain sample and a second target domain sample in a target domain; wherein the source domain and the target domain are adjacent domains; wherein the source domain is a song recommendation domain, and the target domain is a playlist recommendation domain; A knowledge distillation module, configured to obtain a teacher model of the source domain by training the source domain samples based on knowledge distillation, and obtain a student model of the target domain by training the first target domain samples and the prediction data of the teacher model; A two-way learning module, used for performing two-way learning of the teacher model and the student model during knowledge distillation to obtain a target student model; wherein the loss function of the teacher model is determined according to the ratio of the total number of samples of the first target domain to the total number of samples of the source domain and the unnormalized probability Logits of the student model, so that the difference between the loss function and the Logits is less than a preset threshold, so that the teacher model learns the student model; The model training module is used to migrate the model structure of the target student model to the target domain, and use the second target domain samples to train the target student model again to obtain a final recommendation model.

7. A computing device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the recommendation model training method as described in any one of claims 1-5.

8. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the recommendation model training method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Recommendation model training method and device, electronic equipment and storage medium

    CN112541122A

  • Knowledge distillation vertical field detection method based on similarity maintenance

    CN113673254A