Multi-scene based model training method and device, model prediction method and device

CN116933076BActive Publication Date: 2026-10-16ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310870976.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-14
Publication Date
2026-10-16
Estimated Expiration
2043-07-14

Smart Images

  • Figure CN116933076B_ABST
    Figure CN116933076B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a model training method and device based on multiple scenes, a model prediction method and device. In the model training method, common training sample sets and individual training sample sets for different scenes are obtained; for each machine, a support sample set of a scene is used to train a model in the machine to obtain first decision parameters of a decision layer network in the model; a query sample set of the corresponding scene is used to train the updated model to obtain feature parameters of a feature network in the model and second decision parameters of the decision layer network; an individual training sample set of the corresponding scene is used to train the updated model in the machine to obtain scene decision parameters of the corresponding scene for the machine; and the scene decision parameters and the second decision parameters of each scene are stored for use in combination with a model configured with the feature parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of artificial intelligence technology, specifically to multi-scenario model training methods and apparatus, and model prediction methods and apparatus. Background Technology

[0002] With the development of technology, machine learning has been applied to various fields, and its advantages, such as predictive accuracy, have made it popular among users. Generally, machine learning models consist of two parts: model training and model prediction. When training a model for a specific domain, training samples from that domain can be used to train the model, resulting in a model specific to that domain. This model can then be applied to that domain, for example, for recommendation purposes. Summary of the Invention

[0003] In view of the above, embodiments of this specification provide a model training method and apparatus, and a model prediction method and apparatus based on multiple scenarios. Through the technical solutions of the embodiments of this specification, a training scheme and a prediction scheme based on a multi-scenario model structure are provided, which not only retains the parameters shared by different scenarios, but also supports personalized parameter settings for different scenarios.

[0004] According to one aspect of the embodiments of this specification, a multi-scenario model training method is provided, wherein multiple machines are interconnected, each machine is configured with a model to be trained, the models configured on each machine have the same structure, and each model includes a feature network and a decision layer network. The model training method includes: acquiring a common training sample set and individual training sample sets for different scenarios, wherein the common training sample set corresponding to each scenario includes a support sample set and a query sample set; for each machine, using the support sample set of a scenario, training the model on that machine to obtain the first decision parameters of the decision layer network in the model, wherein each machine corresponds to a processing... In a given scenario, different machines handle different scenarios. For each machine, the model updated with the first decision parameters is trained using the query sample set corresponding to the scenario. This yields the feature parameters of the feature network and the second decision parameters of the decision layer network in the model, obtained based on the loss obtained by that machine and the losses on other machines. For each machine, the model updated with the feature parameters and second decision parameters is trained using a personalized training sample set corresponding to the scenario to obtain the scenario decision parameters for that machine. The scenario decision parameters and second decision parameters for each scenario are stored for use in conjunction with the model configured with the feature parameters.

[0005] According to another aspect of the embodiments of this specification, a multi-scenario model training method is also provided, executed by one of a plurality of machines connected in communication. Each machine is configured with a model to be trained, and the models configured on each machine have the same structure. Each model includes a feature network and a decision layer network. The model training method includes: training the local model using a support sample set corresponding to the scenario to obtain the first decision parameters of the decision layer network in the model, wherein each machine corresponds to processing one scenario, and different machines process different scenarios. Each different scenario has a common training sample set and a personalized training sample set. The common training sample set corresponding to each scenario includes a support sample set and a query sample set; training the model updated with the first decision parameters using the query sample set of the corresponding scenario to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the model obtained based on the local loss and the losses on other machines; and training the local model updated with the feature parameters and the second decision parameters using the personalized training sample set of the corresponding scenario to obtain the scenario decision parameters of the corresponding scenario, so that the scenario decision parameters and the second decision parameters of each scenario are stored for use in conjunction with the model configured with the feature parameters.

[0006] According to another aspect of the embodiments of this specification, a multi-scenario model prediction method is also provided, wherein the model is obtained according to any model training method, and the model prediction method includes: obtaining a sample to be predicted; obtaining decision parameters for the sample to be predicted from the stored scenario decision parameters and second decision parameters of each scenario; updating the model configured with feature parameters using the obtained decision parameters; and using the updated model to predict the sample to be predicted, and outputting the prediction result.

[0007] According to another aspect of the embodiments of this specification, a multi-scenario model training device is also provided, applied to one of a plurality of machines connected in communication. Each machine is configured with a model to be trained, and the models configured on each machine have the same structure. Each model includes a feature network and a decision layer network. The model training device includes: a first model training unit, which trains the local model using a support sample set of the corresponding scenario to obtain the first decision parameters of the decision layer network in the model. Each machine corresponds to a scenario, and different machines handle different scenarios. Each different scenario has a common training sample set and a personalized training sample set. The common training sample set corresponding to each scenario includes a support sample set and a query sample set; a second model training unit, which trains the model updated with the first decision parameters using the query sample set of the corresponding scenario to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the model, obtained based on the local loss and the losses on other machines; and a third model training unit, which trains the local model updated with the feature parameters and the second decision parameters using the personalized training sample set of the corresponding scenario to obtain the scenario decision parameters of the corresponding scenario, so that the scenario decision parameters and the second decision parameters of each scenario are stored for use in conjunction with the model configured with the feature parameters.

[0008] According to another aspect of the embodiments of this specification, a multi-scenario model prediction device is also provided, wherein the model is obtained according to any model training method, and the model prediction device includes: a sample acquisition unit for acquiring samples to be predicted; a decision parameter acquisition unit for acquiring decision parameters for the samples to be predicted from stored scenario decision parameters and second decision parameters of various scenarios; a model update unit for updating the model configured with feature parameters using the acquired decision parameters; and a model prediction unit for predicting the samples to be predicted using the updated model and outputting the prediction result.

[0009] According to another aspect of the embodiments of this specification, an electronic device is also provided, comprising: at least one processor, a memory coupled to the at least one processor, and a computer program stored on the memory, wherein the at least one processor executes the computer program to implement the model training method or model prediction method as described above.

[0010] According to another aspect of the embodiments of this specification, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the model training method or model prediction method as described above.

[0011] According to another aspect of the embodiments of this specification, a computer program product is also provided, including a computer program that, when executed by a processor, implements the model training method or model prediction method as described above. Attached Figure Description

[0012] A further understanding of the nature and advantages of the embodiments described in this specification can be achieved by referring to the following accompanying drawings. In the drawings, similar components or features may have the same reference numerals.

[0013] Figure 1 A schematic diagram illustrating an example of multiple machines connected via a server according to embodiments of this specification is shown.

[0014] Figure 2 A schematic diagram illustrating an example of a model structure according to an embodiment of this specification is shown.

[0015] Figure 3 A flowchart illustrating an example of a multi-scenario-based model training method according to an embodiment of this specification is shown.

[0016] Figure 4 A schematic diagram illustrating an example of stored scene decision parameters and second decision parameters according to an embodiment of this specification is shown.

[0017] Figure 5 A flowchart illustrating an example of a multi-scenario-based model training method according to another embodiment of this specification is shown.

[0018] Figure 6 A flowchart illustrating an example of a multi-scenario-based model prediction method according to an embodiment of this specification is shown.

[0019] Figure 7 A block diagram of an example of a multi-scenario-based model training apparatus according to an embodiment of this specification is shown.

[0020] Figure 8 A block diagram of an example of a multi-scene-based model prediction apparatus according to an embodiment of this specification is shown.

[0021] Figure 9 A block diagram of an electronic device for implementing a multi-scenario-based model training method according to an embodiment of this specification is shown.

[0022] Figure 10 A block diagram of an electronic device for implementing a multi-scenario-based model prediction method, according to an embodiment of this specification, is shown. Detailed Implementation

[0023] The subject matter described herein will be discussed below with reference to exemplary embodiments. It should be understood that these embodiments are discussed merely to enable those skilled in the art to better understand and implement the subject matter described herein, and are not intended to limit the scope, applicability, or examples set forth in the claims. The function and arrangement of the elements discussed may be changed without departing from the scope of the embodiments described herein. Various processes or components may be omitted, substituted, or added as needed in the various examples. Furthermore, features described in some examples may be combined in other examples.

[0024] As used herein, the term "comprising" and its variations are open terms meaning "including but not limited to". The term "based on" means "at least partially based on". The terms "one embodiment" and "an embodiment" mean "at least one embodiment". The term "another embodiment" means "at least one other embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other definitions, whether explicit or implicit, may be included below. Unless explicitly indicated by the context, the definition of a term shall remain consistent throughout the specification.

[0025] With the development of technology, machine learning has been applied to various fields, and its advantages, such as predictive accuracy, have made it popular among users. Generally, machine learning models consist of two parts: model training and model prediction. When training a model for a specific domain, training samples from that domain can be used to train the model, resulting in a model specific to that domain. This model can then be applied to that domain, for example, in marketing recommendations.

[0026] Currently, many domains encompass multiple different scenarios, and the traditional training methods described above are only applicable to a single scenario within a single domain. Therefore, a common approach is to model each scenario independently, with a one-to-one correspondence between the trained model and the scenario. In this case, for domains with multiple scenarios, several models need to be trained independently, which incurs significant resource costs for training and maintaining the overall business model.

[0027] Based on the above, embodiments of this specification provide a model training method and apparatus, and a model prediction method and apparatus based on multiple scenarios. In this model training method, common training sample sets and individual training sample sets for different scenarios are obtained; for each machine, a support sample set of a scenario is used to train the model on that machine to obtain first decision parameters for updating the decision layer network of the model; for each machine, a query sample set of the corresponding scenario is used to train the model updated with the first decision parameters to obtain feature parameters for the feature network and second decision parameters for the decision layer network of the model; for each machine, an individual training sample set of the corresponding scenario is used to train the model updated with the feature parameters and second decision parameters on that machine to obtain scenario decision parameters for that machine's corresponding scenario; and the scenario decision parameters and second decision parameters for each scenario are stored for use in conjunction with a model configured with feature parameters. Through the technical solutions of the embodiments of this specification, a training scheme and prediction scheme based on a multi-scenario model structure are provided, which not only retains the parameters shared by different scenarios but also supports personalized parameter settings for different scenarios.

[0028] The following is a detailed description of the multi-scenario model training method and apparatus, and the model prediction method and apparatus provided in the embodiments of this specification.

[0029] The embodiments of this specification can be applied to multiple scenarios, each of which can be determined based on region, time, organization, etc. For example, the embodiments of this specification can be applied to the field of insurance marketing, which can include several different insurance scenarios, such as different insurance recommendation scenarios corresponding to different regions.

[0030] In the embodiments of this specification, it can be applied to multiple machines that are interconnected. In one example, the multiple machines can communicate directly with each other; that is, any two of the machines can communicate directly with each other. In another example, the multiple machines can communicate indirectly with each other; that is, each machine communicates with a server individually, and the machines communicate with each other through the server. Figure 1 As shown, Figure 1 A schematic diagram illustrating an example of multiple machines connected via a server according to embodiments of this specification is shown. Here, i represents a positive integer greater than 1.

[0031] In the embodiments described in this specification, each machine may be configured with a model. In one example, the model in each machine may be a recommendation model, such as a marketing recommendation model applied to an insurance scenario. In the model training scheme, the model in each machine is the model to be trained. The model structure configured in each machine may be the same, and each model may include a feature network and a decision layer network. In each model, the feature network is located before the decision layer network. The samples input to the model are first processed by the feature network, and then processed by the decision layer network before being output. The feature network can be used for feature extraction, and the decision layer network can be used to make decisions and predictions based on the features extracted by the feature network.

[0032] In one example, each model can predict one business objective, or multiple business objectives. In one example, business objectives may include at least one of click-through rate (CTR), conversion rate (CVR), and cost estimate. Click-through rate can be the reach rate of clicks for online advertising, etc. Conversion rate is related to click-through rate and is the percentage of successful outcomes (e.g., successful insurance referrals). Conversion rate can be obtained by dividing the number of conversions by the number of clicks. The cost estimate can vary depending on the scenario; for example, in an insurance scenario, the estimated cost is the insurance premium.

[0033] Figure 2 A schematic diagram illustrating an example of a model structure according to an embodiment of this specification is shown. Figure 2 The image shown is a model, such as Figure 2 As shown, the model consists of a feature network and a decision layer network.

[0034] The feature network can include a feature selection layer, an intermediate network, a feature concatenation layer, and a feature extraction layer. The model's input is processed sequentially through the feature extraction layer, feature concatenation layer, intermediate network, and feature selection layer. The feature extraction layer extracts features from the input samples and feeds these extracted features to the feature concatenation layer. The feature concatenation layer concatenates features, for example, by combining features belonging to the same sample set. The intermediate network can be a multi-layered network with a customizable structure. The feature selection layer selects desired features from the output of the intermediate networks and sends them to the decision layer network. In one example, when each model is used to predict multiple business objectives, the feature selection layer can select features relevant to the corresponding business objectives.

[0035] In one example, the number of feature filtering layers can be determined based on the number of business objectives. The number of feature filtering layers can be the same as the number of business objectives, with a one-to-one correspondence between feature filtering layers and business objectives. Each feature filtering layer can provide corresponding features for its respective business objective. Figure 2 For example, when the model has two business objectives, two corresponding feature filtering layers can be set.

[0036] In one example, the number of intermediate networks can be determined based on the number of business objectives. The number of intermediate networks can be specified as a number greater than the number of business objectives. Figure 2 For example, the number of intermediate networks can be one more than the number of business objectives. When the model has two business objectives, three intermediate networks can be set.

[0037] A decision-making layer network can include multiple different sub-decision-making layer networks. These sub-decision-making layer networks can be determined based on different scenarios, and each sub-decision-making layer network can be tailored to a specific scenario. A decision-making layer network can include one or more sub-decision-making layer networks, and the network type and structure of each sub-decision-making layer network can be customized; for example, a sub-decision-making layer network can be a neural network structure.

[0038] In one example, the sub-decision-level networks included in the decision-level network can be identical. In another example, the number of sub-decision-level networks included in the decision-level network can be determined based on the number of business objectives. The number of sub-decision-level networks in the decision-level network can be the same as the number of business objectives, and each sub-decision-level network corresponds one-to-one with a business objective. Each sub-decision-level network processes and predicts for its corresponding business objective, and can output a predicted value for that business objective. Figure 2 For example, when the model has two business objectives, the decision layer network is configured with two sub-decision layer networks, which are used to make predictions for different business objectives.

[0039] Figure 3 A flowchart illustrating an example of a multi-scenario-based model training method according to an embodiment of this specification is shown.

[0040] like Figure 3 As shown in Figure 310, common training sample sets and individual training sample sets for different scenarios can be obtained.

[0041] In the embodiments of this specification, training samples can be classified according to scenarios, with each scenario corresponding to one category. For each scenario, there can be a common training sample set and a unique training sample set. The common training sample set is used to train the model on the common features of the model, while the unique training sample set is used to train the model on the unique features of the corresponding scenario. The common and unique training sample sets can be historical data for the corresponding scenarios.

[0042] The number of training samples in the common training sample set can be greater than the number of training samples in the individual training sample set. In one example, the number of training samples in the common training sample set can be much larger than the number of training samples in the individual training sample set; for example, the number of training samples in the common training sample set can be tens or even hundreds of times greater than the number of training samples in the individual training sample set. In another example, the training samples included in the common training sample set are different from those included in the individual training sample set.

[0043] In one example, for each scenario, historical data for that scenario can be collected at a first specified time. This first specified time can be a specified time period, a specified duration, etc. Historical data for each scenario can be collected separately.

[0044] Historical data from a second specified time period are selected from the collected historical data as a common training sample set. The second specified time period can be a specified time interval, a specified duration, etc., and is a subset of the first specified time period. Therefore, the selected historical data from the second specified time period is a portion of the collected historical data.

[0045] Then, historical data at a third specified time is selected from historical data other than the common training sample set as the individual training sample set. The third specified time can be a specified time period, a specified duration, etc., and the duration of the second specified time can be longer than the duration of the third specified time. There is no overlap between the second and third specified times, thus making the training samples included in the common training sample set different from those included in the individual training sample set.

[0046] In one example, obtaining a training sample set can be applied in an online scenario. Various machines are deployed online, and each machine can receive sample data in real time as training samples.

[0047] In one example, the second specified time can be earlier than the third specified time. This ensures that the training of the scene decision parameters in the model uses the latest sample data, allowing the trained model to maintain feature synchronization with data generated over time. For example, using the latest generated data as a personalized training sample set to train the model's scene decision parameters ensures that the model is trained to have the features of the latest data.

[0048] For example, the first specified time period is the previous 100 days, the second specified time period can be the first 98 days of the previous 100 days, and the third specified time period can be the first two days, that is, the last two days of the previous 100 days. As another example, the first specified time period is the previous 100 days, the second specified time period can be the first 98 days of the previous 100 days, the third specified time period can be the day immediately following the first 98 days, and the last day of the previous 100 days can be used as the specified time period for collecting the validation set.

[0049] In the embodiments of this specification, the common training sample set corresponding to each scenario may include a support sample set and a query sample set. The support sample set can be used to update the parameters of the decision layer network in the model, and the query sample set can be used to update the parameters of the feature network and the decision layer network in the model.

[0050] The training samples included in the support sample set and the training samples included in the query sample set can be different. In the common training sample set corresponding to each scenario, the training samples in the common training sample set can be divided into two parts according to a specified ratio: one part as the support sample set and the other part as the query sample set. For example, the specified ratio could be 1:1, in which case the common training sample set can be evenly divided into two parts, one as the support sample set and the other as the query sample set.

[0051] In 320, for each machine, a support sample set of a scenario can be used to train the model on that machine to obtain the first decision parameters of the decision layer network in the model.

[0052] In the 320 operation, each machine can be trained independently. The obtained first decision parameters can be used to update the corresponding model. Specifically, the obtained first decision parameters are used as parameters of the decision layer network to update the decision layer network in the corresponding model, and the corresponding model is also updated when the decision layer network is updated.

[0053] In the embodiments described in this specification, each machine is assigned to process one scenario, and different machines handle different scenarios. In one example, there may be a one-to-one correspondence between each machine and each scenario. Each machine may be assigned to a fixed scenario. In another example, the scenarios handled by each machine may be random. For example, after obtaining a training sample set for a scenario, a machine may be randomly selected to process it. Alternatively, the machine may randomly select a training sample set for a scenario for processing.

[0054] During the training process of models on various machines, the support sample set for the corresponding scenario can be input into the feature network of the model for processing. In one example, the feature network can be as follows: Figure 2As shown, the support sample set is input to the feature extraction layer, which extracts features from each sample in the support sample set. The extracted features are input to the feature concatenation layer, and the concatenated features are input to the intermediate network. The features processed by the intermediate network are then input to the feature filtering layer. The feature filtering layer selects the features required for the corresponding business objective from several features output by the intermediate network, and then inputs the selected features to the decision layer network.

[0055] The decision layer network processes and predicts the features input from the feature selection layer to output predicted values ​​for various preset business objectives. In one example, within the decision layer network, each sub-decision layer network corresponding to different business objectives processes features input from different feature selection layers. Since the business objectives differ, the features processed by each sub-decision layer network can also differ. Each sub-decision layer network outputs a predicted value for its corresponding business objective. After obtaining the predicted values ​​for each business objective, a loss is calculated based on the predicted values, and then a gradient is calculated based on the loss. The first decision parameters of the decision layer network are determined based on the gradient. Training the model using the support sample set can be performed for several rounds until the first training termination condition is met, such as reaching a specified threshold of training rounds.

[0056] In 330, for each machine, the model updated with the first decision parameters can be trained using the query sample set of the corresponding scenario to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the model.

[0057] In the embodiments of this specification, the obtained feature parameters and second decision parameters are used to update the model in the machine. Furthermore, the obtained feature parameters and second decision parameters can be derived from the loss obtained on the corresponding machine and the losses on other machines. On each machine, a loss corresponding to the scenario can be obtained, which can be derived from the query sample set processed by that machine and the updated model; the losses obtained on different machines can be different. Then, the global gradient for all machines can be obtained based on the losses obtained on each machine, and the feature parameters and second decision parameters can be obtained based on the global gradient.

[0058] The model obtained after operation 320 is an updated model configured with the first decision parameters. Based on this, the updated model is trained using the query sample set. The training process can refer to the model training process of 320 above. In the training process of 330, the goal is to update the feature network and the decision layer network, that is, to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network.

[0059] In one example, each machine communicates with and connects to the server, and all machines communicate with each other through the server. For instance, this example could be used in scenarios such as... Figure 1 As shown.

[0060] In this example, for each machine, the model updated with the first decision parameters can be trained using the query sample set corresponding to the scenario to obtain the loss for that machine. When performing this operation, the first decision parameters of the models on different machines can be different, and each model corresponds to a different scenario, with different query sample sets used for different scenarios. Therefore, the losses generated for different machines can be different.

[0061] The training process for the models on each machine using the corresponding query sample set can differ; for example, the number of training epochs can vary. After each machine obtains its corresponding loss, it can send its loss result to the server.

[0062] At the server, the feature parameters of the feature network and the second decision parameters of the decision layer network can be obtained from the losses received from each machine to update each model.

[0063] In one example, the losses of each machine can be averaged and summed to obtain the total loss. Then, the overall gradient is calculated based on the total loss, and the feature parameters of the feature network and the second decision parameters of the decision layer network are determined based on the overall gradient.

[0064] For example, different models make predictions for the same business objective, so each machine can obtain the loss for that business objective, and then these business losses are summed by averaging.

[0065] In another example, each model is used to predict multiple business objectives, which may include click-through rate (CTR) and the conversion rate associated with CTR. Since the conversion rate depends on the CTR, and is therefore correlated with CTR, the task of calculating the loss corresponding to the conversion rate as the business objective depends on the loss corresponding to the CTR as the business objective.

[0066] In this example, at the server, the actual loss for conversion rate for each machine can be calculated based on the loss for click-through rate and conversion rate received from each machine.

[0067] In one example of calculating actual loss, for each machine, the loss for click-through rate (CTR) and the loss for conversion rate can be combined to obtain the actual loss for conversion rate. One method of combining these losses is to sum the CTR and conversion rate losses to obtain the actual loss for conversion rate. Another method is to average the CTR and conversion rate losses and then sum them to obtain the actual loss for conversion rate.

[0068] At the server, the total loss is calculated based on the actual loss in conversion rate and the loss in click-through rate for each machine.

[0069] In one example of total loss calculation, the actual loss for conversion rate and the loss for click rate for each machine can be summed, and then the summed loss can be divided by the total number of losses to obtain the average loss, which is the total loss.

[0070] At the server, the feature parameters of the feature network and the second decision parameters of the decision layer network are obtained from the total loss to update each model. In one example, the overall gradient is calculated from the total loss, and then the feature parameters of the feature network and the second decision parameters of the decision layer network are determined based on the overall gradient.

[0071] After obtaining the feature parameters and the second decision parameters of the decision layer network, the server can send the obtained feature parameters and second decision parameters to each machine so that each machine can update its own model according to the obtained feature parameters and second decision parameters, so that the feature parameters and second decision parameters configured in the model of each machine are the same.

[0072] In another example, the machines can communicate directly with each other. Based on this, each machine can train its locally updated model using a query sample set corresponding to the scenario to obtain the corresponding loss. Then, each machine can distribute its own loss to other machines, so that each machine can obtain its own loss and the losses of all other models. Next, at each machine, the feature parameters of the feature network and the second decision parameters of the decision layer network can be obtained based on each machine's loss. Then, each machine can use the locally computed feature parameters and second decision parameters to update its own model.

[0073] In the training process described above, each model is trained using common training sample sets from various scenarios, and the feature network and decision layer network in the model are updated by combining the losses from all scenarios. This allows the trained model to learn the shared features from various scenarios, thus preserving the model parameters shared across different scenarios.

[0074] In 340, for each machine, the model updated with feature parameters and second decision parameters can be trained using a personalized training sample set for the corresponding scenario to obtain the scenario decision parameters for that machine.

[0075] Before performing operation 340, the feature parameters and second decision parameters configured in the models on each machine are the same, meaning all models are identical. Each machine corresponds to a different scenario, and each scenario has a different personalized training sample set. Therefore, different personalized training sample sets can be used to train models for different scenarios.

[0076] For each machine's model, a personalized training sample set corresponding to the scenario is input into a feature network with configured feature parameters, where feature extraction and filtering are performed. Then, a decision layer network configured with second decision parameters processes the features output by the feature network and makes predictions for various business objectives to obtain the corresponding loss. Based on this loss, the corresponding gradient is obtained, and the scenario decision parameters for the corresponding machine scenario can be derived from the gradient.

[0077] Scene decision parameters are the parameters applied to the decision layer network in the model. Different models can obtain different scene decision parameters by using different personalized training sample sets, and different scene decision parameters result in different corresponding models.

[0078] In 350, scene decision parameters and second decision parameters for each scenario can be stored for use in conjunction with a model configured with feature parameters.

[0079] In the embodiments of this specification, the stored scene decision parameters and second decision parameters for each scenario can be combined with models configured with feature parameters. Different decision parameters (including scene decision parameters and second decision parameters) can result in different models, and models configured with different decision parameters are targeted at different scenarios. For example, after the scene decision parameters for a scenario are combined with the model and updated, the updated model can make predictions for that scenario. The second decision parameters can be used for scenarios other than those mentioned above, as well as for cases where no scenario exists.

[0080] In one example, each decision parameter in the stored scenario decision parameters and second decision parameters can correspond to an identifier to indicate the scenario corresponding to each decision parameter or the case where no scenario exists. In another example, the scenario decision parameters and second decision parameters for each scenario can be stored using a key-value data structure.

[0081] by Figure 4 For example, Figure 4A schematic diagram illustrating an example of stored scene decision parameters and second decision parameters according to an embodiment of this specification is shown. Figure 4 As shown, W * This indicates the second decision parameter, and * indicates the identifier corresponding to the second decision parameter. A This represents the scenario decision parameters for scenario A, where A represents the identifier corresponding to the scenario decision parameters for scenario A. B This represents the scenario decision parameters for scenario B, where B represents the identifier corresponding to the scenario decision parameters for scenario B. C This represents the scenario decision parameters for scenario C, where C represents the identifier corresponding to the scenario decision parameters for scenario C.

[0082] In one storage method, scenario decision parameters and second decision parameters for each scenario can be stored locally on each machine. With this method, when the model is applied on each machine, the corresponding decision parameters can be directly retrieved from the local storage.

[0083] In another storage method, where each machine communicates with a server separately, the scene decision parameters and second decision parameters for each scenario can be stored on the server. In this method, when a model on one machine is applied, that machine can request the corresponding decision parameters from the server, and it can also request the stored scene decision parameters and second decision parameters from the server. By storing the scene decision parameters and second decision parameters on the server, this method saves local storage space on each machine.

[0084] The technical solutions in the embodiments of this specification provide a training and prediction scheme for a model structure based on multiple scenarios, which not only retains the parameters shared by different scenarios, but also supports personalized parameter settings for different scenarios.

[0085] Figure 5 A flowchart illustrating an example of a multi-scenario-based model training method according to another embodiment of this specification is shown.

[0086] Figure 5 The example shown is performed by one of a number of machines connected in a communication network. Each machine is configured with a model to be trained. The models configured on each machine have the same structure, and each model includes a feature network and a decision layer network.

[0087] like Figure 5 As shown in Figure 510, the local model is trained using the support sample set for the corresponding scenario to obtain the first decision parameters of the decision layer network in the model. Each machine is assigned to process one scenario, and different machines process different scenarios. Each different scenario has a common training sample set and a unique training sample set. The common training sample set for each scenario includes a support sample set and a query sample set.

[0088] In 520, the model updated with the first decision parameters is trained using the query sample set of the corresponding scenario to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the model. The feature parameters and the second decision parameters are obtained based on the local loss and the losses on other machines.

[0089] In one example, each machine communicates with the server individually, and the machines communicate with each other through the server. The model, updated with the first decision parameters, can be trained using a query sample set corresponding to the scenario to obtain a local loss. This loss is then sent to the server, allowing the server to obtain feature parameters for the feature network and second decision parameters for the decision layer network of each model based on the losses received from each machine. The local model is updated based on the obtained feature parameters and second decision parameters received from the server.

[0090] In 530, the local model updated with feature parameters and second decision parameters is trained using the personalized training sample set of the corresponding scenario to obtain the scenario decision parameters of the corresponding scenario. The scenario decision parameters and second decision parameters of each scenario are stored for use in combination with the model configured with feature parameters.

[0091] In one example, each model is used to predict multiple business objectives. The decision layer network in each model includes multiple sub-decision layer networks that correspond one-to-one with each business objective. The feature network in each model includes multiple feature filtering layers that correspond one-to-one with each business objective. Each feature filtering layer is used to filter features that are relevant to the corresponding business objective.

[0092] The above embodiments provide a training and prediction scheme based on a multi-scenario model structure, which not only retains the parameters shared by different scenarios, but also supports personalized parameter settings for different scenarios.

[0093] Figure 6 A flowchart of an example 600 of a multi-scenario-based model prediction method according to an embodiment of this specification is shown. Figure 6 The model in the example can be obtained according to the model training method provided in the embodiments of this specification. Figure 6 The execution entity of the example can be one of multiple machines configured with a trained model.

[0094] like Figure 6 As shown, at 610, the sample to be predicted can be obtained.

[0095] In one example Figure 6The model prediction method shown can be applied to online application scenarios, and the obtained samples to be predicted can be online samples.

[0096] In 620, decision parameters for the sample to be predicted can be obtained from the stored scenario decision parameters and second decision parameters of each scenario based on the sample to be predicted.

[0097] In one example, the scenario of the sample to be predicted can be determined based on the sample to be predicted. In one scenario determination method, the sample to be predicted carries a scenario identifier, which is used to represent the scenario of the sample to be predicted. Thus, the scenario of the sample to be predicted can be determined based on the scenario identifier.

[0098] After determining the scenario of the sample to be predicted, the decision parameters corresponding to that scenario can be obtained from the stored scenario decision parameters and second decision parameters of each scenario. When the determined scenario is one of the scenarios corresponding to the scenario decision parameters, the scenario decision parameters corresponding to that scenario can be obtained. When the determined scenario is not any of the scenarios corresponding to the scenario decision parameters, the second decision parameters can be determined as the decision parameters corresponding to the determined scenario.

[0099] In one example, when the sample to be predicted does not carry a scene identifier, a second decision parameter can be obtained and determined as the decision parameter for that sample to be predicted.

[0100] In one example, when the scenario decision parameters and the second decision parameters are stored on separate machines, the machine executing the model prediction method can directly obtain the decision parameters for the sample to be predicted from its local machine.

[0101] In another example, where each machine communicates with a server independently, and the scene decision parameters and second decision parameters are stored on the server, the machine executing the model prediction method can request the stored scene decision parameters and second decision parameters from the server. After receiving the scene decision parameters and second decision parameters from the server, the decision parameters for the sample to be predicted can be obtained from them.

[0102] In another example, where each machine communicates with the server separately, when the scene decision parameters and the second decision parameters are stored on the server, the machine executing the model prediction method can send the scene identifier of the sample to be predicted to the server. The server then determines the decision parameters for the sample to be predicted from the stored scene decision parameters and the second decision parameters, and sends the determined decision parameters to the machine executing the model prediction method. In this way, the machine can obtain the decision parameters for the sample to be predicted.

[0103] In 630, the acquired decision parameters can be used to update the model configured with feature parameters.

[0104] In 640, the updated model can be used to predict the sample to be predicted and output the prediction results.

[0105] The model prediction method provided in the above embodiments stores the decision parameters of each scenario and selects the corresponding decision parameters to be applied to the model based on the sample to be predicted, thereby realizing parameter personalization for different scenarios and enabling the model to be applied to multiple different scenarios.

[0106] Figure 7 A block diagram of an example of a multi-scenario-based model training apparatus 700 according to an embodiment of this specification is shown.

[0107] The model training device 700 can be applied to one of multiple machines connected in communication, each machine is configured with a model to be trained, and the models configured on each machine have the same structure, each model including a feature network and a decision layer network.

[0108] like Figure 7 As shown, the model training device 700 includes: a first model training unit 710, a second model training unit 720 and a third model training unit 730.

[0109] The first model training unit 710 can be configured to train the local model using the support sample set of the corresponding scenario to obtain the first decision parameters of the decision layer network in the model. Each machine is assigned to process one scenario, and different machines are assigned to different scenarios. Each different scenario has a common training sample set and a personalized training sample set. The common training sample set for each scenario includes a support sample set and a query sample set.

[0110] The second model training unit 720 can be configured to train the model updated with the first decision parameters using a query sample set of the corresponding scenario, and obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the model. The feature parameters and the second decision parameters are obtained based on the local loss and the losses on other machines.

[0111] In one example, the second model training unit 720 can also be configured such that each machine communicates with the server separately, and the machines communicate with each other through the server. The model updated with the first decision parameters can be trained using a query sample set corresponding to the scenario to obtain a local loss, which is then sent to the server. This allows the server to obtain feature parameters for updating the feature network and second decision parameters for the decision layer network of each model based on the losses received from each machine. The server receives the feature parameters and second decision parameters from the server to update the local model based on the obtained feature parameters and second decision parameters.

[0112] The third model training unit 730 can be configured to train the locally updated model using the feature parameters and second decision parameters using the personalized training sample set of the corresponding scenario, so as to obtain the scenario decision parameters of the corresponding scenario, and store the scenario decision parameters and second decision parameters of each scenario for use in combination with the model configured with feature parameters.

[0113] In one example, each model is used to predict multiple business objectives. The decision layer network in each model includes multiple sub-decision layer networks that correspond one-to-one with each business objective. The feature network in each model includes multiple feature filtering layers that correspond one-to-one with each business objective. Each feature filtering layer is used to filter features that are relevant to the corresponding business objective.

[0114] Figure 8 A block diagram of an example of a multi-scene-based model prediction apparatus 800 according to an embodiment of this specification is shown.

[0115] Figure 8 The model in the example can be obtained according to any of the model training methods described in this specification. For example... Figure 8 As shown, the model prediction device 800 includes: a sample acquisition unit 810, a decision parameter acquisition unit 820, a model update unit 830, and a model prediction unit 840.

[0116] The sample acquisition unit 810 can be configured to acquire samples to be predicted.

[0117] The decision parameter acquisition unit 820 can be configured to acquire decision parameters for the sample to be predicted from the scene decision parameters and second decision parameters of each scene stored in the database.

[0118] The model update unit 830 can be configured to update the model with the acquired decision parameters using the acquired decision parameters.

[0119] The model prediction unit 840 can be configured to use the updated model to predict the sample to be predicted and output the prediction results.

[0120] Reference above Figures 1 to 8 This specification describes embodiments of a multi-scenario model training method and apparatus, and a model prediction method and apparatus, according to examples of these embodiments.

[0121] The multi-scenario model training and prediction devices described in this specification can be implemented in hardware, software, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of its host device reading the corresponding computer program instructions from the memory into memory and executing them. In the embodiments of this specification, the multi-scenario model training and prediction devices can, for example, be implemented using electronic devices.

[0122] Figure 9 A block diagram of an electronic device 900 for implementing a multi-scenario-based model training method according to an embodiment of this specification is shown.

[0123] like Figure 9 As shown, the electronic device 900 may include at least one processor 910, a memory (e.g., non-volatile memory) 920, a RAM 930, and a communication interface 940, and the at least one processor 910, memory 920, RAM 930, and communication interface 940 are connected together via a bus 950. The at least one processor 910 executes at least one computer-readable instruction (i.e., the elements implemented in software above) stored or encoded in the memory.

[0124] In one embodiment, computer-executable instructions are stored in memory, which, when executed, cause at least one processor 910 to: train a local model using a support sample set corresponding to the scene to obtain first decision parameters of the decision layer network in the model; train a model updated with the first decision parameters using a query sample set corresponding to the scene to obtain feature parameters of the feature network and second decision parameters of the decision layer network in the model, obtained based on the local loss and losses on other machines; and train the locally updated model using the feature parameters and second decision parameters using a personalized training sample set corresponding to the scene to obtain scene decision parameters for the scene, so that the scene decision parameters and second decision parameters for each scene are stored for use in conjunction with the model configured with the feature parameters.

[0125] Figure 10 A block diagram of an electronic device 1000 for implementing a multi-scenario-based model prediction method according to an embodiment of this specification is shown.

[0126] like Figure 10As shown, the electronic device 1000 may include at least one processor 1010, a memory (e.g., non-volatile memory) 1020, a RAM 1030, and a communication interface 1040, and the at least one processor 1010, memory 1020, RAM 1030, and communication interface 1040 are connected together via a bus 1050. The at least one processor 1010 executes at least one computer-readable instruction (i.e., the elements implemented in software described above) stored or encoded in the memory.

[0127] In one embodiment, computer-executable instructions are stored in memory, which, when executed, cause at least one processor 1010 to: acquire a sample to be predicted; acquire decision parameters for the sample to be predicted from scene decision parameters and second decision parameters of various scenes stored in memory; update a model configured with feature parameters using the acquired decision parameters; and predict the sample to be predicted using the updated model, and output a prediction result.

[0128] It should be understood that the computer-executable instructions stored in the memory, when executed, cause at least one processor 910 and processor 1010 to perform the above combinations as described in the various embodiments of this specification. Figure 1-8 The description includes various operations and functions.

[0129] According to one embodiment, a program product, such as a machine-readable medium, is provided. The machine-readable medium may have instructions (i.e., the elements implemented in software as described above), which, when executed by a machine, cause the machine to perform the above-described combinations of the various embodiments of this specification. Figure 1-8 The description includes various operations and functions.

[0130] Specifically, a system or apparatus equipped with a readable storage medium may be provided, on which software program code implementing the functions of any of the embodiments described above is stored, and the computer or processor of the system or apparatus can read and execute the instructions stored in the readable storage medium.

[0131] In this case, the program code itself, which can be read from a readable medium, can perform the functions of any of the above embodiments. Therefore, the machine-readable code and the readable storage medium storing the machine-readable code constitute a part of the present invention.

[0132] The computer program code required for the operation of each part of this manual can be written in any one or more programming languages, including object-oriented programming languages ​​such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB, .NET, and Python; conventional procedural programming languages ​​such as C, Visual Basic 2003, Perl, COBOL 2002, PHP, and ABAP; dynamic programming languages ​​such as Python, Ruby, and Groovy; or other programming languages. This program code can run on the user's computer, or as a standalone software package on the user's computer, or partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer via any network, such as a local area network (LAN) or wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service, such as Software as a Service (SaaS).

[0133] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer or the cloud via a communication network.

[0134] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0135] Not all steps and units in the above process and system structure diagrams are mandatory; some steps or units can be omitted as needed. The execution order of each step is not fixed and can be determined as required. The device structure described in the above embodiments can be a physical structure or a logical structure. That is, some units may be implemented by the same physical entity, or some units may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.

[0136] The term "exemplary" as used throughout this specification means "serving as an example, instance, or illustration" and does not imply that it is "preferred" or "advantageous" over other embodiments. Detailed descriptions are included for the purpose of providing an understanding of the described techniques. However, these techniques may be practiced without these detailed descriptions. In some instances, well-known structures and apparatuses are shown in block diagram form to avoid obscuring the concepts of the described embodiments.

[0137] The optional embodiments of the present specification have been described in detail above with reference to the accompanying drawings. However, the embodiments of the present specification are not limited to the specific details in the above embodiments. Within the scope of the technical concept of the embodiments of the present specification, various simple modifications can be made to the technical solutions of the embodiments of the present specification, and these simple modifications all fall within the protection scope of the embodiments of the present specification.

[0138] The foregoing description of this specification is provided to enable any person skilled in the art to implement or use the content of this specification. Various modifications to the content of this specification will be apparent to those skilled in the art, and the general principles defined herein can be applied to other variations without departing from the scope of protection of this specification. Therefore, this specification is not limited to the examples and designs described herein, but is consistent with the widest scope of the principles and novel features disclosed herein.

Claims

1. A model training method based on multiple scenarios, wherein, Multiple machines communicate with each other, each machine is configured with a prediction model to be trained, and all machines are configured with the same model structure. Each prediction model includes a feature network and a decision layer network. The model training method includes: Obtain common training sample sets and individual training sample sets for different scenarios. The common training sample set for each scenario includes a support sample set and a query sample set. For each machine, a support sample set of a scenario is used to train the prediction model in that machine to obtain the first decision parameters of the decision layer network in the prediction model. Each machine is assigned to handle one scenario, and different machines handle different scenarios. For each machine, the prediction model updated with the first decision parameters is trained using the query sample set of the corresponding scenario to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the prediction model. The feature parameters and the second decision parameters are obtained based on the loss obtained by the machine and the losses on other machines. For each machine, a personalized training sample set corresponding to the scene is used to train the prediction model updated using the feature parameters and the second decision parameters for that machine, so as to obtain the scene decision parameters for that machine in the corresponding scene; and The scenario decision parameters and the second decision parameters for each scenario are stored for use in conjunction with a prediction model configured with the feature parameters.

2. The model training method as described in claim 1, wherein, Each prediction model is used to predict multiple business objectives. The decision layer network in each prediction model includes multiple sub-decision layer networks that correspond one-to-one with each business objective. The feature network in each prediction model includes multiple feature filtering layers that correspond one-to-one with each business objective. Each feature filtering layer is used to filter features that are related to the corresponding business objective.

3. The model training method as described in claim 2, wherein, The business objectives include at least one of click-through rate, conversion rate, and cost estimate.

4. The model training method as described in claim 1, wherein, Each machine is individually connected to the server, and the machines communicate with each other through the server. For each machine, the prediction model updated with the first decision parameters is trained using the query sample set corresponding to the scenario. This yields feature parameters of the feature network in the prediction model used to update the model on that machine, obtained from the loss received on that machine and the losses on other machines. The second decision parameters of the decision layer network include: For each machine, the prediction model updated with the first decision parameters is trained using the query sample set of the corresponding scenario to obtain the loss corresponding to that machine. At the server, feature parameters of the feature network and second decision parameters of the decision layer network for updating each prediction model are obtained based on the losses received from each machine; and At the server, the obtained feature parameters and second decision parameters are sent to each machine so that each machine can update its prediction model based on the obtained feature parameters and second decision parameters.

5. The model training method as described in claim 4, wherein, Each prediction model is used to predict multiple business objectives, including click-through rate and conversion rate associated with the click-through rate. At the server, the feature parameters of the feature network used to update each prediction model and the second decision parameters of the decision layer network are obtained based on the losses received from each of the machines, including: At the server, the actual loss for each machine in terms of the conversion rate is calculated based on the losses received from each machine in terms of the click-through rate and the conversion rate. At the server, the total loss is calculated based on the actual loss per conversion rate for each machine and the loss per click per machine; and At the server, feature parameters of the feature network and second decision parameters of the decision layer network for updating each prediction model are obtained based on the total loss.

6. The model training method as described in claim 1, wherein, Obtaining common and individual training sample sets for various scenarios includes: For each scenario, collect historical data for that scenario at a first specified time. Historical data from a second specified time period are selected from the historical data as the common training sample set; and Historical data at a third specified time is selected from historical data other than the common training sample set as the personalized training sample set, wherein the duration of the second specified time is longer than the duration of the third specified time, and the second specified time is earlier than the third specified time.

7. A multi-scenario model training method, executed by one of multiple interconnected machines, each machine configured with a prediction model to be trained, the models configured on each machine having the same structure, each prediction model including a feature network and a decision layer network. The model training method includes: The local prediction model is trained using the support sample set of the corresponding scenario to obtain the first decision parameters of the decision layer network in the prediction model. Each machine is assigned to process one scenario, and different machines are assigned to different scenarios. Each different scenario has a common training sample set and a personalized training sample set. The common training sample set for each scenario includes a support sample set and a query sample set. The prediction model updated with the first decision parameters is trained using the query sample set of the corresponding scenario to obtain the feature parameters of the feature network and the second decision parameters of the decision layer network in the prediction model. The feature parameters and the second decision parameters are obtained based on the local loss and the losses on other machines. The local prediction model updated with the feature parameters and the second decision parameters is trained using the personalized training sample set of the corresponding scenario to obtain the scenario decision parameters of the corresponding scenario, so that the scenario decision parameters and the second decision parameters of each scenario are stored for use in conjunction with the prediction model configured with the feature parameters.

8. A model prediction method based on multiple scenarios, wherein, The prediction model used is obtained according to any one of the model training methods in claims 1 to 6. The model prediction method includes: Obtain the sample to be predicted; Based on the sample to be predicted, the decision parameters for the sample to be predicted are obtained from the scene decision parameters and second decision parameters of each scene stored in the database. The obtained decision parameters are used to update the prediction model configured with feature parameters; and The updated prediction model is used to predict the sample to be predicted, and the prediction results are output.

9. A multi-scenario model training device, applied to one of multiple machines connected via communication, wherein each machine is configured with a prediction model to be trained, the model structures configured on each machine are identical, and each prediction model includes a feature network and a decision layer network. The model training device includes: The first model training unit trains the local model using the support sample set of the corresponding scenario to obtain the first decision parameters of the decision layer network in the model. Each machine is assigned to process one scenario, and different machines are assigned to different scenarios. Each different scenario has a common training sample set and a unique training sample set. The common training sample set for each scenario includes a support sample set and a query sample set. The second model training unit trains the prediction model updated with the first decision parameters using the query sample set of the corresponding scenario, obtaining the feature parameters of the feature network and the second decision parameters of the decision layer network in the prediction model. The feature parameters and the second decision parameters are obtained based on the local loss and the losses on other machines. The third model training unit uses the personalized training sample set of the corresponding scenario to train the prediction model updated locally using the feature parameters and the second decision parameters, so as to obtain the scenario decision parameters of the corresponding scenario, so that the scenario decision parameters and the second decision parameters of each scenario are stored for use in conjunction with the prediction model configured with the feature parameters.

10. A model prediction device based on multiple scenarios, wherein, The prediction model used is obtained according to any one of the model training methods in claims 1 to 6. The model prediction device includes: The sample acquisition unit acquires the sample to be predicted. The decision parameter acquisition unit acquires decision parameters for the sample to be predicted from the scene decision parameters and second decision parameters of each scene stored in the database. The model update unit updates the prediction model configured with feature parameters using the acquired decision parameters; and The model prediction unit uses the updated prediction model to predict the sample to be predicted and outputs the prediction result.

11. An electronic device, comprising: At least one processor, a memory coupled to the at least one processor, and a computer program stored on the memory, wherein the at least one processor executes the computer program to implement the model training method or model prediction method as described in claim 7 or 8.

12. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the model training method or model prediction method as described in claim 7 or 8.

13. A computer program product comprising a computer program that, when executed by a processor, implements the model training method or model prediction method as described in claim 7 or 8.

Citation Information

Patent Citations

  • Method, system and device for jointly training machine learning model

    CN112766514A

  • Base station energy-saving policy determining method and apparatus, and storage medium

    WO2022057268A1