Federal learning modeling method, device, system, equipment and medium
By re-training and performance evaluation of the model on a single participant side of the federated learning system, the problem of low model update efficiency is solved, the performance and efficiency of federated learning tasks are improved, and the effectiveness of the model on online data is ensured.
Patent Information
- Application Number
- CN202310152798.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2024-08-23
AI Technical Summary
The existing federated learning system requires all participants to jointly perform offline tasks when updating the model, resulting in low flexibility and efficiency, and the difference between offline data and online data leads to a decline in model effectiveness.
The model is retrained on the side of a single participant, the prediction results are used to evaluate the model performance, and the fourth model is determined based on the performance of the first model and the third model to update the model and improve the performance and efficiency of the federated learning task.
By updating the model on the individual participant side, the overall performance and efficiency of the federated learning task is improved, ensuring the effectiveness and accuracy of the model on online data.
Smart Images

Figure CN118536614A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, in particular to the field of federated learning technology, and specifically to a federated learning modeling method and its device, system, electronic device, non-transitory computer-readable storage medium, and computer program product. Background Art
[0002] Federated Learning, also known as Federated Machine Learning, is a machine learning framework suitable for multiple participants. The Federated Learning framework can be used to perform machine learning model building, predictive analysis, data query, data statistics and other federated learning tasks while meeting the user privacy protection and data security of multiple participants.
[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0004] The present disclosure provides a federated learning modeling method and its device, system, electronic device, non-transitory computer-readable storage medium, and computer program product.
[0005] According to one aspect of the present disclosure, a federated learning modeling method is provided, which is applied to a first participant among multiple participants performing an online prediction task, wherein the method includes: performing a federated learning modeling task with at least one second participant among the multiple participants to obtain a first model for the first participant and a second model for the second participant; constructing a first training data set based on first data from the first participant and second data from the second participant, wherein the first data and the second data are based on online data, and the online data is obtained by the first participant using the first model and the at least one second participant using the second model to perform the online prediction task in cooperation; based on the first training data set, training the first model again to obtain a third model; and determining a fourth model based on the performance of both the first model and the third model, so that the first participant continues to perform the online prediction task using the fourth model and at least the second participant uses the second model in cooperation.
[0006] According to one aspect of the present disclosure, an online prediction method based on federated learning is applied to a first participant among multiple participants performing an online prediction task, wherein the method includes: the first participant uses a first model and at least one second participant among the multiple participants uses a second model to cooperate with each other to perform the online prediction task; in response to determining a fourth model, the first participant uses the fourth model and at least one second participant among the multiple participants uses the second model to cooperate with each other to continue to perform the online prediction task, wherein the fourth model is obtained according to the above method.
[0007] According to one aspect of the present disclosure, a federated learning modeling device is provided, which is applied to a first participant among multiple participants performing an online prediction task, wherein the device includes: a first training module, which is configured to perform the federated learning modeling task with at least one second participant among the multiple participants to obtain a first model for the first participant and a second model for the second participant; a data acquisition module, which is configured to construct a first training data set based on first data from the first participant and second data from the second participant, wherein the first data and the second data are based on online data, and the online data is obtained by the first participant using the first model and the at least one second participant using the second model to perform the online prediction task in cooperation; a second training module, which is configured to train the first model again based on the first training data set to obtain a third model; and a model determination module, which is configured to determine a fourth model based on the performance of both the first model and the third model, so that the first participant uses the fourth model and the at least second participant uses the second model to continue to perform the online prediction task in cooperation.
[0008] According to one aspect of the present disclosure, there is provided an online prediction device based on federated learning, which is applied to a first participant among multiple participants performing an online prediction task, wherein the device comprises: a first prediction module, which is configured for the first participant to use a first model and at least one second participant among the multiple participants to use a second model to cooperate in performing the online prediction task; a second prediction module, which is configured for, in response to determining a fourth model, the first participant to use the fourth model and at least one second participant among the multiple participants to use the second model to cooperate in continuing to perform the online prediction task, wherein the fourth model is obtained via the above-mentioned device.
[0009] According to one aspect of the present disclosure, a federated learning system is provided, wherein the system includes: the above-mentioned federated learning modeling device of the first participant among multiple participants who are applied to perform a federated learning task; and the above-mentioned online prediction device based on federated learning of the first participant among multiple participants who are applied to perform a federated learning task.
[0010] According to one aspect of the present disclosure, an electronic device is provided, characterized in that it includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method according to any one of the above items.
[0011] According to one aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute any of the above methods.
[0012] According to one aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of the above items is implemented.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0015] Figure 1 A schematic diagram showing a federated learning modeling method according to an exemplary embodiment of the present disclosure is shown;
[0016] Figure 2 A flowchart of a federated learning modeling method according to an exemplary embodiment of the present disclosure is shown;
[0017] Figure 3 A flowchart of a federated learning modeling method according to an exemplary embodiment of the present disclosure is shown;
[0018] Figure 4 A flowchart of an online prediction method based on federated learning according to an exemplary embodiment of the present disclosure is shown;
[0019] Figure 5 A schematic diagram showing a federated learning modeling method according to an exemplary embodiment of the present disclosure is shown;
[0020] Figure 6 A flow chart of a traffic shaping method according to an exemplary embodiment of the present disclosure is shown;
[0021] Figure 7 A block diagram of a federated learning modeling apparatus according to an exemplary embodiment of the present disclosure is shown;
[0022] Figure 8 A block diagram of an online prediction apparatus based on federated learning according to an exemplary embodiment of the present disclosure is shown;
[0023] Fig. 9 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0024] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0025] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0026] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0027] Federated learning is a distributed machine learning framework that can be applied to multiple parties. It can help implement data encryption and privacy protection among multiple parties when performing federated learning tasks. Specifically, federated learning tasks can be training tasks for machine learning models, federated data query tasks, federated data statistics tasks, and so on.
[0028] Federated learning tasks are usually implemented in an offline environment, and then the results of the offline tasks (for example, the model trained by the offline learning task) are applied to online services to receive and respond to user requests. Therefore, in a service cycle, if the results of the offline task need to be updated, the offline task and its verification process must be repeated again, and then the updated results of the offline task are put online again. This causes the real-time performance and effect of the service to decline. In addition, since the data used in the offline task is often different from the data in the online real-time environment (for example, different timeliness of the data, inconsistent data distribution, etc.), the results obtained by the offline task are not necessarily as valid as the online data, which further leads to a decline in service effect. Furthermore, due to the particularity of federated learning involving multiple participants, its offline tasks are completed by all participants in collaboration. When only one participant or a part of the participants wants to update the results of their offline tasks (for example, models), the updated results can only be obtained by all participants jointly executing the offline task again, and it is impossible to achieve updates for a certain participant or a part of the participants, thereby affecting the flexibility and efficiency of the entire federated learning system.
[0029] In order to solve the above problems, the present disclosure provides a federated learning method and its device, system, electronic device, non-transitory computer-readable storage medium and computer program product. By retraining the model using data on a certain participant side and using the prediction results to evaluate the retrained model, the model can be updated on the side of a single participant. As a result, the overall performance and efficiency of the federated learning task can be improved.
[0030] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0031] Figure 1 A schematic diagram of a federated learning modeling method 100 according to an exemplary embodiment of the present disclosure is shown. The federated learning method 100 is applied to a first participant 110 and a second participant 120 among multiple participants performing a federated learning task. The first participant 110 has first data 111 and a first model 112, and the first model 112 may be a model for the first participant 110 obtained through offline learning task training. The second participant 120 has second data 121 and a second model 122, and the second model 122 may be a model for the second participant 120 obtained through offline learning task training.
[0032] Exemplarily, the first data 111 possessed by the first participant 110 may include core business data corresponding to the federated learning task, and the second data 121 possessed by the second participant 120 may include non-core business data corresponding to the federated learning task, for example, other feature data.
[0033] At 130, the second party 120 sends the prediction result based on the second data 121 obtained by the second model 122 to the first party 110. The first party 110 combines the prediction result with the first data 111 and obtains the final prediction result through the first model 112. At 140, the final prediction result is output for the corresponding service (e.g., responding to the user's request).
[0034] The following will be combined Figure 2 It is exemplarily introduced how to obtain the first model 112 of the first participant 110 and / or the second model 122 of the second participant 120 through offline learning task training.
[0035] Figure 2 A flowchart of a federated learning modeling method 200 according to an exemplary embodiment of the present disclosure is shown. The method 200 is applied to a certain participant among multiple participants performing a federated learning task, and the method 200 includes: step S202, preparing training data; step S204, offline training model, wherein the offline training process is based on the training data; step S206, judging whether the offline trained model passes the evaluation, wherein the evaluation process may be an offline evaluation process using the prepared training data; in response to the offline trained model not passing the evaluation, returning to step S202 to further prepare new training data for retraining; in response to the offline trained model passing the evaluation, continuing to step S208, judging whether the model passes the verification, wherein the verification process may be a verification process using actual service results (e.g., prediction results at the first participant); in response to the model not passing the verification, returning to step S204 for offline training again; in response to the model passing the verification, continuing to step S210, launching the verified model as the participant's model (e.g., Figure 1 The first model 112 of the first participant 110 and the second model 122 of the second participant 120 are used to provide corresponding services (for example, responding to user requests).
[0036] As described above, the inventors recognize that after the verified model is put online as the model of the participant, when the offline task needs to be updated, it is often necessary to re-execute the offline federated learning task (e.g., the above-mentioned federated learning method 200) to obtain the updated model, which affects the flexibility and efficiency of the entire federated learning system. In addition, due to the difference between the data used in offline training and the online data, the offline training model (e.g., the model obtained by training in step S204) is not necessarily as effective as the online data, which may cause the effect of the federated learning task to decrease.
[0037] Figure 3A flowchart of a federated learning modeling method 300 according to an exemplary embodiment of the present disclosure is shown. The federated learning modeling method 300 is applied to a first participant among multiple participants performing an online prediction task, wherein the method 300 includes: step S302, performing a federated learning modeling task with at least one second participant among the multiple participants, and obtaining a first model for the first participant and a second model for the second participant; step S304, constructing a first training data set based on first data from the first participant and second data from the second participant, wherein the first data and the second data are based on online data, and the online data is obtained by the first participant using the first model and at least one second participant using the second model to perform the online prediction task in cooperation; step S306, based on the first training data set, training the first model again to obtain a third model; and step S308, determining a fourth model based on the performance of both the first model and the third model, so that the first participant uses the fourth model and at least the second participant uses the second model to continue to perform the online prediction task in cooperation.
[0038] In some embodiments, the model with better performance between the first model and the third model is used as the fourth model.
[0039] Therefore, the model is retrained based on online data to further improve the overall performance and efficiency of the federated learning task.
[0040] In some embodiments, the multiple participants including the first participant and at least one second participant may be, for example, the following combination: Fig. 9 An electronic device 900 is described.
[0041] In some embodiments, the above-mentioned federated learning method 200 can be used to perform the federated learning modeling task in step S302 to obtain the first model of the first participant and the second model of the second participant. When the federated learning modeling task is performed using offline data as training data, the obtained first model of the first participant and the second model of the second participant can also be referred to as an "offline model" or an "offline training model".
[0042] In some embodiments, the first data from the first participant may include core business data corresponding to the federated learning task, and the second data from the second participant may include non-core business data corresponding to the federated learning task, for example, other feature data.
[0043] According to some embodiments, the second data includes at least a portion of the data obtained based on the second participant performing the online prediction task. In other words, the second data is an intermediate prediction result of the federated learning task calculated by the second participant based on its second model.
[0044] Therefore, based on the first data from the first participant and the second data from the second participant, both can be introduced into the federated learning task at the same time to improve the execution effect of the federated learning task.
[0045] In some embodiments, the amount of intermediate prediction result data calculated by the second participant through the second model is large. In order to reduce the training pressure in the federated learning task, only a part of it can be used as the second data and sent to the first participant. The first participant builds a training data set based on the data and the first data.
[0046] The inventors recognize that in real online services, there may be a large amount of abnormal data (e.g., abnormal traffic). Exemplarily, this part of the abnormal data may be malicious data forged by hackers to attack the online service system. Using abnormal data to construct a training data set will cause the trained model to deviate from the actual situation and reduce the quality of the model. Among them, the abnormal data may include the following features: the IP address corresponding to the abnormal data is in the "blacklist", which can be preset or updated as the online service proceeds; or the access behavior of the abnormal data is unreasonable (e.g., corresponding to multiple accesses within 1s, or access to non-existent resources).
[0047] In this regard, according to some embodiments, the second data is obtained by filtering the results determined by the second model based on satisfying preset filtering criteria, and wherein the preset filtering criteria include at least one of the following: the IP address corresponding to the data in the result is included in a preset address set; the data in the result corresponds to multiple visits within a preset time; and the data in the result corresponds to a non-existent target resource.
[0048] In this way, a large amount of abnormal data in real online services can be filtered out, the reliability of the data in the training data set can be ensured, and the model training effect can be improved.
[0049] According to some embodiments, the first data includes additional data corresponding to data in the second data, and based on the first data from the first participant and the second data set from the second participant, determining the first training data set includes: querying the additional data corresponding to the ID information of the data in the second data based on the ID information of the data; integrating the additional data in the first data corresponding to the same ID information with the data in the second data to obtain the first training data set.
[0050] Thus, the data at the first party (e.g., core business data) can be matched with the data at the second party (e.g., other feature data). When data related to a specific ID (e.g., traffic) appears, the features and data associated with the ID can be queried based on the ID to build a training data set including the ID.
[0051] According to some embodiments, the ID information includes encrypted user information.
[0052] In some embodiments, the ID information can be agreed upon as needed. For example, the user's device information can also be encrypted. The first party and the second party use the encrypted user device information as the ID, so that the data at the first party and the second party are associated using the ID without leaking the original user information and / or device information to construct a training data set.
[0053] According to some embodiments, determining a first training data set based on first data from a first participant and second data from a second participant includes: obtaining data distribution characteristics of the first training data set; and determining whether to add the first data from the first participant and / or the second data from the second participant to the first training data set based on the data distribution characteristics of the first training data set and preset distribution characteristics, so that the data in the constructed first training data set conforms to the preset distribution.
[0054] During the training process, the distribution of data in the training data set constructed by the first data and the second data may not meet expectations. For example, when the first data and the second data are online data in the process of executing a federated learning task, the online data in a period of time may correspond to too many certain distribution values and too few other distribution values, and thus cannot accurately represent the characteristics of the actual data. By ensuring that the data in the constructed training data set conforms to the preset distribution, the data in the training data set can fully reflect the data characteristics and improve the training effect of the model.
[0055] According to some embodiments, the data in the first training data set includes label data, and the data distribution feature includes the statistical distribution of the label data. In other words, the label data of all data can satisfy a preset statistical distribution.
[0056] According to some embodiments, the data in the first training data set includes feature data, and the data distribution feature includes the statistical distribution of the feature data. In other words, the feature data of all data can satisfy a preset statistical distribution.
[0057] In some embodiments, the preset statistical distribution may be a binary distribution of 0-1 or a probability distribution.
[0058] Label data can refer to the real label of data, which is annotated based on the specific application scenario requirements. Feature data includes at least one feature associated with the label data. The model can output the predicted label of the data based on the input feature data. The model is adjusted based on the real label and the predicted label to achieve the purpose of model learning.
[0059] In some embodiments, the label data may indicate whether the user meets a specific criterion. For example, the specific criterion may be the completion of a business-related action, such as a user purchasing a specific product is labeled as 1, and not purchasing the specific product is labeled as 0, to form a 0-1 distribution for the label data. For multivariate distributions such as feature distributions, a distribution (e.g., a 0-1 distribution) may be calculated for each variable, or a probability distribution may be used for multiple variables, such as a mixed Gaussian distribution.
[0060] In some embodiments, the feature data may represent specific features of a user. For example, the specific features of the user may be a user profile, which may include basic attributes of the user (e.g., age, gender, educational background, etc.), social relationships, consumption capacity, risk preferences, etc.
[0061] Specifically, according to some embodiments, based on the data distribution characteristics of the first training data set and the preset distribution characteristics, determining whether to add the first data from the first participant and / or the second data from the second participant to the first training data set includes: determining a preset data volume threshold based on the preset distribution characteristics; in response to the data volume of the distribution value corresponding to the first data and the second data in the first training data set being less than the preset data volume threshold, adding the first data from the first participant and the second data from the second participant to the first training data set. More specifically, the distribution value corresponding to the first data and the second data may include a first distribution value, and a corresponding preset data volume threshold may be set for the first distribution value. When the data volume of the first distribution value is less than the corresponding preset data volume threshold, it indicates that the data volume of the first distribution value is not full, and the first data and the second data continue to be added; and when the data volume of the first distribution value is equal to the preset data volume threshold, it indicates that the data volume of the first distribution value is full, and the first data and the second data are no longer added.
[0062] In some embodiments, different distribution values may correspond to different preset data volume thresholds. That is, when the distribution values corresponding to the first data and the second data include different first distribution values and second distribution values, corresponding preset data volume thresholds may be set for the first distribution value and the second distribution value, respectively.
[0063] Thus, the first data and the second data can be selectively added to the training data set so that the data in the constructed training data set conforms to the preset distribution, thereby improving the effect of model training. Figure 6 The traffic shaping method is further described in detail.
[0064] In some embodiments, the data after traffic shaping includes positive data and negative data that conform to a preset distribution (i.e., data that makes the corresponding prediction result more recommended or less recommended). The distribution of positive data and negative data can be further adjusted as needed. And in some embodiments, the amount of data used for training can be further adjusted when the preset distribution is met.
[0065] According to some embodiments, based on the first training data set, training the first model again to obtain the third model includes: initializing the third model using the first model; and training the initialized third model based on the first training data set.
[0066] In other words, the process of obtaining the third model is not necessarily a modeling process starting from scratch. An existing model (e.g., an offline model obtained through offline training, or a third model obtained by previously executing method 300) can be used to initialize the current third model, thereby speeding up the training of the third model and improving the overall efficiency of the federated learning task.
[0067] Figure 4 A flowchart of an online prediction method 400 based on federated learning according to an exemplary embodiment of the present disclosure is shown. The method 400 is applied to a first participant among multiple participants performing an online prediction task, wherein the method 400 includes: step S402, the first participant uses a first model and at least one second participant among multiple participants uses a second model to cooperate in performing the online prediction task; and step S404, in response to determining a fourth model, the first participant uses the fourth model and at least one second participant among multiple participants uses the second model to cooperate in continuing to perform the online prediction task, wherein the fourth model is obtained according to, for example, the above-mentioned federated learning modeling method 300.
[0068] In this way, a model that works better than the current data can be determined, thereby achieving model updates on the side of a single participant, further improving the overall performance and efficiency of the federated learning task.
[0069] In some embodiments, data obtained by executing the online real-time service can be used as a data set for evaluating the first model and the third model.
[0070] Specifically, according to some embodiments, an evaluation data set is obtained from the results obtained by using the first model and the second model to cooperate to perform an online prediction task; based on the evaluation data set, the performance of the first model and the performance of the third model are determined.
[0071] Therefore, the actual prediction results can be used to evaluate the effectiveness of the model, which is better than using historical data to evaluate the model, thereby improving the quality of federated learning tasks.
[0072] According to some embodiments, the method 300 further includes: constructing a second training data set based on third data from the first participant and fourth data from at least one second participant, wherein the third data and the fourth data are based on online data, and the online data is obtained by the first participant using the fourth model and at least one second participant using the second model to cooperate in performing an online prediction task; and training the fourth model again based on the second training data set. Thus, continuous updating and training of the model used at the first participant can be achieved.
[0073] Figure 5 A schematic diagram of a federated learning modeling method 500 according to an exemplary embodiment of the present disclosure is shown. The federated learning method 500 is applied to a first participant 510 and a second participant 520 among multiple participants performing a federated learning task. The first participant 510 has first data 511 and a first model 512, and the first model 512 can be a model for the first participant 510 obtained through offline learning task training. The second participant 520 has second data 521 and a second model 522, and the second model 522 can be a model for the second participant 520 obtained through offline learning task training.
[0074] At 501, the second participant 520 sends the prediction result based on the second data 521 obtained by the second model 522 to the first participant 510. The first participant combines the prediction result with the first data 511 and obtains the initial prediction result through the first model 512. At 502, the final prediction result is output for the corresponding service (for example, responding to the user's request).
[0075] At 503, the second participant 520 also sends the prediction result based on the second data 521 obtained by the second model 522 to the message queue module 530. At the message queue module 530, at least a portion of the prediction result is copied for subsequent training of the third model 513. In some embodiments, the amount of data of the prediction result may be large, so copying only a portion of it helps to reduce the data pressure in the training of the third model 513.
[0076] The message queue module 530 sends the copied prediction results to the abnormal traffic filtering module 540, which filters a large amount of abnormal data (abnormal traffic) that may exist in the real online service to remove abnormal data that is not conducive to subsequent training. The abnormal data includes but is not limited to the data mentioned above that the IP address is in the "blacklist", or the data with unreasonable access behavior (for example, corresponding to multiple accesses within 1s, or access to non-existent resources).
[0077] The abnormal traffic filtering module 540 sends the filtered data to the online feature query module 550, which queries the corresponding additional data at the first participant based on the ID information in the filtered data (for example, the encrypted user information or the encrypted user device information mentioned above), and integrates the additional data in the first data corresponding to the same ID information with the data in the second data to obtain a training data set.
[0078] The training data set obtained by the online feature query module 550 is sent to the traffic shaping module 560, which calculates the data distribution characteristics (for example, label distribution characteristics and feature distribution characteristics) in the training data set and adjusts the data distribution characteristics in the training data set to the desired preset distribution, that is, so that the data satisfies the preset statistical distribution.
[0079] For example, the following combination can be used Figure 6 The traffic shaping method described further is used to shape the data.
[0080] The training data set that meets the preset distribution after shaping in the traffic shaping module 560 is sent to the traffic sampling module 570, and the traffic sampling module 570 adjusts the distribution of positive data and negative data (for example, data that makes the corresponding prediction result more recommended or less recommended) as needed. In some embodiments, the amount of data used for training can be further adjusted when the preset distribution is met.
[0081] The data adjusted by the traffic sampling module 570 can be used to train the third model 513. In some embodiments, the first model 512 can be used to initialize the third model 513, and then train it. The traffic playback module 580 uses the service result data collected at the first participant 510, for example, the prediction results collected in real time for the online service, and inputs the service result data into the first model 512 and the third model 513 to verify their prediction results.
[0082] In the model evaluation module 590, the performance of the first model 512 and the third model 513 is evaluated based on the prediction results of the first model 512 and the third model 513, and the evaluation result is output via 504. When the evaluation result indicates that the third model 513 is considered to be better than the first model 512, a model switch can be performed, and the third model 513 is used to replace the first model 512 at the first participant 510, and the final prediction result is obtained through the third model 513. At 502, the final prediction result is output for the corresponding service.
[0083] In some embodiments, the above Figure 5One or more of the message queue module 530, abnormal traffic filtering module 540, online feature query module 550, traffic shaping module 560, and traffic collection module 570 shown in the figure are optional. For example, in some embodiments, the abnormal traffic filtering module 540 may not be included, and the data output by the message queue module 530 is directly sent to the online feature query module 550. In addition, in some embodiments, the functions of multiple modules in the above modules can be integrated into one or more modules. For example, in some embodiments, the traffic collection module 570 may not be included, and the functions in the traffic collection module 570 can be implemented by the traffic shaping module 560.
[0084] Figure 6 A flow chart of a traffic shaping method 600 according to an exemplary embodiment of the present disclosure is shown. The method 600 can be applied to a data distribution having a first distribution value and a second distribution value (for example, in a 0-1 distribution, the first distribution value can be 0 and the second distribution value can be 1), and the method 600 includes: step S602, receiving data, which can be, for example, the second data from the second participant mentioned above; step S604, determining the distribution value corresponding to the data; when the data corresponds to the first distribution value, executing step S606, determining whether the data volume of the first distribution value is less than the data volume threshold, in other words, whether the data of the first distribution value is full; when the data volume of the first distribution value is not less than the data volume threshold (that is, when the data of the first distribution value is full), executing step S610, discarding the data, and no longer storing the data. When the data volume of the first distribution value is less than the data volume threshold (i.e., the data volume of the first distribution value is not full), step S612 is executed to add the data to the training data set; similarly, when it is determined in step S604 that the first data corresponds to the second distribution value, step S608 is executed to determine whether the data volume of the second distribution value is less than the data volume threshold; when the data volume of the second distribution value is not less than the data volume threshold (i.e., the data volume of the second distribution value is full), step S616 is executed to discard the data and no longer add the data to the training data set; when the data volume of the second distribution value is less than the data volume threshold (i.e., the data volume of the second distribution value is not full), step S614 is executed to add the data to the training data set.
[0085] In some embodiments, the data volume threshold of the first distribution value and the data volume threshold of the second distribution value are different to satisfy specific distributions of the first distribution value and the second distribution value.
[0086] It is understandable that there may be more distribution values. Corresponding to other data distributions, a method similar to the traffic shaping method 600 may also be used to obtain a training data set that satisfies the expected data distribution.
[0087] Figure 7A block diagram of a federated learning modeling apparatus 700 according to an exemplary embodiment of the present disclosure is shown. The apparatus 700 is applied to a first participant among multiple participants performing an online prediction task, wherein the apparatus 700 includes: a first training module 701, the first training module is configured to perform a federated learning modeling task with at least one second participant among the multiple participants, and obtain a first model for the first participant and a second model for the second participant; a data acquisition module 702, the data acquisition module is configured to construct a first training data set based on first data from the first participant and second data from the second participant, wherein the first data and the second data are based on online data, and the online data is obtained by the first participant using the first model and at least one second participant using the second model to perform the online prediction task in cooperation; a second training module 703, the second training module is configured to train the first model again based on the first training data set to obtain a third model; and a model determination module 704, the model determination module is configured to determine a fourth model based on the performance of both the first model and the third model, so that the first participant uses the fourth model and at least the second participant uses the second model to continue to perform the online prediction task in cooperation.
[0088] The federated learning device 700 may be used to perform operations similar to the federated learning method 300 described above, which will not be described in detail here.
[0089] Figure 8 A block diagram of an online prediction device 800 based on federated learning according to an exemplary embodiment of the present disclosure is shown. The online prediction device 800 is applied to a first participant among multiple participants performing an online prediction task, wherein the device 800 includes: a first prediction module 801, the first prediction module is configured for the first participant to use a first model and at least one second participant among multiple participants to use a second model to cooperate in performing the online prediction task; a second prediction module 802, the second prediction module is configured for responding to determining a fourth model, the first participant to use the fourth model and at least one second participant among multiple participants to cooperate in continuing to perform the online prediction task using the second model, wherein the fourth model is obtained via the above-mentioned device 700, for example.
[0090] The online prediction device 800 can be used to perform similar operations to the online prediction method 400 described above, which will not be described in detail here.
[0091] According to one aspect of the present disclosure, a federated learning system is provided, wherein the system includes: the above-mentioned federated learning modeling device for a first participant among multiple participants who are applied to perform a federated learning task.
[0092] According to one aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method.
[0093] According to one aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above method.
[0094] According to one aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the above method when executed by a processor.
[0095] See also Fig. 9 , a block diagram of an electronic device 900 that can be used as the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device can be a computer device of different types, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0096] Fig. 9 1 shows a block diagram of an electronic device according to an embodiment of the present disclosure. Fig. 9 As shown, the electronic device 900 may include at least one processor 901 , a working memory 902 , an I / O device 904 , a display device 905 , a storage device 906 , and a communication interface 907 that can communicate with each other via a system bus 903 .
[0097] The processor 901 may be a single processing unit or multiple processing units, all of which may include a single or multiple computing units or multiple cores. The processor 901 may be implemented as one or more microprocessors, microcomputers, microcontrollers, digital signal processors, central processing units, state machines, logic circuits, and / or any device that manipulates signals based on operating instructions. The processor 901 may be configured to obtain and execute computer-readable instructions stored in a working memory 902, a storage device 906, or other computer-readable media, such as program codes of an operating system 902a, program codes of an application program 902b, and the like.
[0098] The working memory 902 and the storage device 906 are examples of computer-readable storage media for storing instructions, which are executed by the processor 901 to implement the various functions described above. The working memory 902 may include both volatile memory and non-volatile memory (e.g., RAM, ROM, etc.). In addition, the storage device 906 may include a hard disk drive, a solid-state drive, a removable medium, including external and removable drives, memory cards, flash memory, a floppy disk, an optical disk (e.g., CD, DVD), a storage array, a network attached storage, a storage area network, etc. The working memory 902 and the storage device 906 may all be collectively referred to herein as memory or computer-readable storage media, and may be a non-transitory medium capable of storing computer-readable, processor-executable program instructions as computer program code, which may be executed by the processor 901 as a specific machine configured to implement the operations and functions described in the examples herein.
[0099] The I / O device 904 may include an input device and / or an output device. The input device may be any type of device capable of inputting information to the electronic device 900, and may include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output device may be any type of device capable of presenting information, and may include but is not limited to a video / audio output terminal, a vibrator, and / or a printer.
[0100] The communication interface 907 allows the electronic device 900 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.
[0101] The application 902b in the working register 902 can be loaded to execute the various methods and processes described above, such as Figure 3 In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via the storage device 906 and / or the communication interface 907. When the computer program is loaded and executed by the processor 901, one or more steps of the data processing method described above may be performed.
[0102] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0103] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0104] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0105] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0106] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0107] A computing system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0108] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0109] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A federated learning modeling method, applied to a first party among multiple parties performing an online prediction task, wherein: The method comprises: Performing a federated learning modeling task with at least one second participant among the multiple participants to obtain a first model for the first participant and a second model for the second participant; Constructing a first training data set based on first data from the first participant and second data from the second participant, wherein the first data and the second data are based on online data, and the online data is obtained by the first participant using the first model and the at least one second participant using the second model to cooperate in performing the online prediction task; Based on the first training data set, training the first model again to obtain a third model; and A fourth model is determined based on the performance of both the first model and the third model, so that the first participant uses the fourth model and the at least second participant uses the second model to cooperate and continue to perform the online prediction task.
2. The method according to claim 1, wherein: Based on the first data from the first participant and the second data from the second participant, determining the first training data set includes: Acquiring data distribution characteristics of the first training data set; and Based on the data distribution characteristics of the first training data set and the preset distribution characteristics, determine whether to add the first data from the first participant and / or the second data from the second participant to the first training data set so that the data in the constructed first training data set conforms to the preset distribution.
3. The method according to claim 2, wherein: The data in the first training data set includes label data, and the data distribution characteristics include the statistical distribution of the label data.
4. The method according to claim 2 or 3, wherein: The data in the first training data set includes feature data, and the data distribution feature includes the statistical distribution of the feature data.
5. The method according to claim 2 or 3, wherein: Determining whether to add the first data from the first participant and / or the second data from the second participant to the first training data set based on the data distribution feature of the first training data set and the preset distribution feature includes: Based on the preset distribution characteristics, determining a preset data volume threshold; In response to the data amount of the distribution values corresponding to the first data and the second data in the first training data set being less than the preset data amount threshold, the first data from the first participant and the second data from the second participant are added to the first training data set.
6. The method according to claim 1, wherein: The second data includes at least a portion of data obtained based on the second participant performing the online prediction task.
7. The method according to claim 6, wherein: The second data is obtained by screening the results determined by the second model based on satisfying a preset screening criterion, and wherein the preset screening criterion includes at least one of the following: The IP address corresponding to the data in the result is included in the preset address set; The data in the result corresponds to multiple visits within a preset time; and The data in the result corresponds to a target resource that does not exist.
8. The method according to any one of claims 1 to 3, 6 and 7, wherein: The first data includes additional data corresponding to data in the second data, and based on the first data from the first participant and the second data set from the second participant, determining that the first training data set includes: According to the ID information of the data in the second data, query the first data for the additional data corresponding to the ID information; The additional data in the first data corresponding to the same ID information is integrated with the data in the second data to obtain the first training data set.
9. The method according to claim 8, wherein: The ID information includes encrypted user information.
10. The method according to any one of claims 1 to 3, 6 and 7, further comprising: Acquire an evaluation data set from a result obtained by using the first model and the second model to cooperate with each other to perform the online prediction task; Based on the evaluation data set, a performance of the first model and a performance of the third model are determined.
11. The method according to any one of claims 1 to 3, 6 and 7, further comprising: Constructing a second training data set based on third data from the first participant and fourth data from the at least one second participant, wherein the third data and the fourth data are based on online data, and the online data is obtained by the first participant using the fourth model and the at least one second participant using the second model to perform the online prediction task in cooperation; Based on the second training data set, the fourth model is trained again.
12. An online prediction method based on federated learning, applied to a first participant among multiple participants performing an online prediction task, wherein: The method comprises: The first participant uses the first model and at least one second participant among the multiple participants uses the second model to cooperate in performing the online prediction task; In response to determining the fourth model, the first participant uses the fourth model and at least one second participant among the plurality of participants uses the second model to cooperate in continuing to perform the online prediction task. Wherein, the fourth model is obtained according to the method according to any one of claims 1 to 10.
13. A federated learning modeling device, applied to a first participant among multiple participants performing an online prediction task, wherein: The device comprises: A first training module, wherein the first training module is configured to perform a federated learning modeling task with at least one second participant among the multiple participants to obtain a first model for the first participant and a second model for the second participant; a data acquisition module, the data acquisition module being configured to construct a first training data set based on first data from the first participant and second data from the second participant, wherein the first data and the second data are based on online data, and the online data is obtained by the first participant using the first model and the at least one second participant using the second model to cooperate in performing the online prediction task; A second training module, the second training module is configured to train the first model again based on the first training data set to obtain a third model; and A model determination module is configured to determine a fourth model based on the performance of both the first model and the third model, so that the first participant uses the fourth model and the at least the second participant uses the second model to cooperate in continuing to perform the online prediction task.
14. An online prediction device based on federated learning, applied to a first participant among multiple participants performing an online prediction task, wherein: The device comprises: A first prediction module, wherein the first prediction module is configured for the first participant to cooperate with at least one second participant among the plurality of participants to perform the online prediction task using a first model and using a second model; a second prediction module, the second prediction module being configured to, in response to determining a fourth model, cooperate with the first participant to continue to perform the online prediction task using the fourth model and at least one second participant among the plurality of participants using the second model; Wherein, the fourth model is obtained via the device described in claim 13.
15. A federated learning system, wherein: The system comprises: The federated learning modeling device according to claim 13; and The online prediction device according to claim 14.
16. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 12.
17. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 12.
18. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 12 is implemented.
