Model training method and device, computer device, and storage medium

Through the federated learning framework, the model is collaboratively trained between the initiator and the participating server, which solves the problem of data sharing barriers between different devices and improves the efficiency of model training.

CN116992976BActive Publication Date: 2025-10-14SHENZHEN POWER SUPPLY BUREAU
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310799645.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2025-10-14
Estimated Expiration
2043-06-30

AI Technical Summary

Technical Problem

Barriers to data sharing between different devices lead to low model training efficiency, making it difficult to effectively utilize data from multiple devices or data sources for model training.

Method used

Using the federated learning framework, the initiator and the participant's server jointly train the model, use the federated learning framework identifier and model identifier to make model training requests, and adjust the model parameters based on the loss value calculated based on the intermediate results to achieve collaborative training of the initiator and participant models.

Benefits of technology

The efficiency of model training is improved, enabling the initiator and the participating server to collaborate on model training, thereby improving the overall training efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116992976B_ABST
    Figure CN116992976B_ABST
Patent Text Reader

Abstract

The application relates to a model training method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: obtaining a target configuration file corresponding to a target service; sending a model training request carrying a federal learning framework identifier and a model identifier to a participant server corresponding to participant information, so that the participant server trains an initial participant model corresponding to the model identifier in a participant mirror image corresponding to the federal learning framework identifier by using a participant training set, and obtains a participant intermediate result; training a corresponding initial initiator model in an initiator mirror image by using an initiator training set, and obtaining an initiator intermediate result; obtaining the participant intermediate result returned by the participant server, and obtaining a loss value based on the participant intermediate result and the initiator intermediate result; and adjusting model parameters in the initial initiator model in the initiator mirror image by using the loss value, and obtaining a target initiator model. The method can improve the model training efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a model training method, apparatus, computer equipment, storage medium, and computer program product. Background Art

[0002] With the development of machine learning technology, enterprises often need to train corresponding machine learning models for different businesses. Among them, some business-specific machine learning models require not only internal enterprise data to train the model, but also data from other platforms for model training.

[0003] However, there are data sharing barriers between different devices, and modeling and training data scattered across multiple devices or data sources leads to low model training efficiency. Summary of the Invention

[0004] Based on this, it is necessary to provide a model training method, device, computer equipment, computer-readable storage medium and computer program product that can improve the efficiency of model training in response to the above technical problems.

[0005] This application provides a model training method. The method includes:

[0006] Obtain the target configuration file corresponding to the target business; the target configuration file includes the initiator training set, participant information, federated learning framework identifier, and model identifier corresponding to the target business;

[0007] Send a model training request with the federated learning framework identifier and model identifier to the participant server corresponding to the participant information, so that the participant server can train the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier using the participant training set to obtain the participant intermediate result;

[0008] Using the initiator training set, the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier is trained to obtain the initiator intermediate result.

[0009] Obtain the participant's intermediate result returned by the participant's server, and obtain the loss value based on the participant's intermediate result and the initiator's intermediate result;

[0010] The model parameters in the initial initiator model in the initiator mirror are adjusted by the loss value to obtain the target initiator model, and the loss value is sent to the participant server so that the participant server adjusts the initial participant model in the participant mirror by the loss value to obtain the target participant model.

[0011] This application also provides a model training device. The device includes:

[0012] The configuration file acquisition module is used to obtain the target configuration file corresponding to the target business; the target configuration file includes the initiator training set, participant information, federated learning framework identifier, and model identifier corresponding to the target business;

[0013] The training request sending module is used to send a model training request carrying the federated learning framework identifier and model identifier to the participant server corresponding to the participant information, so that the participant server can train the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier through the participant training set to obtain the participant intermediate result;

[0014] The intermediate result generation module is used to train the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier using the initiator training set to obtain the initiator intermediate result;

[0015] The loss value determination module is used to obtain the participant's intermediate result returned by the participant's server and obtain the loss value based on the participant's intermediate result and the initiator's intermediate result;

[0016] The target model determination module is used to adjust the model parameters in the initial initiator model in the initiator mirror through the loss value to obtain the target initiator model, and send the loss value to the participant server so that the participant server adjusts the initial participant model in the participant mirror through the loss value to obtain the target participant model.

[0017] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned model training method when executing the computer program.

[0018] A computer-readable storage medium stores a computer program, which implements the steps of the above-mentioned model training method when executed by a processor.

[0019] A computer program product includes a computer program, which implements the steps of the above-mentioned model training method when executed by a processor.

[0020] The above-mentioned model training method, apparatus, computer equipment, storage medium and computer program product obtain the target configuration file corresponding to the target business. Send a model training request carrying the federated learning framework identifier and the model identifier to the participant server corresponding to the participant information, so that the participant server trains the initial participant model corresponding to the model identifier in the participant mirror corresponding to the federated learning framework identifier through the participant training set to obtain the participant intermediate result. At the same time, the initial initiator model corresponding to the model identifier in the initiator mirror corresponding to the federated learning framework identifier is trained through the initiator training set to obtain the initiator intermediate result. Based on the participant intermediate result and the initiator intermediate result, a loss value is obtained. The model parameters in the initial initiator model are adjusted by the loss value to obtain the target initiator model, and the loss value is sent to the participant server, so that the participant server adjusts the initial participant model by the loss value to obtain the target participant model. In this way, the participant server performs model training on the initial participant model corresponding to the model identifier in the participant mirror corresponding to the federated learning framework identifier. Simultaneously, the initial initiator model corresponding to the model identifier is trained in the initiator mirror corresponding to the federated learning framework identifier. A loss value is obtained based on the obtained participant intermediate results and initiator intermediate results. The initial participant model and initial initiator model are adjusted based on the loss value to obtain the target participant model and target initiator model. This enables collaborative model training between the initiator server and the participant server, effectively improving model training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is an application environment diagram of a model training method in one embodiment;

[0022] Figure 2 Schematic diagram of a flow chart of a model training method in one embodiment;

[0023] Figure 3 A schematic diagram of a process for sending a model training request in one embodiment;

[0024] Figure 4 is a structural block diagram of a model training device in one embodiment;

[0025] Figure 5 It is a structural block diagram of a model training device in another embodiment;

[0026] Figure 6 is a diagram of the internal structure of a computer device in one embodiment;

[0027] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0029] The model training method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. The initiator server 102 communicates with the participant server 104 through the network. Both the initiator server 102 and the participant server 104 can be implemented through a terminal or a server. The server can be implemented as an independent server or a server cluster composed of multiple servers, and the terminal can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart TVs, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The initiator server 102 and the participant server 104 can be directly or indirectly connected through wired or wireless communication, and this application does not limit this.

[0030] The initiator server and the participant server collaborate to execute the model training method provided in the embodiments of the present application. The initiator server obtains a target configuration file corresponding to the target business; the target configuration file includes the initiator training set corresponding to the target business, participant information, a federated learning framework identifier, and a model identifier. The initiator server sends a model training request carrying the federated learning framework identifier and model identifier to the participant server corresponding to the participant information. After receiving the model training request, the participant server trains the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier using the participant training set, obtains a participant intermediate result, and sends the participant intermediate result to the initiator server. The initiator server trains the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier using the initiator training set, obtains an initiator intermediate result. The initiator server obtains the participant intermediate result returned by the participant server and obtains a loss value based on the participant intermediate result and the initiator intermediate result. The initiator server adjusts the model parameters of the initial initiator model in the initiator image using the loss value to obtain a target initiator model, and sends the loss value to the participant server. The participant server adjusts the initial participant model in the participant mirror by the loss value to obtain the target participant model.

[0031] In one embodiment, Figure 2 As shown, a model training method is provided, which is described by taking the method applied to the initiator server as an example. The model training method includes the following steps:

[0032] In step S202, a target configuration file corresponding to the target service is obtained; the target configuration file includes an initiator training set corresponding to the target service, participant information, a federated learning framework identifier, and a model identifier.

[0033] The initiator server refers to a device that initiates model training, and the initiator server can be implemented by a server or a terminal.

[0034] The target service refers to a service that needs to initiate a model training task. For example, when the initiator server is a background system corresponding to a network game A, and the network game A can include multiple services, such as a virtual item recommendation service, a preferential activity push service, a user credit evaluation service, etc., when a model training task for the virtual item recommendation service is initiated, a target configuration file for the virtual item recommendation service is obtained, and at this time, the virtual item recommendation service is the target service.

[0035] The target configuration file refers to a file containing basic configuration information required for model training tasks for the target service, used to indicate the participant server participating in model training, the federated learning framework used, and the algorithm model.

[0036] The initiator training set refers to a training data set provided by the initiator server.

[0037] The participant information refers to information used to determine the participants participating in model training. The participant information can be a participant identifier, or it can be restriction information of the target service for the participants.

[0038] The federated learning framework identifier refers to an identifier used to distinguish different federated learning frameworks corresponding to different images. The model identifier refers to an identifier used to distinguish different algorithm models.

[0039] Illustratively, in order to enable the initiator server and the participant server to cooperatively perform model training, the initiator server obtains a target configuration file corresponding to the target service. Based on the participant information of the target service included in the target configuration file, the participant server is determined. Based on the federated learning framework identifier and the model identifier, the initiator image used and the initiator model in the initiator image are determined. Then, the initiator model in the initiator image is trained through the initiator training set to obtain an initiator intermediate result. At the same time, the federated learning framework identifier and the model identifier are sent to the participant server, so that the participant server performs model training on the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier, to obtain a participant intermediate result. Then, based on the initiator intermediate result and the participant intermediate result, a loss value is obtained, and based on the loss value, the model parameters are adjusted to obtain a target initiator model. This enables the initiator server and the participant server to cooperatively perform model training, effectively improving the efficiency of model training.

[0040] Step S204: Send a model training request carrying the federated learning framework identifier and model identifier to the participant server corresponding to the participant information, so that the participant server trains the initial participant model corresponding to the model identifier in the participant mirror corresponding to the federated learning framework identifier through the participant training set to obtain the participant intermediate result.

[0041] The participant server refers to the device that participates in the model training initiated by the initiator server. The participant server can be implemented as a server or a terminal.

[0042] A model training request is a request sent to a participating server, instructing it to collaboratively train the model using a specified federated learning framework and algorithm model. The participating server's training set refers to the training dataset provided by the participating server. The participating server's training set and the initiating server's training set are sample-aligned training sets. The participating server's image refers to the image corresponding to the federated learning framework identifier on the participating server. The initial participating server model refers to the untrained algorithm model corresponding to the model identifier in the participating server's image.

[0043] When training data is fed into the model, each process within the model generates output data. Some of this output data is created only as an intermediate step and then connected to other processes to contribute to the final output, that is, the final loss value. These data generated by these intermediate steps are called intermediate data. Participant intermediate results refer to the intermediate data set generated by the initial participant model processing the training data in the participant training set, which is used to calculate the model loss value.

[0044] Exemplarily, the initiator server determines the target participant from among the candidate participants based on the participant information, generates a model training request based on the federated learning framework identifier and model identifier in the target configuration file, and sends the model training request to the participant server corresponding to the target participant. This allows the participant server to obtain the participant training set and, using the participant training set, train the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier, thereby obtaining the participant intermediate result. Specifically, the participant server transfers the participant training set to the participant image corresponding to the federated learning framework identifier, and inputs the training samples in the participant training set into the initial participant model in the participant image, thereby obtaining the intermediate result corresponding to the training samples.

[0045] Step S206: Using the initiator training set, the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier is trained to obtain the initiator intermediate result.

[0046] The initiator image refers to an image identified by the federated learning framework in the initiator server. The initial initiator model refers to an algorithm model corresponding to the initiator image and not subjected to model training. The initiator intermediate result refers to intermediate data obtained by inputting training data in the initiator training set into the initial initiator model and processing the training data by the initial initiator model.

[0047] The initiator server identifies the initiator image in the candidate images based on the federated learning framework and identifies the initial initiator model in the initiator image based on the model. The initiator training set is transferred to the corresponding initiator image identified by the federated learning framework, and the training samples in the initiator training set are input into the initial initiator model in the initiator image, and the intermediate result corresponding to the training sample is obtained by processing the training sample by the initial initiator model.

[0048] In step S208, the initiator server obtains the participant intermediate result returned by the participant server and obtains the loss value based on the participant intermediate result and the initiator intermediate result.

[0049] The loss value refers to the model loss calculated by the initiator model based on the participant intermediate result and the initiator intermediate result.

[0050] The initiator server obtains the participant intermediate result returned by the participant server, transfers the participant intermediate result to the initiator image, inputs the participant intermediate result into the initial initiator model in the initiator image, generates the predicted label based on the initiator intermediate result and the participant intermediate result corresponding to the same training sample by the initial initiator model, and then calculates the loss value based on the difference between the predicted label and the sample label corresponding to the training sample.

[0051] In step S210, the model parameters in the initial initiator model in the initiator image are adjusted by the loss value to obtain a target initiator model, and the loss value is sent to the participant server to adjust the initial participant model in the participant image by the loss value to obtain a target participant model.

[0052] The model parameter refers to a configuration variable inside the model. The target initiator model refers to a trained initiator model corresponding to the model identifier. The target participant model refers to a trained participant model corresponding to the model identifier. For example, when the initiator server is a bank back-end system and the participant server is a power enterprise back-end system, the target initiator model can be a model for predicting the credit rating of an enterprise based on the credit data of the enterprise in the initiator server and the power data of the enterprise in the participant server.

[0053] Exemplarily, the initiator server adjusts the initial model parameters in the initial initiator model based on the loss value output by the initial initiator model, to obtain an intermediate initiator model, and takes the intermediate initiator model as the initial initiator model. The loss value is sent to the participant server, so that the participant server adjusts the initial model parameters in the participant model based on the loss value, to obtain an intermediate participant model, and takes the intermediate participant model as the initial participant model.

[0054] Return to the step of inputting the training sample in the initiator training set into the initial initiator model. Specifically, the initial initiator model processes the training sample to obtain the initiator intermediate result corresponding to the training sample, inputs the participant intermediate result returned by the participant server into the initial initiator model, and generates a predicted label based on the initiator intermediate result and the participant intermediate result corresponding to the same training sample by the initial initiator model. Then, based on the difference between the predicted label and the sample label corresponding to the training sample, the loss value is calculated. Until the end condition is met, the target initiator model is obtained in the initiator mirror, and the target participant model is obtained in the participant mirror. The end condition can be that the loss value is less than a preset threshold, or the number of model iterations reaches a preset number.

[0055] In one embodiment, the initiator server sends the initiator intermediate result to the coordination server, the coordination server receives the corresponding participant intermediate result sent by the participant server, and the coordination server calculates the loss value based on the initiator intermediate result and the participant intermediate result. The loss value is sent to the initiator mirror in the initiator server and the participant mirror in the participant server respectively. So that the participant mirror adjusts the model parameters in the initial participant model based on the loss value to obtain the target participant model. The initiator mirror adjusts the model parameters in the initial initiator model based on the loss value to obtain the target initiator model.

[0056] In the model training method, the target configuration file corresponding to the target service is obtained. A model training request carrying a federated learning framework identifier and a model identifier is sent to the participant server corresponding to the participant information, so that the participant server trains an initial participant model corresponding to the model identifier in the participant mirror corresponding to the federated learning framework identifier based on the participant training set to obtain a participant intermediate result. Meanwhile, the initial initiator model corresponding to the model identifier in the initiator mirror corresponding to the federated learning framework identifier is trained based on the initiator training set to obtain an initiator intermediate result. Based on the participant intermediate result and the initiator intermediate result, a loss value is obtained. The model parameters in the initial initiator model are adjusted based on the loss value to obtain a target initiator model, and the loss value is sent to the participant server, so that the participant server adjusts the initial participant model based on the loss value to obtain a target participant model. In this way, the initial participant model corresponding to the model identifier in the participant mirror corresponding to the federated learning framework identifier is trained by the participant server, and the initial initiator model corresponding to the model identifier in the initiator mirror corresponding to the federated learning framework identifier is trained by the initiator server. Based on the obtained participant intermediate result and initiator intermediate result, a loss value is obtained, and the initial participant model and the initial initiator model are adjusted based on the loss value to obtain the target participant model and the target initiator model. The initiator server and the participant server can cooperatively perform model training, and the efficiency of model training is effectively improved.

[0057] In one embodiment, the target configuration file is sent by the initiator client to the initiator server, and the target configuration file is generated by the initiator client in response to a configuration file filling operation. The configuration file filling operation includes an initiator training set configuration operation, a participant information configuration operation, a federated learning framework configuration operation, and a model configuration operation.

[0058] In one embodiment, the target configuration file is sent by the initiator client to the initiator server, and the target configuration file is generated by the initiator client in response to a configuration file filling operation. The configuration file filling operation includes an initiator training set configuration operation, a participant information configuration operation, a federated learning framework configuration operation, and a model configuration operation.

[0059] The configuration file filling operation refers to an operation triggered on the initiator client for generating the target configuration file.

[0060] The initiator training set configuration operation refers to a training set configuration operation triggered on the configuration file filling interface displayed on the initiator client, and is used to submit the initiator training set.

[0061] The participant information configuration operation refers to an operation triggered on the configuration file filling interface displayed on the initiator client for configuring participant information. The participant information configuration operation can be a keyboard input operation or a selection operation on a corresponding control.

[0062] The federated learning framework configuration operation refers to the operation triggered on the configuration file filling interface displayed by the initiator client to select the federated learning framework used for model training. The federated learning framework configuration operation can be a keyboard typing operation or a selection operation for the corresponding control.

[0063] The model configuration operation refers to the operation triggered on the configuration file filling interface displayed by the initiator client, which is used to select the algorithm model used for model training. The model configuration operation can be a keyboard typing operation or a selection operation for the corresponding control.

[0064] Exemplarily, the initiator client displays a configuration file filling interface, and in response to the user triggering the initiator training set configuration operation for the target business on the configuration file filling interface, the initiator client receives the initiator training set corresponding to the target business uploaded by the user. In response to the participant information configuration operation triggered by the user on the configuration file filling interface, the initiator client receives the participant information submitted by the user. In response to the federated learning framework configuration operation triggered by the user on the configuration file filling interface, the initiator client receives the federated learning framework identifier submitted by the user and displays the various candidate models contained in the initiator image corresponding to the federated learning framework identifier. In response to the model configuration operation triggered by the user on the configuration file filling interface, the initiator client receives the model identifier of the target model determined by the user among the various candidate models. The initiator client generates a target configuration file corresponding to the target business based on the initiator training set, participant information, federated learning framework identifier and model identifier corresponding to the target business.

[0065] In the above embodiment, the initiator client corresponding to the initiator server displays a configuration file filling interface, so that the user can perform configuration file filling operations on the configuration file filling interface, thereby obtaining a target configuration file containing the initiator training set, participant information, federated learning framework identifier and model identifier corresponding to the target business. The target configuration file provides the basic information required by the initiator server to build the model, enabling the initiator server to quickly determine the participant server participating in the model training, the federated learning framework and algorithm model used for the model training, and can improve the efficiency of model training.

[0066] In one embodiment, the target configuration file is generated by the initiator client performing format conversion on the initial configuration file generated in response to the configuration file filling operation based on the configuration file conversion rule corresponding to the federated learning framework identifier.

[0067] The configuration file conversion rules are used to convert the configuration file into the data format required by the federated learning framework. The initial configuration file is the configuration file generated directly based on the configuration file filling operation and has not yet undergone format conversion.

[0068] Exemplarily, the initiator client generates an initial configuration file corresponding to the target business based on the initiator's training set, participant information, federated learning framework identifier, and model identifier corresponding to the target business. The client then obtains configuration file conversion rules generated for the federated learning framework corresponding to the federated learning framework identifier and, based on the configuration file conversion rules corresponding to the federated learning framework identifier, performs format conversion on the initial configuration file to obtain a target configuration file. Specifically, the configuration file conversion rules may include conversion rules for the training set, converting the training samples and sample labels in the training set into the form, format, and type of parameters required by the federated learning framework.

[0069] In the above embodiment, by setting corresponding configuration file conversion rules for each federated learning framework, when the initial configuration file is obtained, the initial configuration file can be converted into the format required by the federated learning framework corresponding to the federated learning framework identifier based on the federated learning framework identifier in the initial configuration file. This can adapt to the differences in input data between different federated learning frameworks and facilitate unified management and scheduling of various federated learning frameworks.

[0070] In one embodiment, Figure 3 As shown, a model training request carrying the federated learning framework identifier and business model identifier is sent to the participant server corresponding to the participant information, including:

[0071] Step S302: Acquire a participant set corresponding to the target business; the participant set includes multiple candidate participants corresponding to the target business.

[0072] Step S304: Compare the cooperation information corresponding to each candidate participant with the participant information to obtain the target participant.

[0073] Step S306: Send a model training request carrying the federated learning framework identifier and model identifier to the participant server corresponding to the target participant.

[0074] Among them, the participant set refers to the set of candidate participants corresponding to the target business. For example, when the initiator server is the backend system corresponding to a certain online game and the target business is the promotion activity push business, the initiator server trains a model for screening the most suitable promotion activities for users based on the user's virtual product browsing data corresponding to the game backend system and the user's transaction data corresponding to other online transaction systems. At this time, the candidate participants corresponding to the target business are other online transaction platforms used by the user, and the participant set is a set including other online transaction platforms.

[0075] Candidate participants refer to participants who can collaborate with the initiator server to complete the model training task corresponding to the target business.

[0076] Cooperation information refers to the data information that the participating parties can provide for the model training tasks corresponding to the target business. For example, cooperation information can be the field information that the participating parties can provide. For example, when the candidate participants are Bank A and Bank B, Bank A's cooperation information can include fields such as corporate deposits, cash flow, and loan projects, while Bank B's cooperation information can only include corporate deposits.

[0077] The target participant refers to a candidate participant determined from the participant set to participate in the model training task corresponding to the target business.

[0078] For example, the initiator's server obtains the set of participants corresponding to the target business and the cooperation information corresponding to each candidate participant in the participant set. The cooperation information corresponding to each candidate participant is compared with the participant information to determine the degree of overlap between the cooperation information corresponding to each candidate participant and the participant information. The overlap refers to the amount of information in the candidate participant's cooperation information that overlaps with the participant information. The candidate participant with the highest overlap is selected as the target participant. A model training request carrying the federated learning framework identifier and model identifier is sent to the participant server corresponding to the target participant.

[0079] In the above embodiment, the initiator service obtains the set of participants corresponding to the target business, determines the cooperation information corresponding to each candidate participant in the set, compares the participant information in the target configuration file with the cooperation information corresponding to each candidate participant, and selects the candidate participant with the highest matching score as the target participant. Jointly training the business model corresponding to the target business with the participant service corresponding to the target participant can effectively improve the model's prediction accuracy.

[0080] In one embodiment, the model training method further includes:

[0081] Obtain component sets and system environments corresponding to multiple candidate federated learning frameworks; package the component sets and system environments corresponding to the same candidate federated learning framework to obtain candidate images corresponding to each candidate federated learning framework; the component set includes a candidate model corresponding to at least one candidate business, and a mapping relationship between the candidate model and the corresponding model identifier; deploy each candidate image on the initiator server and the participant server respectively.

[0082] The candidate federated learning framework refers to an alternative federated learning framework. The component set refers to a set of tools and libraries required by the federated learning framework and a candidate model corresponding to at least one candidate business.

[0083] A candidate image refers to an alternative image generated based on the corresponding component set and system environment of the candidate federated learning framework.

[0084] The candidate service refers to each service corresponding to the initiator service end. For example, when the initiator service end is a background system corresponding to a network game A, the network game A can correspond to multiple candidate services, such as a virtual item recommendation service, a preferential activity pushing service, and a user credit evaluation service.

[0085] The candidate model refers to each algorithm model provided by the candidate image.

[0086] Exemplarily, the initiator service end obtains a component set and a system environment corresponding to each candidate federated learning framework, collates the component set corresponding to the candidate federated learning framework into a configuration list, packs the configuration list corresponding to the same candidate federated learning framework and the system environment, and obtains each candidate image. Each candidate image is deployed in the initiator service end. Each candidate image is sent to the participant service end, so that the participant service end deploys each candidate image in the participant service end.

[0087] In an embodiment, the participant service end can include multiple server nodes, and each candidate image can be independently deployed on different server nodes, which can effectively avoid conflicts and resource competition between different candidate images.

[0088] In the above embodiment, the component set and the system environment corresponding to the same candidate federated learning framework are packed to obtain each candidate image corresponding to each candidate federated learning framework, and each candidate image is deployed in the initiator service end, which can effectively solve the inconsistency between the environment and the dependency and improve the efficiency of model training.

[0089] In an embodiment, the model training method further includes:

[0090] From each candidate image corresponding to each candidate federated learning framework, a candidate model corresponding to a target service is obtained; based on a preset segmentation granularity, each candidate model is segmented to obtain a plurality of sub-model sets corresponding to different model sub-functions; the sub-model set includes a sub-model corresponding to a same model sub-function in each candidate model; a target sub-model set is obtained by respectively obtaining a target sub-model from each sub-model set, to obtain at least one target sub-model set; an initial model corresponding to the target service is generated based on the target sub-model set, to obtain at least one initial model; the initial model and a model identifier corresponding to the initial model are transferred to at least one candidate image corresponding to the target service; the candidate image corresponding to the target service refers to a candidate image including a candidate model corresponding to the target service.

[0091] The preset segmentation granularity refers to a preset splitting scale used for splitting algorithm models in different federated learning frameworks, that is, a preset unified model splitting rule.

[0092] A sub-model refers to each functional module obtained by splitting an algorithm model. A model sub-function refers to a function that can be implemented by a sub-model. For example, the model sub-function can be data preprocessing, sample alignment, feature engineering, model evaluation, and the like.

[0093] The sub-model set corresponding to the model sub-function refers to a set including each sub-model belonging to the model sub-function.

[0094] The target sub-model refers to a sub-model determined in the sub-model set for combining an initial model. The target sub-model set refers to a set including target sub-models respectively determined from each sub-model set. The initial model refers to a model obtained by combining each sub-model in the target sub-model set.

[0095] Exemplarily, the initiator server obtains a candidate model corresponding to the target business from each candidate model included in each candidate image respectively corresponding to each candidate federated learning framework. A preset segmentation granularity is obtained, and each candidate model corresponding to the target business is segmented based on the preset segmentation granularity. Each candidate model corresponding to the target business is segmented into sub-models respectively corresponding to different model sub-functions. Each sub-model corresponding to the same model sub-function generates a sub-model set corresponding to the model sub-function, thereby obtaining a sub-model set respectively corresponding to each model sub-function. The target sub-model used for constructing the initial model corresponding to the target business is determined from each sub-model set. The target sub-model set is obtained from the target sub-model respectively corresponding to each model sub-function. Each sub-model in the target sub-model set is combined to obtain the initial model corresponding to the target business. For example, the candidate model corresponding to the target business can be divided into a feature extraction sub-model and a label prediction sub-model. If the feature extraction effect of the feature extraction sub-model in the candidate model A is better than that of the feature extraction sub-model in the candidate model B, the feature extraction sub-model in the candidate model A and the label prediction sub-model in the candidate model B can be combined to obtain the corresponding initial model. The initial model corresponding to the target business is transferred to each candidate image corresponding to the target business.

[0096] In the above embodiment, different candidate models are uniformly segmented at a granularity, algorithms are uniformly segmented into sub-models respectively corresponding to multiple model sub-functions, and the segmented sub-models are converted and combined, so that algorithm models in different frameworks can be interconnected, and the flexibility of model construction can be enhanced.

[0097] In one specific embodiment, the model training method in the present application can be applied to a bank back-end system to train a model for predicting the credit rating of an enterprise based on the credit data of the enterprise in the bank back-end system and the power data of the enterprise in the power system. The model training method includes the following steps:

[0098] 1、Mirror deployment

[0099] The bank back-end system obtains the system environment and configuration list corresponding to different heterogeneous federated learning frameworks, the configuration list is the related software required by each framework, and the system environment and configuration list corresponding to different heterogeneous federated learning frameworks are packaged into corresponding images respectively, and each image is independently deployed on the different server nodes corresponding to the bank back-end system. Multiple heterogeneous federated learning frameworks can also share a system environment and dependency package, so that multiple heterogeneous federated learning frameworks can run on the same server node. This non-independent deployment method may cause conflicts or resource competition between different frameworks, making it difficult to monitor algorithm node performance and state indicators, but it can fully utilize computer resources and improve computer resource utilization.

[0100] 2、Obtain configuration file

[0101] The bank back-end system initiates a federated modeling task through the bank client, the bank client displays a configuration file filling interface, and in response to a configuration file filling operation in the configuration file filling interface, an initial configuration file is obtained. The bank client determines the heterogeneous federated learning framework used for model training based on the parameters in the configuration file, and converts the initial configuration file into the format required by the heterogeneous federated learning framework through a unified encapsulation specification conversion algorithm (i.e. configuration file conversion rule corresponding to the heterogeneous federated learning framework). Specifically, the input and output of the heterogeneous federated learning framework algorithm are uniformly formatted through a unified encapsulation integration specification. This specification mainly divides the input configuration into parameters such as [input dataset, training configuration, algorithm parameter, participant configuration, framework version], and mainly divides the output configuration into parameters such as [output model, output dataset, output log]. In the process of encapsulating and integrating the heterogeneous framework algorithm, according to the unified encapsulation specification, the "unified encapsulation specification conversion algorithm" is realized, which processes and converts the form, format and type of the required parameters in the configuration file according to the specific requirements of each framework.

[0102] 3、Model training

[0103] Based on the participant information in the target configuration file, the bank's backend system uses the corresponding power system as the participant server. A collaborative connection is established with the participant server, ultimately completing the federated modeling task together. Finally, when packaging the trained model, to ensure the integrity and robustness of the algorithm encapsulation, unit testing can be incorporated into the algorithm encapsulation process to pre-emptively detect potential issues that may arise during the encapsulation process and avoid uncontrollable problems when the algorithm is called. Furthermore, algorithm instructions and help documentation can be included during the algorithm encapsulation process to facilitate user understanding of the algorithm's usage and precautions. Finally, the integrity of the algorithm encapsulation requires thorough algorithm verification and system testing to ensure the correctness and reliability of the algorithm on the platform.

[0104] If the user wants to customize the algorithm version, he can set the optional collaboration protocol parameters when editing the model training task (editing the configuration file), and the task process will use the federated framework and algorithm specified by the user.

[0105] The above-described embodiment integrates multiple heterogeneous federated learning frameworks, enabling mixed use within a unified platform. This covers a wide range of application scenarios for different users, significantly reducing development and usage costs when switching between computing frameworks and enabling users to easily utilize a variety of frameworks. This solves the problem of inconsistent environments and dependencies, eliminates differences in algorithm input and output across heterogeneous federated learning frameworks, and ensures the integrity and robustness of algorithm encapsulation.

[0106] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0107] Based on the same inventive concept, the present application also provides a model training device for implementing the aforementioned model training method. The solution to the problem provided by the device is similar to the solution described in the aforementioned method. Therefore, the specific limitations in one or more of the following model training device embodiments can be found in the above-mentioned limitations on the model training method, and will not be repeated here.

[0108] In one embodiment, Figure 4 As shown, a model training device is provided, including: a configuration file acquisition module 402, a training request sending module 404, an intermediate result generation module 406, a loss value determination module 408 and a target model determination module 410, wherein:

[0109] The configuration file acquisition module 402 is used to obtain a target configuration file corresponding to the target business; the target configuration file includes the initiator training set, participant information, federated learning framework identifier and model identifier corresponding to the target business.

[0110] The training request sending module 404 is used to send a model training request carrying the federated learning framework identifier and the model identifier to the participant server corresponding to the participant information, so that the participant server can train the initial participant model corresponding to the model identifier in the participant mirror corresponding to the federated learning framework identifier through the participant training set to obtain the participant intermediate result.

[0111] The intermediate result generation module 406 is used to train the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier using the initiator training set to obtain the initiator intermediate result.

[0112] The loss value determination module 408 is used to obtain the participant intermediate result returned by the participant server, and obtain the loss value based on the participant intermediate result and the initiator intermediate result.

[0113] The target model determination module 410 is used to adjust the model parameters in the initial initiator model in the initiator mirror through the loss value to obtain the target initiator model, and send the loss value to the participant server so that the participant server adjusts the initial participant model in the participant mirror through the loss value to obtain the target participant model.

[0114] In one embodiment, the target configuration file is sent by the initiator client to the initiator server, and the target configuration file is generated by the initiator client in response to a configuration file filling operation, and the configuration file filling operation includes an initiator training set configuration operation, a participant information configuration operation, a federated learning framework configuration operation, and a model configuration operation.

[0115] In one embodiment, the target configuration file is generated by the initiator client performing format conversion on the initial configuration file generated in response to the configuration file filling operation based on the configuration file conversion rule corresponding to the federated learning framework identifier.

[0116] In one embodiment, the training request sending module 404 is further configured to:

[0117] Obtain a set of participants corresponding to the target business; the participant set includes multiple candidate participants corresponding to the target business; compare the cooperation information corresponding to each candidate participant with the participant information to obtain the target participant; send a model training request carrying the federated learning framework identifier and model identifier to the participant server corresponding to the target participant.

[0118] In one embodiment, Figure 5 As shown, the model training device also includes:

[0119] The image deployment module 502 is used to obtain the component sets and system environments corresponding to multiple candidate federated learning frameworks; package the component sets and system environments corresponding to the same candidate federated learning framework to obtain candidate images corresponding to each candidate federated learning framework; the component set includes a candidate model corresponding to at least one candidate business, and a mapping relationship between the candidate model and the corresponding model identifier; and deploy each candidate image on the initiator server and the participant server respectively.

[0120] The image deployment module 502 is also used to obtain candidate models corresponding to the target business from the candidate images corresponding to each candidate federated learning framework; based on the preset segmentation granularity, each candidate model is segmented to obtain a sub-model set corresponding to multiple different model sub-functions; the sub-model set includes sub-models corresponding to the same model sub-function in each candidate model; target sub-models are respectively obtained from each sub-model set to form a target sub-model set, and at least one target sub-model set is obtained; an initial model corresponding to the target business is generated based on the target sub-model set to obtain at least one initial model; the initial model and the model identifier corresponding to the initial model are transferred to at least one candidate image corresponding to the target business; the candidate image corresponding to the target business refers to a candidate image including the candidate model corresponding to the target business.

[0121] The model training device described above involves a participant server performing model training on an initial participant model corresponding to a model identifier in the participant image corresponding to the federated learning framework identifier, and simultaneously performing model training on an initial initiator model corresponding to a model identifier in the initiator image corresponding to the federated learning framework identifier. A loss value is obtained based on the obtained participant intermediate results and initiator intermediate results, and the initial participant model and initial initiator model are adjusted based on the loss value to obtain a target participant model and a target initiator model. This enables collaborative model training between the initiator server and the participant server, effectively improving model training efficiency.

[0122] Each module in the above-mentioned model training device can be implemented in whole or in part through software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each of the above modules.

[0123] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data such as target configuration files and initiator intermediate results. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a model training method is implemented.

[0124] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a model training method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.

[0125] Those skilled in the art will understand that Figure 6 、 7 The structure shown is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0126] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0127] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0128] In one embodiment, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of each of the above-described method embodiments.

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

[0130] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processor involved in the various embodiments provided herein may be, but are not limited to, a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, and the like.

[0131] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0132] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A model training method, characterized in that: Applied to the initiator server, the method includes: Obtain a target configuration file corresponding to the target business; the target configuration file includes an initiator training set, participant information, a federated learning framework identifier, and a model identifier corresponding to the target business; Sending a model training request carrying the federated learning framework identifier and the model identifier to the participant server corresponding to the participant information, so that the participant server trains the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier using the participant training set, and obtains the participant intermediate result; Using the initiator training set, the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier is trained to obtain an initiator intermediate result; Obtaining the participant intermediate result returned by the participant server, and obtaining a loss value based on the participant intermediate result and the initiator intermediate result; wherein, the participant intermediate result is transferred to the initiator image, the participant intermediate result is input into the initial initiator model in the initiator image, and the initial initiator model generates a predicted label based on the initiator intermediate result and the participant intermediate result corresponding to the same training sample, and then calculates the loss value based on the difference between the predicted label and the sample label corresponding to the training sample; Adjusting the model parameters of the initial initiator model in the initiator image by the loss value to obtain a target initiator model, and sending the loss value to the participant server so that the participant server adjusts the initial participant model in the participant image by the loss value to obtain a target participant model; Obtain component sets and system environments corresponding to multiple candidate federated learning frameworks; The component set and system environment corresponding to the same candidate federated learning framework are packaged to obtain candidate images corresponding to each candidate federated learning framework; the component set includes a candidate model corresponding to at least one candidate business, and a mapping relationship between the candidate model and the corresponding model identifier; Deploy each candidate image on the initiator server and the participant server respectively; Obtaining a candidate model corresponding to the target business from the candidate images corresponding to the candidate federated learning frameworks; Based on a preset segmentation granularity, each candidate model is segmented to obtain a plurality of sub-model sets corresponding to different model sub-functions; the sub-model set includes sub-models corresponding to the same model sub-function in each candidate model; Obtain target sub-models from each sub-model set to form a target sub-model set, and obtain at least one target sub-model set; Generate an initial model corresponding to the target business based on the target sub-model set to obtain at least one initial model; The initial model and the model identifier corresponding to the initial model are transferred to at least one candidate image corresponding to the target business; the candidate image corresponding to the target business refers to a candidate image including the candidate model corresponding to the target business.

2. The method according to claim 1, characterized in that The target configuration file is sent by the initiator client to the initiator server. The target configuration file is generated by the initiator client in response to a configuration file filling operation. The configuration file filling operation includes an initiator training set configuration operation, a participant information configuration operation, a federated learning framework configuration operation, and a model configuration operation.

3. The method according to claim 2, characterized in that The target configuration file is generated by the initiator client performing format conversion on an initial configuration file generated in response to the configuration file filling operation based on a configuration file conversion rule corresponding to the federated learning framework identifier.

4. The method according to claim 1, wherein The sending a model training request carrying the federated learning framework identifier and the business model identifier to the participant server corresponding to the participant information includes: Acquire a participant set corresponding to the target business; the participant set includes multiple candidate participants corresponding to the target business; Compare the cooperation information corresponding to each candidate participant with the participant information to obtain the target participant; Send a model training request carrying the federated learning framework identifier and the model identifier to the participant server corresponding to the target participant.

5. A model training device, characterized in that: The device comprises: A configuration file acquisition module is used to obtain a target configuration file corresponding to a target business; the target configuration file includes an initiator training set, participant information, federated learning framework identifier, and model identifier corresponding to the target business; A training request sending module is configured to send a model training request carrying the federated learning framework identifier and the model identifier to the participant server corresponding to the participant information, so that the participant server trains the initial participant model corresponding to the model identifier in the participant image corresponding to the federated learning framework identifier using the participant training set to obtain a participant intermediate result; An intermediate result generation module, configured to train the initial initiator model corresponding to the model identifier in the initiator image corresponding to the federated learning framework identifier using the initiator training set, to obtain an initiator intermediate result; a loss value determination module, configured to obtain the participant intermediate result returned by the participant server, and obtain a loss value based on the participant intermediate result and the initiator intermediate result; wherein the participant intermediate result is transferred to the initiator image, the participant intermediate result is input into the initial initiator model in the initiator image, the initial initiator model generates a predicted label based on the initiator intermediate result and the participant intermediate result corresponding to the same training sample, and further calculates the loss value based on the difference between the predicted label and the sample label corresponding to the training sample; a target model determination module, configured to adjust model parameters in the initial initiator model in the initiator image by the loss value to obtain a target initiator model, and send the loss value to the participant server so that the participant server adjusts the initial participant model in the participant image by the loss value to obtain a target participant model; The image deployment module is used to obtain component sets and system environments corresponding to multiple candidate federated learning frameworks; package the component sets and system environments corresponding to the same candidate federated learning framework to obtain candidate images corresponding to each candidate federated learning framework; the component set includes a candidate model corresponding to at least one candidate business, and a mapping relationship between the candidate model and the corresponding model identifier; and deploy each candidate image on the initiator server and the participant server respectively; The image deployment module is further used to obtain candidate models corresponding to the target business from the candidate images corresponding to each candidate federated learning framework; based on a preset segmentation granularity, each candidate model is segmented to obtain a sub-model set corresponding to multiple different model sub-functions; the sub-model set includes sub-models corresponding to the same model sub-function in each candidate model; target sub-models are respectively obtained from each sub-model set to form a target sub-model set, and at least one target sub-model set is obtained; an initial model corresponding to the target business is generated based on the target sub-model set to obtain at least one initial model; the initial model and the model identifier corresponding to the initial model are transferred to at least one candidate image corresponding to the target business; the candidate image corresponding to the target business refers to a candidate image that includes the candidate model corresponding to the target business.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

8. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Longitudinal federated learning incentive training method, electronic device and storage medium

    CN112328698A

  • Federal learning system and method and equipment for realizing multi-party joint processing task

    CN115169587A