Multi-task model training method, device and equipment and computer storage medium
Through the embedding layer, main network, user network and interest network of the multi-task model, the influence of herd level and popularity is removed, and the popularity and popularity of the recommendation system are deviated, and the accuracy and diversity of the recommendation system are improved. .
Patent Information
- Application Number
- CN202411033353.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-15
AI Technical Summary
There is a bias in the popularity of existing recommendation systems in the training data, which leads to the model's tendency to recommend popular projects and ignore long-tail projects, which in turn hinders users' preferences and diversity of recommendations. It is difficult to accurately achieve popularity and conformity with existing de-biasing methods. The deviation.
Using a multi-task model, including the embedding layer, main network, user network, material network and interest network, to obtain the interaction rate, shelter and popularity of sample users and materials through iterative training, and use interest network to remove the influence of shelter and popularity. , realize the prediction of user material interaction rate.
It improves the accuracy of the popularity and herd level, enhances the robustness and accuracy of the model, and ensures the consistency of online and offline goals.
Smart Images

Figure CN118964993A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a training method, apparatus, device and computer storage medium for a multi-task model. Background Art
[0002] With the continuous development of deep learning technology, personalized recommendations have been more and more widely used. A large number of recommendation algorithm models are trained and optimized through historical items and data of user interactions. However, the frequency distribution of items in the training data shows a long-tail distribution, that is, a few popular items contain most of the interactions, which makes the model more inclined to frequently recommend popular items. On the one hand, this popularity bias will hinder the recommendation system from better understanding user preferences and reduce the diversity of recommendations; on the other hand, it will prevent a large number of long-tail items from being exposed, which is not conducive to the virtuous cycle of the business ecosystem in the long run.
[0003] Currently, popularity debiasing is performed through a multi-task modeling framework and training and prediction methods. However, it is impossible to accurately debias popularity and conformity by simply defining a formula. Summary of the invention
[0004] The present application provides a training method, apparatus, device and computer storage medium for a multi-task model to improve the debiasing accuracy of popularity and conformity.
[0005] The technical solution of this application is implemented as follows:
[0006] The present application provides a training method for a multi-task model, wherein the multi-task model includes an embedding layer, a main network, a user network, a material network, and an interest network, and the method includes: obtaining training data; the training data includes user information of sample users and material information of sample materials; inputting the training data into an initial multi-task model, performing data transformation processing on the training data through the embedding layer to obtain sample embedding features; predicting the interaction rate of sample users to sample materials based on the sample embedding features through the main network, and obtaining a first loss function value of the main network based on the first output data output by the second hidden layer of the main network; predicting the conformity degree of sample users based on the sample embedding features through the user network, and obtaining a second loss function value of the user network based on the output second output data; the conformity degree indicates the user's interest in the popular materials. degree; through the material network, the popularity of the sample material is predicted based on the sample embedding features, and based on the output third output data, the third loss function value of the material network is obtained; the popularity represents the degree of attention paid to the material among users within a predetermined period of time; through the interest network, based on the fifth output data, the second output data and the third output data output by the first hidden layer of the main network, the interaction rate of the sample user to the sample material is predicted while removing the influence of the sample user's conformity degree and the popularity of the sample material, and based on the output fourth output data, the fourth loss function value of the interest network is obtained; based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value, the multi-task model is iteratively trained until the model convergence condition is reached, and the trained multi-task model is obtained.
[0007] In some possible implementations, the interaction rate of sample users to sample materials is predicted based on sample embedding features through the main network, and a first loss function value of the main network is obtained based on the output first output data, including: performing a first linear division process of the main network on the sample embedding features through the first hidden layer of the main network to obtain fifth output data; performing a second linear division process of the main network on the fifth output data through the second hidden layer of the main network to obtain first output data; determining a first prediction value of the interaction rate of sample users to sample materials based on the first output data and a preset first prediction function; and determining a first loss function value based on the first prediction value and a preset main network regression function.
[0008] In some possible implementations, the degree of conformity of a sample user is predicted based on a sample embedding feature through a user network, and a second loss function value of the user network is obtained based on the output second output data, including: determining a user sample embedding feature associated with the sample user in the sample embedding feature; inputting the user sample embedding feature into a user hidden layer of the user network, and performing linear division processing on the user sample embedding feature based on preset user hidden layer parameters to obtain second output data; determining a second prediction value of the degree of conformity of the sample user based on the second output data and a preset second prediction function; and determining a second loss function value based on the second prediction value and a preset user network regression function.
[0009] In some possible implementations, the popularity of the sample material is predicted based on the sample embedding feature through the material network, and a third loss function value of the material network is obtained based on the output third output data, including: determining the material sample embedding feature associated with the sample material in the sample embedding feature; inputting the material sample embedding feature into the material hidden layer of the material network, and performing linear division processing on the material sample embedding feature based on preset material hidden layer parameters to obtain the third output data; determining a third prediction value of the popularity of the sample material based on the third output data and the preset third prediction function; and determining a third loss function value based on the third prediction value and the preset material network regression function.
[0010] In some possible implementations, through the interest network, based on the fifth output data, the second output data and the third output data output by the first hidden layer of the main network, the interaction rate of the sample user to the sample material is predicted while removing the influence of the sample user's conformity and the popularity of the sample material, and based on the output fourth output data, a fourth loss function value of the interest network is obtained, including: obtaining the fifth output data output by the first hidden layer of the main network; inputting the fifth output data into the first interest hidden layer of the interest network, and performing linear division processing on the fifth output data based on the preset first interest hidden layer parameters to obtain the sixth output data; inputting the sixth output data into the second interest hidden layer of the interest network, and performing linear division processing on the sixth output data based on the preset second interest hidden layer parameters The seventh output data is linearly divided to obtain the seventh output data; the second output data is subjected to the first gradient inversion processing through the first gradient inversion adversarial layer of the interest network, and the third output data is subjected to the second gradient inversion processing through the second gradient inversion adversarial layer to obtain the first adversarial output data and the second adversarial output data; based on the seventh output data, the first adversarial output data, the second adversarial output data and the preset fourth prediction function group, by reducing the weights of the sample user's conformity and the sample material's popularity, the fourth prediction value of the sample user's interaction rate with the sample material, the fifth prediction value of the degree of confrontation with the herd, and the sixth prediction value of the degree of confrontation with the popularity are determined; based on the fourth prediction value, the fifth prediction value, the sixth prediction value and the preset interest network regression function, the fourth loss function value is determined.
[0011] In some possible embodiments, based on the seventh output data, the first adversarial output data, the second adversarial output data and the preset fourth prediction function group, a fourth prediction value of the sample user's interaction rate with the sample material, a fifth prediction value of the degree of adversarial conformity and a sixth prediction value of the degree of adversarial popularity are determined, including: determining the fourth prediction value based on the seventh output data and the prediction function associated with the seventh output data in the fourth prediction function group; determining the fifth prediction value based on the first adversarial output data and the prediction function associated with the first adversarial output data in the fourth prediction function group; determining the sixth prediction value based on the second adversarial output data and the prediction function associated with the second adversarial output data in the fourth prediction function group.
[0012] In some possible embodiments, based on the fourth prediction value, the fifth prediction value, the sixth prediction value and the preset interest network regression function, the fourth loss function value is determined, including: based on the preset first interest network regression function and the fourth prediction value, the fifth loss function value is determined; the fifth loss function is used to characterize the error of the first interest hidden layer and the second interest hidden layer; based on the preset second interest network regression function, the fifth prediction value and the third output data output by the user network, the sixth loss function value is determined; the sixth loss function value is used to characterize the error of the first gradient reversal adversarial layer; based on the preset third interest network regression function, the sixth prediction value and the fourth output data output by the material network, the seventh loss function value is determined; the seventh loss function value is used to characterize the error of the second gradient reversal adversarial layer; the fifth loss function value, the sixth loss function value and the seventh loss function value are weighted summed to determine the fourth loss function value.
[0013] In some possible implementations, obtaining training data includes: obtaining original data from a user behavior log and a material database; performing hash mapping processing on the original data to obtain first preprocessed data; the first preprocessed data is binary-coded data of a preset length; encoding the first preprocessed data to obtain second preprocessed data; the second preprocessed data is decimal-coded data of a preset length; mapping the second preprocessed data through a preset embedded matrix lookup table to obtain training data.
[0014] The present application provides a prediction method based on a multi-task model, the multi-task model is formed by training using the training method of the above embodiment, and the prediction method of the multi-task model includes: obtaining input data; the input data includes user information of a target user and material information of a material to be recommended; performing data transformation processing on the input data through an embedding layer of the multi-task model to obtain an embedding feature; the multi-task model is formed by training using the training method described in the above embodiment; determining, through a main network, a first prediction value of the target user's interaction rate with respect to the recommended material based on the embedding feature; the first prediction value is determined based on the first output data output by the main network and a preset first prediction function; determining, through an interest network, a fourth prediction value of the target user's interaction rate with respect to the recommended material under the condition of removing the influence of the target user's conformity and the popularity of the material to be recommended based on the fifth output data output by the first hidden layer of the main network; and predicting the target user's final interaction rate with respect to the recommended material based on the first prediction value and the fourth prediction value.
[0015] In some possible implementations, based on the first prediction value and the fourth prediction value, predicting the final interaction rate of the user with the recommended material includes: using the fourth prediction value output by the interest network as the predicted value of the final interaction rate of the target user with the recommended material, or performing weighted sum processing on the fourth prediction value output by the interest network and the first prediction value output by the main network to obtain the predicted value of the final interaction rate of the target user with the recommended material.
[0016] The present application provides a training device for a multi-task model, wherein the multi-task model includes an embedding layer, a main network, a user network, a material network, and an interest network. The device includes: a training data acquisition module, used to acquire training data, wherein the training data includes user information of sample users and material information of sample materials; a sample data processing module, used to input the training data into an initial multi-task model, and perform data transformation processing on the training data through the embedding layer to obtain sample embedding features; a sample data calculation module, used to predict the interaction rate of the sample user to the sample material based on the sample embedding features through the main network, and obtain the first loss function value of the main network based on the first output data output by the second hidden layer of the main network; predict the conformity degree of the sample user based on the sample embedding features through the user network, and obtain the second loss function value of the user network based on the output second output data; the conformity degree representation The user's interest level in popular materials; through the material network, the popularity of the sample material is predicted based on the sample embedding features, and the third loss function value of the material network is obtained based on the output third output data; the popularity indicates the degree of attention paid to the material by users within a predetermined period of time; through the interest network, based on the fifth output data, the second output data and the third output data output by the first hidden layer of the main network, the interaction rate of the sample user to the sample material is predicted while removing the influence of the sample user's conformity level and the popularity of the sample material, and the fourth loss function value of the interest network is obtained based on the output fourth output data; a training module is used to iteratively train the multi-task model based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value until the model convergence condition is reached to obtain the trained multi-task model.
[0017] In some possible implementations, the sample data calculation module is used to perform a first linear division process of the main network on the sample embedding features through the first hidden layer of the main network to obtain fifth output data; perform a second linear division process of the main network on the fifth output data through the second hidden layer of the main network to obtain first output data; determine a first predicted value of the interaction rate of the sample user to the sample material based on the first output data and a preset first prediction function; determine a first loss function value based on the first predicted value and a preset main network regression function.
[0018] In some possible implementations, a sample data calculation module is used to determine a user sample embedding feature associated with a sample user in the sample embedding feature; input the user sample embedding feature into a user hidden layer of a user network, and perform linear division processing on the user sample embedding feature based on preset user hidden layer parameters to obtain second output data; determine a second prediction value of the sample user's degree of conformity based on the second output data and a preset second prediction function; and determine a second loss function value based on the second prediction value and a preset user network regression function.
[0019] In some possible implementations, the sample data calculation module is used to determine the material sample embedding features associated with the sample material in the sample embedding features; input the material sample embedding features into the material hidden layer of the material network, and perform linear division processing on the material sample embedding features based on preset material hidden layer parameters to obtain third output data; determine a third prediction value of the popularity of the sample material based on the third output data and a preset third prediction function; determine a third loss function value based on the third prediction value and a preset material network regression function.
[0020] In some possible implementations, a sample data calculation module is used to obtain fifth output data output by the first hidden layer of the main network; input the fifth output data into the first interest hidden layer of the interest network, and perform linear division processing on the fifth output data based on preset first interest hidden layer parameters to obtain sixth output data; input the sixth output data into the second interest hidden layer of the interest network, and perform linear division processing on the sixth output data based on preset second interest hidden layer parameters to obtain seventh output data; perform a first gradient inversion processing on the second output data through the first gradient inversion adversarial layer of the interest network, and perform a second gradient inversion processing on the third output data through the second gradient inversion adversarial layer to obtain first adversarial output data and second adversarial output data; based on the seventh output data, the first adversarial output data, the second adversarial output data and the preset fourth prediction function group, by reducing the weights of the sample user's conformity and the popularity of the sample material, determine the fourth prediction value of the sample user's interaction rate with the sample material, the fifth prediction value of the degree of confrontation with conformity and the sixth prediction value of the degree of confrontation with popularity; determine the fourth loss function value based on the fourth prediction value, the fifth prediction value, the sixth prediction value and the preset interest network regression function.
[0021] In some possible embodiments, the sample data calculation module is used to determine a fourth prediction value based on the seventh output data and the prediction function associated with the seventh output data in the fourth prediction function group; determine a fifth prediction value based on the first adversarial output data and the prediction function associated with the first adversarial output data in the fourth prediction function group; and determine a sixth prediction value based on the second adversarial output data and the prediction function associated with the second adversarial output data in the fourth prediction function group.
[0022] In some possible embodiments, the sample data calculation module is used to determine the fifth loss function value based on the preset first interest network regression function and the fourth prediction value; the fifth loss function is used to characterize the error between the first interest hidden layer and the second interest hidden layer; the sixth loss function value is determined based on the preset second interest network regression function, the fifth prediction value and the third output data output by the user network; the sixth loss function value is used to characterize the error of the first gradient reversal adversarial layer; the seventh loss function value is determined based on the preset third interest network regression function, the sixth prediction value and the fourth output data output by the material network; the seventh loss function value is used to characterize the error of the second gradient reversal adversarial layer; the fifth loss function value, the sixth loss function value and the seventh loss function value are weightedly summed to determine the fourth loss function value.
[0023] In some possible implementations, a data acquisition module is used to acquire raw data from a user behavior log and a material database; perform hash mapping on the raw data to obtain first preprocessed data; the first preprocessed data is binary-coded data of a preset length; encode the first preprocessed data to obtain second preprocessed data; the second preprocessed data is decimal-coded data of a preset length; and map the second preprocessed data through a preset embedded matrix lookup table to obtain training data.
[0024] The embodiment of the present application provides a prediction device based on a multi-task model, which includes: a data acquisition module, used to acquire input data; the input data includes user information of a target user and material information of a material to be recommended; a data processing module, used to perform data transformation processing on the input data through an embedding layer of the multi-task model to obtain an embedded feature; the multi-task model is formed by training using a training method as in the above embodiment; a data calculation module, used to determine a first predicted value of the target user's interaction rate with respect to the recommended material through a main network based on the embedded feature; the first predicted value is determined based on the first output data output by the main network and a preset first prediction function; a fourth predicted value of the target user's interaction rate with respect to the recommended material is determined through an interest network based on the fifth output data output by the first hidden layer of the main network, while removing the influence of the target user's conformity and the popularity of the material to be recommended; a prediction module, used to predict the target user's final interaction rate with respect to the recommended material based on the first predicted value and the fourth predicted value.
[0025] In some possible implementations, the prediction module is used to use the fourth prediction value output by the interest network as the prediction value of the final interaction rate of the target user with the recommended material, or to perform weighted sum processing on the fourth prediction value output by the interest network and the first prediction value output by the main network to obtain the prediction value of the final interaction rate of the target user with the recommended material.
[0026] The present application provides an electronic device, comprising: a memory for storing executable instructions; and a processor for executing the executable instructions stored in the memory to implement the method provided by the present application.
[0027] The present application provides a computer storage medium storing executable instructions for implementing the method provided by the present application when the executable instructions are executed by a processor.
[0028] The present application provides a computer program product, including a computer program or instructions, for implementing the method provided by the present application when the computer program or instructions are executed by a processor.
[0029] This application has the following beneficial effects:
[0030] In the present application, by introducing an interest network into the multi-task model, and based on the interest network, the prediction result of the sample user's interaction rate on the sample material is obtained after removing the influence of the sample user's conformity and the popularity of the sample material. This can achieve the decoupling between the conformity, popularity and user interest, and improve the debiasing accuracy of popularity and conformity.
[0031] Furthermore, the first gradient reversal layer and the second gradient reversal layer in the interest network eliminate or weaken the influence of popularity and conformity on the prediction score of the final output of the multi-task model from the perspective of gradient transfer through an adversarial training method, reducing the problem of the model being unable to learn accurately due to artificially defined formulas and hyperparameters, making the multi-task model more robust and more accurate.
[0032] Furthermore, since the interest network can remove the influence of the sample user's conformity and the popularity of the sample material on the final prediction score, the prediction score of the interest network in the trained multi-task model can be directly used as the final prediction score, which ensures the consistency of online and offline goals and evaluations. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is the causal graph structure of the recommendation system;
[0034] Figure 2 It is a multi-task framework that includes popularity prediction and conformity prediction;
[0035] Figure 3 It is a schematic diagram of the architecture of the blog post recommendation system provided in the embodiment of the present application;
[0036] Figure 4 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0037] Figure 5It is an optional flowchart of the training method of the multi-task model provided in the embodiment of the present application;
[0038] Figure 6 It is an optional flowchart of the training method of the multi-task model provided in the embodiment of the present application;
[0039] Figure 7 It is an optional flowchart of the training method of the multi-task model provided in the embodiment of the present application;
[0040] Figure 8 It is an optional structural diagram of a multi-task model provided in an embodiment of the present application;
[0041] Fig. 9 It is an optional flowchart of the training method of the multi-task model provided in the embodiment of the present application;
[0042] Fig.10 It is an optional flowchart of the prediction method based on the multi-task model provided in the embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0044] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0045] If similar descriptions of "first / second" appear in the application documents, the following explanation is added. In the following description, the terms "first / second / third" involved are merely to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first / second / third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0047] With the continuous development of deep learning technology, personalized recommendations have been more and more widely used. A large number of recommendation algorithm models are trained and optimized through historical items and data of user interactions. However, the frequency of items in the training data is unevenly distributed and easily affected by many factors, such as exposure mechanism, item quality, promotional activities, etc., resulting in a long-tail distribution of the frequency distribution of items in most cases, that is, a few popular items contain most of the interactions, making the model more inclined to frequently recommend popular items. On the one hand, this popularity bias will hinder the recommendation system from better understanding user preferences and reduce the diversity of recommendations; on the other hand, it will prevent a large number of long-tail items from being exposed, which is not conducive to the virtuous cycle of the business ecosystem in the long run.
[0048] The existing popularity debiasing method draws on the idea of causal inference. By constructing a causal graph and then modeling the causal effect, it fully explores the impact of item popularity on each specific user interaction, thereby eliminating the impact of popularity. At present, the causal graph abstracted by most recommendation system models mainly contains four factors: user representation vector U, item representation vector I, user-item matching feature K and ranking score Y. Figure 1 , Figure 1 is the causal graph structure of the recommendation system. The structure of the causal graph of the traditional recommendation system model without considering popularity is as follows Figure 1 As shown in Figure (a), the path U&I→K…→Y represents the ranking score obtained by fitting the user-item matching features through model training. Figure 1 Figure (b) shows the causal graph structure of the fusion project popularity, where the path I→Y represents the direct impact of popularity on the score. Figure 1 Figure (c) shows the causal graph structure that integrates item popularity and user conformity, where the path U→Y represents user conformity. Similar to popularity, conformity reflects the behavioral differences between different users. Some users naturally like popular items, while others do not. The purpose of adding user conformity is to allow the model to better model the user's score for the item and the impact of the item's popularity on the score.
[0049] See also Figure 2 , Figure 2 It is a multi-task framework that includes popularity prediction and conformity prediction. Figure 1 When modeling the structure shown in Figure (c), a multi-task framework is often used. The specific structure is as follows Figure 2As shown in the figure, during training, the model in the middle serves as the main task, and the user tower and project tower on the left and right sides serve as auxiliary tasks. The user tower and project tower respectively learn the estimated values of user features and project features when they act alone, which can be approximated as the user's herd value and the material's popularity value. During training, their true labels remain consistent with the main task.
[0050] Taking the classification task as an example, the above Figure 2 When training the model structure shown, the loss calculation formula for each task is as follows:
[0051]
[0052]
[0053]
[0054] Training phase:
[0055] Prediction stage:
[0056] Among them, c is the hyperparameter specified manually during prediction, and σ is the sigmoid function.
[0057] The following disadvantages exist in the process of debiasing popularity through the above multi-task modeling framework and the training and prediction methods: 1. The fusion points are specified during training. It is obtained by the multiplication operation shown in formula (4). On the one hand, this simple method of defining popularity scores and conformity scores limits the upper limit of the model. In fact, it is difficult to clearly describe the impact of popularity and conformity on the final result (i.e., predicted score) by defining a simple formula; on the other hand, this coupled training method requires updating multiple losses at the same time, such as L in formula (1). o , L in formula (2) u , L in formula (3) i , which makes the loss weight allocation a difficult problem, thus affecting the accurate learning of each task. 2. The prediction score used in the prediction process is not the final fusion score, but a value related to popularity and conformity is subtracted from the final fusion score; therefore, according to the calculation method of formula (5), the corresponding hyperparameters need to be configured; this will, on the one hand, lead to inconsistency between the training results and the prediction results, and it is impossible to use the training indicators to evaluate the quality of the final prediction results; on the other hand, similar to the problems in training, the simply defined scoring formula cannot determine the impact of the formula and hyperparameters on the final prediction results.
[0058] In view of the above problems, an embodiment of the present application provides a training method for a multi-task model to improve the debiasing accuracy of popularity and conformity.
[0059] The following describes an exemplary application of the electronic device provided by the embodiment of the present application. The electronic device provided by the embodiment of the present application can be implemented as various types of user terminals such as a laptop computer, a tablet computer, a desktop computer, a mobile device (for example, a mobile phone, a wearable smart watch, a dedicated messaging device), and can also be implemented as a server. The following describes an exemplary application when the electronic device is implemented as a server.
[0060] See also Figure 3 , Figure 3 Schematic diagram of the architecture of the blog post recommendation system provided by the embodiment of the present application. After the multi-task model described in the embodiment of the present application is trained, the blog post recommendation system can recommend the recommended materials with high predicted scores to the user according to the predicted scores of the recommended materials by the multi-task model. The electronic device (electronic device 400-1 and electronic device 400-2 are shown as examples) is connected to the server 200 via the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two.
[0061] In some possible implementations, user A may publish material information A through electronic device 400-1, and user B may publish material information B through electronic device 400-2. Material information A and material information B are uploaded to server 200 through network 300. Server 200 may store material information A and material information B in database 500. In order to accurately push materials according to the interests of users, server 200 may push material documents of material information with the highest degree of matching with the interests of users to users after sorting, and the material documents pushed to users may be displayed on the graphical interface of electronic device 400 (graphical interface 410-1 and graphical interface 410-2 are shown as examples).
[0062] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms. The electronic device 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present invention.
[0063] See also Figure 4 , Figure 4is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 4 The electronic device 400 shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the electronic device 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 4 Various buses are labeled as bus system 440 .
[0064] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0065] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0066] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.
[0067] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0068] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0069] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0070] A network communication module 452, for reaching other computing devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, wireless compatibility certification (WiFi), and universal serial bus (USB);
[0071] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);
[0072] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.
[0073] In some embodiments, the training device for the multi-task model provided in the embodiments of the present application can be implemented in software. Figure 4 A training device 455 of a multi-task model stored in a memory 450 and a prediction device 456 based on the multi-task model are shown, which can be software in the form of programs and plug-ins, etc. The training device 455 of the multi-task model includes the following software modules: a preprocessing module 4551, a sample data processing module 4552, a sample data calculation module 4553 and a training module 4554; the prediction device 456 based on the multi-task model includes the following software modules: a data acquisition module 4561, a data processing module 4562, a data calculation module 4563 and a prediction module 4564.
[0074] These modules are logical, so they can be arbitrarily combined or further divided according to the functions to be implemented. The functions of each module will be explained below.
[0075] In other embodiments, the training device of the multi-task model and the prediction device based on the multi-task model provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the training method of the multi-task model or the prediction method based on the multi-task model provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD), field programmable gate array (FPGA) or other electronic components.
[0076] The following will illustrate the training method of the multi-task model provided in the embodiment of the present application in combination with the exemplary application and implementation of the electronic device provided in the embodiment of the present application.
[0077] See also Figure 5 , Figure 5 This is an optional flow chart of the training method of the multi-task model provided in the embodiment of the present application, wherein the multi-task model is used to finely sort materials, and the multi-task model includes an embedding layer, a main network, a user network, a material network, and an interest network. Figure 5 The steps shown illustrate the training method of the multi-task model.
[0078] It should be noted that the multi-task model mentioned in the embodiment of the present application is applied to a blog post recommendation system, in which the items are materials posted by users in the blog post recommendation system.
[0079] S501, obtaining training data.
[0080] The training data includes user information of sample users and material information of sample materials.
[0081] It is understandable that training data, as an important part of model training, determines the quality of the prediction results output by the model. Training data can be obtained by preprocessing the raw data. The raw data can be obtained from the user behavior log and the material database, which can specifically include the user information of the sample user and the material information of the sample material, as well as the cross information of the sample user and the sample material and the context information of the sample recommended material currently recommended by the blog recommendation system.
[0082] In an embodiment of the present application, the user information of the sample user can be divided into basic user attribute information and user behavior and preference information, wherein the basic user attribute information may include but is not limited to: age, gender, occupation and other information, and the user behavior and preference information may include but is not limited to user behavior sequence and user tag preference, etc. The material information of the sample material can be divided into basic material attribute information and material statistical information, wherein the basic material attribute information may include but is not limited to: material type, material theme and author information, etc., and the material statistical information may include but is not limited to: number of exposures and number of clicks, etc. The cross-information between the sample user and the sample material may include but is not limited to: whether the sample user has interacted with the author corresponding to the sample material, the sample user's preference score for the topic corresponding to the sample material, etc. The contextual information of the sample recommended material may include but is not limited to: the time when the sample user browsed the sample recommended material and the current number of recommended pages of the blog recommendation system, etc.
[0083] In some possible implementations, the above S501 may include: obtaining original data from user behavior logs and material databases; performing hash mapping processing on the original data to obtain first preprocessed data; the first preprocessed data is binary encoded data of a preset length; encoding the first preprocessed data to obtain second preprocessed data; the second preprocessed data is decimal encoded data of a preset length; mapping the second preprocessed data through a preset embedded matrix lookup table to obtain training data.
[0084] It can be understood that after obtaining the original data from the user behavior log and the material database, the original data can be hash mapped to obtain the corresponding features, where each feature corresponds to a unique slot, and the slot number is represented by a 10-bit binary code; the value of each of the above features is hash mapped, and the value of each feature is mapped to a 54-bit binary code; the above two sets of codes are spliced to obtain a 64-bit code corresponding to each feature; the 64-bit code corresponding to each feature is converted into a decimal index number; each of the above features and its corresponding value is mapped to a 16-dimensional low-dimensional dense vector through an embedded matrix lookup table to obtain training data. Among them, by performing a unified hash mapping on the original data, a sufficiently large hash space can be opened up to avoid conflicts. The splicing combination of the 10-bit binary code of the slot number and the corresponding 54-bit binary code, the resulting 64-bit code can be used to represent the combination of "feature-feature value". The obtained training data is the input data for multi-task model training. According to the division of the original data, the training data can also be divided into: user features, material features, cross features and context features.
[0085] S502, input the training data into the initial multi-task model, perform data transformation processing on the training data through the embedding layer, and obtain sample embedding features.
[0086] It can be understood that after obtaining the training data of the multi-task model, the architecture of the multi-task model can be constructed. The multi-task model includes an embedding layer, a main network, a user network, a material network, and an interest network. After the training data (i.e., user features, material features, cross features, and context features) are input into the embedding layer, the embedding layer can perform data transformation processing on the training data. After the data transformation processing is completed, the embedding layer outputs the sample embedding features.
[0087] S503, predicting the interaction rate of the sample user to the sample material based on the sample embedding feature through the main network, and obtaining the first loss function value of the main network based on the first output data output by the second hidden layer of the main network.
[0088] It can be understood that the sample embedding features are input into the main network, and the main network can include at least two hidden layers, and the hidden layer performs linear division processing on the input data. The activation function of each hidden layer uses the relu function, and the dimension of each hidden layer is different (that is, the number of neurons is different). The data output by the last hidden layer, after further calculation, can obtain the score of the interaction rate of the sample user to the sample material (that is, the first output data); further, the score of the above interaction rate is substituted into the preset main network regression function for calculation, and the loss function value of the main network (that is, the first loss function value) can be obtained.
[0089] In the embodiment of the present application, during the training process of the multi-task model, the interaction rate represents the probability that the sample user will interact with the sample material; during the online use of the multi-task model, the interaction rate represents the probability that the user will interact with the recommended material; wherein the interactive behavior may include but is not limited to: clicks, comments, forwarding, viewing, collection, etc., which are not specifically limited in the embodiment of the present application.
[0090] S504, predicting the conformity degree of the sample user based on the sample embedding feature through the user network, and obtaining a second loss function value of the user network based on the output second output data.
[0091] Among them, the degree of conformity indicates the user's interest in popular materials.
[0092] It can be understood that the input data of the user network comes from the embedding layer. The embedding layer inputs the features associated with the sample users in the sample embedding features (i.e., the user sample embedding features) into the user network for data processing. The data output by the last network layer of the user network is further calculated to obtain the predicted value of the degree of conformity of the sample user (i.e., the second output data); further, the score of the predicted value of the degree of conformity of the above-mentioned sample user is substituted into the preset user network regression function for calculation, and the loss function value of the user network (i.e., the second loss function value) can be obtained.
[0093] S505, predicting the popularity of the sample material based on the sample embedding feature through the material network, and obtaining a third loss function value of the material network based on the output third output data.
[0094] The popularity indicates the degree of attention a material receives among users within a predetermined period of time.
[0095] It can be understood that the input data of the material network comes from the embedding layer. The embedding layer inputs the features associated with the sample materials in the sample embedding features (i.e., the material sample embedding features) into the material network for data processing. The data output by the last network layer of the material network is further calculated to obtain the predicted value of the popularity of the sample material (i.e., the third output data); further, the score of the predicted value of the popularity of the above sample material is substituted into the preset material network regression function for calculation, and the loss function value of the material network (i.e., the third loss function value) can be obtained.
[0096] S506, through the interest network, based on the fifth output data, the second output data and the third output data output by the first hidden layer of the main network, the interaction rate of the sample user to the sample material is predicted while removing the influence of the sample user's conformity and the popularity of the sample material, and based on the output fourth output data, the fourth loss function value of the interest network is obtained.
[0097] It can be understood that the output data of one of the network layers of the main network can be used as the input data of the interest network, and the output results of the material network (i.e., the third output data) and the output results of the user network (i.e., the second output data) can also be input into the interest network. Among them, the output data of one of the network layers of the main network is used to predict the interaction rate of sample users to sample materials based on their interests, and the output results of the material network and the output results of the user network are input into the interest network as adversarial targets (adversarial targets include the popularity of sample materials and the conformity of sample users) so that the interest network can calculate the predicted value of the interaction rate of sample users to sample materials (i.e., the fourth output data) based on the output results of the last network layer, after removing the influence of the conformity of sample users and the popularity of sample materials; further, the score of the predicted value of the interaction rate of sample users to sample materials after removing the influence of the conformity of sample users and the popularity of sample materials is substituted into the preset interest network regression function for calculation, and the loss function value of the interest network (i.e., the fourth loss function value) can be obtained.
[0098] S507, based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value, iteratively train the multi-task model until the model convergence condition is reached, to obtain a trained multi-task model.
[0099] It can be understood that the network architecture of the multi-task model is mainly composed of an embedding layer, a main network, a user network, a material network and an interest network, wherein the main network, the user network, the material network and the interest network respectively output corresponding loss function values (i.e., the first loss function value, the second loss function value, the third loss function value and the fourth loss function value), and the above-mentioned first loss function value, the second loss function value, the third loss function value and the fourth loss function value are summed up to obtain the total loss function value of the multi-task model. According to the total loss function value, the multi-task model is iteratively trained for multiple rounds until the multi-task model converges, and a trained multi-task model can be obtained.
[0100] In some possible implementations, see Figure 6 , Figure 6 It is an optional flowchart of the training method of the multi-task model provided in an embodiment of the present application. The above S503 may include S601 to S604.
[0101] S601, performing the first linear division process of the main network on the sample embedding features through the first hidden layer of the main network to obtain fifth output data.
[0102] It can be understood that the embedding layer inputs the sample embedding features into the first hidden layer of the main network (i.e., the first hidden layer), the first hidden layer performs the first linear division processing of the main network on the sample embedding features, and outputs the fifth output data to the second hidden layer of the main network (i.e., the second hidden layer).
[0103] S602, performing a second linear division process of the main network on the fifth output data through the second hidden layer of the main network to obtain the first output data.
[0104] It can be understood that the second hidden layer performs the second linear division processing of the main network on the input fifth output data and outputs the first output data.
[0105] S603: Determine a first prediction value of the interaction rate of the sample user to the sample material based on the first output data and a preset first prediction function.
[0106] It is understandable that by substituting the value of the first output data into the formula of the first prediction function, the first prediction value of the interaction rate of the sample user to the sample material can be calculated. It should be noted that the first prediction value of the main network does not remove the influence of the degree of conformity and popularity.
[0107] S604: Determine a first loss function value based on the first prediction value and a preset main network regression function.
[0108] It can be understood that by substituting the first prediction value into the formula of the main network regression function, the first loss function value of the main network can be calculated.
[0109] In the embodiment of the present application, the number of hidden layers in the main network is at least 2, and the number of hidden layers can also be increased according to actual needs. The embodiment of the present application does not specifically limit the number of hidden layers in the main network.
[0110] In one example, the architecture and data processing process of the main network are described by assuming that the number of hidden layers in the main network is 4. Assume that the interaction rate of sample users to sample materials is the click rate. For ease of explanation, the first hidden layer of the main network is recorded as hidden layer 1, the second hidden layer of the main network is recorded as hidden layer 2, the third hidden layer of the main network is recorded as hidden layer 3, and the fourth hidden layer of the main network is recorded as hidden layer 4. Assume that the embedding vector x∈R output by the embedding layer N*D , where N represents the number of samples (batch_size) for each training of the multi-task model, R represents the real number space, and N and D represent the dimensions; D = S*d, where S represents the number of slots for sample embedding features, and d is the 16-dimensional vector of each sample embedding feature map. The number of parameters in hidden layer 1 is Among them, W1 and b1 are the weights of hidden layer 1, L1 is the dimension of hidden layer 1 (that is, the number of neurons in hidden layer 1); the number of parameters of hidden layer 2 is Among them, W2 and b2 are the weights of hidden layer 2, L2 is the dimension of hidden layer 2 (that is, the number of neurons in hidden layer 2); the number of parameters of hidden layer 3 is Among them, W3 and b3 are the weights of hidden layer 3, L3 is the dimension of hidden layer 3 (that is, the number of neurons in hidden layer 3); the number of parameters of hidden layer 4 is b4∈R 1*1 , where W4 and b4 are the weights of hidden layer 4, and the dimension of hidden layer 4 (i.e., the number of neurons in hidden layer 4) is 1. The calculation formulas for each hidden layer in the main network are as follows:
[0111] h1 = relu(x*W1+b1) (6)
[0112] h2 = relu(h1*W2+b2) (7)
[0113] h3 = relu(h2*W3+b3) (8)
[0114] h4 = h3*W4+b4 (9)
[0115] y m =sigmoid(h4) (10)
[0116]
[0117] Among them, formula (6) is the calculation formula of hidden layer 1, h1 is the output data of hidden layer 1; formula (7) is the calculation formula of hidden layer 2, h2 is the output data of hidden layer 2; formula (8) is the calculation formula of hidden layer 3, h3 is the output data of hidden layer 3; formula (9) is the calculation formula of hidden layer 4, h4 is the output data of hidden layer 4; formula (10) is the formula of the first prediction function, y m is the first predicted value output by the main network; Formula (11) is the formula of the main network regression function, L m is the first loss function value, y i represents the true label of the i-th sample material (i.e., whether it is clicked, clicked is 1, not clicked is 0), y mi Represents the first predicted value of the i-th sample material.
[0118] In some possible implementations, the above S504 may include: determining a user sample embedding feature associated with a sample user in the sample embedding feature; inputting the user sample embedding feature into a user hidden layer of a user network, and performing linear division processing on the user sample embedding feature based on preset user hidden layer parameters to obtain second output data; determining a second prediction value of the sample user's degree of conformity based on the second output data and a preset second prediction function; and determining a second loss function value based on the second prediction value and a preset user network regression function.
[0119] It can be understood that the number of user hidden layers of the user network can be designed and constructed according to actual needs. After the user hidden layer performs linear division processing on the user sample embedding features, the second output data can be obtained; the numerical value of the second output data is substituted into the formula of the second prediction function to calculate the predicted value of the sample user's degree of conformity (i.e., the second prediction value); the second prediction value is substituted into the formula of the user network regression function to calculate the second loss function value of the user network.
[0120] In one example, the user network architecture and data processing process are described by taking the user network as having 4 user hidden layers and the user network also including a user embedding layer. For ease of description, the first user hidden layer of the user network is recorded as user hidden layer 1, the second user hidden layer of the user network is recorded as user hidden layer 2, the third user hidden layer of the user network is recorded as user hidden layer 3, and the fourth user hidden layer of the user network is recorded as user hidden layer 4. Assume that the embedding layer inputs the user embedding vector of the user embedding layer of the user network Among them, N and D u Indicates dimension; D u =S u *d, where S urepresents the number of slots for embedding features of user samples, and d is the 16-dimensional vector of each user sample embedding feature map. After the user embedding layer performs data transformation on the user embedding vector, the obtained data is input into the user hidden layer 1. The number of parameters of the user hidden layer 1 is Among them, W u1 and b u1 is the weight of the user hidden layer 1, L u1 is the dimension of user hidden layer 1 (i.e. the number of neurons in user hidden layer 1); the number of parameters of user hidden layer 2 is Among them, W u2 and b u2 is the weight of user hidden layer 2, L u2 is the dimension of user hidden layer 2 (i.e. the number of neurons in user hidden layer 2); the number of parameters of user hidden layer 3 is Among them, W u3 and b u3 is the weight of user hidden layer 3, L u3 is the dimension of user hidden layer 3 (i.e. the number of neurons in user hidden layer 3); the number of parameters of user hidden layer 4 is b u4 ∈R 1 *1 , where W u4 and b u4 is the weight of user hidden layer 4, and the dimension of user hidden layer 4 (i.e., the number of neurons in user hidden layer 4) is 1. The calculation formulas for each user hidden layer in the user network are as follows:
[0121] h u1 = relu(stop_gradient(x u )*W u1 +b u1 ) (12)
[0122] h u2 = relu(h u1 *W u2 +b u2 ) (13)
[0123] h u3 = relu(h u2 *W u3 +b u3 ) (14)
[0124] h u4 = h u3 *W u4 +b u4 (15)
[0125] y u=sigmoid(h u4 ) (16)
[0126]
[0127] Among them, formula (12) is the calculation formula of user hidden layer 1, h u1 is the output data of user hidden layer 1; formula (13) is the calculation formula of user hidden layer 2, h u2 is the output data of user hidden layer 2; Formula (14) is the calculation formula of user hidden layer 3, h u3 is the output data of user hidden layer 3; Formula (15) is the calculation formula of user hidden layer 4, h u4 is the output data of user hidden layer 4; Formula (16) is the formula of the second prediction function, y u is the second predicted value output by the user network; Formula (17) is the formula of the user network regression function, L u is the second loss function value, y ui Represents the predicted value of the conformity degree of the i-th sample user.
[0128] It should be noted that in the process of training the multi-task model, a gradient cutoff (stop_gradient) is set between the user network and the main network. The gradient cutoff is specifically set between the user embedding layer of the user network and the embedding layer of the main network. In this way, it can be ensured that the training of the user network has no effect on the training of the main network, and the embedding vector x u The learning of (i.e., sample embedding features) is only updated by the main network training.
[0129] In some possible implementations, the above S505 may include: determining a material sample embedding feature associated with a sample material in the sample embedding feature; inputting the material sample embedding feature into a material hidden layer of a material network, and performing linear division processing on the material sample embedding feature based on preset material hidden layer parameters to obtain a third output data; determining a third prediction value of the popularity of the sample material based on the third output data and a preset third prediction function; and determining a third loss function value based on the third prediction value and a preset material network regression function.
[0130] It can be understood that the number of material hidden layers of the material network can be designed and constructed according to actual needs. After the material hidden layer performs linear division processing on the material sample embedding features, the third output data can be obtained; the numerical value of the third output data is substituted into the formula of the third prediction function to calculate the predicted value of the popularity of the sample material (ie, the third prediction value); the third prediction value is substituted into the formula of the material network regression function to calculate the third loss function value of the material network.
[0131] In an example, the material network architecture and data processing process are described by taking the case that the number of material hidden layers in the material network is 4 and the material network also includes a material embedding layer. For ease of description, the first material hidden layer of the material network is recorded as material hidden layer 1, the second material hidden layer of the material network is recorded as material hidden layer 2, the third material hidden layer of the material network is recorded as material hidden layer 3, and the fourth material hidden layer of the material network is recorded as material hidden layer 4. Assume that the embedding layer inputs the material embedding vector of the material embedding layer of the material network Among them, N and D i Indicates dimension; D i =S i *d, where S i represents the number of slots for embedding features of material samples, and d is the 16-dimensional vector of each material sample embedding feature map. After the material embedding layer performs data transformation on the material embedding vector, the obtained data is input into the material hidden layer 1. The number of parameters of the material hidden layer 1 is Among them, W i1 and b i1 is the weight of the material hidden layer 1, L i1 is the dimension of material hidden layer 1 (i.e. the number of neurons in material hidden layer 1); the number of parameters of material hidden layer 2 is Among them, W i2 and b i2 is the weight of the material hidden layer 2, L i2 is the dimension of material hidden layer 2 (i.e. the number of neurons in material hidden layer 2); the number of parameters of material hidden layer 3 is Among them, W i3 and b i3 is the weight of the material hidden layer 3, L i3 is the dimension of material hidden layer 3 (i.e. the number of neurons in material hidden layer 3); the number of parameters of material hidden layer 4 is b i4 ∈R 1*1 , where W i4 and b i4 is the weight of the material hidden layer 4, and the dimension of the material hidden layer 4 (i.e., the number of neurons in the material hidden layer 4) is 1. The calculation formulas for each material hidden layer in the material network are as follows:
[0132] h i1 = relu(stop_gradient(x i )*W i1 +b i1 ) (18)
[0133] h i2 = relu(h i1 *Wi2 +b i2 ) (19)
[0134] h i3 = relu(h i2 *W i3 +b i3 ) (20)
[0135] h i4 = h i3 *W i4 +b i4 (twenty one)
[0136] y i =sigmoid(h i4 ) (twenty two)
[0137]
[0138] Wherein, formula (18) is the calculation formula of material hidden layer 1, h i1 is the output data of material hidden layer 1; formula (19) is the calculation formula of material hidden layer 2, h i2 is the output data of material hidden layer 2; formula (20) is the calculation formula of material hidden layer 3, h i3 is the output data of material hidden layer 3; formula (21) is the calculation formula of material hidden layer 4, h i4 is the output data of material hidden layer 4; Formula (22) is the formula of the third prediction function, y i is the third predicted value output by the material network; Formula (23) is the formula of the material network regression function, L i is the third loss function value, y ii Represents the predicted value of the popularity of the i-th sample material.
[0139] It should be noted that in the process of training the multi-task model, a gradient cutoff (stop_gradient) is set between the material network and the main network. The gradient cutoff is specifically set between the material embedding layer of the material network and the embedding layer of the main network. In this way, it can be ensured that the training of the material network has no effect on the training of the main network, and the embedding vector x u The learning of (i.e., sample embedding features) is only updated by the main network training.
[0140] In some possible implementations, see Figure 7 , Figure 7 It is an optional flowchart of the training method of the multi-task model provided in an embodiment of the present application. The above S506 may include S701 to S706.
[0141] S701, obtaining fifth output data output by the first hidden layer of the main network.
[0142] It can be understood that the input data of the interest network comes from the output data of one of the hidden layers of the main network. For example, when the main network includes two hidden layers, the output data of the first hidden layer can be used as the input data of the interest network; when the main network includes four hidden layers, the output data of the second hidden layer can be used as the input data of the interest network. It can be understood that when the main network includes two hidden layers, the interest network and the main network share the first hidden layer of the main network, and in this case, the first hidden layer is used to represent the first hidden layer of the main network; when the main network includes four hidden layers, the interest network and the main network share the first hidden layer and the second hidden layer of the main network, and in this case, the first hidden layer is used to represent the first hidden layer and the second hidden layer of the main network.
[0143] S702, input the fifth output data into the first interest hidden layer of the interest network, and perform linear division processing on the fifth output data based on preset first interest hidden layer parameters to obtain sixth output data.
[0144] It can be understood that the output data of the first hidden layer of the main network (i.e., the fifth output data) is input into the first interest hidden layer of the interest network (i.e., the first interest hidden layer), and after the first interest hidden layer performs linear division processing on the fifth output data (i.e., the first linear division processing of the interest network), it outputs the sixth output data.
[0145] S703, input the sixth output data into the second interest hidden layer of the interest network, and perform linear division processing on the sixth output data based on preset second interest hidden layer parameters to obtain seventh output data.
[0146] It can be understood that the second network layer of the interest network includes a second interest hidden layer. The first interest hidden layer located in the first network layer inputs the sixth output data to the second interest hidden layer. After the second interest hidden layer performs linear division processing on the sixth output data (i.e., the second linear division processing of the interest network), it outputs the seventh output data.
[0147] S704, performing a first gradient reversal process on the second output data through the first gradient reversal adversarial layer of the interest network, and performing a second gradient reversal process on the third output data through the second gradient reversal adversarial layer, to obtain first adversarial output data and second adversarial output data.
[0148] It can be understood that the second network layer of the interest network also includes a first gradient reversal layer and a second gradient reversal layer, that is, the second network layer of the interest network includes a first gradient reversal layer, a second interest hidden layer and a second gradient reversal layer arranged in parallel. The sixth output data output by the first interest hidden layer is also input into the first gradient reversal layer and the second gradient reversal layer. The first gradient reversal layer performs a first gradient reversal process on the second output data to obtain first adversarial output data; the second gradient reversal layer performs a second gradient reversal process on the third output data to obtain second adversarial output data.
[0149] In some embodiments, the first gradient reversal layer includes two network layers, the first network layer is a gradient reversal layer, and the second network layer is a conformity antagonism layer; wherein the gradient reversal layer and the conformity antagonism layer in the first gradient reversal layer are used to achieve the purpose of antagonizing the degree of conformity by reducing the weight of the degree of conformity, thereby realizing the decoupling between the degree of conformity of the sample user and the interest of the sample user in the sample material.
[0150] In some embodiments, the second gradient reversal layer includes two network layers, the first network layer is a gradient reversal layer, and the second network layer is a popularity confrontation layer; wherein the gradient reversal layer and the popularity confrontation layer in the second gradient reversal layer are used to achieve the purpose of confronting popularity by reducing the weight of popularity, thereby achieving decoupling between the popularity of sample materials and the interest of sample users in the sample materials.
[0151] S705, based on the seventh output data, the first adversarial output data, the second adversarial output data and the preset fourth prediction function group, by reducing the weights of the sample user's conformity and the popularity of the sample material, determine the fourth prediction value of the sample user's interaction rate with the sample material, the fifth prediction value of the degree of confrontation with conformity and the sixth prediction value of the degree of confrontation with popularity.
[0152] It can be understood that according to the seventh output data output by the second interest hidden layer, the first adversarial output data output by the first gradient reversal layer, the second adversarial output data output by the second gradient reversal layer, and the preset fourth prediction function group (the fourth prediction function group includes the prediction function associated with the seventh output data, the prediction function associated with the first adversarial output data, and the prediction function associated with the second adversarial output data), the predicted value of the interaction rate after removing the degree of conformity and popularity (i.e., the fourth prediction value) can be further calculated. The fourth prediction value is not affected by the degree of conformity of the sample user and the popularity of the sample material, and represents the predicted value of the probability that the sample user will interact with the sample material based on interest.
[0153] In some possible implementations, the above S705 may include: determining a fourth prediction value based on the seventh output data and the prediction function associated with the seventh output data in the fourth prediction function group; determining a fifth prediction value based on the first adversarial output data and the prediction function associated with the first adversarial output data in the fourth prediction function group; determining a sixth prediction value based on the second adversarial output data and the prediction function associated with the second adversarial output data in the fourth prediction function group.
[0154] It can be understood that the second interest hidden layer, the first gradient reversal layer and the second gradient reversal layer respectively calculate the corresponding output data (i.e., the seventh output data, the first adversarial output data and the second adversarial output data), and the above-mentioned seventh output data, the first adversarial output data and the second adversarial output data are respectively substituted into the prediction functions associated therewith in the fourth prediction function group to obtain the fourth prediction value, the fifth prediction value and the sixth prediction value.
[0155] S706, determine a fourth loss function value based on the fourth prediction value, the fifth prediction value, the sixth prediction value and the preset interest network regression function.
[0156] It can be understood that the fourth prediction value corresponds to the second interest hidden layer, the fifth prediction value corresponds to the first gradient reversal layer against the degree of conformity, and the sixth prediction value corresponds to the second gradient reversal layer against the degree of popularity. The fourth prediction value, the fifth prediction value, and the sixth prediction value all have corresponding loss function values. The loss function values corresponding to the fourth prediction value, the fifth prediction value, and the sixth prediction value are weighted and summed to obtain the fourth loss function value.
[0157] In some possible implementations, the above S706 may include: determining the fifth loss function value based on the preset first interest network regression function and the fourth prediction value; the fifth loss function is used to characterize the error between the first interest hidden layer and the second interest hidden layer; determining the sixth loss function value based on the preset second interest network regression function, the fifth prediction value and the third output data output by the user network; the sixth loss function value is used to characterize the error of the first gradient reversal adversarial layer; determining the seventh loss function value based on the preset third interest network regression function, the sixth prediction value and the fourth output data output by the material network; the seventh loss function value is used to characterize the error of the second gradient reversal adversarial layer; and determining the fourth loss function value by weighted summing the fifth loss function value, the sixth loss function value and the seventh loss function value.
[0158] It can be understood that the first interest network regression function is associated with the fourth prediction value, and the fourth prediction value is substituted into the first interest network regression function to calculate the fifth loss function value; the second interest network regression function is associated with the fifth prediction value, and the fifth prediction value and the data output by the last layer of the user hidden layer of the user network (i.e., the third output data) are substituted into the second interest network regression function to calculate the sixth loss function value; the third interest network regression function is associated with the sixth prediction value, and the sixth prediction value and the data output by the last layer of the material hidden layer of the material network (i.e., the fourth output data) are substituted into the third interest network regression function to calculate the seventh loss function value. Substituting the fifth loss function value, the sixth loss function value, and the seventh loss function value into the preset weighted summation formula for calculation, the total loss function value of the interest network (i.e., the fourth loss function value) can be obtained.
[0159] In one example, assuming that the interaction rate of sample users to sample materials is click rate, the number of parameters of the first network layer (i.e., the first interest hidden layer) of the interest network is Among them, W interest1 and b interest1 is the weight of the first hidden layer of interest, R represents the real number space, L i1 is the dimension of the first hidden layer of interest (i.e., the number of neurons in the first hidden layer of interest), L i2 is the dimension of the second hidden layer of interest (i.e., the number of neurons in the second hidden layer of interest). The number of parameters of the second hidden layer of interest in the second network layer of the interest network is b interest2 ∈R 1*1 , where W interest2 and b interest2 is the weight of the second interest hidden layer. The number of parameters of the first gradient reversal layer in the second network layer of the interest network is b uadv2 ∈R 1*1 , where W uadv2 and b uadv2 is the weight of the first gradient reversal layer. The number of parameters of the second gradient reversal layer in the second network layer of the interest network is b iadv2 ∈R 1*1 , where W iadv2 and b iadv2 is the weight of the second gradient reversal layer. The interest network has three fitting targets, namely: the predicted value of the interaction rate of interest (i.e., the fourth prediction value), the prediction value of the degree of conformity (i.e., the fifth predicted value) and the predicted value of prevalence (i.e., the sixth predicted value). The calculation formulas for each network layer in the interest network are as follows:
[0160] h interest1 = relu(stop_gradient(h2)*W interest1 +b interest1 ) (twenty four)
[0161] h interest2 = h interest1 *W interest2 +b interest2 (25)
[0162]
[0163] Wherein, formula (24) is the calculation formula of the first interest hidden layer, h interest1 is the output data of the first hidden layer of interest, h2 is the output data of the first hidden layer of the main network (i.e., the fifth output data); Formula (25) is the calculation formula of the second hidden layer of interest, h interest2 is the output data of the second interest hidden layer; Formula (26) is the prediction function associated with the seventh output data in the fourth prediction function group.
[0164] The first gradient reversal layer and the second gradient reversal layer both include a gradient reversal layer, and the gradient reversal layer in the first gradient reversal layer and the gradient reversal layer in the second gradient reversal layer process data in the same way. The gradient reversal layer in the first gradient reversal layer is used to process data associated with sample users output by the first interest hidden layer, and the gradient reversal layer in the second gradient reversal layer is used to process data associated with sample materials output by the first interest hidden layer. The following takes the gradient reversal layer in the first gradient reversal layer as an example for explanation. Assuming that the vector input to the gradient reversal layer in the first gradient reversal layer is vi and the output is vo, the calculation method of the gradient reversal layer in the first gradient reversal layer is as follows:
[0165] vi_r = -vi (27)
[0166] vo = grl(vi) = vi_r + stop_gradient(vi-vi_r) (28)
[0167] Among them, vi_r in formula (27) represents the inverse of the gradient. That is, when training the interest network, the forward propagation input and output remain consistent, and the reverse propagation gradient is calculated.
[0168] h uadv2 = grl(h interest1 )*W uadv2 +b uadv2 (29)
[0169]
[0170] h iadv2 = grl(h interest1 )*W iadv2 +b iadv2 (31)
[0171]
[0172]
[0173]
[0174]
[0175] Among them, formula (29) is the calculation formula of the first gradient reversal layer, formula (30) is the prediction function associated with the first adversarial output data in the fourth prediction function group, formula (31) is the calculation formula of the second gradient reversal layer, formula (32) is the prediction function associated with the second adversarial output data in the fourth prediction function group, formula (33) is the first interest network regression function, L interest is the fifth loss function value, represents the predicted value of the sample user's interaction rate with the i-th sample material, formula (34) is the second interest network regression function, L uadv is the sixth loss function value, represents the predicted value of the conformity degree of the i-th sample user, h u4i represents the data associated with the i-th sample user output by the user hidden layer 4, and formula (35) is the third interest network regression function, L iadv is the seventh loss function value, represents the predicted value of the popularity of the i-th sample material, h i4i Represents the data associated with the i-th sample material output by the material hidden layer 4.
[0176] The fifth loss function value, the sixth loss function value, and the seventh loss function value are obtained, and the loss value of the interest network (ie, the fourth loss function value) is calculated according to the following weighted summation formula.
[0177] L interest_adv = L interest +α*L uadv +β*L iadv (36)
[0178] Among them, L interest_adv is the value of the fourth loss function, α and β in formula (36) are weights, and the values of α and β can be set according to actual conditions, and the embodiment of the present application does not make any specific limitation on this.
[0179] In some embodiments, after obtaining the first loss function value, the second loss function value, the third loss function value, and the fourth loss function value, the first loss function value, the second loss function value, the third loss function value, and the fourth loss function value may be summed to obtain a total loss function value of the multi-task model. The formula for calculating the total loss function value of the multi-task model is as follows:
[0180] L total =L m + L interest_adv +L u +L i (37)
[0181] Among them, in formula (37), L total is the total loss function value of the multi-task model.
[0182] It should be noted that in the process of training the multi-task model, a gradient cutoff (stop_gradient) is set between the interest network and the main network, and the gradient cutoff is specifically set between the first interest hidden layer of the interest network and the first hidden layer of the main network. In this way, it can be ensured that the training of the interest network has no effect on the training of the main network. A gradient cutoff (stop_gradient) is set between the interest network and the user network, and the gradient cutoff is specifically set between the first gradient reversal layer of the interest network and the last network layer of the user network. In this way, it can be ensured that the training of the interest network has no effect on the training of the user network. A gradient cutoff (stop_gradient) is set between the interest network and the material network, and the gradient cutoff is specifically set between the second gradient reversal layer of the interest network and the last network layer of the material network. In this way, it can be ensured that the training of the interest network has no effect on the training of the material network.
[0183] In the embodiment of the present application, the gradients among the main network, user network, material network and interest network are truncated, so that the training of the main network and the interest network is not affected by popularity and conformity, and the accuracy of the training of each network can be guaranteed.
[0184] In some possible implementations, the above S507 may include: based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value, respectively performing back propagation calculations on the main network, the user network, the material network and the interest network to generate the gradient of each network layer in the multi-task model; aggregating the gradient of each network layer and updating the parameters of each network layer until the multi-task model converges.
[0185] It can be understood that the main network is back-propagated based on the first loss function value to generate the gradient of each network layer in the main network; the user network is back-propagated based on the second loss function value to generate the gradient of each network layer in the user network; the material network is back-propagated based on the third loss function value to generate the gradient of each network layer in the material network; the interest network is back-propagated based on the fourth loss function value to generate the gradient of each network layer in the interest network. Based on the gradient of each network layer, the parameters of each network layer are used in each round of iterative training until the multi-task model converges.
[0186] Figure 8 It is an optional structural diagram of the multi-task model provided in the embodiment of the present application. Fig. 9 This is an optional flow chart of the training method of the multi-task model provided in the embodiment of the present application. Figure 8 right Fig. 9 The steps shown are explained.
[0187] Below, an example is given in which the main network includes four hidden layers, the user network includes four user hidden layers, and the material network includes four material hidden layers.
[0188] S901, obtain training data by preprocessing the original data. The training data includes user features, context features, cross features and material features.
[0189] S902, input the training data into the embedding layer to obtain the sample embedding features output by the embedding layer.
[0190] S903, input the sample embedding feature into hidden layer 1, and obtain data 1 output by hidden layer 1.
[0191] S904, input data 1 into hidden layer 2 to obtain data 2 output by hidden layer 2.
[0192] S905, input data 2 into hidden layer 3 to obtain data 3 output by hidden layer 3.
[0193] S906, input data 3 into hidden layer 4, and obtain data 4 output by hidden layer 4.
[0194] S907, based on data 4, calculate the regression loss value of the main network (i.e., L m ).
[0195] S908, inputting the user sample embedding feature associated with the sample user in the sample embedding feature into the user embedding layer in the user network to obtain a first embedding feature output by the user embedding layer.
[0196] S909, input the first embedding feature into the user hidden layer 1 to obtain the data 1u output by the user hidden layer 1.
[0197] S910, input data 1u into the user hidden layer 2, and obtain data 2u output by the user hidden layer 2.
[0198] S911, input data 2u into user hidden layer 3, and obtain data 3u output by user hidden layer 3.
[0199] S912, input data 3u into the user hidden layer 4, and obtain data 4u output by the user hidden layer 4.
[0200] S913, based on data 4u, calculate the regression loss value of the user network (i.e., L u ).
[0201] S914, inputting the material sample embedding features associated with the sample material in the sample embedding features into the material embedding layer in the material network to obtain a second embedding feature output by the material embedding layer.
[0202] S915, input the second embedded feature into the material hidden layer 1 to obtain the data 1i output by the material hidden layer 1.
[0203] S916, input data 1i into material hidden layer 2, and obtain data 2i output by material hidden layer 2.
[0204] S917, input data 2i into material hidden layer 3, and obtain data 3i output by material hidden layer 3.
[0205] S918, input data 3i into the material hidden layer 4, and obtain data 4i output by the material hidden layer 4.
[0206] S919, based on data 4i, calculate the regression loss value of the material network (i.e. L i ).
[0207] S920, input data 2 into the interest hidden layer 1 in the interest network, and obtain data 1interest output by the interest hidden layer 1.
[0208] S921, input data 1interest into interest hidden layer 2, and obtain data 2interest output by interest hidden layer 2.
[0209] S922, based on data 2interest, calculate the first regression loss value of the interest network.
[0210] S923, input data 1interest into the first gradient reversal layer to obtain data 2uadv output by the first gradient reversal layer.
[0211] S924, based on data 4u and data 2uadv, calculate the second regression loss value of the interest network.
[0212] S925, input the data 1interest into the second gradient inversion layer to obtain the data 2iadv output by the second gradient inversion layer.
[0213] S926, based on data 4i and data 2iadv, calculate the third regression loss value of the interest network.
[0214] Among them, based on the first regression loss value, the second regression loss value and the third regression loss value, the regression loss value of the interest network can be calculated. Based on the regression loss value of the main network, the regression loss value of the user network, the regression loss value of the material network and the regression loss value of the interest network, the main network, the user network, the material network and the interest network can be iteratively trained respectively.
[0215] In an embodiment of the present application, by introducing an interest network into a multi-task model, and based on the interest network, the prediction result of the sample user's interaction rate with the sample material is obtained after removing the influence of the sample user's conformity and the popularity of the sample material. This can achieve decoupling between the conformity, popularity and user interests, and improve the debiasing accuracy of popularity and conformity.
[0216] Furthermore, the first gradient reversal layer and the second gradient reversal layer in the interest network eliminate or weaken the influence of popularity and conformity on the prediction score of the final output of the multi-task model from the perspective of gradient transfer through an adversarial training method, reducing the problem of the model being unable to learn accurately due to artificially defined formulas and hyperparameters, making the multi-task model more robust and more accurate.
[0217] Furthermore, since the interest network can remove the influence of the sample user's conformity and the popularity of the sample material on the final prediction score, the prediction score of the interest network in the trained multi-task model can be directly used as the final prediction score, which ensures the consistency of online and offline goals and evaluations.
[0218] The present application embodiment provides a prediction method based on a multi-task model. The multi-task model is formed by training using the training method described in the above embodiment. Fig.10 , Fig.10 This is an optional flow chart of a prediction method based on a multi-task model provided in an embodiment of the present application. Fig.10 The steps shown illustrate a prediction method based on a multi-task model.
[0219] S1001, obtaining input data.
[0220] The input data includes user information of the target user and material information of the material to be recommended.
[0221] It can be understood that after the multi-task model training is completed, it will be put into online use. During the online use, the input data of the multi-task model is first obtained. The collection method and preprocessing method of the input data of the multi-task model are the same as the above-mentioned method of obtaining the training data, and the embodiment of the present application will not go into details about this.
[0222] In an embodiment of the present application, the target user is a user to whom the blog post publishing system recommends the material to be recommended. For example, the target user issues an instruction to obtain the material to be recommended, and the blog post publishing system responds to the instruction and recommends the material to be recommended to the target user.
[0223] S1002, performing data transformation processing on the input data through the embedding layer of the multi-task model to obtain embedded features.
[0224] It can be understood that after obtaining the input data, the input data is output to the embedding layer of the multi-task model for data transformation processing, and the embedding features output by the embedding layer can be obtained.
[0225] S1003, determining, through the main network and based on the embedded features, a first predicted value of the target user's interaction rate with respect to the recommended material.
[0226] The first prediction value is determined based on the first output data output by the main network and a preset first prediction function.
[0227] It can be understood that the main network can output the first prediction value based on the embedded features of the input, after being processed by each network layer in the main network.
[0228] S1004, determining, through the interest network and based on the fifth output data of the first hidden layer output of the main network, a fourth predicted value of the target user's interaction rate with the recommended material while removing the influence of the target user's conformity and the popularity of the recommended material.
[0229] It can be understood that, based on the trained multi-task model, the interest network will obtain the input data of the interest network from the first hidden layer of the main network, and finally output the fourth prediction value after being processed by each network layer in the interest network.
[0230] S1005: Predict the final interaction rate of the target user with respect to the recommended material based on the first prediction value and the fourth prediction value.
[0231] It can be understood that the online prediction result of the multi-task model depends on the first prediction value and the second prediction value.
[0232] In some possible implementations, the above S1005 may include: using the fourth prediction value output by the interest network as the prediction value of the target user's final interaction rate with the recommended material, or performing weighted sum processing on the fourth prediction value output by the interest network and the first prediction value output by the main network to obtain the prediction value of the target user's final interaction rate with the recommended material.
[0233] It can be understood that there are two ways of online prediction. One is to use only the predicted value output by the interest network as the predicted value of the interaction rate of the multi-task model. The other is to perform a weighted sum calculation on the predicted value output by the interest network and the predicted value output by the main network to obtain the predicted value of the interaction rate of the multi-task model.
[0234] The present application provides a training device 455 for a multi-task model, wherein the multi-task model includes an embedding layer, a main network, a user network, a material network, and an interest network. The training device 455 for the multi-task model includes: a training data acquisition module 4551, used to acquire training data, wherein the training data includes user information of sample users and material information of sample materials; a sample data processing module 4552, used to input the training data into an initial multi-task model, and perform data transformation processing on the training data through the embedding layer to obtain sample embedding features; a sample data calculation module 4553, used to predict the interaction rate of the sample user to the sample material based on the sample embedding features through the main network, and obtain the first loss function value of the main network based on the first output data output by the second hidden layer of the main network; and predict the conformity degree of the sample user based on the sample embedding features through the user network, and obtain the second loss function value of the user network based on the output second output data. Function value; the degree of conformity indicates the user's interest in the popular material; through the material network, the popularity of the sample material is predicted based on the sample embedding feature, and based on the output third output data, the third loss function value of the material network is obtained; the popularity indicates the degree of attention paid to the material by users within a predetermined period of time; through the interest network, based on the fifth output data, the second output data and the third output data output by the first hidden layer of the main network, the interaction rate of the sample user to the sample material is predicted while removing the influence of the degree of conformity of the sample user and the popularity of the sample material, and based on the output fourth output data, the fourth loss function value of the interest network is obtained; the training module 4554 is used to iteratively train the multi-task model based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value until the model convergence condition is reached to obtain the trained multi-task model.
[0235] In some possible implementations, the sample data calculation module 4553 is used to perform a first linear division process of the main network on the sample embedding features through the first hidden layer of the main network to obtain fifth output data; perform a second linear division process of the main network on the fifth output data through the second hidden layer of the main network to obtain first output data; determine a first predicted value of the interaction rate of the sample user to the sample material based on the first output data and a preset first prediction function; determine a first loss function value based on the first predicted value and a preset main network regression function.
[0236] In some possible implementations, the sample data calculation module 4553 is used to determine the user sample embedding features associated with the sample user in the sample embedding features; input the user sample embedding features into the user hidden layer of the user network, and perform linear division processing on the user sample embedding features based on preset user hidden layer parameters to obtain second output data; determine a second prediction value of the sample user's degree of conformity based on the second output data and a preset second prediction function; and determine a second loss function value based on the second prediction value and a preset user network regression function.
[0237] In some possible implementations, the sample data calculation module 4553 is used to determine the material sample embedding features associated with the sample material in the sample embedding features; input the material sample embedding features into the material hidden layer of the material network, and perform linear division processing on the material sample embedding features based on preset material hidden layer parameters to obtain third output data; determine a third prediction value of the popularity of the sample material based on the third output data and a preset third prediction function; determine a third loss function value based on the third prediction value and a preset material network regression function.
[0238] In some possible implementations, the sample data calculation module 4553 is used to obtain the fifth output data output by the first hidden layer of the main network; input the fifth output data into the first interest hidden layer of the interest network, and perform linear division processing on the fifth output data based on the preset first interest hidden layer parameters to obtain the sixth output data; input the sixth output data into the second interest hidden layer of the interest network, and perform linear division processing on the sixth output data based on the preset second interest hidden layer parameters to obtain the seventh output data; perform a first gradient inversion processing on the second output data through the first gradient inversion adversarial layer of the interest network, and perform a second gradient inversion processing on the third output data through the second gradient inversion adversarial layer to obtain the first adversarial output data and the second adversarial output data; based on the seventh output data, the first adversarial output data, the second adversarial output data and the preset fourth prediction function group, by reducing the weights of the sample user's conformity and the popularity of the sample material, determine the fourth prediction value of the sample user's interaction rate with the sample material, the fifth prediction value of the degree of confrontation with the degree of conformity and the sixth prediction value of the degree of confrontation with the degree of popularity; determine the fourth loss function value based on the fourth prediction value, the fifth prediction value, the sixth prediction value and the preset interest network regression function.
[0239] In some possible embodiments, the sample data calculation module 4553 is used to determine a fourth prediction value based on the seventh output data and the prediction function associated with the seventh output data in the fourth prediction function group; determine a fifth prediction value based on the first adversarial output data and the prediction function associated with the first adversarial output data in the fourth prediction function group; and determine a sixth prediction value based on the second adversarial output data and the prediction function associated with the second adversarial output data in the fourth prediction function group.
[0240] In some possible embodiments, the sample data calculation module 4553 is used to determine the fifth loss function value based on the preset first interest network regression function and the fourth prediction value; the fifth loss function is used to characterize the error between the first interest hidden layer and the second interest hidden layer; the sixth loss function value is determined based on the preset second interest network regression function, the fifth prediction value and the third output data output by the user network; the sixth loss function value is used to characterize the error of the first gradient reversal adversarial layer; the seventh loss function value is determined based on the preset third interest network regression function, the sixth prediction value and the fourth output data output by the material network; the seventh loss function value is used to characterize the error of the second gradient reversal adversarial layer; the fifth loss function value, the sixth loss function value and the seventh loss function value are weightedly summed to determine the fourth loss function value.
[0241] In some possible implementations, the training data acquisition module 4551 is used to obtain original data from user behavior logs and material databases; perform hash mapping on the original data to obtain first preprocessed data; the first preprocessed data is binary-coded data of a preset length; encode the first preprocessed data to obtain second preprocessed data; the second preprocessed data is decimal-coded data of a preset length; map the second preprocessed data through a preset embedded matrix lookup table to obtain training data.
[0242] The embodiment of the present application provides a prediction device 456 based on a multi-task model, and the prediction device 456 based on the multi-task model includes: a data acquisition module 4561, used to acquire input data; the data includes user information of the target user and material information of the material to be recommended; a data processing module 4562, used to perform data transformation processing on the input data through the embedding layer of the multi-task model to obtain embedded features; the multi-task model is formed by training using the training method described in the above embodiment; a data calculation module 4563, used to determine a first prediction value of the target user's interaction rate with the recommended material based on the embedded features through the main network; the first prediction value is determined based on the first output data output by the main network and a preset first prediction function; through the interest network, based on the fifth output data output by the first hidden layer of the main network, determine a fourth prediction value of the target user's interaction rate with the recommended material when the influence of the target user's conformity and the popularity of the material to be recommended are removed; a prediction module 4564, used to predict the target user's final interaction rate with the recommended material based on the first prediction value and the fourth prediction value.
[0243] In some possible implementations, the prediction module 4564 is used to use the fourth prediction value output by the interest network as the prediction value of the final interaction rate of the target user with respect to the recommended material, or to perform weighted sum processing on the fourth prediction value output by the interest network and the first prediction value output by the main network to obtain the prediction value of the final interaction rate of the target user with respect to the recommended material.
[0244] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in a computer storage medium. The processor of the computer device reads the computer instructions from the computer storage medium, and the processor executes the computer instructions, so that the computer device executes the training method of the multi-task model or the prediction method based on the multi-task model described in the embodiment of the present application.
[0245] The embodiment of the present application provides a computer storage medium storing executable instructions, wherein executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the training method of the multi-task model or the prediction method based on the multi-task model provided in the embodiment of the present application, for example Figure 5 The training method of the multi-task model shown or Fig.10 The prediction method based on the multi-task model is shown.
[0246] In some embodiments, the computer storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0247] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0248] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a hypertext markup language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).
[0249] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0250] The above are only embodiments of the present application and are not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A training method for a multi-task model, characterized in that: The multi-task model includes an embedding layer, a main network, a user network, a material network and an interest network, and the method includes: Acquire training data; the training data includes user information of sample users and material information of sample materials; Inputting the training data into an initial multi-task model, performing data transformation processing on the training data through the embedding layer, and obtaining sample embedding features; Predicting the interaction rate of the sample user to the sample material based on the sample embedding feature through the main network, and obtaining a first loss function value of the main network based on the first output data output by the second hidden layer of the main network; Predicting the conformity degree of the sample user based on the sample embedding feature through the user network, and obtaining a second loss function value of the user network based on the output second output data; the conformity degree represents the user's interest in the hot material; Predicting the popularity of the sample material based on the sample embedding feature through the material network, and obtaining a third loss function value of the material network based on the output third output data; the popularity represents the degree of attention paid to the material by users within a predetermined period of time; Through the interest network, based on the fifth output data output by the first hidden layer of the main network, the second output data and the third output data, the interaction rate of the sample user to the sample material is predicted while removing the influence of the conformity degree of the sample user and the popularity degree of the sample material, and based on the output fourth output data, a fourth loss function value of the interest network is obtained; Based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value, the multi-task model is iteratively trained until a model convergence condition is reached to obtain a trained multi-task model.
2. The method according to claim 1, characterized in that The method of predicting the interaction rate of the sample user to the sample material based on the sample embedding feature through the main network, and obtaining a first loss function value of the main network based on the output first output data, includes: Through the first hidden layer of the main network, the sample embedding feature is subjected to a first linear division process of the main network to obtain fifth output data; Through the second hidden layer of the main network, the fifth output data is subjected to a second linear division process of the main network to obtain the first output data; Determine a first prediction value of the interaction rate of the sample user to the sample material based on the first output data and a preset first prediction function; Based on the first prediction value and a preset main network regression function, the first loss function value is determined.
3. The method according to claim 1, characterized in that The predicting the conformity degree of the sample user based on the sample embedding feature through the user network, and obtaining the second loss function value of the user network based on the output second output data, includes: Determining a user sample embedding feature associated with the sample user from among the sample embedding features; Inputting the user sample embedding feature into the user hidden layer of the user network, and performing linear division processing on the user sample embedding feature based on preset user hidden layer parameters to obtain the second output data; Determine a second predicted value of the conformity degree of the sample user based on the second output data and a preset second prediction function; Based on the second prediction value and a preset user network regression function, the second loss function value is determined.
4. The method according to claim 1, characterized in that: The predicting the popularity of the sample material based on the sample embedding feature through the material network, and obtaining a third loss function value of the material network based on the output third output data, includes: Determining a material sample embedding feature associated with the sample material in the sample embedding feature; Inputting the material sample embedding feature into the material hidden layer of the material network, and performing linear division processing on the material sample embedding feature based on preset material hidden layer parameters to obtain the third output data; Determining a third prediction value of the popularity of the sample material based on the third output data and a preset third prediction function; Based on the third predicted value and a preset material network regression function, the third loss function value is determined.
5. The method according to claim 2, characterized in that: The method of predicting the interaction rate of the sample user with respect to the sample material by the interest network based on the fifth output data output by the first hidden layer of the main network, the second output data and the third output data, while removing the influence of the conformity degree of the sample user and the popularity degree of the sample material, and obtaining the fourth loss function value of the interest network based on the output fourth output data, includes: Obtain the fifth output data of the first hidden layer output of the main network; Inputting the fifth output data into the first interest hidden layer of the interest network, and performing linear division processing on the fifth output data based on preset first interest hidden layer parameters to obtain sixth output data; Inputting the sixth output data into the second interest hidden layer of the interest network, and performing linear division processing on the sixth output data based on preset second interest hidden layer parameters to obtain seventh output data; Performing a first gradient reversal process on the second output data through the first gradient reversal adversarial layer of the interest network, and performing a second gradient reversal process on the third output data through the second gradient reversal adversarial layer to obtain first adversarial output data and second adversarial output data; Based on the seventh output data, the first confrontation output data, the second confrontation output data and the preset fourth prediction function group, by reducing the weights of the conformity degree of the sample user and the popularity degree of the sample material, a fourth prediction value of the interaction rate of the sample user to the sample material, a fifth prediction value against the conformity degree and a sixth prediction value against the popularity degree are determined; The fourth loss function value is determined based on the fourth prediction value, the fifth prediction value, the sixth prediction value and the preset interest network regression function.
6. The method according to claim 5, characterized in that The determining, based on the seventh output data, the first confrontation output data, the second confrontation output data and a preset fourth prediction function group, a fourth prediction value of the sample user's interaction rate with the sample material, a fifth prediction value against the herd degree and a sixth prediction value against the popularity degree comprises: determining the fourth prediction value based on the seventh output data and a prediction function in the fourth prediction function group associated with the seventh output data; determining the fifth prediction value based on the first adversarial output data and a prediction function in the fourth prediction function group associated with the first adversarial output data; The sixth prediction value is determined based on the second adversarial output data and a prediction function in the fourth prediction function group associated with the second adversarial output data.
7. The method according to claim 5, characterized in that The determining the fourth loss function value based on the fourth prediction value, the fifth prediction value, the sixth prediction value and a preset interest network regression function includes: Based on the preset first interest network regression function and the fourth prediction value, determining a fifth loss function value; the fifth loss function is used to characterize the error between the first interest hidden layer and the second interest hidden layer; Determine a sixth loss function value based on a preset second interest network regression function, the fifth prediction value, and the third output data output by the user network; the sixth loss function value is used to characterize the error of the first gradient reversal adversarial layer; Determine a seventh loss function value based on a preset third interest network regression function, the sixth prediction value, and fourth output data output by the material network; the seventh loss function value is used to characterize the error of the second gradient reversal adversarial layer; The fifth loss function value, the sixth loss function value and the seventh loss function value are weightedly summed to determine the fourth loss function value.
8. The method according to claim 1, characterized in that The obtaining of training data comprises: Get raw data from user behavior logs and material databases; Performing hash mapping processing on the original data to obtain first pre-processed data; the first pre-processed data is binary coded data of a preset length; Encoding the first preprocessed data to obtain second preprocessed data; the second preprocessed data is decimal coded data of a preset length; The second preprocessed data is mapped using a preset embedding matrix lookup table to obtain the training data.
9. A prediction method based on a multi-task model, characterized in that: The method comprises: Acquire input data; the input data includes user information of the target user and material information of the material to be recommended; The input data is subjected to data transformation processing by an embedding layer of a multi-task model to obtain an embedding feature; the multi-task model is formed by training using the training method described in any one of claims 1 to 8; Determine, by means of the main network, a first prediction value of the target user's interaction rate with the to-be-recommended material based on the embedded features; the first prediction value is determined based on first output data output by the second hidden layer of the main network and a preset first prediction function; Determine, through the interest network, a fourth predicted value of the target user's interaction rate with the material to be recommended, based on fifth output data output by the first hidden layer of the main network, in the case where the influence of the target user's conformity and the popularity of the material to be recommended are removed; Based on the first prediction value and the fourth prediction value, a final interaction rate of the target user with the material to be recommended is predicted.
10. The method according to claim 9, characterized in that The predicting, based on the first prediction value and the fourth prediction value, a final interaction rate of the user with respect to the to-be-recommended material includes: The fourth prediction value output by the interest network is used as the prediction value of the final interaction rate of the target user to the material to be recommended, or, A weighted summation process is performed on the fourth prediction value output by the interest network and the first prediction value output by the main network to obtain a prediction value of the final interaction rate of the target user for the material to be recommended.
11. A multi-task model training device, characterized in that: The multi-task model includes an embedding layer, a main network, a user network, a material network and an interest network, and the device includes: A training data acquisition module, used to acquire training data, wherein the training data includes user information of sample users and material information of sample materials; A sample data processing module, used for inputting the training data into the initial multi-task model, performing data transformation processing on the training data through the embedding layer, and obtaining sample embedding features; A sample data calculation module, used to predict the interaction rate of the sample user to the sample material based on the sample embedding feature through the main network, and obtain the first loss function value of the main network based on the first output data output by the second hidden layer of the main network; predict the conformity degree of the sample user based on the sample embedding feature through the user network, and obtain the second loss function value of the user network based on the output second output data; the conformity degree indicates the user's interest in popular materials; predict the popularity of the sample material based on the sample embedding feature through the material network, and obtain the third loss function value of the material network based on the output third output data; the popularity indicates the degree of attention paid to the material by users within a predetermined period of time; predict the interaction rate of the sample user to the sample material based on the fifth output data, the second output data and the third output data output by the first hidden layer of the main network through the interest network, while removing the influence of the conformity degree of the sample user and the popularity of the sample material, and obtain the fourth loss function value of the interest network based on the output fourth output data; A training module is used to iteratively train the multi-task model based on the first loss function value, the second loss function value, the third loss function value and the fourth loss function value until the model convergence condition is reached, thereby obtaining a trained multi-task model.
12. A prediction device based on a multi-task model, characterized in that: The device comprises: A data acquisition module, used to acquire input data; the input data includes user information of the target user and material information of the material to be recommended; A data processing module, used for performing data transformation processing on the input data through an embedding layer of a multi-task model to obtain an embedding feature; the multi-task model is formed by training using the training method according to any one of claims 1 to 8; A data calculation module, configured to determine, through the main network and based on the embedded features, a first prediction value of the target user's interaction rate with the material to be recommended; the first prediction value is determined based on the first output data output by the second hidden layer of the main network and a preset first prediction function; and, through the interest network and based on the fifth output data output by the first hidden layer of the main network, determine a fourth prediction value of the target user's interaction rate with the material to be recommended, in the case of removing the influence of the target user's conformity and the popularity of the material to be recommended; A prediction module is used to predict the final interaction rate of the target user with the material to be recommended based on the first prediction value and the fourth prediction value.
13. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable instructions; A processor, configured to implement the method of any one of claims 1 to 8 or 9 to 10 when executing the executable instructions or computer programs stored in the memory.
14. A computer-readable storage medium storing executable instructions or a computer program, characterized in that: When the executable instructions are executed by a processor, the method according to any one of claims 1 to 8 or 9 to 10 is implemented.
