Model prediction method and apparatus, device, and medium
By introducing global experience and difference prompting mechanisms into the multi-task model, the prediction results of the upper-layer network structure are corrected, which solves the problem of insufficient prediction accuracy of multi-task models in the existing technology and improves the prediction accuracy and consistency in the recommendation system.
Patent Information
- Application Number
- PCT/CN2025/082620
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-04-15
- Filing Date
- 2025-03-14
- Publication Date
- 2025-10-23
AI Technical Summary
There is room for improvement in the prediction accuracy of each prediction task in existing multi-task models, especially in recommendation systems, where the accuracy of predicting user satisfaction with recommended content is insufficient.
The first upper-level network structure in the multi-task model makes an initial prediction to obtain global experience. Based on the difference between the initial prediction result and the updated prediction result, the difference prompts guide the upper-level network structure to correct the initial prediction result and obtain the prediction result again.
It improves the accuracy of prediction results for each task and the consistency of prediction results across multiple tasks, thereby enhancing the accuracy of predicting user satisfaction with recommended content in the recommendation system.
Smart Images

Figure CN2025082620_23102025_PF_FP_ABST
Abstract
Description
Model prediction method, device, equipment and medium
[0001] Related applications
[0002] The present application claims priority to the Chinese patent application No. 202410451912.4, filed on April 15, 2024, and entitled "Model prediction method, device, equipment and medium", the contents of which are hereby incorporated by reference in its entirety. TECHNICAL FIELD
[0003] The present application relates to the field of artificial intelligence, and in particular, to a model prediction method, device, equipment and medium. BACKGROUND
[0004] Multi-task learning refers to learning multiple related prediction tasks, such as click rate, reading time, interaction (such as comments, forwarding, and likes), etc., simultaneously through a multi-task model. Multi-task learning under a recommendation system reflects the user's satisfaction with recommended content from different levels.
[0005] In related technologies, a typical multi-task model structure includes a lower network structure located at a lower logical level and multiple upper network structures located at an upper logical level in parallel, and each prediction task network branch includes a lower network structure and an upper network structure. Among them, the same lower network structure is shared by multiple prediction tasks, and the upper network structures of each prediction task are independent of each other.
[0006] However, under the architecture of the multi-task model provided in related technologies, the accuracy of the prediction results of each prediction task still has room for improvement. SUMMARY
[0007] The present application provides a model prediction method, device, equipment and medium.
[0008] According to an aspect of the present application, a model prediction method is provided, which is executed by a computer device, and the method comprises:
[0009] performing prediction of a first task through a first upper network structure in multiple upper network structures of a multi-task model to obtain a preliminary prediction result of the first task;
[0010] obtaining global experience of the multi-task model, the global experience representing comprehensive prediction information commonly reflected by at least two tasks; and predicting an updated prediction result of the first task based on network layer output of the first upper network structure and the global experience; and
[0011] obtaining a difference prompt based on a difference between the preliminary prediction result of the first task and the updated prediction result of the first task; and
[0012] The prediction module is further configured to guide the first upper-layer network structure to correct the initial prediction result of the first task based on the difference prompt, to obtain a second prediction result of the first task.
[0013] According to another aspect of the present application, a model prediction device is provided, the device comprising:
[0014] A prediction module is configured to perform prediction of a first task by a first upper-layer network structure in a plurality of upper-layer network structures of a multi-task model, to obtain an initial prediction result of the first task.
[0015] An acquisition module is configured to acquire global experience of the multi-task model, the global experience representing comprehensive prediction information reflected by at least two tasks.
[0016] The prediction module is further configured to predict an updated prediction result of the first task based on network layer output of the first upper-layer network structure and the global experience; and
[0017] A prompt construction module is configured to obtain a difference prompt based on a difference between the initial prediction result of the first task and the updated prediction result of the first task; and
[0018] The prediction module is further configured to guide the first upper-layer network structure to correct the initial prediction result of the first task based on the difference prompt, to obtain a second prediction result of the first task.
[0019] According to an aspect of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the model prediction method as above.
[0020] According to another aspect of the present application, a computer readable storage medium is provided, the storage medium storing a computer program, the computer program being loaded and executed by the processor to implement the model prediction method as above.
[0021] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the model prediction method as above.
[0022] The details of one or more embodiments of the present application are set forth in the accompanying drawings and the description below. Other features, objects, and advantages of the present application will be apparent from the description, drawings, and claims. BRIEF DESCRIPTION OF DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments. Obviously, the drawings in the following description only are the embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from the disclosed drawings without any creative effort.
[0024] FIG. 1 is a schematic diagram of a multi-task model provided by the related art.
[0025] FIG. 2 is a schematic diagram of a model prediction method provided by an embodiment of the present application.
[0026] FIG. 3 is a schematic diagram of a multi-task system provided by an embodiment of the present application.
[0027] FIG. 4 is a flowchart of a model prediction method provided by an embodiment of the present application.
[0028] FIG. 5 is a flowchart of a model prediction method provided by another embodiment of the present application.
[0029] FIG. 6 is a flowchart of a model prediction method provided by another embodiment of the present application.
[0030] FIG. 7 is a schematic diagram of a global knowledge distillation network provided by an embodiment of the present application.
[0031] FIG. 8 is a flowchart of a method for constructing a task consistency index provided by an embodiment of the present application.
[0032] FIG. 9 is a flowchart of a prediction method of a multi-task model applied to a recommendation system provided by an embodiment of the present application.
[0033] FIG. 10 is a flowchart of a prediction method of a multi-task model applied to an advertisement system provided by an embodiment of the present application.
[0034] FIG. 11 is a flowchart of a prediction method of a multi-task model applied to a search system provided by an embodiment of the present application.
[0035] FIG. 12 is a structural block diagram of a model prediction apparatus provided by an embodiment of the present application.
[0036] FIG. 13 is a structural block diagram of a computer device provided by an embodiment of the present application.
[0037] FIG. 14 is a structural block diagram of a computer device provided by another embodiment of the present application. DETAILED DESCRIPTION
[0038] With reference to the drawings, the technical solutions in the embodiments of the present application will be described clearly and completely. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work are within the scope of protection of the present application.
[0039] First, the terms involved in the embodiments of the present application are briefly introduced.
[0040] Artificial Intelligence (AI): is to use digital computers or digital computer controlled machine simulation, extension and expansion of human intelligence, perception of environment, acquisition of knowledge and use of knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which aims to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0041] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include, such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-training model technology, operation / interaction system, mechatronics, etc. Among them, the pre-training model is also called large model, basic model, which can be widely applied to downstream tasks in various directions of artificial intelligence after fine-tuning. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0042] Large model: or large artificial intelligence model, refers to an artificial intelligence model with a large number of parameters and complex structure. These models usually have tens of billions or even hundreds of billions of parameters, can process massive data, and have strong learning and generalization ability. The emergence of large models has greatly promoted the development and application of artificial intelligence technology. Optionally, the model (optionally, a multi-task model) in the present application is a large model.
[0043] Hadamard product: a kind of matrix calculation operation commonly used in machine learning. Unlike traditional matrix multiplication calculation method, Hadamard product performs multiplication operation on corresponding matrix elements of execution position, it is worth noting that the two multiplied matrices must have the same number of rows and columns.
[0044] Multi-task Learning (MTL): learning multiple related tasks simultaneously through one multi-task model, each task corresponds to a respective loss function. For example, in a recommendation system, multiple related tasks, including predicting the click rate, reading duration, whether to forward, whether to like the recommended content of the user, and so on. In a search system, multiple related tasks, including predicting the click rate, reading duration, whether to copy, whether to collect the search results of the user, and so on. In an advertising system, multiple related tasks, including predicting the click rate, conversion rate of the user on the advertisement, and so on.
[0045] In the related art, a typical multi-task model is to establish a proper parameter sharing network for multiple tasks at the lower layer, and reserve a separate task tower for each task at the upper layer. In combination with reference to FIG. 1, FIG. 1 shows a multi-task model. The embedding vector 101 to be input is input into the lower layer network structure 102 to obtain an intermediate vector, the intermediate vector is input into multiple upper layer network structures 103 (including task tower 0, task tower 1, …, task tower k), and is trained through multiple losses 104 (including loss 0, loss 1, …, loss k). Among them, the multiple upper layer network structures 103 correspond one-to-one to the multiple tasks, and each upper layer network structure is trained according to the respective loss function. The task tower refers to the network structure related to each task at the logical upper layer in the multi-task learning model. Each task tower corresponds to a specific task and is used to predict the task. In this application, the multiple upper layer network structures correspond one-to-one to the multiple tasks, and each upper layer network structure is a task tower, and the intermediate vector output by the lower layer network structure is used for task prediction.
[0046] Illustratively, in a recommendation system, the user-side features (such as user ID, etc.) and the recommended content-side features (such as recommended content ID, etc.) are both subjected to embedding operations, and then input into the lower layer network structure 102. The lower layer network structure 102 performs feature fusion on the user-side features and the recommended content-side features to obtain an intermediate vector with better effect and stronger expression capability, and then sends the intermediate vector to each upper layer network structure. Each upper layer network structure performs prediction tasks such as click rate, reading duration, whether to forward, whether to like, and so on.
[0047] FIG. 2 shows a schematic diagram of the principle of the model prediction method provided in an example embodiment of the present application. FIG. 2 shows a multi-task model, the input of the multi-task model is the embedding vector 201 to be input, the multi-task model includes the lower layer network structure 202 at the logical lower layer and the multiple upper layer network structures (including the upper layer network structure k 203) at the logical upper layer in parallel, and each task network branch includes the lower layer network structure 202 and an upper layer network structure.
[0048] In part (A) of FIG. 2, input embedding vectors (Input Embs) 201 to be input are input to a lower network structure 202, and intermediate vectors (not shown in the figure) output by the lower network structure 202 are respectively input to each of a plurality of upper network structures (K upper network structures in the figure). For the upper network structure k 203, the upper network structure k 203 performs a first prediction of the kth task based on the intermediate vectors, and the upper network structure k 203 outputs a first prediction result of the kth task. The lower network structure is a bottom backbone network (Backbone Bottom) shared by a plurality of tasks, and the plurality of upper network structures correspond one-to-one to a plurality of tasks, and the upper network structure is also commonly referred to as a task tower (Task Tower).
[0049] In the global knowledge distillation network k 204, a plurality of network layer outputs of the plurality of upper network structures are aggregated to obtain global experience, and the plurality of upper network structures correspond one-to-one to a plurality of network layer outputs. Based on the global experience and the network layer output of the upper network structure k 203, an updated prediction result of the kth task is predicted. The network layer output includes an output in the upper network structure that does not pass through a logits layer (result layer), that is, an upper output of the logits layer, and logits values output by the logits layer are the first prediction result.
[0050] The global experience represents comprehensive prediction information reflected by at least two tasks, for example, the task 0 is a prediction task of a click rate of recommended content, the task 1 is a prediction task of a reading time of recommended content, and the task k is a prediction task of whether to like recommended content. The global experience represents a comprehensive judgment of a user's satisfaction with recommended content from a higher perspective. In this application, the prediction of the task is performed again after the network layer output and the global experience are fused to obtain a prediction result after regression of the global experience, that is, the updated prediction result.
[0051] In part (B) of FIG. 2, a difference prompt k 206 is obtained based on a difference between the first prediction result of the upper network structure k 203 and the updated prediction result output by the global knowledge distillation network k 204. In an embodiment, a difference between the first prediction result and the updated prediction result is calculated to obtain a first difference; the first difference is subjected to an embedding operation to obtain the difference prompt k 206, and the difference prompt k 206 is a prompt in a latent space. Optionally, the first difference is input to a multi-layer perceptron (MLP) to perform the embedding operation.
[0052] Latent Space refers to an abstract vector space obtained by encoding original data in machine learning and deep learning. In this application, the target latent space is the vector space in which the feature embedding vector input to the lower network structure is located. The difference prompt is in this latent space. The latent space prompt does not force the difference prompt to be a real text representation, but learns a text vector in the latent space with the embedding vectors of each token in the lower network structure in the same vector space. Feature Embedding Vector refers to a vector obtained by mapping original discrete features (such as text, category, etc.) to a continuous low-dimensional vector space. In this application, the feature embedding vector is a vector obtained by performing embedding operation on the features on the user side (such as user ID, etc.) and the features on the recommended content side (such as recommended content ID, etc.) and input to the lower network structure for feature fusion.
[0053] The difference prompt k 206 is returned to the upper network structure k 203, which guides the upper network structure k 203 to correct the initial prediction result to obtain the re-prediction result 207 of the k-th task, and the model training of the k-th task is performed through the loss k 205. In one embodiment, the difference prompt k 206 and the network layer output of the upper network structure k 203 are spliced to obtain an intermediate splicing result, and the intermediate splicing result is input to the result layer (logits layer) to obtain the re-prediction result 207.
[0054] The present application utilizes the technology of Prompt Learning, and guides the upper network structure to self-correct according to the comparison between the initial prediction result and the updated prediction result through the difference prompt, better utilizes the guiding effect of global experience, and helps to improve the accuracy of the prediction result of each task and the direction consistency of the prediction result of multiple tasks.
[0055] FIG. 3 shows a schematic diagram of a multi-task system according to an example embodiment of the present application. FIG. 3 shows a training device 310 of a multi-task model and a using device 320 of the multi-task model.
[0056] During the training process, the training device 310 trains using the model prediction method shown in FIG. 2. Based on the re-prediction result and the k-th label of the sample, the loss k 205 is obtained, and the network related to the k-th task is trained based on the loss k 205. The k-th label of the sample refers to the real label or target value corresponding to the k-th task of each sample in the training data set. In this application, the re-prediction result of the k-th task of the multi-task model is compared to calculate the loss function, so as to train the network related to the k-th task.
[0057] In use, the use device 320 uses the prediction method similar to the multi-task model shown in FIG. 2 to perform reasoning. In the first reasoning, the initial prediction result output by the upper-layer network structure k 203 and the updated prediction result output by the global knowledge distillation network k 204 are obtained. In the second reasoning, based on the difference between the initial prediction result and the updated prediction result, the difference prompt is obtained to guide the upper-layer network structure k 203 to correct the initial prediction result to obtain the second prediction result. In this way, in the i-th reasoning, based on the difference between the i-th prediction result and the updated prediction result, the i-1-th difference prompt is obtained; based on the i-1-th difference prompt, the i-th prediction result is corrected by the upper-layer network structure k 203 to obtain the i+1-th prediction result. i is an integer with an initial value of two, when i is equal to two, the i-th prediction result is the second prediction result, and the i-1-th prediction result is the initial prediction result.
[0058] In one embodiment, the training device 310 includes at least one of a terminal device and a server. The use device 320 includes at least one of a terminal device and a server. The device type of the terminal device includes at least one of a smartphone, a smart watch, a vehicle-mounted terminal, a wearable device, a smart TV, a tablet computer, an e-book reader, an MP3 player, an MP4 player, a laptop computer, and a desktop computer. In some embodiments, the server can be a standalone physical server, a server cluster composed of multiple physical servers, or a distributed system, and can also be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms, etc. Basic cloud computing services.
[0059] It should be noted that the information (including but not limited to user device information, recommended content features, and advertisement features) involved in the present application, data (including but not limited to data for analysis, stored data, and displayed data), and signals are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data need to comply with relevant laws, regulations, and standards of relevant countries and regions. For example, the recommended content features, advertisement features, etc. involved in the present application are obtained under full authorization. Moreover, for related information, the related information processor will follow the principles of legality, legitimacy, and necessity, clearly define the purpose, method, and scope of related information processing, obtain the consent of the related information subject, and take necessary technical and organizational measures to ensure the security of related information.
[0060] Figure 4 shows a flowchart of a model prediction method according to an example embodiment of the present application. The model is a multi-task model, which includes a lower network structure at a logical lower layer and a plurality of upper network structures at a logical upper layer in parallel. Each task branch includes the lower network structure and one upper network structure. The method is performed by a computer device and includes:
[0061] At step 420, a first task is predicted by a first upper network structure of the plurality of upper network structures of the multi-task model, to obtain a first task preliminary prediction result.
[0062] The multi-task model is a model for simultaneously performing prediction of a plurality of related tasks. In a recommendation system, the plurality of related tasks include tasks of predicting click rate, reading duration, whether to forward, whether to like, etc. of a recommended content by a user. In a search system, the plurality of related tasks include tasks of predicting click rate, reading duration, whether to copy, whether to collect, etc. of a search result by a user. In an advertising system, the plurality of related tasks include tasks of predicting click rate, conversion rate, etc. of an advertisement by a user.
[0063] The multi-task model includes a lower network structure at a logical lower layer and a plurality of upper network structures at a logical upper layer in parallel. The lower network structure is a bottom backbone network shared by the plurality of related tasks. Optionally, the bottom backbone network is used to fuse user-side features and recommended content-side features to obtain intermediate features. For example, in the bottom backbone network, user ID, recommended content ID, recommended content category ID, etc. are concatenated through a concat layer, and then the feature embedding is mapped to a lower dimension through a Dense layer to obtain intermediate features. Optionally, the lower network structure can be any one of MMOE (Multi-gate Mixture-of-Experts), PLE (Progressive Layered Extraction), and MSSM (Multiple-level Sparse Sharing Model). The intermediate feature is a feature extracted at a certain layer between the input layer and the output layer in the process of neural network processing. In the present application, the intermediate feature is a feature obtained by the lower network structure after fusing the user-side features and the recommended content-side features, which has better expression ability and is used for subsequent task prediction of the upper network structure.
[0064] The upper-layer network structure is often referred to as a task tower (or Tower for short). A plurality of upper-layer network structures are used to perform prediction of a plurality of tasks, and the plurality of upper-layer network structures correspond to the plurality of tasks one by one. The plurality of upper-layer network structures are network structures designed to be related to respective tasks.
[0065] In one embodiment, the prediction result of each task is output by the plurality of upper-layer network structures to obtain the initial prediction result of the plurality of tasks. For one of the tasks, i.e., a first task, the initial prediction result of the first task is obtained, wherein the first task can be a specified task or any one of the plurality of tasks.
[0066] In step 440, the global experience of the multi-task model is obtained, and the global experience represents comprehensive prediction information commonly reflected by at least two tasks; and the updated prediction result of the first task is predicted based on the network layer output of the first upper-layer network structure and the global experience.
[0067] The global experience represents comprehensive prediction information commonly reflected by at least two tasks (a plurality of tasks). The global experience is a higher-level comprehensive judgment of the prediction information of at least two tasks (a plurality of tasks) in a global perspective. The prediction information can be a network layer output of an upper-layer network structure, a prediction result, etc. For example, in a recommendation system, a plurality of related tasks include tasks of predicting a click rate, a reading time, an interaction, etc. of a user on recommended content, and the prediction results of the plurality of related tasks all reflect the satisfaction of the user on the recommended content from different levels and different angles, and the global experience represents the satisfaction of the user on the recommended content.
[0068] For the first task, the network layer output of the first upper-layer network structure and the global experience are fused, and then the prediction of the first task is performed again to obtain the updated prediction result of the first task. The network layer output includes an output of the upper-layer network structure that has not passed through a logits layer (a result layer), i.e., an upper-layer output of the logits layer, and logits values output by the logits layer are the prediction result.
[0069] In step 460, the difference prompt is obtained based on the difference between the initial prediction result of the first task and the updated prediction result of the first task.
[0070] In one embodiment, a first difference value is obtained by calculating the difference between the initial prediction result of the first task and the updated prediction result of the first task; and the difference prompt is obtained by performing embedding operation on the first difference value, and the difference prompt is in a target latent space, and the target latent space is a vector space in which a feature embedding vector input to a lower-layer network structure is located.
[0071] Optionally, the first difference value is input into a first multi-layer perceptron to perform embedding operation to obtain the difference prompt.
[0072] In the related art, a common prompt construction method is manually constructed, a suitable text template is designed for a target problem, and the model is guided to correct the prediction result through the prompt of the specified text template. However, the text template depends on human experience, and the effect is difficult to guarantee. In the present application, a hidden space prompt is constructed. The hidden space prompt does not require the difference prompt to be a real text representation, but learns a text vector in the hidden space. The difference prompt may not be mapped to a specific token, but is in the same vector space as the embedding of each token in the lower network structure. The hidden space prompt does not depend on the human-designed text template, and the hidden space prompt is more flexible and has better effect.
[0073] In addition, the difference prompt constructed in the present application is clear and explicit, has strong interpretability, and the model can accurately understand our needs and perform related operations through the difference prompt.
[0074] Optionally, the first difference value is input into the first multi-layer perception to perform an embedding operation to obtain the difference prompt. The present embodiment provides a method of mapping the difference into a hidden space prompt through a multi-layer perception, which is simple and convenient to operate.
[0075] Step 480, based on the difference prompt, guiding the first upper network structure to correct the initial prediction result of the first task to obtain the re-prediction result of the first task.
[0076] The difference prompt is input into the first upper network structure to guide the first upper network structure to correct the initial prediction result of the first task to obtain the re-prediction result of the first task.
[0077] In one embodiment, the difference prompt and the network layer output of the first upper network structure are spliced to obtain an intermediate splicing result; and the intermediate splicing result is input into the result layer (logits layer) of the first upper network structure to obtain the re-prediction result of the first task.
[0078] In the present application, the difference prompt is returned to the task for guidance, and the first upper network structure is corrected based on the difference between the two prediction results to re-predict the task target and obtain the re-prediction result of the first task.
[0079] In the present application, through the guidance of the difference prompt, the model is self-corrected based on the comparison between the two prediction results, better utilizing the guiding effect of global experience, which is the significance of the introduction of the prompt. Not only does it improve the accuracy of the final prediction result of each sub-task, but also improves the task consistency index of the prediction result of multiple tasks. The task consistency index will be introduced separately below.
[0080] The task consistency index is an index for indicating whether the directions of the prediction results of the plurality of upper-layer network structures are consistent. The index is obtained by obtaining a plurality of prediction result means corresponding to a plurality of tasks (each prediction result mean refers to a mean of a plurality of re-prediction results obtained by performing one task on a plurality of test samples), counting the number of test samples in which the re-prediction result for each task is greater than the prediction result mean of the corresponding task (obtaining a first number), counting the number of test samples in which the re-prediction result for each task is less than the prediction result mean of the corresponding task (obtaining a second number), and dividing the sum of the first number and the second number by the total number (the total number is the number of the plurality of test samples). When the index value is high, it indicates that the prediction results of the plurality of tasks as a whole are more accurate; when the value is low, it indicates that the prediction results of the plurality of tasks as a whole are less accurate.
[0081] In addition, in the related art, an AITM (Adaptive Information Transfer Multi-task) framework is provided, which enhances the knowledge transfer between task towers. However, it can only be applied to tasks with sequential dependency, such as click rate estimation and conversion rate estimation problems. The framework provided by the present application can be applied to various sub-tasks with parallel relationship, and is not limited to sequential dependency. In addition, the framework of the present application can be compatible with various multi-task base models. Offline and online experiments prove that the prediction method of the model proposed in the present application can effectively improve the accuracy and consistency of multi-task target prediction, thereby improving the business indicators.
[0082] In the optional embodiment shown in FIG. 4, the guided correction is performed only once for the first upper-layer network structure, and the obtained re-prediction result is not necessarily the most accurate prediction result. Therefore, the following embodiments introduce a method for continuously circulating the prediction result. After step 480 shown in FIG. 4, the method steps shown in FIG. 5 are further performed. FIG. 5 shows one cycle process, and the steps in the one cycle process include:
[0083] Step 501: determining whether the difference between the ith prediction result and the (i-1)th prediction result is less than a difference threshold.
[0084] i is a positive integer not less than one, and the initial value of i is two. When i is equal to two, the ith prediction result is the re-prediction result of the first task, and the (i-1)th prediction result is the initial prediction result of the first task.
[0085] The difference threshold is a parameter preset in the model prediction process, which is used to determine the difference between the adjacent two prediction results to determine whether to continue to correct the prediction result. When the difference between the ith prediction result and the (i-1)th prediction result is less than the difference threshold, it is considered that the ith prediction result obtained at this time is a relatively accurate answer, which can be output; when the difference is not less than the threshold, the difference prompt is further obtained based on the difference between the ith prediction result and the updated prediction result, and the prediction result is corrected.
[0086] That is, when entering the loop structure for the first time, it is judged whether the difference between the second prediction result and the first prediction result is less than the difference threshold. If it is less than the difference threshold, step 502 is executed, and if it is not less than the difference threshold, step 503 is executed. The difference threshold is a preset parameter.
[0087] When entering the loop structure for the (i-1)th time, it is judged whether the difference between the ith prediction result and the (i-1)th prediction result is less than the difference threshold. If it is less than the difference threshold, step 502 is executed, and if it is not less than the difference threshold, step 503 is executed. The difference threshold is a preset parameter.
[0088] For example, the ith prediction result of the first task is 10s (reading time), the (i-1)th prediction result is 5s (reading time), and the difference threshold is 2s. It is determined that the difference (5s) between the ith prediction result and the (i-1)th prediction result is not less than the difference threshold.
[0089] Step 502, in the case that the difference between the ith prediction result and the (i-1)th prediction result is less than the difference threshold, the ith prediction result is output.
[0090] If the difference between the ith prediction result and the (i-1)th prediction result is less than the difference threshold, it is considered that the ith prediction result obtained at this time is the correct answer, and the ith prediction result is output.
[0091] Step 503, in the case that the difference between the ith prediction result and the (i-1)th prediction result is not less than the difference threshold, the (i-1)th difference prompt is obtained based on the difference between the ith prediction result and the updated prediction result of the first task.
[0092] If the difference between the ith prediction result and the (i-1)th prediction result is not less than the difference threshold, it is considered that the ith prediction result obtained at this time is still incorrect and needs to be corrected again. In this embodiment, the (i-1)th difference prompt is obtained based on the difference between the ith prediction result and the updated prediction result of the first task.
[0093] Following the above example, the ith prediction result of the first task is 10s, and the updated prediction result is 20s. The (i-1)th difference prompt is obtained based on the difference (10s) between the ith prediction result and the updated prediction result.
[0094] Step 504, based on the i-1 difference prompt, guide the first upper layer network structure to modify the i prediction result, and obtain the i+1 prediction result.
[0095] Based on the i-1 difference prompt, guide the first upper layer network structure to modify the i prediction result (10s), and obtain the i+1 prediction result (11s).
[0096] Step 505, update i+1 to i, and re-enter the loop process.
[0097] In the above embodiment, whether the difference between the two prediction results is large enough is used as the loop end condition. If the difference between the two prediction results is small, it means that the model cannot continue to modify the result, and the prediction result obtained at this time is the correct answer. In the above embodiment, the loop process is continuously executed to simulate the process of human reasoning, and the accuracy of reasoning can be improved by repeatedly checking and modifying the prediction result.
[0098] FIG. 6 shows a flowchart of a model prediction method provided by an example embodiment of the present application. The multi-task model includes a lower layer network structure, a plurality of upper layer network structures in parallel, and a plurality of global knowledge distillation networks in parallel. The network branch of each task includes a lower layer network structure, an upper layer network structure, and a global knowledge distillation network. The method is exemplarily executed by a computer device, and the method includes:
[0099] Step 610, through the first upper layer network structure in the plurality of upper layer network structures of the multi-task model, perform prediction of the first task to obtain a preliminary prediction result of the first task.
[0100] The multi-task model is a model for simultaneously performing prediction of a plurality of related tasks. In a recommendation system, the plurality of related tasks include tasks of predicting click rate, reading time, whether to forward, and whether to like of a user on recommended content, etc. In a search system, the plurality of related tasks include tasks of predicting click rate, reading time, whether to copy, and whether to collect of a user on search results, etc. In an advertising system, the plurality of related tasks include tasks of predicting click rate and conversion rate of a user on an advertisement, etc.
[0101] The multi-task model includes a lower layer network structure at a logical lower layer and a plurality of upper layer network structures in parallel at a logical upper layer. The lower layer network structure is a bottom backbone network shared by the plurality of related tasks (Backbone Bottom). Optionally, the bottom backbone network is used to fuse user-side features and recommended content-side features to obtain intermediate features.
[0102] The upper-layer network structure is often referred to as a task tower (Task Tower or Tower for short). A plurality of upper-layer network structures are used to perform prediction of a plurality of tasks, and the plurality of upper-layer network structures correspond to the plurality of tasks one by one. The plurality of upper-layer network structures are network structures designed to be related to each task respectively.
[0103] In an embodiment, the prediction results of the respective tasks are output by the plurality of upper-layer network structures to obtain initial prediction results of the plurality of tasks. For one of the tasks, i.e., a first task, the initial prediction result of the first task is obtained, wherein the first task can be a designated task or any one of the plurality of tasks.
[0104] In step 620, the plurality of network layer outputs of the plurality of upper-layer network structures are aggregated by the first global knowledge distillation network to obtain global experience.
[0105] In an embodiment, the plurality of network layer outputs of the plurality of upper-layer network structures are aggregated by the first global knowledge distillation network to obtain global experience, and the global experience represents comprehensive prediction information reflected by at least two tasks (the plurality of tasks) together. The network layer output includes an output of the upper-layer network structure that has not passed through the logits layer, i.e., an upper-layer output of the logits layer, and logits values output by the logits layer are prediction results.
[0106] In an embodiment, the first global knowledge distillation network includes a second multi-layer perceptron. The plurality of network layer outputs of the plurality of upper-layer network structures are spliced to obtain a splicing result, and the splicing result is input into the second multi-layer perceptron to obtain the global experience.
[0107] The global experience is a higher-perspective comprehensive judgment of the prediction information of at least two tasks (the plurality of tasks) from a global perspective. The prediction information can be a network layer output of the upper-layer network structure, a prediction result, etc. For example, in a recommendation system, the plurality of related tasks include tasks of predicting a click rate, a reading time, an interaction, etc. of a user on recommended content, and the prediction results of the plurality of related tasks all reflect the satisfaction of the user on the recommended content from different levels and different angles. The global experience represents the satisfaction of the user on the recommended content.
[0108] In this embodiment, a global experience generation method is provided, which has less invasiveness to the original respective upper-layer network structures and only adds a global knowledge distillation network, so that the model is less changed.
[0109] In combination with reference to FIG. 7, FIG. 7 shows a global knowledge distillation network k 701.
[0110] In the global knowledge distillation network k 701, after gradient blocking 720 is performed on the multiple network layer outputs (k network layer outputs) 710 of the multiple upper layer network structures (upper layer network structure 0, upper layer network structure 1, …, upper layer network structure k), the multiple network layer outputs of the multiple upper layer network structures are spliced to obtain a splicing result; the splicing result is input into a second multi-layer perceptron (MLP 0) 730 to obtain global experience. Gradient blocking refers to an operation of preventing gradient from being reversely propagated in a certain part of a network during neural network training. In this application, gradient blocking is performed on the multiple network layer outputs of the multiple upper layer network structures, and the effect is that the original task output is not affected when learning global experience by using the multiple network layer outputs. The network layer output refers to an output of an upper layer network structure that has not passed through a logits layer (result layer), and a logits value output by the logits layer is a primary prediction result. That is, the application provides a way of generating global experience by using a multi-layer perceptron, which is simple in operation and strong in interpretability.
[0111] In step 630, an updated prediction result of the first task is predicted based on the network layer output of the first upper layer network structure and the global experience.
[0112] In one embodiment, for the first upper layer network structure, the attention weight of the global experience for the first upper layer network structure is calculated, and the global experience is used for reference in the first task. The fusion result of the global experience and the network layer output of the first upper layer network structure is used for target prediction again to obtain an updated prediction result of the first task.
[0113] In an optional embodiment, the first reference weight is obtained by calculating the attention weight of the global experience for the network layer output of the first upper layer network structure through the first global knowledge distillation network. The first reference weight is the reference weight corresponding to the first task. Optionally, the first global knowledge distillation network includes a third multi-layer perceptron. The network layer output of the first upper layer network structure and the global experience are input into the third multi-layer perceptron to obtain the first reference weight. The last network layer of the third multi-layer perceptron is a normalization exponential function layer. The first reference weight and the global experience are both matrices. In this embodiment, the first reference weight is obtained by using the third multi-layer perceptron, which is simple in operation.
[0114] The Softmax layer refers to a network layer in a neural network that uses the Softmax function to process input. The Softmax function converts a real number vector into a probability distribution, so that each element in the vector is between 0 and 1, and the sum of all elements is 1. In this application, the last network layer of the third multi-layer perceptron is a Softmax layer, which is used to calculate the attention weight of the network layer output of the first upper network structure on the global experience, and obtain the first reference weight.
[0115] The first reference experience is obtained by performing a weighted operation on the global experience based on the first reference weight, and the first reference experience represents the experience in the global experience that is related to the first task. The first reference experience is a matrix.
[0116] Based on the first reference experience and the network layer output of the first upper network structure, an updated prediction result of the first task is predicted. Optionally, the first global knowledge distillation network includes a fourth multi-layer perceptron, and the first reference experience and the network layer output of the first upper network structure are input into the fourth multi-layer perceptron to predict the updated prediction result of the first task. In this embodiment, the fourth multi-layer perceptron is used to perform a second prediction, and the model structure is relatively simple.
[0117] In this application, the attention mechanism is used to obtain the experience worth learning from the global experience. The attention mechanism can select the global experience, so that the model focuses on the information worth paying attention to in the global experience, thereby improving the accuracy of the updated prediction result.
[0118] For example, referring to FIG. 7, the MLP0 730 outputs the global experience (GK k ), and the global experience and the network layer output of the kth upper network structure (the kth network layer output) 740 are input into the third multi-layer perceptron (MLP1) 750 to obtain the kth reference weight (GW k ). The last network layer of the third multi-layer perceptron 750 is a Softmax layer. The global experience and the kth reference weight are subjected to Hadamard product 760 operation to obtain the kth reference experience (WGK k ), which represents the experience learned from the global experience. The kth reference experience and the network layer output of the kth upper network structure (the kth network layer output) 740 are input into the fourth multi-layer perceptron (MLP2) 770 to perform a prediction of the kth task again, and obtain the updated prediction result 780 of the kth task. The Hadamard product operation is an operation of multiplying the elements at the same position in two matrices.
[0119] In step 640, a difference prompt is obtained based on the difference between the initial prediction result of the first task and the updated prediction result of the first task.
[0120] In one embodiment, a first difference value is calculated by subtracting the initial prediction result of the first task from the updated prediction result of the first task.
[0121] The first difference value is subjected to an embedding operation to obtain a difference prompt, and the difference prompt is in a target latent space, which is a vector space in which a feature embedding vector of an input lower network structure is located.
[0122] Optionally, the first difference value is input into a first multi-layer perceptron to perform an embedding operation to obtain the difference prompt.
[0123] At step 650, based on the difference prompt, the first upper network structure is guided to correct the initial prediction result of the first task to obtain a re-prediction result of the first task.
[0124] The difference prompt is input into the first upper network structure to guide the first upper network structure to correct the initial prediction result of the first task to obtain a re-prediction result of the first task.
[0125] In one embodiment, the difference prompt and a network layer output of the first upper network structure are spliced to obtain an intermediate splicing result; and the intermediate splicing result is input into a result layer (logits layer) of the first upper network structure to obtain the re-prediction result of the first task.
[0126] In the present application, the difference prompt is returned to the task to guide the prompt, and the first upper network structure is guided to correct the difference between the two prediction results to re-predict the sub-task target to obtain the re-prediction result of the first task.
[0127] In the experimental stage, a task consistency index is constructed. The task consistency index is used to indicate whether the directions of the prediction results of the plurality of upper network structures are consistent.
[0128] FIG. 8 shows a flowchart of a method for constructing a task consistency index according to an example embodiment of the present application. The method is exemplarily executed by a computer device, and includes the following steps:
[0129] At step 801, a plurality of prediction result means corresponding to a plurality of tasks are obtained, and each prediction result mean indicates a mean of a plurality of re-prediction results obtained by executing a task on a plurality of test samples.
[0130] The prediction result mean is a mean of a plurality of re-prediction results obtained by executing a task on a plurality of test samples. For example, for a reading time task, the mean of the reading time (re-prediction result) of a plurality of test samples is the prediction result mean of the task; and for a click rate prediction task, the mean of the click rate (re-prediction result) of a plurality of test samples is the prediction result mean of the task.
[0131] A plurality of test samples, such as a plurality of recommended items, are obtained. For a task, a plurality of re-prediction results of the plurality of test samples are output, a mean value of the plurality of re-prediction results is calculated, and a prediction result mean value is obtained.
[0132] For example, for a reading duration task, the mean value of the reading duration (re-prediction result) of the plurality of test samples is 20s. For a click rate prediction task, the mean value of the click rate (re-prediction result) of the plurality of test samples is 0.5.
[0133] Step 802, the number of test samples in which the re-prediction result for each task is greater than the prediction result mean value of the corresponding task is counted, and a first number is obtained.
[0134] For example, the plurality of test samples include samples 1, 2, 3, 4, and 5. The re-prediction result of sample 1 for task 1 is greater than the prediction result mean value of task 1, the re-prediction result of sample 1 for task 2 is greater than the prediction result mean value of task 2, and the re-prediction result of sample 1 for task 3 is greater than the prediction result mean value of task 3, so it is determined that the prediction results of the multiple tasks of sample 1 are consistent (all greater than the prediction result mean value).
[0135] Similarly, it is determined that the prediction results of the multiple tasks of samples 1 and 2 are all greater than the prediction result mean value, that is, the prediction results of the multiple tasks of samples 1 and 2 are consistent.
[0136] Step 803, the number of test samples in which the re-prediction result for each task is less than the prediction result mean value of the corresponding task is counted, and a second number is obtained.
[0137] For example, the plurality of test samples include samples 1, 2, 3, 4, and 5. The re-prediction result of sample 3 for task 1 is less than the prediction result mean value of task 1, the re-prediction result of sample 3 for task 2 is less than the prediction result mean value of task 2, and the re-prediction result of sample 3 for task 3 is less than the prediction result mean value of task 3, so it is determined that the prediction results of the multiple tasks of sample 3 are consistent (all less than the prediction result mean value).
[0138] Similarly, it is determined that the prediction results of the multiple tasks of samples 3 and 4 are all less than the prediction result mean value, that is, the prediction results of the multiple tasks of samples 3 and 4 are consistent.
[0139] Step 804, the sum of the first number and the second number is divided by the total number, and a task consistency index of the plurality of tasks is obtained, and the total number is the number of the plurality of test samples.
[0140] The sum of the first number (two) and the second number (two) is divided by the total number (five) to obtain a task consistency index 4 / 5 of the plurality of tasks.
[0141] In summary, the task consistency index constructed by the above embodiments can be used to measure the direction consistency of the prediction results of the plurality of tasks. For example, when the task consistency index is 1, the following cases are included: the prediction results of the plurality of tasks all reflect that the user is very satisfied with the recommended content, the prediction results of the plurality of tasks all reflect that the user is moderately satisfied with the recommended content, and the prediction results of the plurality of tasks all reflect that the user is less satisfied with the recommended content. When the value of the task consistency index is high, it indicates that the prediction results of the plurality of tasks as a whole are more accurate, and when the value of the task consistency index is low, it indicates that the prediction results of the plurality of tasks as a whole are less accurate.
[0142] For the prediction of the multi-task model not executed by the method of the present application (i.e., the baseline method), only the click rate prediction task and the interaction task are considered, and the value of the task consistency index of the two obtained is 0.799632.
[0143] For the prediction of the multi-task model executed by the method of the present application (i.e., the present application), only the click rate prediction task and the interaction task are considered, and the value of the task consistency index of the two obtained is 0.808475.
[0144] Therefore, for the task consistency index, the present application improves 0.008843 compared with the baseline method.
[0145] The model prediction method introduced in the above embodiments can be applied to a recommendation system. Next, the prediction method of the model applied to the recommendation system is introduced.
[0146] FIG. 9 shows a prediction method of a model applied to a recommendation system. Optionally, the model is a multi-task model, the multi-task model includes a lower network structure and a plurality of upper network structures arranged in parallel, and each network branch of a recommendation task includes the lower network structure and one upper network structure. The method includes the following steps:
[0147] In step 920, the first task is predicted by the first upper network structure of the plurality of upper network structures of the multi-task model to obtain the initial prediction result of the first recommendation task.
[0148] The recommendation task includes a task of predicting the click rate, reading time, whether to forward, whether to like, and the like of the user on the recommended content.
[0149] In step 940, the global experience of the multi-task model is obtained, the global experience represents the comprehensive prediction information commonly reflected by at least two recommendation tasks; and the updated prediction result of the first recommendation task is predicted based on the network layer output of the first upper network structure and the global experience.
[0150] In an optional embodiment, the network branch of each task further comprises a global knowledge distillation network. The global experience is obtained by aggregating the multiple network layer outputs of the multiple upper network structures through the first global knowledge distillation network, and the multiple network layer outputs correspond one-to-one to the multiple upper network structures. Optionally, the first global knowledge distillation network comprises a second multi-layer perceptron, and the multiple network layer outputs of the multiple upper network structures are concatenated to obtain a concatenation result; and the concatenation result is input into the second multi-layer perceptron to obtain the global experience.
[0151] In an optional embodiment, the network branch of each task further comprises a global knowledge distillation network, and the first reference weight is obtained by calculating the attention weight of the network layer output of the first upper network structure to the global experience through the first global knowledge distillation network, and the first reference weight is the reference weight corresponding to the first recommendation task. Optionally, the first global knowledge distillation network comprises a third multi-layer perceptron, and the network layer output of the first upper network structure and the global experience are input into the third multi-layer perceptron to obtain the first reference weight, and the last network layer of the third multi-layer perceptron is a normalization exponential function layer.
[0152] The first reference experience is obtained by performing a weighted operation on the global experience through the first reference weight, and the first reference experience represents the experience related to the first recommendation task in the global experience.
[0153] Based on the first reference experience and the network layer output of the first upper network structure, the updated prediction result of the first recommendation task is predicted. Optionally, the first global knowledge distillation network comprises a fourth multi-layer perceptron, and the first reference experience and the network layer output of the first upper network structure are input into the fourth multi-layer perceptron to predict the updated prediction result of the first recommendation task.
[0154] Step 960, based on the difference between the initial prediction result of the first recommendation task and the updated prediction result of the first recommendation task, a difference prompt is obtained.
[0155] In an optional embodiment, the first difference value is obtained by calculating the difference between the initial prediction result of the first recommendation task and the updated prediction result of the first recommendation task. The embedding operation is performed on the first difference value to obtain the difference prompt, and the difference prompt is in a target latent space, and the target latent space is a vector space in which the feature embedding vector input into the lower network structure is located. Optionally, the first difference value is input into the first multi-layer perceptron to perform the embedding operation to obtain the difference prompt.
[0156] Step 980, based on the difference prompt, guiding the first upper network structure to correct the initial prediction result of the first recommendation task to obtain the second prediction result of the first recommendation task.
[0157] In one embodiment, the difference prompt and the network layer output of the first upper-layer network structure are spliced to obtain an intermediate splicing result; the intermediate splicing result is input into the result layer of the first upper-layer network structure to obtain a second prediction result of the first recommendation task.
[0158] In one optional embodiment, in one cycle, when the difference between the ith prediction result and the (i-1)th prediction result is less than the difference threshold, the ith prediction result is output, i is an integer with an initial value of two, when i is equal to two, the ith prediction result is the second prediction result of the first recommendation task, and the (i-1)th prediction result is the first prediction result of the first recommendation task. When the difference between the ith prediction result and the (i-1)th prediction result is not less than the difference threshold, based on the difference between the ith prediction result and the updated prediction result of the first recommendation task, the (i-1)th difference prompt is obtained; based on the (i-1)th difference prompt, the first upper-layer network structure is guided to correct the ith prediction result to obtain the (i+1)th prediction result; i+1 is updated to i, and the cycle process is re-entered.
[0159] In one optional embodiment, a plurality of prediction result means corresponding to a plurality of recommendation tasks are obtained, each prediction result mean refers to the mean of a plurality of second prediction results obtained by executing one recommendation task on a plurality of test samples. The number of test samples in which the second prediction result for each recommendation task is greater than the prediction result mean of the corresponding recommendation task is counted to obtain a first number. In addition, the number of test samples in which the second prediction result for each recommendation task is less than the prediction result mean of the corresponding recommendation task is counted to obtain a second number. The sum of the first number and the second number is divided by the total number to obtain a task consistency index of the plurality of recommendation tasks, and the total number is the number of the plurality of test samples.
[0160] In summary, in the present application, based on the difference between the updated prediction result (a prediction result obtained by fusing global experience) and the first prediction result, a difference prompt is constructed, and then the first upper-layer network structure is guided to correct the first prediction result of the first task through the difference prompt. That is, the present application provides a prediction architecture of a multi-task model based on a prompt, introduces a prompt mechanism, can better utilize the guiding role of global experience (global experience represents comprehensive prediction information commonly reflected by at least two tasks), and corrects and guides the prediction result from a higher level, which not only can improve the accuracy of the prediction result of each recommendation task, but also can improve the direction consistency of the prediction results of the plurality of recommendation tasks. For example, the prediction results of the plurality of recommendation tasks all reflect that the user is relatively satisfied with the recommended content, and the prediction results of the plurality of recommendation tasks all reflect that the user is relatively dissatisfied with the recommended content.
[0161] The model prediction method introduced in the above embodiments can be applied to an advertising system. Next, a prediction method of a model applied to an advertising system is introduced.
[0162] FIG. 10 shows a prediction method of a model applied to an advertising system. Optionally, the model is a multi-task model including a lower network structure located at a logical lower layer and a plurality of upper network structures located at a logical upper layer in parallel, and each network branch of an advertising task includes the lower network structure and one upper network structure. The method includes:
[0163] At step 1020, a first task is predicted through a first upper network structure of the plurality of upper network structures of the multi-task model to obtain a preliminary prediction result of the first advertising task.
[0164] The advertising tasks include tasks of predicting a click rate and a conversion rate of a user on an advertisement.
[0165] At step 1040, global experience of the multi-task model is obtained, the global experience representing comprehensive prediction information commonly reflected by at least two advertising tasks; and an updated prediction result of the first advertising task is predicted based on the network layer output of the first upper network structure and the global experience.
[0166] In an optional embodiment, each network branch of each task further includes a global knowledge distillation network. The global experience is obtained by aggregating a plurality of network layer outputs of the plurality of upper network structures through the first global knowledge distillation network, the plurality of network layer outputs corresponding to the plurality of upper network structures one by one. Optionally, the first global knowledge distillation network includes a second multi-layer perceptron, the plurality of network layer outputs of the plurality of upper network structures are concatenated to obtain a concatenation result, and the concatenation result is input into the second multi-layer perceptron to obtain the global experience.
[0167] In an optional embodiment, each network branch of each task further includes a global knowledge distillation network. The first reference weight is obtained by calculating an attention weight of the network layer output of the first upper network structure on the global experience through the first global knowledge distillation network, the first reference weight being a reference weight corresponding to the first advertising task. Optionally, the first global knowledge distillation network includes a third multi-layer perceptron, the network layer output of the first upper network structure and the global experience are input into the third multi-layer perceptron to obtain the first reference weight, and a last network layer of the third multi-layer perceptron is a normalization exponential function layer.
[0168] The first reference experience is obtained by performing a weighted operation on the global experience through the first reference weight, the first reference experience representing experience related to the first advertising task in the global experience.
[0169] The first global knowledge distillation network includes a fourth multi-layer perceptron. The first reference experience and the network layer output of the first upper network structure are input into the fourth multi-layer perceptron to predict the updated prediction result of the first advertising task.
[0170] In step 1060, a difference prompt is obtained based on the difference between the initial prediction result of the first advertising task and the updated prediction result of the first advertising task.
[0171] In an optional embodiment, a first difference value is obtained by calculating the difference between the initial prediction result of the first advertising task and the updated prediction result of the first advertising task. The first difference value is subjected to an embedding operation to obtain the difference prompt, and the difference prompt is in a target latent space, which is a vector space in which a feature embedding vector input into a lower network structure is located. Optionally, the first difference value is input into the first multi-layer perceptron to perform the embedding operation to obtain the difference prompt.
[0172] In step 1080, the first upper network structure is guided to correct the initial prediction result of the first advertising task based on the difference prompt to obtain a second prediction result of the first advertising task.
[0173] In an embodiment, the difference prompt and the network layer output of the first upper network structure are spliced to obtain an intermediate splicing result. The intermediate splicing result is input into a result layer of the first upper network structure to obtain the second prediction result of the first advertising task.
[0174] In an optional embodiment, in a loop process, when the difference between the i-th prediction result and the (i-1)-th prediction result is less than a difference threshold, the i-th prediction result is output, i is an integer with an initial value of two, and when i is equal to two, the i-th prediction result is the second prediction result of the first advertising task, and the (i-1)-th prediction result is the initial prediction result of the first advertising task. When the difference between the i-th prediction result and the (i-1)-th prediction result is not less than the difference threshold, an (i-1)-th difference prompt is obtained based on the difference between the i-th prediction result and the updated prediction result of the first advertising task. The first upper network structure is guided to correct the i-th prediction result based on the (i-1)-th difference prompt to obtain an (i+1)-th prediction result. The value of i+1 is updated to i, and the loop process is re-entered.
[0175] In an optional embodiment, a plurality of prediction result means corresponding to a plurality of advertising tasks are obtained, each prediction result mean indicating a mean of a plurality of re-prediction results obtained by performing an advertising task on a plurality of test samples. A first number is obtained by counting the number of test samples in the plurality of test samples whose re-prediction result for each advertising task is greater than the prediction result mean corresponding to the advertising task. A second number is obtained by counting the number of test samples in the plurality of test samples whose re-prediction result for each advertising task is less than the prediction result mean corresponding to the advertising task. A sum of the first number and the second number is divided by a total number to obtain a task consistency index of the plurality of advertising tasks, the total number being the number of the plurality of test samples.
[0176] In summary, in the present application, a difference prompt is constructed based on the difference between the updated prediction result (a prediction result obtained by fusing global experience) and the initial prediction result, and then the first upper-layer network structure is guided to correct the initial prediction result of the first task through the difference prompt. That is, the present application provides a prediction architecture of a multi-task model based on a prompt, introduces a prompt mechanism, and can better utilize the guiding effect of global experience (global experience represents comprehensive prediction information commonly reflected by at least two tasks) to correct and guide the prediction result from a higher level. This not only improves the accuracy of the prediction result of each advertising task, but also improves the direction consistency of the prediction result of a plurality of advertising tasks. For example, the prediction results of a plurality of advertising tasks all reflect that the user is more interested in the advertising content, and the prediction results of a plurality of advertising tasks all reflect that the user is less interested in the advertising content.
[0177] The model prediction method introduced in the above embodiments can be applied to a search system. Next, a prediction method of a model applied to a search system is introduced.
[0178] FIG. 11 shows a prediction method of a model applied to a search system. Optionally, the model is a multi-task model, the multi-task model includes a lower-layer network structure and a plurality of upper-layer network structures arranged in parallel, and each search task network branch includes the lower-layer network structure and an upper-layer network structure. The method includes the following steps:
[0179] In step 1120, the first task is predicted by the first upper-layer network structure of the plurality of upper-layer network structures of the multi-task model to obtain the initial prediction result of the first search task.
[0180] The search task includes a task of predicting the click rate, reading time, whether to copy, and whether to collect of the search result of the user, etc.
[0181] At step 1140, a global experience of the multi-task model is obtained, the global experience representing comprehensive prediction information reflected by at least two search tasks; and an updated prediction result of the first search task is predicted based on the network layer output of the first upper network structure and the global experience.
[0182] In an optional embodiment, the network branch of each task further comprises a global knowledge distillation network. The global experience is obtained by aggregating the plurality of network layer outputs of the plurality of upper network structures through the first global knowledge distillation network, the plurality of network layer outputs corresponding to the plurality of upper network structures one by one. Optionally, the first global knowledge distillation network comprises a second multi-layer perceptron, and the plurality of network layer outputs of the plurality of upper network structures are concatenated to obtain a concatenation result; and the concatenation result is input into the second multi-layer perceptron to obtain the global experience.
[0183] In an optional embodiment, the network branch of each task further comprises a global knowledge distillation network, and the first reference weight is obtained by calculating an attention weight of the network layer output of the first upper network structure on the global experience through the first global knowledge distillation network. Optionally, the first global knowledge distillation network comprises a third multi-layer perceptron, and the network layer output of the first upper network structure and the global experience are input into the third multi-layer perceptron to obtain the first reference weight, and the last network layer of the third multi-layer perceptron is a normalization exponential function layer.
[0184] The first reference experience is obtained by performing a weighted operation on the global experience through the first reference weight, and the first reference experience represents the experience related to the first search task in the global experience. The updated prediction result of the first search task is predicted based on the first reference experience and the network layer output of the first upper network structure. Optionally, the first global knowledge distillation network comprises a fourth multi-layer perceptron, and the first reference experience and the network layer output of the first upper network structure are input into the fourth multi-layer perceptron to predict the updated prediction result of the first search task.
[0185] At step 1160, a difference prompt is obtained based on a difference between the initial prediction result of the first search task and the updated prediction result of the first search task.
[0186] In an optional embodiment, a first difference value is obtained by calculating a difference between the initial prediction result of the first search task and the updated prediction result of the first search task. The difference prompt is obtained by performing an embedding operation on the first difference value, and the difference prompt is in a target latent space, which is a vector space where the feature embedding vectors input into the lower network structure are located. Optionally, the first difference value is input into the first multi-layer perceptron to perform the embedding operation to obtain the difference prompt.
[0187] At step 1180, based on the difference prompt, the first upper-layer network structure is guided to correct the initial prediction result of the first search task to obtain a re-prediction result of the first search task.
[0188] In one embodiment, the difference prompt and the network layer output of the first upper-layer network structure are spliced to obtain an intermediate splicing result; and the intermediate splicing result is input into the result layer of the first upper-layer network structure to obtain the re-prediction result of the first search task.
[0189] In one optional embodiment, in one loop process, when the difference between the ith prediction result and the (i-1)th prediction result is less than the difference threshold, the ith prediction result is output, i is an integer with an initial value of two, when i is equal to two, the ith prediction result is the re-prediction result of the first search task, and the (i-1)th prediction result is the initial prediction result of the first search task. When the difference between the ith prediction result and the (i-1)th prediction result is not less than the difference threshold, based on the difference between the ith prediction result and the updated prediction result of the first search task, an (i-1)th difference prompt is obtained; based on the (i-1)th difference prompt, the first upper-layer network structure is guided to correct the ith prediction result to obtain an (i+1)th prediction result; i+1 is updated to i, and the loop process is re-entered.
[0190] In one optional embodiment, a plurality of prediction result means corresponding to a plurality of search tasks are obtained, each prediction result mean refers to a mean of a plurality of re-prediction results obtained by executing one search task on a plurality of test samples. The number of test samples in which the re-prediction result for each search task is greater than the prediction result mean of the corresponding search task is counted to obtain a first number. And, the number of test samples in which the re-prediction result for each search task is less than the prediction result mean of the corresponding search task is counted to obtain a second number. The sum of the first number and the second number is divided by the total number to obtain a task consistency index of the plurality of search tasks, and the total number is the number of the plurality of test samples.
[0191] In summary, in the present application, a difference prompt is constructed based on the difference between the update prediction result (a prediction result obtained by fusing global experience for prediction) and the initial prediction result, and then the first upper-layer network structure is guided to correct the initial prediction result of the first task through the difference prompt. That is, the present application provides a prediction architecture of a multi-task model based on a prompt, introduces a prompt mechanism, can better utilize the guiding role of global experience (global experience represents comprehensive prediction information commonly reflected by at least two tasks), and corrects and guides the prediction result from a higher level, which not only improves the accuracy of the prediction result of each search task, but also improves the direction consistency of the prediction results of multiple search tasks. For example, the prediction results of multiple search tasks all reflect that the user is relatively satisfied with the search results, and the prediction results of multiple search tasks all reflect that the user is relatively dissatisfied with the search results.
[0192] FIG. 12 shows a structural block diagram of a model prediction device provided by an example embodiment of the present application. Optionally, the model is a multi-task model, the multi-task model includes a lower-layer network structure and multiple upper-layer network structures arranged in parallel, and each task network branch includes the lower-layer network structure and one upper-layer network structure. The device includes:
[0193] The prediction module 1201 is configured to perform prediction of the first task through the first upper-layer network structure of the multiple upper-layer network structures of the multi-task model, to obtain an initial prediction result of the first task.
[0194] The acquisition module 1202 is configured to acquire global experience of the multi-task model, the global experience representing comprehensive prediction information commonly reflected by at least two tasks.
[0195] The prediction module 1201 is further configured to predict an update prediction result of the first task based on the network layer output of the first upper-layer network structure and the global experience.
[0196] The prompt construction module 1203 is configured to obtain a difference prompt based on the difference between the initial prediction result of the first task and the update prediction result of the first task.
[0197] The prediction module 1201 is further configured to guide the first upper-layer network structure to correct the initial prediction result of the first task based on the difference prompt, to obtain a re-prediction result of the first task.
[0198] In an optional embodiment, the prompt construction module 1203 is further configured to calculate a difference value between the initial prediction result of the first task and the update prediction result of the first task, to obtain a first difference value.
[0199] The first difference value is subjected to an embedding operation to obtain the difference prompt, and the difference prompt is in a target latent space, which is a vector space where a feature embedding vector input to the lower-layer network structure is located.
[0200] In an optional embodiment, the prompt construction module 1203 is further configured to input the first difference value into the first multi-layer perceptron to perform an embedding operation to obtain a difference prompt.
[0201] In an optional embodiment, the prediction module 1201 is further configured to concatenate the difference prompt and the network layer output of the first upper-layer network structure to obtain an intermediate concatenation result; and input the intermediate concatenation result into a result layer of the first upper-layer network structure to obtain a re-prediction result of the first task.
[0202] In an optional embodiment, the apparatus further comprises an output module 1204.
[0203] In a loop process, in a case where a difference between an i-th prediction result and an (i-1)-th prediction result is less than a difference threshold, the output module 1204 is configured to output the i-th prediction result, i is a positive integer not less than one, an initial value of i is two, the i-th prediction result is the re-prediction result of the first task when i is equal to two, and the (i-1)-th prediction result is the initial prediction result of the first task.
[0204] In a case where the difference between the i-th prediction result and the (i-1)-th prediction result is not less than the difference threshold, the prompt construction module 1203 is further configured to obtain an (i-1)-th difference prompt based on a difference between the i-th prediction result and an updated prediction result of the first task.
[0205] The prediction module 1201 is further configured to guide the first upper-layer network structure to correct the i-th prediction result based on the (i-1)-th difference prompt to obtain an (i+1)-th prediction result; and update i+1 to i to re-enter the loop process.
[0206] In an optional embodiment, the network branch of each task further comprises a global knowledge distillation network; and the acquisition module 1202 is further configured to aggregate the multiple network layer outputs of the multiple upper-layer network structures through the first global knowledge distillation network to obtain global experience, the multiple upper-layer network structures and the multiple network layer outputs being in one-to-one correspondence.
[0207] In an optional embodiment, the first global knowledge distillation network comprises a second multi-layer perceptron; and the acquisition module 1202 is further configured to concatenate the multiple network layer outputs of the multiple upper-layer network structures to obtain a concatenation result; and input the concatenation result into the second multi-layer perceptron to obtain the global experience.
[0208] In an optional embodiment, the network branch of each task further comprises a global knowledge distillation network; the prediction module 1201 is further configured to calculate, by the first global knowledge distillation network, attention weights of network layer outputs of the first upper-layer network structure to the global experience, to obtain first reference weights, the first reference weights being reference weights corresponding to the first task; perform a weighting operation on the global experience by the first reference weights, to obtain first reference experience, the first reference experience representing experience related to the first task in the global experience; and predict an updated prediction result of the first task based on the first reference experience and the network layer outputs of the first upper-layer network structure.
[0209] In an optional embodiment, the first global knowledge distillation network comprises a third multi-layer perceptron; the prediction module 1201 is further configured to input the network layer outputs of the first upper-layer network structure and the global experience into the third multi-layer perceptron, to obtain the first reference weights, the last network layer of the third multi-layer perceptron being a normalization exponential function layer.
[0210] In an optional embodiment, the first global knowledge distillation network comprises a fourth multi-layer perceptron; the prediction module 1201 is further configured to input the first reference experience and the network layer outputs of the first upper-layer network structure into the fourth multi-layer perceptron, to predict the updated prediction result of the first task.
[0211] In an optional embodiment, the apparatus further comprises an index construction module 1205. The index construction module 1205 is configured to obtain a plurality of prediction result means corresponding to a plurality of tasks, each prediction result mean representing a mean of a plurality of re-prediction results obtained by executing one task on a plurality of test samples; count a number of test samples in which a re-prediction result for each task is greater than a prediction result mean corresponding to the task, to obtain a first number; count a number of test samples in which a re-prediction result for each task is less than a prediction result mean corresponding to the task, to obtain a second number; and divide a sum of the first number and the second number by a total number, to obtain a task consistency index of the plurality of tasks, the total number being a number of the plurality of test samples.
[0212] In summary, in the present application, a difference prompt is constructed based on the difference between the updated prediction result (a prediction result obtained by fusing global experience for prediction) and the initial prediction result, and then the first upper-layer network structure is guided to correct the initial prediction result of the first task through the difference prompt. That is, the present application provides a prediction architecture of a multi-task model based on a prompt, introduces a prompt mechanism, can better utilize the guiding role of global experience (global experience represents comprehensive prediction information commonly reflected by at least two tasks), and corrects and guides the prediction result from a higher level. This not only can improve the accuracy of the prediction result of each task, but also can improve the direction consistency of the prediction results of multiple tasks. For example, the prediction results of multiple tasks all reflect that the user is relatively satisfied with the recommended content, and the prediction results of multiple tasks all reflect that the user is relatively dissatisfied with the recommended content.
[0213] FIG. 13 is a structural schematic diagram of a computer device according to an exemplary embodiment. The computer device 1300 includes a central processing unit (CPU) 1301, a system memory 1304 including a random access memory (RAM) 1302 and a read-only memory (ROM) 1303, and a system bus 1305 connecting the system memory 1304 and the central processing unit 1301. The computer device 1300 also includes a basic input / output system (I / O) 1306 to help transfer information between various devices within the computer device, and a mass storage device 1307 for storing an operating system 1313, application programs 1314, and other program modules 1315.
[0214] The basic input / output system 1306 includes a display 1308 for displaying information and an input device 1309 such as a mouse, a keyboard, or the like for inputting information. The display 1308 and the input device 1309 are both connected to the central processing unit 1301 through an input / output controller 1310 connected to the system bus 1305. The basic input / output system 1306 can also include an input / output controller 1310 for receiving and processing input from a keyboard, a mouse, or an electronic stylus, and the like. Similarly, the input / output controller 1310 also provides output to a display screen, a printer, or other types of output devices.
[0215] The mass storage device 1307 is connected to the central processing unit 1301 through a mass storage controller (not shown) connected to the system bus 1305. The mass storage device 1307 and its associated computer device readable medium provide nonvolatile storage for the computer device 1300. That is, the mass storage device 1307 can comprise a computer device readable medium (not shown) such as a hard disk or a Compact Disc Read-Only Memory (CD-ROM) drive.
[0216] Without loss of generality, computer device readable media can include computer device storage media and communication media. Computer device storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer device readable instructions, data structures, program modules or other data. Computer device storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), CD-ROM, Digital Video Disc (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Computer device storage media would not, however, include communication media including any medium that facilitates transfer of a computer device readable instruction, data structure, program module or other data from one place to another. The system memory 1304 and mass storage device 1307 described above can collectively be referred to as memory.
[0217] According to various embodiments of the present disclosure, the computer device 1300 can further operate in a networked environment using a network connection to one or more remote computer devices. The computer device 1300 can thus be connected to the network 1311 through a network interface unit 1312 connected to the system bus 1305, or can use another type of network connection (not shown) to the other types of networks or remote computer systems (not shown).
[0218] The memory further includes one or more programs, which are stored in the memory and implemented by the central processing unit 1301 to implement all or part of the steps described above for the model prediction method.
[0219] FIG. 14 shows a structural block diagram of a computer device 1400 according to an example embodiment of the present application. The computer device 1400 can be a portable mobile terminal, such as a smartphone, a tablet computer, an MP3 player, an MP4 player, a notebook computer, or a desktop computer. The computer device 1400 can also be referred to as a user device, a portable terminal, a laptop terminal, a desktop terminal, or other names.
[0220] Generally, the computer device 1400 includes a processor 1401 and a memory 1402.
[0221] The processor 1401 can include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor 1401 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor 1401 can also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 1401 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing content required to be displayed on a display screen. In some embodiments, the processor 1401 can further include an AI (Artificial Intelligence) processor for processing machine learning-related computing operations.
[0222] The memory 1402 can include one or more computer-readable storage media. The computer-readable storage media can be non-transitory. The memory 1402 can also include high-speed random access memory and can include nonvolatile memory, such as one or more magnetic disk storage devices, optical storage devices, flash memory devices, or other nonvolatile solid-state storage devices. In some embodiments, the non-transitory computer-readable storage medium of the memory 1402 is used to store at least one instruction for execution by the processor 1401 to implement the model prediction method provided by the method embodiments of the present application.
[0223] In some embodiments, the computer device 1400 can further optionally include a peripheral device interface 1403 and at least one peripheral device. The processor 1401, the memory 1402, and the peripheral device interface 1403 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 1403 through a bus, a signal line, or a circuit board. For example, the peripheral device can include at least one of a radio frequency circuit 1404, a display screen 1405, a camera assembly 1406, an audio circuit 1407, and a power supply 1408.
[0224] The peripheral device interface 1403 can be used to connect at least one peripheral device related to input / output to the processor 1401 and the memory 1402. In some embodiments, the processor 1401, the memory 1402, and the peripheral device interface 1403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1401, the memory 1402, and the peripheral device interface 1403 can be implemented on a separate chip or circuit board, and the present embodiment is not limited in this regard.
[0225] The radio frequency circuit 1404 is configured to receive and send RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1404 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 1404 converts electrical signals to electromagnetic signals for transmission, or vice versa. Optionally, the radio frequency circuit 1404 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a code chip set, a subscriber identity module card, and the like. The radio frequency circuit 1404 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1404 can also include NFC (Near Field Communication) related circuitry, which is not limited in the present application.
[0226] The display screen 1405 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video and any combination thereof. When the display screen 1405 is a touch display screen, the display screen 1405 also has the ability to collect touch signals on or above the surface of the display screen 1405. The touch signals can be input as control signals to the processor 1401 for processing. At this time, the display screen 1405 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1405 can be one, arranged on the front panel of the computer device 1400; in other embodiments, the display screen 1405 can be at least two, arranged on different surfaces of the computer device 1400 or in a folding design; in other embodiments, the display screen 1405 can be a flexible display screen, arranged on a curved surface or a folding surface of the computer device 1400. Even, the display screen 1405 can also be arranged in an irregular shape, that is, a special-shaped screen. The display screen 1405 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode) and the like.
[0227] The camera component 1406 is configured to capture images or videos. Optionally, the camera component 1406 includes a front camera and a rear camera. Generally, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, the rear camera is at least two, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to realize the background blur function by fusing the main camera and the depth-of-field camera, the panorama shooting and VR (Virtual Reality) shooting function by fusing the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera component 1406 can further include a flash. The flash can be a single-color-temperature flash or a dual-color-temperature flash. The dual-color-temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0228] The audio circuit 1407 can include a microphone and a speaker. The microphone is configured to capture sound waves of a user and an environment, and convert the sound waves into an electrical signal input to the processor 1401 for processing or to the radio frequency circuit 1404 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, which are respectively disposed at different parts of the computer device 1400. The microphone can also be an array microphone or an omnidirectional collection microphone. The speaker is configured to convert an electrical signal from the processor 1401 or the radio frequency circuit 1404 into sound waves. The speaker can be a traditional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert an electrical signal into a sound wave audible to humans, but also convert an electrical signal into an inaudible sound wave to humans for ranging purposes. In some embodiments, the audio circuit 1407 can further include a headphone jack.
[0229] The power supply 1408 is configured to supply power to various components in the computer device 1400. The power supply 1408 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1408 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery that is charged through a wired line, and the wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0230] In some embodiments, the computer device 1400 further includes one or more sensors 1409. The one or more sensors 1409 include, but are not limited to, an acceleration sensor 1410, a gyroscope sensor 1411, a pressure sensor 1412, an optical sensor 1413, and a proximity sensor 1414.
[0231] The acceleration sensor 1410 can detect the acceleration magnitude in three coordinate axes of the coordinate system established by the computer device 1400. For example, the acceleration sensor 1410 can be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 1401 can control the display screen 1405 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signals collected by the acceleration sensor 1410. The acceleration sensor 1410 can also be used for game or user motion data collection.
[0232] The gyroscope sensor 1411 can detect the body orientation and rotation angle of the computer device 1400, and the gyroscope sensor 1411 can collect the 3D motion of the user to the computer device 1400 in cooperation with the acceleration sensor 1410. The processor 1401 can implement the following functions according to the data collected by the gyroscope sensor 1411: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization when shooting, game control, and inertial navigation.
[0233] The pressure sensor 1412 can be arranged on the side frame of the computer device 1400 and / or the lower layer of the display screen 1405. When the pressure sensor 1412 is arranged on the side frame of the computer device 1400, the user's holding signal to the computer device 1400 can be detected, and the left-hand or right-hand recognition or shortcut operation can be performed by the processor 1401 according to the holding signal collected by the pressure sensor 1412. When the pressure sensor 1412 is arranged on the lower layer of the display screen 1405, the processor 1401 can control the operable control on the UI interface according to the user's pressure operation to the display screen 1405. The operable control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0234] The optical sensor 1413 is used to collect the ambient light intensity. In an embodiment, the processor 1401 can control the display brightness of the display screen 1405 according to the ambient light intensity collected by the optical sensor 1413. For example, when the ambient light intensity is high, the display brightness of the display screen 1405 is increased; when the ambient light intensity is low, the display brightness of the display screen 1405 is decreased. In another embodiment, the processor 1401 can also dynamically adjust the shooting parameters of the camera assembly 1406 according to the ambient light intensity collected by the optical sensor 1413.
[0235] The proximity sensor 1414, also called a distance sensor, is usually arranged on the front panel of the computer device 1400. The proximity sensor 1414 is used to collect the distance between the user and the front of the computer device 1400. In one embodiment, when the proximity sensor 1414 detects that the distance between the user and the front of the computer device 1400 gradually decreases, the display screen 1405 is switched from the bright screen state to the screen-off state under the control of the processor 1401; when the proximity sensor 1414 detects that the distance between the user and the front of the computer device 1400 gradually increases, the display screen 1405 is switched from the screen-off state to the bright screen state under the control of the processor 1401.
[0236] Those skilled in the art can understand that the structure shown in FIG. 14 does not constitute a limitation on the computer device 1400, and can include more or fewer components than shown, or combine certain components, or adopt a different component arrangement.
[0237] The present application also provides a computer readable storage medium, the storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to realize the model prediction method provided by the above-mentioned method embodiment.
[0238] The present application provides a computer program product or computer program, which includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the model prediction method provided by the above-mentioned method embodiment.
[0239] The above-mentioned application embodiment serial number is only for description, not representing the advantages and disadvantages of the embodiment.
[0240] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by program to instruct related hardware to complete, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be read-only memory, disk or optical disk, etc.
[0241] To sum up, the computer device utilizes the multi-task model to perform first task prediction through a first upper network structure in the multi-task model, and obtains a preliminary prediction result. Then, global experience of the multi-task model is obtained, which represents comprehensive prediction information embodied by at least two tasks, and an updated prediction result of the first task is predicted according to the network layer output of the first upper network structure and the global experience. Subsequently, a difference prompt is obtained according to the difference between the preliminary prediction result and the updated prediction result, and the first upper network structure is guided to correct the preliminary prediction result by means of the difference prompt, thereby obtaining a re-prediction result. This method can better utilize the guiding effect of global experience and help improve the accuracy of the prediction result and the prediction consistency of the multi-task by introducing global experience and correcting the prediction result based on the difference prompt.
[0242] Further, a first difference value is obtained by calculating the difference between the preliminary prediction result and the updated prediction result of the first task, and the first difference value is subjected to embedding operation so that the difference prompt is in a target latent space where a feature embedding vector input to a lower network structure is located. The difference prompt constructed in this way is more flexible and has better effect, and can explicitly guide the model to correct the prediction result, thereby improving the accuracy of prediction.
[0243] In the process of obtaining the difference prompt, the first difference value is input into the first multi-layer perceptron to perform embedding operation, thereby obtaining the difference prompt. This method of mapping the difference into a latent space prompt through the multi-layer perceptron is simple and convenient, and provides an effective way for generating the difference prompt, further ensuring the feasibility and efficiency of the prediction correction process.
[0244] When guiding the first upper network structure to correct the preliminary prediction result based on the difference prompt, the difference prompt and the network layer output of the first upper network structure are spliced to obtain an intermediate splicing result, and the intermediate splicing result is input into the result layer of the first upper network structure, thereby finally obtaining the re-prediction result of the first task. This process explicitly shows the specific operation of correcting the prediction result by using the difference prompt, which helps to improve the accuracy of the prediction result.
[0245] Further, a cycle process is set. When the difference between the ith prediction result and the (i-1)th prediction result is less than a difference threshold (i is initially two, the ith prediction result is the second prediction result of the first task, and the (i-1)th prediction result is the first prediction result of the first task), the ith prediction result is output; if the difference is not less than the difference threshold, an (i-1)th difference prompt is obtained based on the difference between the ith prediction result and the updated prediction result of the first task, the first upper-layer network structure is guided to correct the ith prediction result according to the difference prompt to obtain an (i+1)th prediction result, and i+1 is updated to i, and the cycle process is re-entered. By continuously correcting the prediction result, simulating the human reasoning process, repeatedly checking and correcting, the accuracy of reasoning can be further improved, and the final prediction result is more reliable.
[0246] When the network branch of each task includes the global knowledge distillation network, the global experience is obtained by the first global knowledge distillation network based on the multiple network layer outputs of the multiple upper-layer network structures, and the multiple network layer outputs correspond to the multiple upper-layer network structures one by one. This method provides an effective way to obtain global experience, which helps the model to grasp the comprehensive information of multiple tasks from the overall level and provides more comprehensive guidance for subsequent prediction.
[0247] When the global experience is obtained by the first global knowledge distillation network, if the first global knowledge distillation network includes a second multi-layer perceptron, the specific operation is to splice the multiple network layer outputs of the multiple upper-layer network structures to obtain a spliced result, and then input the spliced result into the second multi-layer perceptron to obtain the global experience. This method has less invasiveness to the original upper-layer network structures, only adds a global knowledge distillation network, and has less model modification. At the same time, the multi-layer perceptron is used to generate the global experience, which is simple to operate and has strong interpretability.
[0248] When the network branch of each task includes the global knowledge distillation network, the attention weight of the network layer output of the first upper-layer network structure to the global experience is calculated by the first global knowledge distillation network to obtain the first reference weight (the reference weight corresponding to the first task), then the weighted operation is performed on the global experience by the first reference weight to obtain the first reference experience (representing the experience related to the first task in the global experience), and finally the updated prediction result of the first task is predicted based on the first reference experience and the network layer output of the first upper-layer network structure. This process uses the attention mechanism to obtain the experience related to the first task from the global experience, realizes the selection of the global experience, makes the model focus on the key information, and further improves the accuracy of the updated prediction result.
[0249] In the process of calculating the attention weight of the global experience by the first global knowledge distillation network, if the first global knowledge distillation network includes a third multi-layer perceptron, the network layer output of the first upper network structure and the global experience are input into the third multi-layer perceptron to obtain the first reference weight, and the last network layer of the third multi-layer perceptron is a normalized exponential function layer. This way calculates the attention weight through the third multi-layer perceptron, which is simple to operate and provides an effective means for obtaining global experience related to the first task, which helps to improve the accuracy of the update prediction result.
[0250] After obtaining the first reference experience, if the first global knowledge distillation network includes a fourth multi-layer perceptron, the first reference experience and the network layer output of the first upper network structure are input into the fourth multi-layer perceptron to predict the update prediction result of the first task. This method uses the fourth multi-layer perceptron to perform re-prediction, and the model structure is relatively simple, providing a feasible way for predicting the update result based on global experience and network layer output, which helps to improve the prediction efficiency and accuracy.
[0251] Further, a plurality of prediction result means corresponding to a plurality of tasks (each prediction result mean refers to the mean of a plurality of re-prediction results obtained by executing a task on a plurality of test samples) are obtained, the number of test samples in which the re-prediction result for each task is greater than the prediction result mean of the corresponding task is counted, to obtain a first number, and the number of test samples in which the re-prediction result for each task is less than the prediction result mean of the corresponding task is counted, to obtain a second number. Finally, the sum of the first number and the second number is divided by the total number (the number of test samples) to obtain a task consistency index of the plurality of tasks. This index can measure the directional consistency of the prediction results of the plurality of tasks, and a higher value indicates that the overall prediction results of the plurality of tasks are more accurate, providing an effective reference for evaluating the multi-task prediction effect of the model.
[0252] The technical features of the above embodiments can be combined in any way. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not contradict, they should be considered within the scope of the present disclosure.
[0253] The above-described embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be noted that for ordinary skilled persons in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A model prediction method performed by a computer device, the method comprising: performing prediction of a first task by a first upper network structure of a plurality of upper network structures of a multi-task model to obtain a first prediction result of the first task; obtaining global experience of the multi-task model, the global experience representing comprehensive prediction information reflected by at least two tasks; predicting an updated prediction result of the first task based on network layer output of the first upper network structure and the global experience; and obtaining a difference prompt based on a difference between the first prediction result and the updated prediction result of the first task. based on the difference prompt, guiding the first upper network structure to correct the first prediction result of the first task to obtain a second prediction result of the first task. 2.The method of claim 1, wherein the obtaining the difference prompt based on the difference between the first prediction result and the updated prediction result of the first task comprises: calculating a difference value between the first prediction result and the updated prediction result of the first task to obtain a first difference value; and performing embedding operation on the first difference value to obtain the difference prompt, the difference prompt being in a target latent space, the target latent space being a vector space in which a feature embedding vector input to a lower network structure is located. 3.The method of claim 2, wherein the performing embedding operation on the first difference value to obtain the difference prompt comprises: inputting the first difference value into a first multi-layer perceptron to perform the embedding operation to obtain the difference prompt. 4.The method of any one of claims 1 to 3, wherein the guiding the first upper network structure to correct the first prediction result of the first task based on the difference prompt to obtain the second prediction result of the first task comprises: concatenating the difference prompt and the network layer output of the first upper network structure to obtain an intermediate concatenation result; and inputting the intermediate concatenation result into a result layer of the first upper network structure to obtain the second prediction result of the first task. 5.The method of any one of claims 1 to 4, further comprising: in a loop, in a case where a difference between an i-th prediction result and an i-1-th prediction result is less than a difference threshold, outputting the i-th prediction result, i being an integer with an initial value of two, the i-th prediction result being the second prediction result of the first task when i is equal to two, and the i-1-th prediction result being the first prediction result of the first task; in a case where the difference between the i-th prediction result and the i-1-th prediction result is not less than the difference threshold, obtaining an i-1-th difference prompt based on a difference between the i-th prediction result and an updated prediction result of the first task; guiding the first upper network structure to correct the i-th prediction result based on the i-1-th difference prompt to obtain an i+1-th prediction result; and updating i+1 to i to re-enter the loop. 6. The method of any one of claims 1-5, wherein each network branch of each task comprises a global knowledge distillation network; and wherein the obtaining the global experience of the multi-task model comprises: obtaining, by a first global knowledge distillation network, the global experience by aggregating a plurality of network layer outputs of the plurality of upper network structures, the plurality of network layer outputs corresponding one-to-one to the plurality of upper network structures.
7. The method of claim 6, wherein the first global knowledge distillation network comprises a second multi-layer perceptron; and wherein the obtaining the global experience by aggregating the plurality of network layer outputs of the plurality of upper network structures comprises: concatenating the plurality of network layer outputs of the plurality of upper network structures to obtain a concatenation result; and inputting the concatenation result into the second multi-layer perceptron to obtain the global experience.
8. The method of any one of claims 1-7, wherein each network branch of each task comprises a global knowledge distillation network; and wherein the predicting the updated prediction result of the first task based on the network layer output of the first upper network structure and the global experience comprises: obtaining, by a first global knowledge distillation network, a first borrowing weight by calculating an attention weight of the network layer output of the first upper network structure on the global experience, the first borrowing weight being a borrowing weight corresponding to the first task; performing a weighting operation on the global experience by using the first borrowing weight to obtain a first borrowing experience, the first borrowing experience representing an experience in the global experience that is relevant to the first task; and predicting the updated prediction result of the first task based on the first borrowing experience and the network layer output of the first upper network structure.
9. The method of claim 8, wherein the first global knowledge distillation network comprises a third multi-layer perceptron; and wherein the obtaining the first borrowing weight by calculating the attention weight of the network layer output of the first upper network structure on the global experience comprises: inputting the network layer output of the first upper network structure and the global experience into the third multi-layer perceptron to obtain the first borrowing weight, a last network layer of the third multi-layer perceptron being a normalization exponential function layer.
10. The method of claim 8, wherein the first global knowledge distillation network comprises a fourth multi-layer perceptron; and wherein the predicting the updated prediction result of the first task based on the first borrowing experience and the network layer output of the first upper network structure comprises: inputting the first borrowing experience and the network layer output of the first upper network structure into the fourth multi-layer perceptron to predict the updated prediction result of the first task.
11. The method of any one of claims 1-10, further comprising: obtaining a plurality of prediction result means corresponding to the plurality of tasks, each prediction result mean being a mean of a plurality of the re-prediction results of a plurality of test samples performing one task; and counting a number of test samples in the plurality of test samples for which the re-prediction result of each task is greater than the prediction result mean of the corresponding task to obtain a first number. and, counting the number of test samples whose re-predicted results for each task are less than the mean of the predicted results of the corresponding task in the plurality of test samples, obtaining a second number; dividing the sum of the first number and the second number by the total number, obtaining the task consistency index of the plurality of tasks, the total number being the number of the plurality of test samples. 12.A model prediction device, comprising: a prediction module configured to predict a first task by a first upper-layer network structure in a plurality of upper-layer network structures of a multi-task model, and obtain a primary prediction result of the first task; an acquisition module configured to acquire global experience of the multi-task model, the global experience representing comprehensive prediction information reflected by at least two tasks; the prediction module is further configured to predict an updated prediction result of the first task based on network layer output of the first upper-layer network structure and the global experience; a prompt construction module configured to obtain a difference prompt based on a difference between the primary prediction result of the first task and the updated prediction result of the first task; and the prediction module is further configured to guide the first upper-layer network structure to correct the primary prediction result of the first task based on the difference prompt, and obtain a re-predicted result of the first task.
13. A computer device comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the model prediction method according to any one of claims 1 to 11. 14.A computer readable storage medium storing a computer program, the computer program being loaded and executed by a processor to implement the model prediction method according to any one of claims 1 to 11. 15.A computer program product storing a computer program, the computer program being loaded and executed by a processor to implement the model prediction method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Multi-task joint training crowd counting network method, system, medium and terminal
CN110610143A
Parking space prediction method and device, electronic equipment and storage medium
CN114693001A
Training method of multi-task prediction model, and multi-task prediction method and device
CN115423016A
Encryption anomaly traffic detection method based on deep contrast learning
CN116886433A
Network structure determination method and device of multi-task model, and data prediction method and device
CN116956204A