Training method of multi-task recommendation model, resource recommendation method, device and equipment

By adjusting the gradient magnitude and direction of the multi-task recommendation model, the gradient of each task is ensured to be within a reasonable range, and conflicts between gradients are resolved, thereby improving the accuracy of the model.

CN118897915AActive Publication Date: 2024-11-05BEIJING DAJIA INTERNET INFORMATION TECH CO LTD +2
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411025752.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-11-05
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

Multi-task recommendation models suffer from gradient magnitude and direction conflicts during training. This results in the model performing well on tasks with larger gradient magnitudes but poorly on tasks with smaller magnitudes. Furthermore, the model performs poorly on tasks with conflicting gradient directions, thus reducing its accuracy.

Method used

By adjusting the magnitude and direction of the gradients corresponding to multiple tasks in the multi-task recommendation model, the gradient magnitude of each task is kept within a reasonable range, and the directions of the gradients do not conflict with each other. The model parameters are then updated by weighted summation using the magnitude and direction adjustment weights.

Benefits of technology

It achieves a balance between gradient magnitude and direction, resolves gradient conflict issues, and improves the accuracy of multi-task recommendation models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118897915A_ABST
    Figure CN118897915A_ABST
Patent Text Reader

Abstract

The invention provides a training method of a multi-task recommendation model, a resource recommendation method, devices and equipment, and belongs to the technical field of computers. The method comprises the following steps: inputting sample training data into a multi-task recommendation model for training to obtain a plurality of first gradients; the amplitudes and the directions of the multiple first gradients are adjusted respectively, multiple second gradients are obtained, the multiple second gradients correspond to the multiple first gradients one to one, and the difference between the amplitudes of the second gradients and the maximum amplitude in the multiple first gradients is not larger than an amplitude threshold value; the included angle between the directions of any two second gradients in the plurality of second gradients is not greater than 90 degrees; and updating the multi-task recommendation model based on an average gradient of the plurality of second gradients. According to the method, amplitude balance and global direction balance can be realized on gradients, so that amplitude conflicts and direction conflicts existing in gradients corresponding to a plurality of tasks in a multi-task recommendation model training process are solved, and the accuracy of a multi-task recommendation model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a training method for a multi-task recommendation model, a resource recommendation method, a device and equipment. Background Art

[0002] With the development of Internet technology, in multimedia resource recommendation systems, the purpose of recommendation is generally diverse. It may consider whether the user will watch or whether the user will like it, etc., so that the recommendation is multi-task. However, in the process of training the multi-task recommendation model, the gradients corresponding to different tasks may have direction conflicts and amplitude conflicts. Among them, when there is an amplitude conflict, the gradient amplitude difference between different tasks is large, which causes the multi-task recommendation model to learn the tasks with larger gradient amplitudes better, but learn the tasks with smaller gradient amplitudes poorly, so that the multi-task recommendation model will mainly consider the prediction results of the tasks with larger gradient amplitudes for multimedia resources when recommending multimedia resources, which reduces the accuracy of the multi-task recommendation model. When there is a direction conflict, the gradient directions between different tasks conflict with each other, which causes the multi-task model to fail to learn the tasks with conflicting gradient directions, so that the multi-task recommendation model cannot consider the prediction results of the tasks with conflicting gradient directions for multimedia resources when recommending multimedia resources, which reduces the accuracy of the multi-task recommendation model. Therefore, how to solve the amplitude conflict and direction conflict of the gradients corresponding to multiple tasks in the training process of the multi-task recommendation model is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The present disclosure provides a training method, resource recommendation method, device and equipment for a multi-task recommendation model, which can achieve amplitude balance and global direction balance on the gradient to solve the amplitude conflict and direction conflict of the gradients corresponding to multiple tasks in the multi-task recommendation model training process, thereby improving the accuracy of the multi-task recommendation model. The technical solution of the present disclosure is as follows:

[0004] According to one aspect of an embodiment of the present disclosure, a training method for a multi-task recommendation model is provided, including:

[0005] Inputting sample training data into a multi-task recommendation model for training to obtain a plurality of first gradients, wherein the multi-task recommendation model is used to predict a plurality of interactive behaviors of an object with respect to multimedia resources, wherein the plurality of interactive behaviors correspond one-to-one to a plurality of tasks of the multi-task recommendation model, and the plurality of first gradients are gradients corresponding to the plurality of tasks, and correspond one-to-one to the plurality of tasks;

[0006] The amplitudes and directions of the multiple first gradients are adjusted respectively to obtain multiple second gradients, wherein the multiple second gradients correspond to the multiple first gradients one by one, the difference between the amplitude of the second gradient and the maximum amplitude of the multiple first gradients is not greater than an amplitude threshold, and the angle between the directions of any two second gradients in the multiple second gradients is not greater than 90 degrees;

[0007] The multi-task recommendation model is updated based on the average gradient of the multiple second gradients.

[0008] According to another aspect of an embodiment of the present disclosure, a resource recommendation method is provided, including:

[0009] Acquire object characteristics of a target object and resource characteristics of a plurality of target multimedia resources;

[0010] For any target multimedia resource, inputting the object features of the target object and the resource features of the target multimedia resource into a multi-task recommendation model for processing to obtain a plurality of predicted interaction behaviors of the target object with respect to the target multimedia resource, wherein the multi-task recommendation model is trained based on the training method of the multi-task recommendation model;

[0011] Determining a recommendation probability of the target multimedia resource based on the multiple predicted interaction behaviors;

[0012] At least one target multimedia resource is recommended to the target object based on the recommendation probabilities of the multiple target multimedia resources.

[0013] According to another aspect of an embodiment of the present disclosure, a training device for a multi-task recommendation model is provided, comprising:

[0014] A training unit is configured to input sample training data into a multi-task recommendation model for training to obtain a plurality of first gradients, wherein the multi-task recommendation model is used to predict a plurality of interactive behaviors of an object with respect to multimedia resources, wherein the plurality of interactive behaviors correspond one-to-one to a plurality of tasks of the multi-task recommendation model, and the plurality of first gradients are gradients corresponding to the plurality of tasks, and correspond one-to-one to the plurality of tasks;

[0015] an adjusting unit, configured to adjust the amplitudes and directions of the plurality of first gradients respectively to obtain a plurality of second gradients, wherein the plurality of second gradients correspond to the plurality of first gradients one by one, a difference between an amplitude of the second gradient and a maximum amplitude of the plurality of first gradients is not greater than an amplitude threshold, and an angle between directions of any two second gradients of the plurality of second gradients is not greater than 90 degrees;

[0016] An updating unit is configured to update the multi-task recommendation model based on an average gradient of the plurality of second gradients.

[0017] In some embodiments, the sample training data includes object features of a plurality of sample objects, resource features of a plurality of sample multimedia resources, and a plurality of historical interaction behaviors of the plurality of sample objects with respect to the plurality of sample multimedia resources;

[0018] The training unit is configured to input the sample training data into the multi-task recommendation model for processing to obtain a plurality of predicted interaction behaviors of the plurality of sample objects with respect to the plurality of sample multimedia resources; determine a plurality of training losses corresponding to the plurality of tasks based on the plurality of historical interaction behaviors and the plurality of predicted interaction behaviors, wherein the training loss corresponding to each task is used to indicate the difference between the historical interaction behaviors and the predicted interaction behaviors corresponding to the task; and determine the plurality of first gradients based on the plurality of training losses.

[0019] In some embodiments, the adjustment unit comprises:

[0020] an amplitude adjustment subunit, configured to adjust the amplitude of any first gradient based on a target first gradient to obtain an intermediate gradient corresponding to the first gradient, wherein the target first gradient is a gradient with the largest amplitude among the plurality of first gradients, and a difference between the amplitude of the intermediate gradient and the amplitude of the target first gradient is not greater than the amplitude threshold;

[0021] The direction adjustment subunit is configured to adjust the direction of the intermediate gradient based on at least one target intermediate gradient to obtain the second gradient, wherein the target intermediate gradient is a gradient among the intermediate gradients corresponding to the multiple first gradients and whose angle with the intermediate gradient is greater than 90 degrees.

[0022] In some embodiments, the amplitude adjustment subunit is configured to determine a target multiple based on the amplitude of the target first gradient and the amplitude of the first gradient, the target multiple is used to reflect the amplitude difference between the first gradient and the target first gradient, the amplitude adjustment parameter is used to reflect the amplitude difference between the first gradient after amplitude adjustment and the target first gradient, the amplitude adjustment weight is positively correlated with the target multiple and the amplitude adjustment parameter; based on the target multiple and the amplitude adjustment parameter, the amplitude adjustment weight is determined; based on the amplitude adjustment weight, the first gradient is weighted to obtain an intermediate gradient corresponding to the first gradient.

[0023] In some embodiments, the direction adjustment subunit is configured to determine a direction adjustment weight based on the at least one target intermediate gradient, the intermediate gradient and a direction adjustment parameter, wherein the direction adjustment parameter is used to reflect the angle between the intermediate gradient after direction adjustment and any of the target intermediate gradients, and the direction adjustment weight is positively correlated with the angle between the intermediate gradient and any of the target intermediate gradients, and is positively correlated with the direction adjustment parameter; based on the direction adjustment weight, a weighted sum is performed on the at least one target intermediate gradient and the intermediate gradient to obtain the second gradient.

[0024] In some embodiments, the direction adjustment subunit is configured to determine a projection vector based on the amplitude of the at least one target intermediate gradient, the amplitude of the intermediate gradient and the direction adjustment parameter, wherein the projection vector is used to reflect the inner product between the intermediate gradient after direction adjustment and any of the target intermediate gradients; and determine the direction adjustment weight based on the projection vector, the at least one target intermediate gradient and the intermediate gradient.

[0025] In some embodiments, the projection vector includes at least one element, and the at least one element corresponds one-to-one with the at least one target intermediate gradient;

[0026] The direction adjustment subunit is configured to multiply the amplitude of the target intermediate gradient, the amplitude of the intermediate gradient and the direction adjustment parameter for any target intermediate gradient to obtain an element corresponding to the target intermediate gradient in the projection vector.

[0027] In some embodiments, the direction adjustment weight includes at least one element, and the at least one element corresponds one-to-one with the at least one target intermediate gradient;

[0028] The direction adjustment subunit is configured to determine, for any target intermediate gradient, a first product based on the target intermediate gradient, the first product being the product of the target intermediate gradient and the transpose of the target intermediate gradient; determine a second product based on the target intermediate gradient and the intermediate gradient, the second product being the product of the target intermediate gradient and the transpose of the intermediate gradient; and obtain the element corresponding to the target intermediate gradient in the direction adjustment weight by subtracting the second product from the element corresponding to the target intermediate gradient in the projection vector and dividing it by the first product.

[0029] According to another aspect of an embodiment of the present disclosure, a resource recommendation device is provided, including:

[0030] An acquisition unit, configured to acquire object characteristics of a target object and resource characteristics of a plurality of target multimedia resources;

[0031] A prediction unit is configured to input the object features of the target object and the resource features of the target multimedia resource into a multi-task recommendation model for processing for any target multimedia resource, so as to obtain a plurality of predicted interaction behaviors of the target object with respect to the target multimedia resource, wherein the multi-task recommendation model is trained based on the training method of the multi-task recommendation model;

[0032] a determination unit, configured to determine a recommendation probability of the target multimedia resource based on the multiple predicted interaction behaviors;

[0033] The recommendation unit is configured to recommend at least one target multimedia resource to the target object based on the recommendation probabilities of the multiple target multimedia resources.

[0034] According to another aspect of an embodiment of the present disclosure, there is provided an electronic device, the electronic device comprising:

[0035] one or more processors;

[0036] A memory for storing program codes executable by the processor;

[0037] Among them, the processor is configured to execute the program code to implement the training method of the above-mentioned multi-task recommendation model, or to implement the above-mentioned resource push method.

[0038] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device is enabled to execute the above-mentioned training method of the multi-task recommendation model, or execute the above-mentioned resource push method.

[0039] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the training method of the multi-task recommendation model or the resource push method.

[0040] The disclosed embodiment provides a method for training a multi-task recommendation model. By adjusting the amplitude and direction of the gradients corresponding to multiple tasks of the multi-task recommendation model respectively, it is possible to ensure that the gradient amplitude corresponding to each task is within a reasonable range, and avoid large amplitude differences between the gradients corresponding to multiple tasks. At the same time, when adjusting the direction of the gradient corresponding to any task, it is also possible to simultaneously consider the gradients corresponding to all tasks that conflict with the direction of the gradient to ensure global non-conflict between the gradients. The above scheme can achieve amplitude balance and global direction balance on the gradient to resolve the amplitude conflict and direction conflict of the gradients corresponding to multiple tasks during the training process of the multi-task recommendation model, thereby improving the accuracy of the multi-task recommendation model.

[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0043] Figure 1 It is a schematic diagram of an implementation environment of a training method for a multi-task recommendation model according to an exemplary embodiment.

[0044] Figure 2 The figure is a flowchart of a method for training a multi-task recommendation model according to an exemplary embodiment.

[0045] Figure 3 The figure is a flowchart of another method for training a multi-task recommendation model according to an exemplary embodiment.

[0046] Figure 4 The figure is a flow chart showing a gradient adjustment direction according to an exemplary embodiment.

[0047] Figure 5 The figure is a flowchart of a resource recommendation method according to an exemplary embodiment.

[0048] Figure 6 The figure is a block diagram of a training device for a multi-task recommendation model according to an exemplary embodiment.

[0049] Figure 7 It is a block diagram of another training device for a multi-task recommendation model according to an exemplary embodiment.

[0050] Figure 8 The figure is a block diagram of a resource recommendation device according to an exemplary embodiment.

[0051] Fig. 9 It is a block diagram of a terminal according to an exemplary embodiment.

[0052] Fig.10 It is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION

[0053] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0054] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0055] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the sample training data involved in this disclosure was obtained with full authorization.

[0056] Figure 1 FIG. 1 is a schematic diagram of an implementation environment of a training method for a multi-task recommendation model according to an exemplary embodiment. Figure 1 , the implementation environment specifically includes: a terminal 101 and a server 102.

[0057] The terminal 101 may be at least one of a smart phone, a smart watch, a desktop computer, a laptop computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, and a laptop computer. An application for displaying multimedia resources may be installed and run on the terminal 101, and a user may log in to the application through the terminal 101 to obtain the services provided by the application. The application is associated with the server 102, and the server 102 provides background services. The terminal 101 may be connected to the server 102 via a wireless network or a wired network.

[0058] The terminal 101 may generally refer to one of a plurality of terminals. This embodiment is only illustrated by taking the terminal 101 as an example. Those skilled in the art may know that the number of the above terminals may be more or less. For example, the above terminals may be only a few, or the above terminals may be dozens or hundreds, or a greater number. The embodiment of the present disclosure does not limit the number and device type of the terminals.

[0059] The server 102 may be at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 102 may be connected to the terminal 101 and other terminals via a wireless network or a wired network. Optionally, the number of the above servers may be more or less, which is not limited in the embodiments of the present disclosure. Of course, the server 102 may also include other functional servers to provide more comprehensive and diversified services.

[0060] Figure 2 is a flowchart of a training method for a multi-task recommendation model according to an exemplary embodiment. Figure 2 As shown, the method is performed by an electronic device and includes the following steps:

[0061] In step S201, the sample training data is input into the multi-task recommendation model for training to obtain multiple first gradients. The multi-task recommendation model is used to predict multiple interactive behaviors of the object to multimedia resources. The multiple interactive behaviors correspond one-to-one to multiple tasks of the multi-task recommendation model. The multiple first gradients are gradients corresponding to the multiple tasks, and correspond one-to-one to the multiple tasks.

[0062] In the embodiment of the present disclosure, the sample training data includes multiple training samples, each training sample is a piece of interaction data between a sample object and a sample multimedia resource, including object features of the sample object, resource features of the sample multimedia resource, and multiple interaction behaviors of the sample object to the sample multimedia resource. The electronic device can obtain the sample training data from a local database, or from other servers, or from a terminal used to publish or view multimedia resources, which is not limited in the embodiment of the present disclosure.

[0063] The electronic device can use multiple interactive behaviors of multiple sample objects to multiple sample multimedia resources in the sample training data as label information, and perform supervised training on the multi-task recommendation model based on the sample training data to obtain multiple gradients corresponding to multiple tasks of the multi-task recommendation model, that is, the first gradient. Among them, each task of the multi-task recommendation model can predict an interactive behavior of the object to the multimedia resource, that is, the multi-task recommendation model is used to predict multiple interactive behaviors of the object to the multimedia resource, and the multiple interactive behaviors correspond to the multiple tasks one by one.

[0064] In step S202, the amplitudes and directions of the multiple first gradients are adjusted respectively to obtain multiple second gradients, the multiple second gradients correspond one-to-one to the multiple first gradients, the difference between the amplitude of the second gradient and the maximum amplitude among the multiple first gradients is no greater than the amplitude threshold, and the angle between the directions of any two second gradients among the multiple second gradients is no greater than 90 degrees.

[0065] In the disclosed embodiment, the first gradient is a vector having both direction and magnitude, and the amplitude represents the magnitude of the gradient. Since there may be amplitude conflicts or direction conflicts between the gradients corresponding to different tasks, updating the multi-task recommendation model based on multiple conflicting first gradients will reduce the accuracy of the multi-task recommendation model. Therefore, before updating the model parameters of the multi-task recommendation model based on multiple first gradients, the electronic device can adjust the amplitudes and directions of the multiple first gradients respectively to obtain multiple second gradients. Among them, the multiple second gradients correspond one to one to the multiple first gradients. For any second gradient, the second gradient is the first gradient after adjusting the amplitude and direction, and the difference between the amplitude of the second gradient and the maximum amplitude of the multiple first gradients is not greater than the amplitude threshold, and the angle between the direction of the second gradient and the direction of any second gradient in the multiple second gradients is not greater than 90 degrees.

[0066] In step S203, the multi-task recommendation model is updated based on the average gradient of the plurality of second gradients.

[0067] In the disclosed embodiment, the electronic device can resolve the amplitude conflict and direction conflict between the gradients corresponding to the multiple tasks by adjusting the amplitude and direction of the multiple first gradients respectively. Accordingly, the electronic device can update the model parameters of the multi-task recommendation model based on the average gradient of the multiple second gradients obtained after the adjustment.

[0068] The disclosed embodiment provides a method for training a multi-task recommendation model. By adjusting the amplitude and direction of the gradients corresponding to multiple tasks of the multi-task recommendation model respectively, it is possible to ensure that the gradient amplitude corresponding to each task is within a reasonable range, and avoid large amplitude differences between the gradients corresponding to multiple tasks. At the same time, when adjusting the direction of the gradient corresponding to any task, it is also possible to simultaneously consider the gradients corresponding to all tasks that conflict with the direction of the gradient to ensure global non-conflict between the gradients. The above scheme can achieve amplitude balance and global direction balance on the gradient to resolve the amplitude conflict and direction conflict of the gradients corresponding to multiple tasks during the training process of the multi-task recommendation model, thereby improving the accuracy of the multi-task recommendation model.

[0069] In some embodiments, the sample training data includes object features of a plurality of sample objects, resource features of a plurality of sample multimedia resources, and a plurality of historical interaction behaviors of the plurality of sample objects to the plurality of sample multimedia resources;

[0070] The sample training data is input into the multi-task recommendation model for training to obtain multiple first gradients, including:

[0071] The sample training data is input into the multi-task recommendation model for processing to obtain multiple predicted interaction behaviors of multiple sample objects to multiple sample multimedia resources;

[0072] Based on the multiple historical interaction behaviors and the multiple predicted interaction behaviors, multiple training losses corresponding to the multiple tasks are determined, where the training loss corresponding to each task is used to indicate the difference between the historical interaction behavior and the predicted interaction behavior corresponding to the task;

[0073] Based on the plurality of training losses, a plurality of first gradients are determined.

[0074] In the embodiment of the present disclosure, by determining multiple first gradients, the server can update the model parameters of the multi-task recommendation model based on the multiple first gradients after adjusting the amplitude and direction, so as to reduce the training loss of the multi-task recommendation model, thereby improving the accuracy of the multi-task recommendation model.

[0075] In some embodiments, the amplitudes and directions of the plurality of first gradients are adjusted respectively to obtain the plurality of second gradients, including:

[0076] For any first gradient, based on the target first gradient, the amplitude of the first gradient is adjusted to obtain an intermediate gradient corresponding to the first gradient, the target first gradient is a gradient with the largest amplitude among the multiple first gradients, and the difference between the amplitude of the intermediate gradient and the amplitude of the target first gradient is not greater than the amplitude threshold;

[0077] Based on at least one target intermediate gradient, the direction of the intermediate gradient is adjusted to obtain a second gradient, wherein the target intermediate gradient is a gradient whose angle with the intermediate gradient is greater than 90 degrees among the intermediate gradients corresponding to the plurality of first gradients.

[0078] In the disclosed embodiment, by executing the above steps, the server can adjust the amplitude of the gradient corresponding to each task according to the gradient with the largest amplitude among the gradients corresponding to multiple tasks, thereby avoiding large amplitude differences between the gradients corresponding to multiple tasks, and solving the amplitude conflict problem between the gradients corresponding to multiple tasks. At the same time, for any gradient after the amplitude adjustment, the server can also adjust the direction of the gradient based on all gradients that conflict with the direction of the gradient, so that the direction conflict problem between the gradient and all other gradients can be solved at the same time in each adjustment, ensuring global non-conflict between gradients.

[0079] In some embodiments, based on the target first gradient, the amplitude of the first gradient is adjusted to obtain an intermediate gradient corresponding to the first gradient, including:

[0080] Based on the amplitude of the target first gradient and the amplitude of the first gradient, a target multiple is determined, the target multiple is used to reflect the amplitude difference between the first gradient and the target first gradient, the amplitude adjustment parameter is used to reflect the amplitude difference between the first gradient after amplitude adjustment and the target first gradient, and the amplitude adjustment weight is positively correlated with the target multiple and positively correlated with the amplitude adjustment parameter;

[0081] Determine the amplitude adjustment weight based on the target multiple and the amplitude adjustment parameter;

[0082] Based on the amplitude adjustment weight, the first gradient is weighted to obtain an intermediate gradient corresponding to the first gradient.

[0083] In the disclosed embodiment, the amplitude adjustment weights of the first gradients corresponding to different tasks are determined according to the target multiple and the amplitude adjustment parameters, so that the server can increase the amplitude adjustment weight when the amplitude difference between the first gradient and the target first gradient is large, and reduce the amplitude adjustment weight when the amplitude difference is small. This ensures that the gradient amplitude corresponding to each task is within a reasonable range, avoids amplitude conflicts caused by large amplitude differences between gradients corresponding to multiple tasks, and thus improves the accuracy of the multi-task recommendation model obtained based on gradient update.

[0084] In some embodiments, based on at least one target intermediate gradient, adjusting the direction of the intermediate gradient to obtain the second gradient includes:

[0085] Determining a direction adjustment weight based on at least one target intermediate gradient, the intermediate gradient, and a direction adjustment parameter, where the direction adjustment parameter is used to reflect the angle between the intermediate gradient after the direction adjustment and any target intermediate gradient, and the direction adjustment weight is positively correlated with the angle between the intermediate gradient and any target intermediate gradient, and is positively correlated with the direction adjustment parameter;

[0086] Based on the direction adjustment weight, a weighted sum is performed on at least one target intermediate gradient and the intermediate gradient to obtain a second gradient.

[0087] In the embodiment of the present disclosure, by adjusting the direction adjustment weight used in the weighted summation of the intermediate gradient corresponding to any first gradient and at least one target intermediate gradient based on the direction adjustment parameter, the sine and cosine similarity between the second gradient and at least one target intermediate gradient can be emphasized while ensuring the orthogonality between the second gradient and at least one target intermediate gradient, thereby promoting the active transfer of knowledge while resolving the gradient direction conflict and improving the learning effect of the multi-task recommendation model on multiple tasks.

[0088] In some embodiments, determining a direction adjustment weight based on at least one target intermediate gradient, the intermediate gradient, and the direction adjustment parameter includes:

[0089] Determine a projection vector based on the magnitude of at least one target intermediate gradient, the magnitude of the intermediate gradient, and a direction adjustment parameter, where the projection vector is used to reflect the inner product between the intermediate gradient after the direction adjustment and any target intermediate gradient;

[0090] A direction adjustment weight is determined based on the projection vector, the at least one target intermediate gradient, and the intermediate gradient.

[0091] In the embodiment of the present disclosure, by determining the weight of at least one target intermediate gradient during weighted summation based on a projection vector determined by a direction adjustment parameter, the second gradient obtained by weighted summation of the intermediate gradient and at least one target intermediate gradient can achieve the projection target represented by the projection vector, that is, the direction of the second gradient finally obtained no longer conflicts with the direction of at least one target intermediate gradient, thereby improving the accuracy of the multi-task recommendation model obtained based on gradient update.

[0092] Above Figure 2 The basic process of the present disclosure is shown below. The solution provided by the present disclosure is further described based on a specific implementation method. Figure 3 is a flowchart of another method for training a multi-task recommendation model according to an exemplary embodiment. The method is executed by a server, see Figure 3 , the method comprising:

[0093] In step S301, the sample training data is input into the multi-task recommendation model for training to obtain multiple first gradients. The multi-task recommendation model is used to predict multiple interactive behaviors of the object to multimedia resources. The multiple interactive behaviors correspond one-to-one to multiple tasks of the multi-task recommendation model. The multiple first gradients are gradients corresponding to the multiple tasks, and correspond one-to-one to the multiple tasks.

[0094] In an embodiment of the present disclosure, the sample training data includes multiple training samples, each training sample is an interaction data between a sample object and a sample multimedia resource, including object features of the sample object, resource features of the sample multimedia resource, and multiple historical interaction behaviors of the sample object to the sample multimedia resource. Among them, the sample object is an account logged in on a multimedia resource client installed on a terminal, and various multimedia resources such as videos, audios, and items can be published or browsed through the sample object. The object features of the sample object include object identification and object activity, etc. The resource features of the sample multimedia resource include resource identification, resource type, resource duration, and resource popularity of the sample multimedia resource. The multiple historical interaction behaviors of the sample object to the sample multimedia resource include click behavior, browsing duration, like behavior, forwarding behavior, etc. of the sample object to the sample multimedia resource.

[0095] The server can use multiple historical interaction behaviors of multiple sample objects in the sample training data to multiple sample multimedia resources as label information, and perform supervised training on the multi-task recommendation model based on the sample training data to obtain multiple gradients corresponding to multiple tasks of the multi-task recommendation model, that is, the first gradient. Among them, each historical interaction behavior corresponds to a discrete or continuous label, such as a like behavior corresponds to a discrete label, including 0 and 1, 0 indicates that the sample object does not like the sample multimedia resource, and 1 indicates that the sample object likes the sample multimedia resource. The browsing time corresponds to a continuous label, such as 10.23 seconds represents the browsing time of the sample object to the sample multimedia resource. Each task of the multi-task recommendation model can predict an interaction behavior of the object to the multimedia resource, that is, the multi-task recommendation model is used to predict multiple interaction behaviors of the object to the multimedia resource, and the multiple interaction behaviors correspond to multiple tasks one by one. For example, one task among multiple tasks is used to predict the click behavior of the object to the multimedia resource, that is, to predict whether the object will click to watch the recommended multimedia resource, and another task is used to predict the like behavior of the object to the multimedia resource, that is, to predict whether the object will like the watched multimedia resource.

[0096] In some embodiments, the process of training the multi-task recommendation model based on the sample training data by the server includes: the server inputs the sample training data into the multi-task recommendation model for processing, and obtains multiple predicted interaction behaviors of multiple sample objects to multiple sample multimedia resources; then, the server determines multiple training losses corresponding to multiple tasks based on multiple historical interaction behaviors and multiple predicted interaction behaviors, and the training loss corresponding to each task is used to indicate the difference between the historical interaction behavior and the predicted interaction behavior corresponding to the task; finally, the server determines multiple first gradients based on the multiple training losses. Among them, the multi-task recommendation model is used to predict multiple interaction behaviors of the object to the multimedia resources. Therefore, the server can predict the object features of the sample objects and the resource features of the sample multimedia resources in the sample training data based on the multi-task recommendation model, and obtain multiple predicted interaction behaviors of the sample objects to the sample multimedia resources. Since the sample training data includes multiple historical interaction behaviors of the sample objects to the Domoto multimedia resources, the server can determine multiple training losses corresponding to multiple tasks of the multi-task recommendation model based on multiple historical interaction behaviors and multiple predicted interaction behaviors, and then can determine multiple gradients corresponding to multiple tasks based on multiple training losses. The training loss is used to reflect the accuracy of the multi-task recommendation model and is negatively correlated with the accuracy. The gradient is used to reflect how to adjust the model parameters and in which direction the model parameters can be adjusted to reduce the training loss. Therefore, by determining multiple first gradients, the server can update the model parameters of the multi-task recommendation model based on the multiple first gradients adjusted in magnitude and direction, so as to reduce the training loss of the multi-task recommendation model, thereby improving the accuracy of the multi-task recommendation model.

[0097] In some embodiments, the server determines the loss of each task of the multi-task recommendation model on the sample training data through the following formula 1, that is, determines multiple training losses corresponding to multiple tasks of the multi-task recommendation model.

[0098] Formula 1:

[0099] l i =L(f θ (x) i ,y i ; D)(i=1,…,T)

[0100] Among them, the multi-task recommendation model f θ Including T tasks, l i is the training loss corresponding to task i in the multi-task recommendation model. D is the sample training data, including all features x of the sample object-sample multimedia resource pair and multiple historical interaction behaviors y = [y1…, y T ]. i represents the historical interaction behavior corresponding to task i in multiple historical interaction behaviors. θ (x) i It represents the interaction behavior of the sample object on the sample multimedia resource predicted by task i of the multi-task recommendation model θ, that is, the predicted interaction behavior. L() is the loss function of the multi-task recommendation model. For discrete labels, it can be a binary cross entropy loss function, and for continuous labels, it can be a mean square error loss function.

[0101] In some embodiments, the server determines the gradient corresponding to each task of the multi-task recommendation model through the following formula 2, that is, determines multiple first gradients.

[0102] Formula 2:

[0103]

[0104] Among them, θ is the multi-task recommendation model f θ Model parameters of the multi-task recommendation model f θ Including T tasks, l i is the training loss corresponding to task i in the multi-task recommendation model, g i It is the gradient corresponding to task i in the multi-task recommendation model, that is, the first gradient. is the Hamiltonian operator used to calculate the gradient of training loss.

[0105] Optionally, the multi-task recommendation model may adopt an MMoE (Multi-gate Mixture-of-Experts) model or a PLE (Progressive Layered Extraction) model.

[0106] In step S302, for any first gradient, the amplitude of the first gradient is adjusted based on the target first gradient to obtain an intermediate gradient corresponding to the first gradient, the target first gradient is the gradient with the largest amplitude among the multiple first gradients, and the difference between the amplitude of the intermediate gradient and the amplitude of the target first gradient is not greater than the amplitude threshold.

[0107] In the disclosed embodiment, the first gradient is a vector having both direction and magnitude, and the amplitude represents the magnitude of the gradient. Since there may be amplitude conflicts or direction conflicts between the first gradients corresponding to different tasks, updating the multi-task recommendation model based on multiple conflicting first gradients will result in a reduction in the accuracy of the multi-task recommendation model. Therefore, the server can adjust the amplitudes and directions of multiple first gradients respectively. Accordingly, in the amplitude adjustment process, for any first gradient, the server can determine the gradient with the largest amplitude from multiple first gradients based on the amplitudes of multiple first gradients, that is, the target first gradient. Then, the server can adjust the amplitude of the first gradient based on the target first gradient to obtain the intermediate gradient corresponding to the first gradient, so that the difference between the amplitude of the adjusted first gradient and the amplitude of the target first gradient is not greater than the amplitude threshold.

[0108] In some embodiments, the server can perform weighted processing on the first gradient based on the amplitude adjustment weight to obtain an intermediate gradient corresponding to the first gradient. Accordingly, the server determines the target multiple based on the amplitude of the target first gradient and the amplitude of the first gradient, and the target multiple is used to reflect the amplitude difference between the first gradient and the target first gradient; then, the server determines the amplitude adjustment weight based on the target multiple and the amplitude adjustment parameter; finally, the server can perform weighted processing on the first gradient based on the amplitude adjustment weight to obtain an intermediate gradient corresponding to the first gradient. Among them, the server can determine the value obtained by dividing the amplitude of the target first gradient by the amplitude of the first gradient as the target multiple. The target multiple can reflect the amplitude difference between the first gradient and the target first gradient. The server can determine the amplitude adjustment weight of the first gradient based on the target multiple and the amplitude adjustment parameter. The amplitude adjustment parameter is used to reflect the amplitude difference between the first gradient after amplitude adjustment and the target first gradient. The amplitude adjustment weight is used to reflect the amplitude growth degree of the first gradient, which is positively correlated with the target multiple and the amplitude adjustment parameter. The larger the target multiple is, the larger the amplitude difference between the first gradient and the target first gradient is. Therefore, in order to reduce the amplitude difference so that it is not greater than the amplitude threshold, the server can increase the amplitude growth degree of the first gradient by increasing the amplitude adjustment weight of the first gradient, so that the difference between the amplitude of the intermediate gradient obtained by weighting the first gradient based on the amplitude adjustment weight and the amplitude of the target first gradient is not greater than the amplitude threshold. The larger the amplitude adjustment parameter is, the smaller the amplitude difference between the desired amplitude-adjusted first gradient and the target first gradient is. Therefore, in order to reduce the amplitude difference, the server can increase the amplitude growth degree of the first gradient by increasing the amplitude adjustment weight of the first gradient. By determining the amplitude adjustment weight of the first gradient corresponding to different tasks according to the target multiple and the amplitude adjustment parameter, the server can increase the amplitude adjustment weight when the amplitude difference between the first gradient and the target first gradient is large, and reduce the amplitude adjustment weight when the amplitude difference is small, which can ensure that the gradient amplitude corresponding to each task is within a reasonable range, avoid the large amplitude difference between the gradients corresponding to multiple tasks and cause amplitude conflicts, thereby improving the accuracy of the multi-task recommendation model obtained based on gradient update.

[0109] In some embodiments, the server adjusts the amplitude of the first gradient by the following formula three to obtain an intermediate gradient.

[0110] Formula 3:

[0111]

[0112] Among them, g i is the first gradient corresponding to task i, max j ||g j|| is the amplitude of the target first gradient, that is, the maximum amplitude among multiple first gradients, ||g i || is g i The amplitude. is the amplitude adjusted g i , which is the middle gradient of the first gradient corresponding to task i. Amplitude adjustment parameter τ∈[0,1]. By adjusting the amplitude of each first gradient through formula 3, it can ensure that the difference between the maximum gradient amplitude and the minimum gradient amplitude among multiple tasks does not exceed 1 / τ times.

[0113] Optionally, when determining the value of the amplitude adjustment parameter, the server can first pre-set multiple values ​​for the amplitude adjustment parameter, such as setting different τ values ​​{0, 0.1, 0.2, ..., 1.0}. These values ​​are then used to determine the amplitude adjustment weights of the first gradient, and then the amplitude of the first gradient is adjusted. Finally, the server can evaluate the performance indicators (such as accuracy AUC) of the multi-task recommendation model obtained by updating the first gradient after adjusting different τ values ​​on the verification data set, and determine the value of the amplitude adjustment parameter used by the multi-task recommendation model with the best performance indicator as the final value of the amplitude adjustment parameter.

[0114] In step S303, based on at least one target intermediate gradient, the direction of the intermediate gradient is adjusted to obtain a second gradient, where the target intermediate gradient is a gradient whose angle with the intermediate gradient is greater than 90 degrees among the intermediate gradients corresponding to the multiple first gradients, the difference between the amplitude of the second gradient and the maximum amplitude among the multiple first gradients is no greater than the amplitude threshold, and the angle between the directions of any two second gradients among the multiple second gradients corresponding to the multiple first gradients is no greater than 90 degrees.

[0115] In the disclosed embodiment, the intermediate gradient is a gradient obtained after adjusting the amplitude of the first gradient. After the server adjusts the amplitude of the first gradient corresponding to the multiple tasks, it can obtain multiple intermediate gradients. At this time, there is no excessive amplitude difference between the multiple intermediate gradients, that is, the amplitude balance is achieved on the gradient, and the amplitude conflict problem between the multiple first gradients is solved. In order to solve the direction conflict problem between the multiple first gradients, the server also needs to adjust the direction of the multiple intermediate gradients. Correspondingly, for any intermediate gradient, the server can determine the angle between the intermediate gradient and the other intermediate gradients based on the direction of the intermediate gradient and the direction of the other intermediate gradients, and then can determine at least one target intermediate gradient from the multiple intermediate gradients according to the angle. The angle between the target intermediate gradient and the intermediate gradient is greater than 90 degrees, that is, the direction of the target intermediate gradient conflicts with the direction of the intermediate gradient. In order to make the direction of the intermediate gradient no longer conflict with the direction of at least one target gradient, the server can adjust the direction of the intermediate gradient based on at least one target intermediate gradient to obtain a second gradient so that the angle between the adjusted intermediate gradient and any target intermediate gradient is not greater than 90 degrees. By executing the above steps 302-303, the server can adjust the amplitude of the gradient corresponding to each task according to the gradient with the largest amplitude among the gradients corresponding to multiple tasks, thereby avoiding large amplitude differences between the gradients corresponding to multiple tasks and solving the amplitude conflict problem between the gradients corresponding to multiple tasks. At the same time, for any gradient after the amplitude adjustment, the server can also adjust the direction of the gradient based on all gradients that conflict with the direction of the gradient, so that the direction conflict problem between the gradient and all other gradients can be solved at the same time in each adjustment, ensuring global non-conflict between gradients.

[0116] In some embodiments, the server can perform weighted summation of the intermediate gradient corresponding to the first gradient and at least one target intermediate gradient based on the direction adjustment weight to obtain a second gradient. Accordingly, the server determines the direction adjustment weight based on at least one target intermediate gradient, the intermediate gradient and the direction adjustment parameter; then, the server can perform weighted summation of at least one target intermediate gradient and the intermediate gradient based on the direction adjustment weight to obtain the second gradient. Wherein, since the direction of the intermediate gradient conflicts with the direction of at least one intermediate gradient, the cosine similarity between the intermediate gradient and at least one target intermediate gradient is negative. Cosine similarity is the cosine value of the angle between the two gradients, which is used to reflect the similarity between the two gradients. When the angle is greater than 90 degrees, the cosine value is negative, that is, the cosine similarity between the two gradients is negative. In order to solve the negative cosine similarity between the intermediate gradient and at least one target intermediate gradient, the server can determine the direction adjustment weight based on at least one target intermediate gradient, the intermediate gradient and the direction adjustment parameter. The direction adjustment parameter is used to reflect the angle between the intermediate gradient after direction adjustment and any target intermediate gradient, that is, to reflect the cosine similarity between the intermediate gradient after direction adjustment and any target intermediate gradient, and the cosine similarity is no longer a negative value. For example, when the direction adjustment parameter is equal to 0, it means that the cosine similarity between the gradients is 0, that is, the gradients are orthogonal (angle 90), and when it is greater than 0, it means that the cosine similarity between the gradients is greater than 0, that is, the angle between the gradients is less than 90. Therefore, by setting the value of the direction adjustment parameter, the angle between the gradient after direction adjustment and the original conflicting gradient can be controlled not to be greater than 90. Since the larger the angle between the gradients, the larger the angle amplitude to be adjusted when resolving the direction conflict, the larger the direction adjustment amplitude reflected by the direction adjustment weight. Since the larger the direction adjustment parameter, the smaller the angle between the desired direction-adjusted gradients, the larger the angle amplitude to be adjusted when resolving the direction conflict, that is, the larger the direction adjustment amplitude reflected by the direction adjustment weight. It can be seen that the direction adjustment weight is positively correlated with the angle between the intermediate gradient and any target intermediate gradient, and is positively correlated with the direction adjustment parameter. Since the second gradient is a gradient obtained by adjusting the direction of the intermediate gradient corresponding to the first gradient, and the direction of the second gradient no longer conflicts with the direction of at least one target intermediate gradient, the second gradient can be expressed as the sum of the linear combination of the intermediate gradient corresponding to the first gradient and the at least one target intermediate gradient. Since the direction adjustment weight is used to represent the weight used when the at least one target intermediate gradient is linearly combined, the server can perform a weighted summation of the intermediate gradient corresponding to the first gradient and the at least one target intermediate gradient based on the direction adjustment weight to obtain the second gradient.By determining the direction adjustment weight used when performing weighted summation of the intermediate gradient corresponding to any first gradient and at least one target intermediate gradient based on the direction adjustment parameter, the sine and cosine similarity between the second gradient and at least one target intermediate gradient can be emphasized while ensuring the orthogonality between the second gradient and at least one target intermediate gradient. This can promote the active transfer of knowledge while resolving the gradient direction conflict and improve the learning effect of the multi-task recommendation model on multiple tasks.

[0117] In some embodiments, in the process of determining the direction adjustment weight, the server can determine a projection vector based on the amplitude of at least one target intermediate gradient, the amplitude of the intermediate gradient, and the direction adjustment parameter, and the projection vector is used to reflect the inner product between the intermediate gradient after the direction adjustment and any target intermediate gradient; then the direction adjustment weight is determined based on the projection vector, at least one target intermediate gradient, and the intermediate gradient. Wherein, since the inner product between the two gradients is less than 0 when the directions of the two gradients conflict, in order to make the directions of the gradients no longer conflict, it is necessary to make the inner product between the gradients greater than or equal to 0. The projection vector is used to reflect the inner product between the intermediate gradient after the direction adjustment and any target intermediate gradient, that is, to reflect the inner product between the two gradients whose directions do not conflict. The direction adjustment parameter is used to reflect the angle between the intermediate gradient after the direction adjustment and any target intermediate gradient. Therefore, the server can determine the projection vector based on the amplitude of at least one target intermediate gradient, the amplitude of the intermediate gradient, and the direction adjustment parameter. The projection vector is also the projection target that the second gradient needs to achieve with at least one target intermediate gradient. Therefore, the server can determine the direction adjustment weight based on the projection vector, at least one target intermediate gradient, and the intermediate gradient. By determining the weight of at least one target intermediate gradient during weighted summation based on the projection vector determined by the direction adjustment parameter, the second gradient obtained by weighted summation of the intermediate gradient and at least one target intermediate gradient can achieve the projection target represented by the projection vector, that is, the direction of the second gradient finally obtained no longer conflicts with the direction of at least one target intermediate gradient, thereby improving the accuracy of the multi-task recommendation model obtained based on gradient update.

[0118] In some embodiments, the projection vector includes at least one element, and the at least one element corresponds to at least one target intermediate gradient one-to-one; for any target intermediate gradient, the server can multiply the amplitude of the target intermediate gradient, the amplitude of the intermediate gradient, and the direction adjustment parameter to obtain the element corresponding to the target intermediate gradient in the projection vector. Wherein, since the inner product between two gradients is equal to the product of the amplitude of the two gradients and the cosine similarity between the gradients, the direction adjustment parameter is used to reflect the cosine similarity between the intermediate gradient after direction adjustment and any target intermediate gradient, the server can determine the value obtained by multiplying the amplitude of any target intermediate gradient, the amplitude of the intermediate gradient, and the direction adjustment parameter as the element corresponding to the target intermediate gradient in the projection vector. By determining the projection vector that the intermediate gradient after direction adjustment and at least one target intermediate gradient are expected to reach, the direction of the second gradient obtained by weighted summing the intermediate gradient and at least one target intermediate gradient based on the direction adjustment weight determined by the projection vector no longer conflicts with the direction of at least one target intermediate gradient, thereby improving the accuracy of the multi-task recommendation model obtained based on gradient update.

[0119] In some embodiments, the direction adjustment weight includes at least one element, and the at least one element corresponds to at least one target intermediate gradient one-to-one; for any target intermediate gradient, the server determines a first product based on the target intermediate gradient, and the first product is the product of the target intermediate gradient and the transposition of the target intermediate gradient; then, the server determines a second product based on the target intermediate gradient and the intermediate gradient, and the second product is the product of the transposition of the target intermediate gradient and the intermediate gradient; finally, the server can divide the difference obtained by subtracting the second product from the element corresponding to the target intermediate gradient in the projection vector by the first product to obtain the element corresponding to the target intermediate gradient in the direction adjustment weight. By executing the above calculation process, the accuracy of the calculated direction adjustment weight can be improved, so as to improve the accuracy of the second gradient obtained by weighted summation of the intermediate gradient and at least one target intermediate gradient based on the direction adjustment weight, and ensure that the direction conflict between the gradients is resolved.

[0120] In some embodiments, the server performs weighted summation of the intermediate gradient corresponding to the first gradient and at least one target intermediate gradient through the following formula 4 to obtain the second gradient.

[0121] Formula 4:

[0122]

[0123] in, is the intermediate gradient corresponding to the first gradient corresponding to task i, Includes at least one target intermediate gradient corresponding to task i. For The intermediate gradient corresponding to any first gradient that conflicts with the direction of , that is, the target intermediate gradient, w = [w1…, w n ] adjusts the weights for the directions, including the weights of each target intermediate gradient. is the second gradient.

[0124] In some embodiments, the server determines the direction adjustment weight based on at least one target intermediate gradient, the intermediate gradient, and the direction adjustment parameter through the following formula five.

[0125] Formula 5:

[0126]

[0127] Among them, w is the direction adjustment weight, is the intermediate gradient corresponding to the first gradient corresponding to task i, Includes at least one intermediate gradient corresponding to task i. The projection vector is the magnitude of the intermediate gradient corresponding to the first gradient corresponding to task i, is the magnitude of at least one target intermediate gradient corresponding to task i. ε is the direction adjustment parameter, ε≥0.

[0128] In step S304, the multi-task recommendation model is updated based on the average gradient of the plurality of second gradients.

[0129] In the disclosed embodiment, the server can obtain multiple second gradients by adjusting the amplitudes and directions of multiple first gradients respectively, and the multiple second gradients correspond one to one with the multiple first gradients. Since the difference between the amplitude of the second gradient and the maximum amplitude of the multiple first gradients is not greater than the amplitude threshold, the angle between the directions of any two second gradients in the multiple second gradients is not greater than 90 degrees, that is, there is no amplitude conflict and direction conflict between the gradients corresponding to multiple tasks. Therefore, the server can update the model parameters of the multi-task recommendation model based on the average gradient of the multiple second gradients obtained after adjustment.

[0130] In some embodiments, the electronic device updates the multi-task recommendation model based on the average gradient of multiple second gradients through the following formula six.

[0131] Formula 6:

[0132]

[0133] Among them, θ is the model parameter of the multi-task recommendation model, T is the number of tasks of the multi-task recommendation model, is the second gradient corresponding to task i, and η is the learning rate.

[0134] In order to facilitate understanding of the gradient adjustment process in the process of training the multi-task recommendation model in the present disclosure, the present disclosure also shows a flow chart of the gradient adjustment direction. Figure 4 As shown, first, the multi-task recommendation model f θ By processing the sample training data D, multiple first gradients g1, g2, and g3 can be obtained. Then, for the first gradient g1, the server can adjust the amplitude of g1 based on the target first gradient g2 to obtain the intermediate gradient corresponding to the first gradient g1 The same is true for g2 and g3. Then, for the intermediate gradient corresponding to the first gradient g1 The server can be based on at least one target intermediate gradient right The direction is adjusted to obtain the second gradient For the intermediate gradient corresponding to the first gradient g2 The server can be based on at least one target intermediate gradient right The direction is adjusted to obtain the second gradient For the intermediate gradient corresponding to the first gradient g3 The server can be based on at least one target intermediate gradient right The direction is adjusted to obtain the second gradient Finally, the server can recommend a multi-task model f based on the average gradient of multiple second gradients. θ The model parameters are updated.

[0135] The disclosed embodiment provides a method for training a multi-task recommendation model. By adjusting the amplitude and direction of the gradients corresponding to multiple tasks of the multi-task recommendation model respectively, it is possible to ensure that the gradient amplitude corresponding to each task is within a reasonable range, and avoid large amplitude differences between the gradients corresponding to multiple tasks. At the same time, when adjusting the direction of the gradient corresponding to any task, it is also possible to simultaneously consider the gradients corresponding to all tasks that conflict with the direction of the gradient to ensure global non-conflict between the gradients. The above scheme can achieve amplitude balance and global direction balance on the gradient to resolve the amplitude conflict and direction conflict of the gradients corresponding to multiple tasks during the training process of the multi-task recommendation model, thereby improving the accuracy of the multi-task recommendation model.

[0136] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0137] On the basis of the above embodiments, the embodiments of the present disclosure also evaluate the effectiveness of the trained multi-task recommendation model on the test data set. In order to comprehensively evaluate the performance of the multi-task recommendation model that optimizes multiple tasks at the same time, the embodiments of the present disclosure adopt two widely recognized accuracy indicators: AUC and GAUC. As shown in the following formulas 7 to 10, M represents the training method of the multi-task recommendation model adopted by the embodiments of the present disclosure, that is, the training method of optimizing multiple tasks at the same time. Single represents a single-task optimization method, that is, a method of optimizing each task separately during the training process. AV-A(M) represents the average performance index of all tasks of the multi-task recommendation model evaluated by AUC, and AV-G represents the average performance index of all tasks of the multi-task recommendation model evaluated by GAUC. R,-A(M) represents the improvement of the average performance index of multiple tasks of the multi-task recommendation model trained by the training method of the multi-task recommendation model provided by the embodiments of the present disclosure, compared with the average performance of multiple tasks of the multi-task recommendation model trained by the single-task optimization method, when the performance is evaluated by AUC. R, -G(M) represents the improvement of the average performance indicators of multiple tasks of the multi-task recommendation model trained by the training method of the multi-task recommendation model provided by the embodiment of the present disclosure, compared with the average performance of multiple tasks of the multi-task recommendation model trained by the single-task optimization method, when the performance is evaluated by GAUC.

[0138] Formula 7:

[0139]

[0140] Formula 8:

[0141]

[0142] Formula 9:

[0143]

[0144] Formula 10:

[0145]

[0146] Among them, compared with other methods, the training method of the multi-task recommendation model proposed in the embodiment of the present disclosure has achieved the best results on the test data set in terms of the four indicators defined in the above formulas 7 to 10.

[0147] Figure 5 is a flow chart of a resource recommendation method according to an exemplary embodiment. Figure 5 As shown, the method is performed by an electronic device and includes the following steps:

[0148] In step S501, object features of a target object and resource features of a plurality of target multimedia resources are acquired.

[0149] In the disclosed embodiment, the target object is an account logged in on a resource client installed on an electronic device, through which various multimedia resources can be published or browsed. Among them, the object characteristics of the target object include object identification and object activity, etc. The resource characteristics of the target multimedia resource include resource identification, object identification of the resource publishing object, resource duration, resource popularity, etc.

[0150] In step S502, for any target multimedia resource, the object features of the target object and the resource features of the target multimedia resource are input into the multi-task recommendation model for processing to obtain multiple predicted interaction behaviors of the target object with respect to the target multimedia resource. The multi-task recommendation model is trained based on the training method of the multi-task recommendation model in the above-mentioned embodiment.

[0151] In the disclosed embodiment, the multi-task recommendation model is used to predict multiple interactive behaviors of an object to a multimedia resource. Therefore, for any target multimedia resource, the electronic device can process the input object features of the target object and the resource features of the target multimedia resource to obtain multiple predicted interactive behaviors of the target object to the target multimedia resource. Among them, the multiple predicted interactive behaviors include click behavior, browsing time, like behavior, forwarding behavior, etc.

[0152] In step S503, the recommendation probability of the target multimedia resource is determined based on the multiple predicted interaction behaviors.

[0153] In an embodiment of the present disclosure, the electronic device can determine the probability that the target multimedia resource is a multimedia resource of interest to the target object based on multiple predicted interactive behaviors of the target object on the target multimedia resource, and further determine the recommendation probability of the target multimedia resource. Among them, if multiple predicted interactive behaviors indicate that the target object has a large number of clicks on the target multimedia resource, or a long viewing time, or has given a like or forwarded post, the higher the probability that the electronic device can determine that the target multimedia resource is a multimedia resource of interest to the target object, the higher the recommendation probability of the target multimedia resource. If multiple predicted interactive behaviors indicate that the target object has a small number of clicks on the target multimedia resource, or a short viewing time, or has not given a like or forwarded post, the lower the probability that the electronic device can determine that the target multimedia resource is a multimedia resource of interest to the target object, the lower the recommendation probability of the target multimedia resource.

[0154] In step S504, at least one target multimedia resource is recommended to the target object based on the recommendation probabilities of the multiple target multimedia resources.

[0155] In the disclosed embodiment, the higher the recommendation probability of the target multimedia resource, the higher the probability that the target multimedia resource is a resource that the target object is interested in. By comparing the recommendation probabilities of multiple target multimedia resources, the electronic device can recommend at least one target multimedia resource with a higher recommendation probability to the target object, thereby improving the viewing experience of the target object.

[0156] The disclosed embodiment provides a resource recommendation method. Since the multi-task recommendation model is used to predict multiple interactive behaviors of an object with respect to multimedia resources, the electronic device can output multiple predicted interactive behaviors of the target object with respect to the target multimedia resources based on the multi-task recommendation model, determine the recommendation probability of the target multimedia resources, and then can preferentially recommend target resources with high recommendation probabilities to the target object, thereby improving the accuracy of the recommended resources of the multi-task recommendation model and enhancing the viewing experience of the target object.

[0157] Figure 6 is a block diagram of a training device for a multi-task recommendation model according to an exemplary embodiment. Figure 6 The device includes: a training unit 601, an adjustment unit 602 and an updating unit 603.

[0158] The training unit 601 is configured to input the sample training data into the multi-task recommendation model for training to obtain a plurality of first gradients, where the multi-task recommendation model is used to predict a plurality of interactive behaviors of the object to the multimedia resources, where the plurality of interactive behaviors correspond one-to-one to a plurality of tasks of the multi-task recommendation model, and the plurality of first gradients are gradients corresponding to the plurality of tasks, and correspond one-to-one to the plurality of tasks;

[0159] an adjusting unit 602, configured to adjust the amplitudes and directions of the plurality of first gradients respectively to obtain a plurality of second gradients, wherein the plurality of second gradients correspond to the plurality of first gradients one by one, the difference between the amplitude of the second gradient and the maximum amplitude of the plurality of first gradients is not greater than an amplitude threshold, and the angle between the directions of any two second gradients in the plurality of second gradients is not greater than 90 degrees;

[0160] The updating unit 603 is configured to update the multi-task recommendation model based on the average gradient of the multiple second gradients.

[0161] In some embodiments, the sample training data includes object features of a plurality of sample objects, resource features of a plurality of sample multimedia resources, and a plurality of historical interaction behaviors of the plurality of sample objects to the plurality of sample multimedia resources;

[0162] The training unit 601 is configured to input the sample training data into the multi-task recommendation model for processing to obtain multiple predicted interaction behaviors of multiple sample objects to multiple sample multimedia resources; based on multiple historical interaction behaviors and multiple predicted interaction behaviors, determine multiple training losses corresponding to multiple tasks, and the training loss corresponding to each task is used to indicate the difference between the historical interaction behavior and the predicted interaction behavior corresponding to the task; based on the multiple training losses, determine multiple first gradients.

[0163] In some embodiments, Figure 7 is a block diagram of another multi-task recommendation model training device according to an exemplary embodiment. Figure 6 , the adjustment unit 602 includes:

[0164] The amplitude adjustment subunit 701 is configured to adjust the amplitude of any first gradient based on the target first gradient to obtain an intermediate gradient corresponding to the first gradient, the target first gradient being the gradient with the largest amplitude among the multiple first gradients, and the difference between the amplitude of the intermediate gradient and the amplitude of the target first gradient being no greater than an amplitude threshold;

[0165] The direction adjustment subunit 702 is configured to adjust the direction of the intermediate gradient based on at least one target intermediate gradient to obtain a second gradient, wherein the target intermediate gradient is a gradient whose angle with the intermediate gradient is greater than 90 degrees among the intermediate gradients corresponding to the multiple first gradients.

[0166] In some embodiments, the amplitude adjustment subunit 701 is configured to determine a target multiple based on the amplitude of the target first gradient and the amplitude of the first gradient, the target multiple being used to reflect the amplitude difference between the first gradient and the target first gradient; determine an amplitude adjustment weight based on the target multiple and the amplitude adjustment parameter, the amplitude adjustment parameter being used to reflect the amplitude difference between the first gradient after amplitude adjustment and the target first gradient, the amplitude adjustment weight being positively correlated with the target multiple and with the amplitude adjustment parameter; and perform weighted processing on the first gradient based on the amplitude adjustment weight to obtain an intermediate gradient corresponding to the first gradient.

[0167] In some embodiments, the direction adjustment subunit 702 is configured to determine a direction adjustment weight based on at least one target intermediate gradient, the intermediate gradient and a direction adjustment parameter, where the direction adjustment parameter is used to reflect the angle between the intermediate gradient after direction adjustment and any target intermediate gradient, and the direction adjustment weight is positively correlated with the angle between the intermediate gradient and any target intermediate gradient, and is positively correlated with the direction adjustment parameter; based on the direction adjustment weight, a weighted sum is performed on at least one target intermediate gradient and the intermediate gradient to obtain a second gradient.

[0168] In some embodiments, the direction adjustment subunit 702 is configured to determine a projection vector based on the amplitude of at least one target intermediate gradient, the amplitude of the intermediate gradient, and the direction adjustment parameter, where the projection vector is used to reflect the inner product between the intermediate gradient after direction adjustment and any target intermediate gradient; and determine the direction adjustment weight based on the projection vector, at least one target intermediate gradient, and the intermediate gradient.

[0169] In some embodiments, the projection vector includes at least one element, and the at least one element corresponds one-to-one with at least one target intermediate gradient;

[0170] The direction adjustment subunit 702 is configured to multiply the amplitude of the target intermediate gradient, the amplitude of the intermediate gradient and the direction adjustment parameter for any target intermediate gradient to obtain an element corresponding to the target intermediate gradient in the projection vector.

[0171] In some embodiments, the direction adjustment weight includes at least one element, and the at least one element corresponds one-to-one to at least one target intermediate gradient;

[0172] The direction adjustment subunit 702 is configured to determine, for any target intermediate gradient, a first product based on the target intermediate gradient, the first product being the product of the target intermediate gradient and the transpose of the target intermediate gradient; determine a second product based on the target intermediate gradient and the intermediate gradient, the second product being the product of the target intermediate gradient and the transpose of the intermediate gradient; and obtain an element corresponding to the target intermediate gradient in the direction adjustment weight by subtracting the difference obtained by the second product from the element corresponding to the target intermediate gradient in the projection vector.

[0173] The disclosed embodiment provides a training device for a multi-task recommendation model. By adjusting the amplitude and direction of the gradients corresponding to the multiple tasks of the multi-task recommendation model respectively, it is possible to ensure that the gradient amplitude corresponding to each task is within a reasonable range, and avoid large amplitude differences between the gradients corresponding to multiple tasks. At the same time, when adjusting the direction of the gradient corresponding to any task, it is also possible to simultaneously consider the gradients corresponding to all tasks that conflict with the direction of the gradient to ensure global non-conflict between the gradients. The above scheme can achieve amplitude balance and global direction balance on the gradient to resolve the amplitude conflict and direction conflict of the gradients corresponding to multiple tasks during the training process of the multi-task recommendation model, thereby improving the accuracy of the multi-task recommendation model.

[0174] It should be noted that the training device for the multi-task recommendation model provided in the above embodiment only uses the division of the above functional units as an example when running an application. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the training device for the multi-task recommendation model provided in the above embodiment and the training method embodiment of the multi-task recommendation model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0175] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0176] Figure 8 is a block diagram of a resource recommendation device according to an exemplary embodiment. Figure 8 The device includes: an acquisition unit 801, a prediction unit 802, a determination unit 803 and a recommendation unit 804.

[0177] An acquisition unit 801 is configured to acquire object features of a target object and resource features of a plurality of target multimedia resources;

[0178] The prediction unit 802 is configured to input the object features of the target object and the resource features of the target multimedia resource into the multi-task recommendation model for processing for any target multimedia resource, so as to obtain a plurality of predicted interaction behaviors of the target object with respect to the target multimedia resource, wherein the multi-task recommendation model is trained based on the training method of the multi-task recommendation model;

[0179] A determination unit 803 is configured to determine a recommendation probability of a target multimedia resource based on a plurality of predicted interaction behaviors;

[0180] The recommendation unit 804 is configured to recommend at least one target multimedia resource to a target object based on the recommendation probabilities of the multiple target multimedia resources.

[0181] The disclosed embodiment provides a resource recommendation device. Since the multi-task recommendation model is used to predict multiple interactive behaviors of an object with respect to multimedia resources, the electronic device can output multiple predicted interactive behaviors of the target object with respect to the target multimedia resources based on the multi-task recommendation model, determine the recommendation probability of the target multimedia resources, and then can preferentially recommend target resources with high recommendation probabilities to the target object, thereby improving the accuracy of the recommended resources of the multi-task recommendation model and enhancing the viewing experience of the target object.

[0182] It should be noted that the resource recommendation device provided in the above embodiment only uses the division of the above functional units as an example when running an application. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the resource recommendation device provided in the above embodiment and the resource recommendation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0183] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0184] When an electronic device is provided as a terminal, Fig. 9 is a block diagram of a terminal according to an exemplary embodiment. Fig. 9 The structure block diagram of a terminal 900 provided by an exemplary embodiment of the present disclosure is shown. The terminal 900 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 900 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.

[0185] Typically, the terminal 900 includes a processor 901 and a memory 902 .

[0186] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0187] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one program code, which is used to be executed by the processor 901 to implement the training method and resource recommendation method of the multi-task recommendation model provided in the method embodiment of the present disclosure.

[0188] In some embodiments, the terminal 900 may further optionally include: a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902 and the peripheral device interface 903 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 903 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908 and a power supply 909.

[0189] The peripheral device interface 903 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0190] The radio frequency circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 904 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 904 may also include circuits related to NFC (Near Field Communication), which is not limited in the present disclosure.

[0191] The display screen 905 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to collect touch signals on the surface or above the surface of the display screen 905. The touch signal can be input to the processor 901 as a control signal for processing. At this time, the display screen 905 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 905 can be one, and the front panel of the terminal 900 is set; in other embodiments, the display screen 905 can be at least two, which are respectively set on different surfaces of the terminal 900 or are folded; in some other embodiments, the display screen 905 can be a flexible display screen, which is set on the curved surface or folded surface of the terminal 900. Even, the display screen 905 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 905 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0192] The camera assembly 906 is used to capture images or videos. Optionally, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0193] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 901 for processing, or input them into the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 900. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 907 may also include a headphone jack.

[0194] The power supply 908 is used to power various components in the terminal 900. The power supply 908 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 908 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0195] In some embodiments, the terminal 900 further includes one or more sensors 909 . The one or more sensors 909 include, but are not limited to: an acceleration sensor 910 , a gyroscope sensor 911 , a pressure sensor 912 , an optical sensor 913 , and a proximity sensor 914 .

[0196] The acceleration sensor 910 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 900. For example, the acceleration sensor 910 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 910. The acceleration sensor 910 can also be used to collect motion data of games or users.

[0197] The gyro sensor 911 can detect the body direction and rotation angle of the terminal 900, and the gyro sensor 911 can cooperate with the acceleration sensor 910 to collect the user's 3D actions on the terminal 900. The processor 901 can implement the following functions based on the data collected by the gyro sensor 911: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0198] The pressure sensor 912 can be set on the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 912 is set on the side frame of the terminal 900, it can detect the user's holding signal of the terminal 900, and the processor 901 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 912. When the pressure sensor 912 is set on the lower layer of the display screen 905, the processor 901 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 905. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0199] The optical sensor 913 is used to collect the ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 according to the ambient light intensity collected by the optical sensor 913. Optionally, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 913.

[0200] The proximity sensor 914, also called a distance sensor, is disposed on the front panel of the terminal 900. The proximity sensor 914 is used to collect the distance between the user and the front of the terminal 900. In one embodiment, when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually decreasing, the processor 901 controls the display screen 905 to switch from the screen-on state to the screen-off state; when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually increasing, the processor 901 controls the display screen 905 to switch from the screen-off state to the screen-on state.

[0201] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the terminal 900, and the terminal 900 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.

[0202] When the electronic device is provided as a server, Fig.10It is a block diagram of a server according to an exemplary embodiment. The server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1001 and one or more memories 1002, wherein the memory 1002 stores at least one program code, and the at least one program code is loaded and executed by the processor 1001 to implement the training method and resource recommendation method of the multi-task recommendation model provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1000 may also include other components for implementing device functions, which will not be repeated here.

[0203] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 902 or a memory 1002 including instructions, and the instructions can be executed by the processor 901 of the terminal 900 or the processor 1001 of the server 1000 to complete the training method of the multi-task recommendation model and the resource recommendation method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0204] A computer program product includes a computer program, which, when executed by a processor, implements the training method of the multi-task recommendation model or the resource push method.

[0205] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0206] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A training method for a multi-task recommendation model, characterized in that: The method comprises: Inputting sample training data into a multi-task recommendation model for training to obtain a plurality of first gradients, wherein the multi-task recommendation model is used to predict a plurality of interactive behaviors of an object with respect to multimedia resources, wherein the plurality of interactive behaviors correspond one-to-one to a plurality of tasks of the multi-task recommendation model, and the plurality of first gradients are gradients corresponding to the plurality of tasks, and correspond one-to-one to the plurality of tasks; The amplitudes and directions of the multiple first gradients are adjusted respectively to obtain multiple second gradients, wherein the multiple second gradients correspond to the multiple first gradients one by one, the difference between the amplitude of the second gradient and the maximum amplitude of the multiple first gradients is not greater than an amplitude threshold, and the angle between the directions of any two second gradients in the multiple second gradients is not greater than 90 degrees; The multi-task recommendation model is updated based on the average gradient of the multiple second gradients.

2. The training method of the multi-task recommendation model according to claim 1, characterized in that: The sample training data includes object features of a plurality of sample objects, resource features of a plurality of sample multimedia resources, and a plurality of historical interaction behaviors of the plurality of sample objects to the plurality of sample multimedia resources; The sample training data is input into the multi-task recommendation model for training to obtain multiple first gradients, including: Inputting the sample training data into the multi-task recommendation model for processing to obtain a plurality of predicted interaction behaviors of the plurality of sample objects to the plurality of sample multimedia resources; Based on the multiple historical interaction behaviors and the multiple predicted interaction behaviors, determining multiple training losses corresponding to the multiple tasks, wherein the training loss corresponding to each task is used to indicate the difference between the historical interaction behavior and the predicted interaction behavior corresponding to the task; Based on the plurality of training losses, the plurality of first gradients are determined.

3. The training method of the multi-task recommendation model according to claim 1, characterized in that: The amplitudes and directions of the plurality of first gradients are adjusted respectively to obtain a plurality of second gradients, including: For any first gradient, based on the target first gradient, the amplitude of the first gradient is adjusted to obtain an intermediate gradient corresponding to the first gradient, the target first gradient being a gradient with the largest amplitude among the multiple first gradients, and the difference between the amplitude of the intermediate gradient and the amplitude of the target first gradient being no greater than the amplitude threshold; Based on at least one target intermediate gradient, the direction of the intermediate gradient is adjusted to obtain the second gradient, wherein the target intermediate gradient is a gradient whose angle with the intermediate gradient is greater than 90 degrees among the intermediate gradients corresponding to the plurality of first gradients.

4. The training method of the multi-task recommendation model according to claim 3, characterized in that: The adjusting the amplitude of the first gradient based on the target first gradient to obtain an intermediate gradient corresponding to the first gradient includes: Determine a target multiple based on the amplitude of the target first gradient and the amplitude of the first gradient, wherein the target multiple is used to reflect the amplitude difference between the first gradient and the target first gradient; Determine an amplitude adjustment weight based on the target multiple and an amplitude adjustment parameter, wherein the amplitude adjustment parameter is used to reflect the amplitude difference between the first gradient after amplitude adjustment and the target first gradient, and the amplitude adjustment weight is positively correlated with the target multiple and the amplitude adjustment parameter; Based on the amplitude adjustment weight, the first gradient is weighted to obtain an intermediate gradient corresponding to the first gradient.

5. The training method of the multi-task recommendation model according to claim 3, characterized in that: The adjusting the direction of the intermediate gradient based on at least one target intermediate gradient to obtain the second gradient includes: determining a direction adjustment weight based on the at least one target intermediate gradient, the intermediate gradient, and a direction adjustment parameter, wherein the direction adjustment parameter is used to reflect the angle between the intermediate gradient after direction adjustment and any of the target intermediate gradients, and the direction adjustment weight is positively correlated with the angle between the intermediate gradient and any of the target intermediate gradients, and is positively correlated with the direction adjustment parameter; Based on the direction adjustment weight, a weighted sum is performed on the at least one target intermediate gradient and the intermediate gradient to obtain the second gradient.

6. The training method of the multi-task recommendation model according to claim 5, characterized in that: The determining the direction adjustment weight based on the at least one target intermediate gradient, the intermediate gradient and the direction adjustment parameter comprises: Determine a projection vector based on the magnitude of the at least one target intermediate gradient, the magnitude of the intermediate gradient, and the direction adjustment parameter, wherein the projection vector is used to reflect the inner product between the intermediate gradient after the direction adjustment and any of the target intermediate gradients; The direction adjustment weight is determined based on the projection vector, the at least one target intermediate gradient, and the intermediate gradient.

7. The training method of the multi-task recommendation model according to claim 6, characterized in that: The projection vector includes at least one element, and the at least one element corresponds one-to-one to the at least one target intermediate gradient; The determining of the projection vector based on the magnitude of the at least one target intermediate gradient, the magnitude of the intermediate gradient, and the direction adjustment parameter comprises: For any target intermediate gradient, the magnitude of the target intermediate gradient, the magnitude of the intermediate gradient, and the direction adjustment parameter are multiplied to obtain an element corresponding to the target intermediate gradient in the projection vector.

8. The training method of the multi-task recommendation model according to claim 7, characterized in that: The direction adjustment weight includes at least one element, and the at least one element corresponds to the at least one target intermediate gradient in one-to-one correspondence; The determining the direction adjustment weight based on the projection vector, the at least one target intermediate gradient and the intermediate gradient comprises: For any target intermediate gradient, determining a first product based on the target intermediate gradient, the first product being the product of the target intermediate gradient and the transpose of the target intermediate gradient; Determining a second product based on the target intermediate gradient and the intermediate gradient, the second product being a product of a transpose of the target intermediate gradient and the intermediate gradient; The element corresponding to the target intermediate gradient in the direction adjustment weight is obtained by subtracting the difference obtained by the second product from the element corresponding to the target intermediate gradient in the projection vector and dividing it by the first product.

9. A resource recommendation method, characterized in that: The method comprises: Acquire object characteristics of a target object and resource characteristics of a plurality of target multimedia resources; For any target multimedia resource, inputting the object features of the target object and the resource features of the target multimedia resource into a multi-task recommendation model for processing to obtain a plurality of predicted interaction behaviors of the target object with respect to the target multimedia resource, wherein the multi-task recommendation model is trained based on the training method of the multi-task recommendation model according to any one of claims 1 to 8; Determining a recommendation probability of the target multimedia resource based on the multiple predicted interaction behaviors; At least one target multimedia resource is recommended to the target object based on the recommendation probabilities of the multiple target multimedia resources.

10. A training device for a multi-task recommendation model, characterized in that: The device comprises: A training unit is configured to input sample training data into a multi-task recommendation model for training to obtain a plurality of first gradients, wherein the multi-task recommendation model is used to predict a plurality of interactive behaviors of an object with respect to multimedia resources, wherein the plurality of interactive behaviors correspond one-to-one to a plurality of tasks of the multi-task recommendation model, and the plurality of first gradients are gradients corresponding to the plurality of tasks, and correspond one-to-one to the plurality of tasks; an adjusting unit, configured to adjust the amplitudes and directions of the plurality of first gradients respectively to obtain a plurality of second gradients, wherein the plurality of second gradients correspond to the plurality of first gradients one by one, a difference between an amplitude of the second gradient and a maximum amplitude of the plurality of first gradients is not greater than an amplitude threshold, and an angle between directions of any two second gradients of the plurality of second gradients is not greater than 90 degrees; An updating unit is configured to update the multi-task recommendation model based on an average gradient of the plurality of second gradients.

11. A resource recommendation device, characterized in that: The device comprises: An acquisition unit, configured to acquire object characteristics of a target object and resource characteristics of a plurality of target multimedia resources; A prediction unit, configured to input, for any target multimedia resource, object features of the target object and resource features of the target multimedia resource into a multi-task recommendation model for processing, to obtain a plurality of predicted interaction behaviors of the target object with respect to the target multimedia resource, wherein the multi-task recommendation model is trained based on the training method for the multi-task recommendation model according to any one of claims 1 to 8; a determination unit, configured to determine a recommendation probability of the target multimedia resource based on the multiple predicted interaction behaviors; The recommendation unit is configured to recommend at least one target multimedia resource to the target object based on the recommendation probabilities of the multiple target multimedia resources.

12. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing program code executable by the processor; The processor is configured to execute the program code to implement the training method of the multi-task recommendation model as described in any one of claims 1 to 8, or the resource recommendation method as described in claim 9.

13. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the training method of the multi-task recommendation model as described in any one of claims 1 to 8, or the resource recommendation method as described in claim 9.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the training method of the multi-task recommendation model as described in any one of claims 1 to 8, or the resource recommendation method as described in claim 9 is implemented.

Citation Information

Patent Citations

  • Model parameter updating method, model parameter updating device and electronic equipment

    CN114519435A

  • Point cloud multi-task model training method and device and electronic equipment

    CN115358413A

  • Recommendation model training method and device, recommendation method and device and computer readable medium

    CN115917535A

  • Resource recommendation method, resource recommendation model training method, device and equipment

    CN117131269A

  • Model training method, document recommendation method and related products

    CN117726007A