Training method, device and electronic equipment
By adopting a training method in the recommendation system, the rough arrangement model is guided and trained by the fine arrangement preference probability and target labels, the resource waste and performance impact caused by independent training of the rough arrangement model and fine arrangement model is solved, and the recommendation effect and the consistency of the recommended system are improved.
Patent Information
- Application Number
- CN202111069335.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-13
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2041-09-13
AI Technical Summary
In the existing recommendation system, independent training of rough and fine scheduling models leads to waste of resources and performance impacts. At the same time, due to different network structures, the gap in sorting results is large, resulting in poor recommendation results.
Through a training method, the first loss function of the fine placing model is determined using the fine placing preference probability and the target label, and the rough placing model is guided and trained based on the loss function to obtain the second loss function of the rough placing model, thereby outputting the target fine placing model and the target rough placing model. This method avoids the oscillation phenomenon of the rough-row model in the initial stage, and improves the accuracy of the prediction results of the recommendation system through the same network structure.
This method avoids resource waste and performance impact by jointly training the rough and fine placing model, and improves the recommendation effect of the recommendation system, reduces the gap in sorting results, and improves the recommendation accuracy of the items of interest to users.
Smart Images

Figure CN113869377B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a training method, device and electronic equipment. Background Art
[0002] Recommendation system refers to recommending items of interest to users based on information such as the user's historical behavior or the user's interest preferences. Currently, recommendation systems include four models: recall, coarse sorting, fine sorting, and re-ranking. Usually, the coarse sorting model and the fine sorting model are trained separately through different features and different network structures. In the prediction process, the electronic device first uses the coarse sorting model to predict and sort and truncate the sorting results to filter out the top ranked items, and then pass these items to the fine sorting model, which predicts and sorts these items again, so as to show the items of interest to the user.
[0003] However, on the one hand, since the coarse ranking model and the fine ranking model are trained separately, the problem of doubling the training resources during offline training occurs. On the other hand, since the coarse ranking model and the fine ranking model use different network structures, there is a large gap between the ranking results of the coarse ranking model and the fine ranking model, resulting in items that the fine ranking model originally believed that the user was interested in being filtered out in the coarse ranking stage. As a result, the recommendation effect predicted by the coarse and fine ranking models is poor. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a training method, device and electronic device that can solve the problem of poor recommendation effect predicted by a coarse-fine ranking model.
[0005] In order to solve the above technical problems, this application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a training method, which includes: determining a first loss function of a fine ranking model based on a fine ranking preference probability and a target label, wherein the fine ranking preference probability is used to indicate the user's preference for a recommended object output by the fine ranking model, and the target label is used to indicate the user's behavior towards the recommended object; based on the first loss function, training a coarse ranking model to obtain a second loss function of the coarse ranking model; based on the first loss function and the second loss function, outputting a target fine ranking model and a target coarse ranking model.
[0007] In the second aspect, an embodiment of the present application provides a training device, which includes: a determination module, a training module and an output module. Among them, the determination module is used to determine the first loss function of the fine ranking model according to the fine ranking preference probability and the target label, the fine ranking preference probability is used to indicate the user's preference for the recommended object output by the fine ranking model, and the target label is used to indicate the user's behavior towards the recommended object. The training module is used to train the coarse ranking model based on the first loss function determined by the determination module to obtain the second loss function of the coarse ranking model. The output module is used to output the target fine ranking model and the target coarse ranking model based on the first loss function determined by the determination module and the second loss function obtained by the training module.
[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0010] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0011] In an embodiment of the present application, in the process of training the fine ranking model and the coarse ranking model, the electronic device can first determine the first loss function of the fine ranking model according to the fine ranking preference probability and the target label, and then the electronic device can guide the coarse ranking model based on the first loss function to determine the second loss function of the coarse ranking model, thereby inputting the target fine ranking model and the target coarse ranking model based on the first loss function and the second loss function. In this scheme, on the one hand, since the coarse ranking model and the fine ranking model are trained together, the method of first convergence and then guidance is adopted to guide the training of the coarse ranking model through the fine ranking model, thereby avoiding the oscillation phenomenon of the coarse ranking model in the initial stage, affecting the iterative training and convergence of the coarse ranking model and the fine ranking model, and the problem of resource waste and performance impact during the online and offline training process due to the independent training of the coarse ranking model and the fine ranking model; on the other hand, the coarse ranking model and the fine ranking model use the same network structure during the training process, thereby avoiding the situation where the ranking results of the coarse ranking model and the fine ranking model are too different; in this way, the recommendation effect predicted by the electronic device through the coarse and fine ranking model is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1is a flow chart of a training method provided in an embodiment of the present application;
[0013] Figure 2 It is a model schematic diagram of a training method provided in an embodiment of the present application;
[0014] Figure 3 is a structural schematic diagram of a training device provided in an embodiment of the present application;
[0015] Figure 4 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;
[0016] Figure 5 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0018] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0019] The training method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0020] In the current data age of information overload, thousands of commodities enter the market every day. The recommendation system can select the most suitable items for users from these thousands of items and display them in the user's field of vision, thereby solving the problem of information overload. At present, the recommendation system includes four models: recall, rough sorting, fine sorting and re-ranking. The execution order of these four modules is like a funnel, constantly screening from a huge collection of items to select the items that the user is really interested in. Among them, the role of the rough sorting model is to filter the collection of items recalled by the recall model, and to ensure the performance of the fine sorting model while ensuring the prediction effect as much as possible. Usually, the rough sorting model and the fine sorting model are independent of each other, and are trained separately through different features and different network structures. In the process of prediction, the electronic device first uses the rough sorting model to predict and sort and truncate the sorting results, screen out the top ranked items, and then pass these items to the fine sorting model. The fine sorting model predicts and sorts these items again, so as to show the items that the user is interested in.
[0021] However, on the one hand, since the coarse ranking model and the fine ranking model are trained separately, the problem of doubling the training resources during offline training occurs. On the other hand, since the coarse ranking model and the fine ranking model use different network structures, there is a large gap between the ranking results of the coarse ranking model and the fine ranking model, resulting in items that the fine ranking model originally believed that the user was interested in being filtered out in the coarse ranking stage. As a result, the recommendation effect predicted by the coarse and fine ranking models is poor.
[0022] In the traditional scheme, electronic devices can use the knowledge distillation method to train the coarse-rank model and the fine-rank model together, but the following defects still exist: 1) Since the input features of the coarse-rank model and the fine-rank model are different, different input features need to be constructed for the coarse-rank model and the fine-rank model during the prediction process, which has a certain impact on the online performance; 2) In the initial stage of training the fine-rank model, the fine-rank model is in an unconverged state. If the coarse-rank model is guided to be trained in this state, it is easy to cause the coarse-rank model to oscillate, making it impossible for the coarse-rank model to be well trained. In addition, since the coarse-rank model and the fine-rank model share the underlying network, when the coarse-rank model cannot be well trained, it will also have a certain impact on the training of the fine-rank model, thus entering a vicious circle.
[0023] In an embodiment of the present application, in the preparation stage of iterative training of the fine ranking model and the coarse ranking model, the electronic device can obtain N preset sample features and labels of the N preset sample features (i.e., the target labels in the following embodiments), and set a first marking bit and a second marking bit for each sample feature, respectively, to construct an occlusion layer of the coarse ranking model and an occlusion layer of the fine ranking model. The electronic device constructs an embedding layer of the coarse ranking model (represented by a target coarse ranking vector) according to the occlusion layer of the coarse ranking model, and constructs an embedding layer of the fine ranking model (represented by a target fine ranking vector) according to the occlusion layer of the fine ranking model. Afterwards, the electronic device can input the target coarse ranking vector into a preset network structure to obtain a coarse ranking preference probability, and input the target fine ranking vector into a preset network structure to obtain a fine ranking preference probability. In the process of iterative training of the fine ranking model and the coarse ranking model, the electronic device can determine the first loss function of the fine ranking model based on the fine ranking preference probability and the labels of N preset sample features. When the difference between the first loss function of the fine ranking model and the loss function obtained by the last iterative training of the fine ranking model (i.e., the third loss function in the following embodiment) is less than the stability threshold of the fine ranking model, it indicates that the fine ranking model has converged. Then, the electronic device can determine the second loss function of the coarse ranking model based on the coarse ranking preference probability and the fine ranking preference probability. Then, the electronic device can perform weighted summation processing on the first loss function of the fine ranking model and the second loss function of the coarse ranking model. , and obtain the final loss function (i.e., the target loss function in the following embodiments). During the process of the electronic device iterating the fine sorting model and the coarse sorting model for multiple times in a row, if the final loss function does not decrease (indicating that the fine sorting model and the coarse sorting model have converged to a certain degree), the iterative training of the fine sorting model and the coarse sorting model is stopped, and the fine sorting model and the coarse sorting model after the last iterative training are output; if the final loss function decreases at the Kth iteration, the back propagation algorithm is used to update the fine sorting preference probability, and the fine sorting model and the coarse sorting model are iteratively trained again based on the updated fine sorting preference probability to output the target fine sorting model and the target coarse sorting model.
[0024] Through this program:
[0025] 1) Since the coarse-ranking model and the fine-ranking model are trained together, the problem of resource waste and performance impact during online and offline training caused by independent training of the coarse-ranking model and the fine-ranking model is avoided.
[0026] 2) Since both the coarse ranking model and the fine ranking model use the same network structure, the coarse ranking preference probability and the fine ranking preference probability are obtained respectively, which avoids the situation where the ranking results of the coarse ranking model and the fine ranking model are too different, and improves the accuracy of the prediction results of the recommendation system.
[0027] 3) Since both the coarse-ranking model and the fine-ranking model use N preset sample features as input features, that is, a unified input feature, some features are masked in the coarse-ranking model and the fine-ranking model respectively, which avoids the problem of repeated encoding online and improves the service performance of online training.
[0028] 4) Since the method of first convergence and then guidance is adopted for the refined network, that is, the refined model is trained first, and when the refined model converges to a certain degree, the coarse model is guided for training, thereby avoiding the oscillation phenomenon of the coarse model in the initial stage, affecting the iterative training and convergence of the coarse and refined models.
[0029] The present application embodiment provides a training method. Figure 1 FIG. 1 is a flow chart of a training method provided by an embodiment of the present application, which can be applied to electronic devices. Figure 1 As shown, the training method provided in the embodiment of the present application may include the following steps 201 to 203.
[0030] Step 201: The electronic device determines a first loss function of a refined ranking model according to the refined ranking preference probability and the target label.
[0031] In the embodiment of the present application, the above-mentioned refined ranking preference probability is used to indicate the user's preference degree for the recommended object output by the refined ranking model, and the above-mentioned target label is used to indicate the user's behavior towards the recommended object.
[0032] In an embodiment of the present application, during the process of training the fine ranking model and the coarse ranking model, the electronic device can first determine the first loss function of the fine ranking model based on the fine ranking preference probability and the target label. Then, the electronic device can guide the training of the coarse ranking model based on the first loss function to determine the second loss function of the coarse ranking model, thereby inputting the target fine ranking model and the target coarse ranking model based on the first loss function and the second loss function.
[0033] Optionally, in an embodiment of the present application, the electronic device can use a first preset algorithm (such as a cross entropy loss function) to calculate a first loss function loss_detail(t) of the refined ranking model based on the refined ranking preference probability p_detail_rank(u, i) and the target label label. The first loss function loss_detail(t) is the loss function value output by the refined ranking model during the tth iterative training.
[0034] Optionally, in the embodiment of the present application, if the detailed ranking preference probability p_detail_rank(u,i) is larger, it means that the user u has a higher preference for material (ie, the recommended object) i, that is, material i should be recommended to user u.
[0035] Optionally, in the embodiment of the present application, the target label is a label of N preset sample features, and the N preset sample features correspond to one target label. It should be noted that the description of the N preset sample features will be specifically described in the following embodiment and will not be repeated here.
[0036] Optionally, in an embodiment of the present application, the target tag can be used to indicate the user's click behavior on the recommended object. When the user clicks on a recommended object (e.g., a certain type of article), the electronic device can set the target tag to 1; when the user does not click on the recommended object, the electronic device can set the target tag to 0.
[0037] Optionally, in an embodiment of the present application, before the above step 201, the training method provided in the embodiment of the present application further includes the following step 301.
[0038] Step 301: The electronic device determines a refined ranking preference probability according to N first marking bits of N preset sample features.
[0039] In the embodiment of the present application, each preset sample feature corresponds to a first flag bit, and each first flag bit is used to indicate whether the refined ranking model is allowed to use a preset sample feature.
[0040] Optionally, in the embodiment of the present application, the above-mentioned N preset sample features may include user-side features, recommended object-side features and cross-side features. Among them, the user-side features represent the user's portrait, such as the user's related behavior; the recommended object-side features represent the classification information of the recommended object, etc.; the cross-side features represent the features that have both the user portrait and the recommended object classification information.
[0041] Optionally, in an embodiment of the present application, the electronic device may pre-mark each sample feature of the N preset sample features using the first marking bit is_detail to allow the refined ranking model to use the sample feature, or not to allow the refined ranking model to use the sample feature.
[0042] Optionally, in an embodiment of the present application, the above-mentioned first mark bit can be 1 or 0. When the first mark bit corresponding to a preset sample feature is 1, it indicates that the electronic device allows the refined ranking model to use the preset sample feature; when the first mark bit corresponding to a preset sample feature is 0, it indicates that the electronic device does not allow the refined ranking model to use the preset sample feature.
[0043] In an embodiment of the present application, in the preparation stage for training the refined ranking model, the electronic device may set a first mark bit for each of N preset sample features to indicate whether the refined ranking model is allowed to use a preset sample feature, thereby determining the refined ranking preference probability based on the first mark bits of these preset sample features, and training the refined ranking model based on the refined ranking preference probability and the target label, thereby ensuring the convergence of the refined ranking model and thus ensuring the stability of the subsequent guided training of the rough ranking model.
[0044] Optionally, in the embodiment of the present application, the above step 301 can be specifically implemented by the following steps 301a and 301b.
[0045] Step 301a: The electronic device determines a first vector according to the N first marker bits, and determines a target refined sorting vector based on the first vector and N preset sample features.
[0046] Optionally, in an embodiment of the present application, the electronic device may use a first marking bit to respectively mark each sample feature of N preset sample features to construct an occlusion layer of the refined ranking model, and the occlusion layer is represented by a vector (i.e., the first vector) vec_detail_marking, and the length of the vector is consistent with the number of sample features allowed to be used by the refined ranking model.
[0047] Exemplarily, if N is 6, and the first marking bits of the six preset sample features are 1, 0, 1, 1 and 0 respectively, then the first vector vec_detail_marking=(1, 0, 1, 1, 0), and the length of the first vector is 3.
[0048] Optionally, in an embodiment of the present application, the electronic device may perform dot product processing on the first vector and N preset sample features respectively. Since the first marker bit corresponding to the sample features that are not allowed to be used by the refined ranking model is zero, the sample features that are not allowed to be used by the refined ranking model are always zero, that is, these sample features do not participate in the training process of the refined ranking model, thereby playing a shielding role.
[0049] Optionally, in an embodiment of the present application, the electronic device may construct an embedding layer of the refined ranking module based on the first vector and N preset sample features, and the embedding layer is represented by a vector (i.e., the target refined ranking vector) vec_detail_embedding, which is an abstract representation of the N preset sample features for the entire refined ranking model, and the vector contains relevant information of the sample features required by the refined ranking model, such as classification information of the recommended object.
[0050] Step 301b: The electronic device determines the refined ranking preference probability based on the preset model and the target refined ranking vector.
[0051] Optionally, in an embodiment of the present application, the electronic device may use the target refined ranking vector vec_detail_embedding as an input of a preset model (eg, an artificial neural network model) to output a refined ranking preference probability through the preset model, and the preset model may be designed according to requirements of the refined ranking model.
[0052] In an embodiment of the present application, the electronic device can set a first marking position for each sample feature to construct an occlusion layer of the refined ranking model, and then construct an embedding layer of the refined ranking model based on the occlusion layer of the refined ranking model. The use of an independent embedding method can enable the refined ranking model to learn its own abstract representation, thereby ensuring the stability of the refined ranking model training. Finally, by inputting the target refined ranking vector of the embedding layer into the preset model to obtain the refined ranking preference probability, the refined ranking model is trained according to the refined ranking preference probability and the target label, thereby ensuring the convergence of the refined ranking model and thus ensuring the stability of the subsequent guided training of the coarse ranking model.
[0053] Optionally, in an embodiment of the present application, before the above step 301, the coarse-fine sorting model training method provided in the embodiment of the present application further includes the following steps 401 and 402.
[0054] Step 401: When the refined ranking model is not allowed to use the first sample feature among N preset sample features, the electronic device sets the first flag bit corresponding to the first sample feature to the first bit bit.
[0055] Optionally, in an embodiment of the present application, the first bit may be 0.
[0056] It can be understood that the electronic device does not allow the refined ranking model to use the first sample feature among the N preset sample features, which means that the first sample feature cannot participate in the training process of the refined ranking model.
[0057] Step 402: When the refined ranking model is allowed to use the first sample feature among the N preset sample features, the electronic device sets the first flag bit corresponding to the first sample feature to the second bit.
[0058] Optionally, in an embodiment of the present application, the second bit may be 1.
[0059] It can be understood that the electronic device allows the refined ranking model to use the first sample feature among the N preset sample features, which means that the first sample feature can participate in the training process of the refined ranking model.
[0060] It should be noted that, for the method of setting the first mark bit for the electronic device, specific reference may be made to the relevant description in the above embodiment, which will not be repeated here.
[0061] Optionally, in an embodiment of the present application, before setting the first mark bit for each sample feature of N preset sample features, the electronic device may initialize configuration parameters, for example, setting the number of iterations t=0, the stability threshold α of the fine sorting model=0.01, the coarse sorting loss weight δ=0.5, and the initial loss function value loss_detail(0)=99999 of the fine sorting model, indicating that the initial loss function value of the fine sorting model is positive infinity and the threshold a=5 for the number of iterations at which the final loss function does not continuously decrease.
[0062] In an embodiment of the present application, the electronic device can set a first marking position for each sample feature to construct an occlusion layer of the refined ranking model, that is, allowing a part of the sample features to participate in the training process of the refined ranking model, while not allowing another part of the sample features to participate in the training process of the refined ranking model. Since the other part of the sample features cannot participate in the training process of the refined ranking model, an occlusion effect is played.
[0063] Step 202: The electronic device trains the coarse-grained model based on the first loss function to obtain a second loss function of the coarse-grained model.
[0064] Optionally, in the embodiment of the present application, the above step 201 can be implemented by the following step 201a. And the above step 202 can be implemented by the following step 202a and step 202b.
[0065] Step 201a: The electronic device performs M iterative training on the refined ranking model according to the refined ranking preference probability and the target label to obtain a first loss function.
[0066] In the embodiment of the present application, M is a positive integer.
[0067] Optionally, in an embodiment of the present application, the above-mentioned first loss function is the first loss function obtained by iteratively training the refined ranking model this time.
[0068] Optionally, in an embodiment of the present application, the electronic device can obtain an initial fine ranking preference probability through a preset model, and perform a first iterative training on the fine ranking model according to the initial fine ranking preference probability and the target label to obtain a first loss function; after the first iterative training, the electronic device can obtain an updated fine ranking preference probability by updating the parameters in the preset model, and perform a second iterative training on the fine ranking model according to the updated fine ranking preference probability and the target label to obtain a first loss function, ... In this way, a first loss function can be obtained each time the fine ranking model is iteratively trained.
[0069] Step 202a: The electronic device determines a target difference according to the first loss function and the third loss function.
[0070] In the embodiment of the present application, the third loss function is the loss function obtained by performing the M-1th iteration on the refined ranking model.
[0071] Optionally, in an embodiment of the present application, during the first iterative training of the refined ranking model, the electronic device may determine the target difference based on the first loss function and the initial loss function obtained by the first iteration of the refined ranking model; during the second iterative training of the refined ranking model, the electronic device may determine the target difference based on the first loss function obtained by the second iteration of the refined ranking model and the loss function (i.e., the third loss function) obtained by the first iteration of the refined ranking model;…
[0072] Optionally, in the embodiment of the present application, the initial loss function loss_detail(0)=99999, indicating that the initial loss function of the refined ranking model is positive infinity. The specific value can be determined according to actual use requirements, and the embodiment of the present application does not limit it.
[0073] It can be understood that the electronic device can determine the target difference based on the loss function loss_detail(t) obtained by iteratively training the refined ranking model this time and the loss function loss_detail(t-1) obtained by iteratively training the refined ranking model last time.
[0074] Step 202b: When the target difference is less than or equal to the stability threshold of the fine ranking model, the electronic device iteratively trains the coarse ranking model according to the fine ranking preference probability and the coarse ranking preference probability to obtain a second loss function.
[0075] In the embodiment of the present application, the above-mentioned coarse-ranking preference probability is used to indicate the user's preference degree for the recommended object output by the coarse-ranking model.
[0076] Optionally, in an embodiment of the present application, the electronic device may calculate a second loss function loss_rough(t) of the rough ranking model based on the fine ranking preference probability p_detail_rank(u,i) and the rough ranking preference probability p_rough_rank(u,i) by using a second preset algorithm (e.g., a mean square error algorithm), where the second loss function loss_rough(t) represents the loss function value output by the rough ranking model during the tth iterative training.
[0077] Optionally, in the embodiment of the present application, the stability threshold of the refined sorting model may be 0.01, which may be determined according to actual use requirements and is not limited in the embodiment of the present application.
[0078] Optionally, in an embodiment of the present application, when the target difference is greater than a stability threshold of the fine ranking model, the second loss function is determined to be zero, and the coarse ranking loss weight is set to zero.
[0079] It should be noted that if the target difference is less than or equal to the stability threshold of the fine ranking model, it means that the fine ranking model has converged to a certain extent and can guide the training of the coarse ranking model. If the target difference is greater than the stability threshold of the fine ranking model, it means that the fine ranking model needs to converge further and the coarse ranking model is not considered for the time being.
[0080] Optionally, in an embodiment of the present application, after determining the first loss function and the second loss function, the electronic device can determine the loss weight value of the fine sorting model and the loss weight value of the fine sorting model based on the first loss function and the second loss function, so that the fine sorting model and the coarse sorting model can converge more efficiently.
[0081] Optionally, in an embodiment of the present application, the electronic device may add the target fine ranking vector (embedding layer of the fine ranking model) and the target coarse ranking vector (embedding layer of the coarse ranking model) to the first loss function and the second loss function, respectively, so as to ensure that the target coarse ranking vector learned by the coarse ranking model and the target fine ranking vector learned by the fine ranking model can remain consistent and independent of each other.
[0082] In the embodiments of the present application, the method of first convergence and then guidance is adopted for the refined network, that is, the refined model is first trained, and when the refined model converges to a certain degree, the coarse model is guided for training, so as to avoid the oscillation phenomenon of the coarse model in the initial stage, which affects the iterative training and convergence of the coarse and refined models, thereby ensuring the stability of the training of the refined and coarse models.
[0083] Optionally, in the embodiment of the present application, before the above step 202b, the coarse and fine sorting method provided in the embodiment of the present application further includes the following step 501.
[0084] Step 501: The electronic device determines a rough preference probability according to N second marking bits of N preset sample features.
[0085] In the embodiment of the present application, each preset sample feature corresponds to a second flag bit, and each second flag bit is used to indicate whether the coarse-grained model is allowed to use a preset sample feature.
[0086] Optionally, in an embodiment of the present application, the electronic device may pre-mark each sample feature of the N preset sample features using the second flag bit is_rough to allow the rough sorting model to use the sample feature, or not to allow the rough sorting model to use the sample feature.
[0087] Optionally, in an embodiment of the present application, when the coarse-cooked model is not allowed to use the second sample feature among N preset sample features, the electronic device sets the second mark bit corresponding to the second sample feature to the first bit; when the coarse-cooked model is allowed to use the second sample feature, the electronic device sets the second mark bit corresponding to the second sample feature to the second bit.
[0088] Optionally, in an embodiment of the present application, the first bit may be 0, and the second bit may be 1.
[0089] It can be understood that the electronic device does not allow the coarse-grained model to use the second sample feature among the N preset sample features, indicating that the second sample feature cannot participate in the training process of the coarse-grained model. The electronic device allows the coarse-grained model to use the second sample feature among the N preset sample features, indicating that the second sample feature can participate in the training process of the coarse-grained model.
[0090] Optionally, in an embodiment of the present application, the electronic device may determine a second vector based on N second marker bits, and determine a target coarse sorting vector based on the second vector and N preset sample features; then, determine a coarse sorting preference probability based on a preset model and the target coarse sorting vector.
[0091] Optionally, in an embodiment of the present application, the electronic device can construct an embedding layer of the rough sorting module based on the second vector and N preset sample features. The embedding layer is represented by a vector (i.e., the target rough sorting vector) vec_rough_embedding, which is an abstract representation of the N preset sample features for the entire rough sorting model. The vector contains relevant information of the sample features required by the rough sorting model.
[0092] It can be understood that when abstractly representing sample features, by constructing independent embedding layers, the coarse-grained model and the fine-grained model can learn their own abstract representations separately, so that the two will not affect each other.
[0093] It should be noted that, for the method in which the electronic device determines the coarse sorting preference probability according to the N second marking bits, specific reference may be made to the method in which the electronic device determines the fine sorting preference probability according to the N first marking bits in the above embodiment, which will not be described in detail here.
[0094] In an embodiment of the present application, in the preparation stage for training the coarse-cluster model, the electronic device may set a second mark bit for each of the N preset sample features to indicate whether the coarse-cluster model is allowed to use a preset sample feature. In this way, the coarse-cluster preference probability is determined based on the second mark bits of these preset sample features. When the fine-cluster model has converged, the coarse-cluster model is iteratively trained based on the fine-cluster preference probability and the coarse-cluster preference probability to obtain the loss function of the coarse-cluster model, thereby avoiding the oscillation phenomenon of the coarse-cluster model in the initial stage, which affects the iterative training and convergence of the coarse-cluster model and the fine-cluster model, thereby ensuring the stability of the guided training of the coarse-cluster model.
[0095] Step 203: The electronic device outputs a target fine ranking model and a target coarse ranking model based on the first loss function and the second loss function.
[0096] Optionally, in the embodiment of the present application, the above step 203 can be specifically implemented by the following steps 203a to 203c.
[0097] Step 203a: The electronic device performs weighted sum processing on the first loss function and the second loss function to obtain a target loss function.
[0098] Optionally, in the embodiment of the present application, the electronic device may use a third preset algorithm to perform weighted sum processing on the coarse sorting loss function and the fine sorting loss function to obtain a final loss function loss_final(t) (i.e., the target loss function), and the third preset algorithm is:
[0099] loss_final(t)=δ*loss_rough(t)+(1-δ)*loss_detail(t)
[0100] Among them, δ is the coarse-sequence loss weight, which indicates the importance of the final loss given to the coarse-sequence loss.
[0101] Optionally, in the embodiment of the present application, δ may be 0.5, which may be determined according to actual use requirements and is not limited in the embodiment of the present application.
[0102] Optionally, in an embodiment of the present application, when the fine ranking model has converged, the electronic device can perform weighted summation processing on the first loss function and the second loss function (i.e., the loss function of the coarse ranking model obtained according to the fine ranking preference probability and the coarse ranking preference probability) to obtain a target loss function; when the fine ranking model has not converged, the electronic device temporarily does not consider the coarse ranking model, sets the weights of the second loss function and the coarse ranking loss to zero, and then performs weighted summation processing on the first loss function and the second loss function to obtain the target loss function, at which time the target loss function is the first loss function.
[0103] Optionally, in an embodiment of the present application, the above-mentioned target loss function is a loss function obtained by iteratively training the fine ranking model and the coarse ranking model.
[0104] Optionally, in the embodiment of the present application, after obtaining the target loss function of this iterative training, the electronic device needs to iteratively train the fine ranking model and the coarse ranking model again. It can be understood that the electronic device needs to iteratively train the fine ranking model and the coarse ranking model multiple times to obtain multiple target loss functions, so as to determine whether to output the target fine ranking model and the target coarse ranking model according to these target loss functions.
[0105] Step 203b: If the target loss function does not decrease during the multiple iterations of the fine ranking model and the coarse ranking model, the electronic device stops iterative training of the fine ranking model and the coarse ranking model, and outputs the fine ranking model and the coarse ranking model after the last iterative training.
[0106] In the embodiment of the present application, the fine ranking model and the coarse ranking model after the last iterative training are the target fine ranking model and the target coarse ranking model.
[0107] Optionally, in an embodiment of the present application, during the process of iterating the fine ranking model and the coarse ranking model for a consecutive times, if the target loss function loss_final(t) does not decrease, it means that the coarse ranking model and the fine ranking model have converged to a certain extent, and the iterative training of the fine ranking model and the coarse ranking model is stopped, and the fine ranking model and the coarse ranking model after the last iterative training are output.
[0108] Optionally, in the embodiment of the present application, a is a threshold value of the number of iterations of the target loss function that does not continuously decrease, and a may be 5. The specific value may be determined according to actual use requirements, and the embodiment of the present application does not limit this.
[0109] Step 203c, when the electronic device iterates the fine ranking model and the coarse ranking model for multiple times in a row, if the target loss function decreases at the Kth iteration, the back propagation algorithm is used to update the fine ranking preference probability, and the fine ranking model and the coarse ranking model are iteratively trained again based on the updated fine ranking preference probability to output the target fine ranking model and the target coarse ranking model.
[0110] In the embodiment of the present application, K is a positive integer.
[0111] Optionally, in an embodiment of the present application, during the process of iterating the fine ranking model and the coarse ranking model for a consecutive times, if the target loss function loss_final(t) decreases at the Kth iteration, the back propagation algorithm is used to update the parameters of each layer, and then the fine ranking model and the coarse ranking model are iteratively trained again.
[0112] Optionally, in an embodiment of the present application, the electronic device can update the preset parameters in the preset model to update the fine ranking preference probability and the coarse ranking preference probability, and then train the fine ranking model based on the updated fine ranking preference probability, and train the coarse ranking model based on the updated fine ranking preference probability and the updated coarse ranking preference probability.
[0113] In an embodiment of the present application, the electronic device can obtain a target loss function based on the first loss function of the fine ranking model and the second loss function of the fine ranking model, so as to determine whether the target fine ranking model and the target coarse ranking model can be output according to the target initial function. In this way, in the process of continuous multiple iterations of the fine ranking model and the coarse ranking model, if the target loss function does not decrease (that is, the target coarse ranking model and the target fine ranking model have converged to a certain degree), then the target fine ranking model and the target coarse ranking model are output, thereby ensuring the stability and training efficiency of the coarse ranking model and the fine ranking model.
[0114] The embodiment of the present application provides a training method. In the process of training the fine ranking model and the coarse ranking model, the electronic device can first determine the first loss function of the fine ranking model according to the fine ranking preference probability and the target label. Then, the electronic device can guide the coarse ranking model based on the first loss function to determine the second loss function of the coarse ranking model, and then input the target fine ranking model and the target coarse ranking model based on the first loss function and the second loss function. In this scheme, on the one hand, since the coarse ranking model and the fine ranking model are trained together, the method of first convergence and then guidance is adopted to guide the training of the coarse ranking model through the fine ranking model, which avoids the oscillation phenomenon of the coarse ranking model in the initial stage, affecting the iterative training and convergence of the coarse ranking model and the fine ranking model, and the problem of resource waste and performance impact during the online and offline training process due to the independent training of the coarse ranking model and the fine ranking model; on the other hand, the coarse ranking model and the fine ranking model use the same network structure during the training process, which avoids the situation where the ranking results of the coarse ranking model and the fine ranking model are too different; in this way, the recommendation effect predicted by the electronic device through the coarse and fine ranking model is improved.
[0115] Combine the following Figure 2 , the specific process of the coarse and fine training method provided in the embodiment of the present application is described:
[0116] 1) The electronic device obtains N preset sample features and labels label of the N preset sample features, where the N preset sample features may include user-side features, recommended object-side features, and cross-side features.
[0117] 2) The electronic device constructs an occlusion layer of a coarse arrangement model and an occlusion layer of a fine arrangement model respectively according to N preset sample features.
[0118] 3) The electronic device constructs an embedding layer of the coarse arrangement model according to the occlusion layer of the coarse arrangement model, and constructs an embedding layer of the fine arrangement model according to the occlusion layer of the fine arrangement model; wherein the embedding layer of the coarse arrangement model is represented by a target coarse arrangement vector, and the embedding layer of the fine arrangement model is represented by a target fine arrangement vector.
[0119] 4) The electronic device inputs the target coarse sorting vector into the coarse sorting network structure to obtain the coarse sorting preference probability, and inputs the target fine sorting vector into the fine sorting network structure to obtain the fine sorting preference probability, wherein the coarse sorting network structure and the fine sorting network structure are the same network structure.
[0120] 5) The electronic device may determine the loss function of the coarse sorting model according to the coarse sorting preference probability and the fine sorting preference probability; and the electronic device may determine the loss function of the fine sorting model according to the fine sorting preference probability and the labels label of the N preset sample features.
[0121] 6) The electronic device can determine the final loss function based on the loss function of the coarse sorting model and the loss function of the fine sorting model, and output the target coarse sorting model and the target fine sorting model based on the final loss function.
[0122] It should be noted that the training method provided in the embodiment of the present application can be executed by a training device or a control module in the training device for executing the training method. In the embodiment of the present application, the training device provided in the embodiment of the present application is described by taking the training method executed by the training device as an example.
[0123] Figure 3 A possible structural diagram of the training device involved in the embodiment of the present application is shown. Figure 3 As shown, the training device 70 may include: a determination module 71 , a training module 72 and an output module 73 .
[0124] Among them, the determination module 71 is used to determine the first loss function of the fine ranking model according to the fine ranking preference probability and the target label, the fine ranking preference probability is used to indicate the user's preference for the recommended object output by the fine ranking model, and the target label is used to indicate the user's behavior towards the recommended object. The training module 72 is used to train the coarse ranking model based on the first loss function determined by the determination module 71 to obtain the second loss function of the coarse ranking model. The output module 73 is used to output the target fine ranking model and the target coarse ranking model based on the first loss function determined by the determination module 71 and the second loss function obtained by the training module 72.
[0125] The embodiment of the present application provides a training device. On the one hand, since the coarse ranking model and the fine ranking model are trained together, the method of first convergence and then guidance is adopted to guide the training of the coarse ranking model through the fine ranking model, thereby avoiding the oscillation phenomenon of the coarse ranking model in the initial stage, affecting the iterative training and convergence of the coarse ranking model and the fine ranking model, and the problem of resource waste and performance impact during online and offline training due to the independent training of the coarse ranking model and the fine ranking model; on the other hand, the coarse ranking model and the fine ranking model use the same network structure during the training process, thereby avoiding the situation where the ranking results of the coarse ranking model and the fine ranking model are too different; in this way, the recommendation effect predicted by the coarse and fine ranking models is improved.
[0126] In a possible implementation, the above-mentioned determination module 71 is also used to determine the refined ranking preference probability according to N first marking bits of N preset sample features before determining the first loss function of the refined ranking model according to the refined ranking preference probability and the target label, each preset sample feature corresponds to a first marking bit, and each first marking bit is used to indicate whether the refined ranking model is allowed to use a preset sample feature.
[0127] In a possible implementation, the above-mentioned determination module 71 is specifically used to determine the first vector according to N first marker bits, and determine the target refined ranking vector based on the first vector and N preset sample features; and determine the refined ranking preference probability based on the preset model and the target refined ranking vector.
[0128] In a possible implementation, the training device further includes: a setting module. The setting module is used to set the first mark bit corresponding to the first sample feature to the first bit position when the fine ranking model is not allowed to use the first sample feature among the N preset sample features before the determination module 71 determines the fine ranking preference probability according to the N first mark bits of the N preset sample features; and to set the first mark bit corresponding to the first sample feature to the second bit position when the fine ranking model is allowed to use the first sample feature among the N preset sample features.
[0129] In a possible implementation, the determination module 71 is specifically used to perform M iterations of training on the refined ranking model according to the refined ranking preference probability and the target label to obtain a first loss function, where M is a positive integer. The training module 72 is specifically used to determine the target difference according to the first loss function and the third loss function, where the third loss function is the loss function obtained by performing the M-1th iteration on the refined ranking model; and when the target difference is less than or equal to the stable threshold of the refined ranking model, the coarse ranking model is iteratively trained according to the refined ranking preference probability and the coarse ranking preference probability to obtain a second loss function, where the coarse ranking preference probability is used to indicate the user's preference for the recommended object output by the coarse ranking model.
[0130] In a possible implementation, the above-mentioned determination module 71 is also used to iteratively train the coarse sorting model according to the fine sorting preference probability and the coarse sorting preference probability before the training module 72 obtains the second loss function, and determines the coarse sorting preference probability according to N second mark bits of N preset sample features, each preset sample feature corresponds to a second mark bit, and each second mark bit is used to indicate whether the coarse sorting model is allowed to use a preset sample feature.
[0131] In one possible implementation, the output module 73 is specifically used to perform weighted summation processing on the first loss function and the second loss function to obtain a target loss function; in the process of multiple consecutive iterations of the fine ranking model and the coarse ranking model, if the target loss function does not decrease, the iterative training of the fine ranking model and the coarse ranking model is stopped, and the fine ranking model and the coarse ranking model after the last iterative training are output; if the target loss function decreases at the Kth iteration, the back propagation algorithm is used to update the fine ranking preference probability, and the fine ranking model and the coarse ranking model are iteratively trained again based on the updated fine ranking preference probability to output the target fine ranking model and the target coarse ranking model, where K is a positive integer.
[0132] The training device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in an electronic device. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0133] The training device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0134] The training device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0135] Alternatively, if Figure 4As shown, an embodiment of the present application also provides an electronic device 800, including a processor 801, a memory 802, and a program or instruction stored in the memory 802 and executable on the processor 801. When the program or instruction is executed by the processor 801, each process of the above-mentioned training method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0136] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0137] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0138] The electronic device 1000 includes but is not limited to: a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010 and other components.
[0139] Those skilled in the art will appreciate that the electronic device 1000 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0140] Among them, processor 1010 is used to determine the first loss function of the fine ranking model according to the fine ranking preference probability and the target label, the fine ranking preference probability is used to indicate the user's preference degree for the recommended object output by the fine ranking model, and the target label is used to indicate the user's behavior towards the recommended object; and based on the first loss function, the coarse ranking model is trained to obtain the second loss function of the coarse ranking model; and based on the first loss function and the second loss function, the target fine ranking model and the target coarse ranking model are output.
[0141] The embodiment of the present application provides an electronic device. On the one hand, since a coarse ranking model and a fine ranking model are trained together, a method of first convergence and then guidance is adopted to guide the training of the coarse ranking model through the fine ranking model, thereby avoiding the oscillation phenomenon of the coarse ranking model in the initial stage, affecting the iterative training and convergence of the coarse ranking model and the fine ranking model, and the problem of resource waste and performance impact during online and offline training due to the independent training of the coarse ranking model and the fine ranking model; on the other hand, the coarse ranking model and the fine ranking model use the same network structure during the training process, thereby avoiding the situation where the ranking results of the coarse ranking model and the fine ranking model are too different; in this way, the recommendation effect predicted by the coarse and fine ranking models of the electronic device is improved.
[0142] Optionally, in an embodiment of the present application, the processor 1010 is further used to determine the refined ranking preference probability based on N first marking bits of N preset sample features before determining the first loss function of the refined ranking model based on the refined ranking preference probability and the target label, each preset sample feature corresponding to a first marking bit, and each first marking bit is used to indicate whether the refined ranking model is allowed to use a preset sample feature.
[0143] Optionally, in an embodiment of the present application, the processor 1010 is specifically used to determine a first vector based on N first marker bits, and determine a target refined ranking vector based on the first vector and N preset sample features; and determine a refined ranking preference probability based on a preset model and the target refined ranking vector.
[0144] Optionally, in an embodiment of the present application, the processor 1010 is further used to, before determining the refined ranking preference probability based on the N first mark bits of the N preset sample features, set the first mark bit corresponding to the first sample feature to the first bit position when the refined ranking model is not allowed to use the first sample feature among the N preset sample features; and set the first mark bit corresponding to the first sample feature to the second bit position when the refined ranking model is allowed to use the first sample feature among the N preset sample features.
[0145] Optionally, in an embodiment of the present application, the processor 1010 is specifically used to perform M iterative training on the fine ranking model according to the fine ranking preference probability and the target label to obtain a first loss function, where M is a positive integer; and determine a target difference according to the first loss function and a third loss function, where the third loss function is the loss function obtained by performing the M-1th iteration on the fine ranking model; and when the target difference is less than or equal to a stable threshold of the fine ranking model, iteratively train the coarse ranking model according to the fine ranking preference probability and the coarse ranking preference probability to obtain a second loss function, where the coarse ranking preference probability is used to indicate the user's preference for the recommended object output by the coarse ranking model.
[0146] Optionally, in an embodiment of the present application, the processor 1010 is further used to determine the coarse sorting preference probability according to N second marking bits of N preset sample features before iteratively training the coarse sorting model according to the fine sorting preference probability and the coarse sorting preference probability to obtain the second loss function, each preset sample feature corresponding to a second marking bit, and each second marking bit is used to indicate whether the coarse sorting model is allowed to use a preset sample feature.
[0147] Optionally, in an embodiment of the present application, the processor 1010 is specifically used to perform weighted summation processing on the first loss function and the second loss function to obtain a target loss function; in the process of multiple consecutive iterations of the fine ranking model and the coarse ranking model, if the target loss function does not decrease, the iterative training of the fine ranking model and the coarse ranking model is stopped, and the fine ranking model and the coarse ranking model after the last iterative training are output; if the target loss function decreases at the Kth iteration, the back propagation algorithm is used to update the fine ranking preference probability, and the fine ranking model and the coarse ranking model are iteratively trained again based on the updated fine ranking preference probability to output the target fine ranking model and the target coarse ranking model, where K is a positive integer.
[0148] The electronic device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0149] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described again here.
[0150] It should be understood that in the embodiment of the present application, the input unit 1004 may include a graphics processor (Graphics Processing Unit, GPU) 10041 and a microphone 10042, and the graphics processor 10041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1006 may include a display panel 10061, and the display panel 10061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1007 includes a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include two parts: a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1009 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1010 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1010.
[0151] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned training method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0152] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0153] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned training method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0154] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0155] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0156] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0157] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A training method, characterized in that: The method comprises: According to the refined ranking preference probability and the target label, the refined ranking model is iteratively trained M times to obtain the first loss function of the refined ranking model, where M is a positive integer; the refined ranking preference probability is used to indicate the user's preference for the recommended object output by the refined ranking model, and the target label is used to indicate the user's behavior towards the recommended object; Determine a target difference according to the first loss function and a third loss function, wherein the third loss function is a loss function obtained by performing an M-1th iteration on the refined ranking model; When the target difference is less than or equal to the stability threshold of the fine ranking model, iteratively training the coarse ranking model according to the fine ranking preference probability and the coarse ranking preference probability to obtain a second loss function of the coarse ranking model, wherein the coarse ranking preference probability is used to indicate the user's preference degree for the recommended object output by the coarse ranking model; Performing weighted sum processing on the first loss function and the second loss function to obtain a target loss function; In the process of iterating the fine ranking model and the coarse ranking model for multiple times, if the objective loss function does not decrease, the iterative training of the fine ranking model and the coarse ranking model is stopped, and the fine ranking model and the coarse ranking model after the last iterative training are output; If the target loss function decreases at the Kth iteration, the back propagation algorithm is used to update the fine ranking preference probability, and the fine ranking model and the coarse ranking model are iteratively trained again based on the updated fine ranking preference probability to output a target fine ranking model and a target coarse ranking model, where K is a positive integer; Before performing M iterative training on the refined ranking model according to the refined ranking preference probability and the target label to obtain the first loss function of the refined ranking model, the method further includes: The refined ranking preference probability is determined according to N first marking bits of N preset sample features, each preset sample feature corresponds to a first marking bit, and each first marking bit is used to indicate whether the refined ranking model is allowed to use a preset sample feature.
2. The method according to claim 1, characterized in that The step of determining the refined sorting preference probability according to the N first marking bits of the N preset sample features includes: Determine a first vector according to the N first markers, and determine a target refined sorting vector based on the first vector and the N preset sample features; The refined ranking preference probability is determined based on a preset model and the target refined ranking vector.
3. The method according to claim 2, characterized in that Before determining the refined ranking preference probability according to the N first marking bits of the N preset sample features, the method further includes: In a case where the refined ranking model is not allowed to use a first sample feature among the N preset sample features, setting a first flag bit corresponding to the first sample feature to a first bit; In the case where the refined ranking model is allowed to use a first sample feature among the N preset sample features, a first flag bit corresponding to the first sample feature is set to a second bit.
4. The method according to claim 1, characterized in that: Before iteratively training the coarse sorting model according to the fine sorting preference probability and the coarse sorting preference probability to obtain the second loss function of the coarse sorting model, the method further includes: The coarse sorting preference probability is determined according to the N second flag bits of the N preset sample features, each preset sample feature corresponds to a second flag bit, and each second flag bit is used to indicate whether the coarse sorting model is allowed to use a preset sample feature.
5. A training device, characterized in that: The training device comprises: a determination module, a training module and an output module; The determination module is used to perform M iterations of training on the refined ranking model according to the refined ranking preference probability and the target label to obtain a first loss function of the refined ranking model, where M is a positive integer; the refined ranking preference probability is used to indicate the user's preference for the recommended object output by the refined ranking model, and the target label is used to indicate the user's behavior towards the recommended object; The training module is used to determine a target difference according to the first loss function and the third loss function determined by the determination module, wherein the third loss function is a loss function obtained by performing the M-1th iteration on the fine ranking model; and when the target difference is less than or equal to the stability threshold of the fine ranking model, iteratively train the coarse ranking model according to the fine ranking preference probability and the coarse ranking preference probability to obtain a second loss function of the coarse ranking model, wherein the coarse ranking preference probability is used to indicate the user's preference for the recommended object output by the coarse ranking model; The output module is used to perform weighted summation processing on the first loss function determined by the determination module and the second loss function obtained by the training module to obtain a target loss function; and in the process of iterating the fine ranking model and the coarse ranking model for multiple times in a row, if the target loss function does not decrease, stop iterative training of the fine ranking model and the coarse ranking model, and output the fine ranking model and the coarse ranking model after the last iterative training; if the target loss function decreases at the Kth iteration, use the back propagation algorithm to update the fine ranking preference probability, and iteratively train the fine ranking model and the coarse ranking model again based on the updated fine ranking preference probability to output the target fine ranking model and the target coarse ranking model, K is a positive integer; The determination module is also used to determine the refined ranking preference probability according to N first marking bits of N preset sample features before performing M iterative training on the refined ranking model according to the refined ranking preference probability and the target label to obtain the first loss function of the refined ranking model, each preset sample feature corresponds to a first marking bit, and each first marking bit is used to indicate whether the refined ranking model is allowed to use a preset sample feature.
6. An electronic device, characterized in that: It comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the training method as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Rough arrangement method and device and storage medium
CN113221017A