Microservices-based Federated Learning Method, System, Device and Medium for Crowdsourcing

The microservices-based federated learning method addresses device heterogeneity and privacy issues by customizing training tasks and aggregating models, improving training efficiency and effectiveness in federated learning systems.

CN115841160BActive Publication Date: 2025-07-15SUN YAT SEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211506042.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-29
Publication Date
2025-07-15
Estimated Expiration
2042-11-29

AI Technical Summary

Technical Problem

The existing federated learning methods are difficult to meet complex computing needs flexibly and efficiently, and cannot adapt to diverse information forms and behavior types. The device response speed and reliability are uneven, and the lack of cross-platform compatibility leads to low training efficiency and poor results.

Method used

Using a microservice federated learning method, a customized federated learning service is provided through the container image library and model database of the central server. The container image and pre-trained model are used to match clients with the same modeling tasks for federated modeling, and the Restful microservice architecture is used for interaction to realize local computing and global model updates.

Benefits of technology

It improves the training efficiency and effectiveness of federated learning, ensures data security and privacy, simplifies the deployment process, reduces the difficulty of getting started for developers and users, and supports a variety of devices and learning strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115841160B_ABST
    Figure CN115841160B_ABST
Patent Text Reader

Abstract

The present invention discloses a microservice-based federated learning method, system, device and medium for crowdsourcing. The method includes: obtaining a first task customization request of a first client, and performing a matching query in the container image library of the central server according to the first task customization request; when a corresponding first container image is matched, sending the first container image to the first client, otherwise, designing a container according to the task customization request to obtain a first container image, adding the first container image to the container image library and sending it to the first client; determining a plurality of second clients with the same modeling task according to the first task customization request, and sending a federated modeling task to the first client and each second client through the central server; performing the federated modeling task through the first client, each second client and the central server. The present invention can provide customized federated learning services, improve the training efficiency and training effect of federated learning, and can be widely applied to the technical field of federated learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular to a microservice-based federated learning method, system, device and medium for crowdsourcing. Background Art

[0002] With the advent of the big data era, the computing power of computers and the network bandwidth have been greatly improved. A large number of applications related to artificial intelligence based on machine learning have emerged in aspects of life such as healthcare, food and agriculture, and intelligent transportation. However, machine learning also faces new difficulties and challenges. Traditional machine learning methods require a large amount of high-quality data to ensure the accuracy of the model, so a large model training cost is required. Edge devices are often limited in resources such as computing power and network bandwidth, which poses strict conditions for the deployment and application of traditional machine learning methods on edge devices; the protection of data privacy and information security is gradually becoming a worldwide trend, and the behavior of directly collecting and using others' data in traditional deep learning frameworks is no longer allowed, increasing the difficulty of related research; in the big data era, the concept of "data is an asset" is increasingly accepted by enterprises. Enterprises pay more and more attention to local data within the enterprise and have less and less data exchange with other enterprises. The phenomena of "data barriers" and "data islands" are becoming more and more serious, and it is increasingly difficult to ensure the data quality required by traditional machine learning methods. Traditional machine learning methods are greatly restricted.

[0003] To solve these problems, Federated Learning (FL) has emerged as the times require. Federated learning enables different data sources (device sides) to jointly train machine learning models without sharing data, and has become a hot research direction in the field of artificial intelligence. However, traditional federated learning methods face challenges of heterogeneity in devices, data, and models, and cannot cope with the personalized characteristics and needs of different clients, affecting the training efficiency and training effect of federated learning. Summary of the Invention

[0004] An object of the present invention is to solve at least to some extent one of the technical problems existing in the prior art.

[0005] For this reason, an object of an embodiment of the present invention is to provide a microservice-based federated learning method for crowdsourcing, which can provide customized federated learning services and improve the training efficiency and training effect of federated learning.

[0006] Another object of an embodiment of the present invention is to provide a microservice-based federated learning system for crowdsourcing.

[0007] To achieve the above technical object, the technical solutions adopted in the embodiments of the present invention include:

[0008] On the one hand, an embodiment of the present invention provides a microservice-based federated learning method for crowdsourcing, including the following steps:

[0009] Obtain a first task customization request of a first client, and perform a matching query in the container image library of the central server according to the first task customization request;

[0010] When a corresponding first container image is matched, send the first container image to the first client; otherwise, design a container according to the task customization request to obtain the first container image, add the first container image to the container image library and send it to the first client;

[0011] Determine multiple second clients with the same modeling task according to the first task customization request, and send a federated modeling task to the first client and each of the second clients through the central server;

[0012] Perform local local calculations through the first client and each of the second clients to obtain local models, and upload each of the local models to the central server;

[0013] Aggregate the parameters of each of the local models through the central server, update the global model, and then send the updated global model to the first client and each of the second clients.

[0014] Further, in an embodiment of the present invention, the step of obtaining a first task customization request of a first client specifically includes:

[0015] Encapsulate the first task customization request into a first yaml configuration file through the first client;

[0016] Send the first yaml configuration file to a Restful-style API interface, and forward the first yaml configuration file to the central server through the API interface;

[0017] Wherein, the first task customization request includes a first container image configuration and first modeling task information requested by the first client.

[0018] Further, in an embodiment of the present invention, the step of performing a matching query in the container image library of the central server according to the first task customization request specifically includes:

[0019] Determine the first container image configuration according to the first yaml configuration file;

[0020] Obtain second container image configurations corresponding to each second container image in the container image library;

[0021] Compare the first container image configuration with each of the second container image configurations;

[0022] When there is at least one second container image configuration that is the same as the first container image configuration, obtain the corresponding second container image as the first container image obtained by matching.

[0023] Further, in an embodiment of the present invention, the microservices-based federated learning method further includes the following steps:

[0024] Perform a matching query in the model database of the central server according to the first task customization request;

[0025] When a corresponding first pre-trained model is matched, send the first pre-trained model to the first client. Otherwise, design a model according to the task customization request to obtain the first pre-trained model, add the first pre-trained model to the model database, and send it to the first client.

[0026] Further, in an embodiment of the present invention, the step of performing a matching query in the model database of the central server according to the first task customization request specifically includes:

[0027] Determine the first modeling task information according to the first yaml configuration file;

[0028] Obtain the second modeling task information corresponding to each second pre-trained model in the model database;

[0029] Compare the first modeling task information with each of the second modeling task information;

[0030] When there is at least one second modeling task information that is the same as the first modeling task information, obtain the corresponding second pre-trained model as the first pre-trained model obtained by matching.

[0031] Further, in an embodiment of the present invention, the step of determining a plurality of second clients with the same modeling task according to the first task customization request and sending a federated modeling task to the first client and each of the second clients through the central server specifically includes:

[0032] Determine the first modeling task information according to the first yaml configuration file;

[0033] Determine a plurality of second clients with the same modeling task according to the first modeling task information;

[0034] Obtain the second container image configurations of the respective second clients, and determine a federated modeling task according to the first modeling task information, the first container image configuration, and the respective second container image configurations;

[0035] Send the federated modeling task to the first client and the respective second clients.

[0036] Further, in an embodiment of the present invention, the microservices-based federated learning method further includes the following steps:

[0037] Receive the federated modeling task through the first client and the respective second clients, and return confirmation information to the central server.

[0038] On the other hand, an embodiment of the present invention provides a microservices-based federated learning system for crowdsourcing, including:

[0039] A matching query module, configured to obtain a first task customization request of a first client, and perform a matching query in the container image library of the central server according to the first task customization request;

[0040] A first container image distribution module, configured to, when a corresponding first container image is matched, distribute the first container image to the first client; otherwise, perform container design according to the task customization request to obtain the first container image, add the first container image to the container image library, and distribute it to the first client;

[0041] A federated modeling request module, configured to determine a plurality of second clients with the same modeling task according to the first task customization request, and send a federated modeling task to the first client and the respective second clients through the central server;

[0042] A local computing module, configured to respectively perform local local computing through the first client and the respective second clients to obtain local models, and upload the respective local models to the central server;

[0043] A global update module, configured to perform parameter aggregation on the respective local models through the central server, update the global model, and then distribute the updated global model to the first client and the respective second clients.

[0044] On the other hand, an embodiment of the present invention provides a microservices-based federated learning device for crowdsourcing, including:

[0045] At least one processor;

[0046] At least one memory, configured to store at least one program;

[0047] When the at least one program is executed by the at least one processor, the at least one processor is caused to implement the above-mentioned micro-service-based federated learning method for crowdsourcing.

[0048] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, in which a program executable by a processor is stored, and the program executable by the processor is used to execute the above-mentioned micro-service-based federated learning method for crowdsourcing when executed by the processor.

[0049] The advantages and beneficial effects of the present invention will be partially given in the following description, partially will become obvious from the following description, or will be understood through the practice of the present invention:

[0050] An embodiment of the present invention provides a micro-service-based federated learning method for crowdsourcing. This method adopts the micro-service concept and uses container images to package the modeling tasks and environment configurations customized by the client. In the crowdsourcing mode, each time the client customizes a task, the container image library of the central server will be expanded, thus enriching the container image library. Based on the modeling task requirements of each client stored in the central server, a federated modeling task can be initiated for clients with the same modeling task. After each client uses its own source data for local training to obtain a local model and uploads it to the central server, the central server aggregates the local model data and then returns the updated global model to each client participating in the federated modeling task through the method of model distribution, completing one round of the federated learning process. The embodiment of the present invention uses container technology to provide customized federated learning services for clients, improves the container image library of the central server in the crowdsourcing mode, and matches multiple clients with the same modeling task to participate in the federated modeling task, improving the training efficiency and training effect of federated learning while ensuring the security and privacy of data. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following introduces the drawings required to be used in the embodiments of the present invention. It should be understood that the drawings introduced below are only for conveniently and clearly expressing some embodiments of the technical solutions in the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

[0052] Figure 1 It is a flowchart of the steps of a micro-service-based federated learning method for crowdsourcing provided by an embodiment of the present invention;

[0053] Figure 2 It is a schematic diagram of data interaction between a client and a central server provided by an embodiment of the present invention;

[0054] Figure 3Schematic diagram of the process for customizing container images and pre-trained models provided by an embodiment of the present invention;

[0055] Figure 4 Schematic diagram of the environment deployment of the client and the central server provided by an embodiment of the present invention;

[0056] Figure 5 Schematic diagram of the learning process of the federated modeling task provided by an embodiment of the present invention;

[0057] Figure 6 Schematic diagram of the crowdsourcing method provided by an embodiment of the present invention;

[0058] Figure 7 Schematic diagram of microservices provided by an embodiment of the present invention;

[0059] Figure 8 Block diagram of the structure of a crowdsourcing-oriented microservices-based federated learning system provided by an embodiment of the present invention;

[0060] Figure 9 Block diagram of the structure of a crowdsourcing-oriented microservices-based federated learning device provided by an embodiment of the present invention. Detailed implementation manners

[0061] The embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention. For the step numbers in the following embodiments, they are only set for the convenience of explanation and illustration, and no limitation is imposed on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0062] In the description of the present invention, the meaning of "a plurality" is two or more. If there is a description of "first" and "second", it is only for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or implicitly indicating the sequence of the indicated technical features. In addition, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs.

[0063] Currently, the existing federated learning frameworks are difficult to flexibly and efficiently meet the increasingly complex computing needs in reality, and customized federated learning tasks have gradually become the research focus. The main reasons are as follows:

[0064] 1) The forms of information transmitted between federated learning participants are more diverse, and the behaviors of federated learning participants are more changeable. For example, the information transmitted by each party is no longer limited to homogeneous information such as model parameters or gradients, but also public keys and some encrypted information will be transmitted; in the cross-device federated learning scenario, it is often necessary to compress the model on the server side to meet the operation requirements of terminal devices; while on terminal devices, the received model is often fine-tuned to achieve better results. The diverse forms of information and the diverse behaviors of participants require the federated learning framework to flexibly support a variety of custom behaviors.

[0065] 2) The response speeds and reliabilities of federated learning participants vary, and using the traditional synchronous training method is likely to cause problems such as poor training efficiency and low system utilization. This requires the federated learning framework to allow developers or users to adopt different federated learning training strategies according to the application scenario, so as to improve the training efficiency while ensuring the training effect.

[0066] 3) In practical applications, federated learning participants may be equipped with different model training environments. For example, some device back-end machine learning training environments use PyTorch, while others use TensorFlow. This requires the federated learning framework to have better compatibility, be able to support cross-platform federated learning construction, and avoid requiring users to spend time and effort adapting the environments of all participants.

[0067] Therefore, the embodiments of the present invention propose a personalized federated learning method that allows users to customize aspects such as the operating environment and work content of federated learning tasks. This method can perform personalized customization on federated learning task content such as machine learning models, federated learning training methods, and the number of client devices according to the requirements of developers or users. At the same time, the system architecture is built through the Restful microservice architecture, which is convenient for developers and users to perform simple deployment and research and development, and meets the diverse application needs of different users in actual use.

[0068] Refer to Figure 1 , the embodiments of the present invention provide a microservice-based federated learning method for crowdsourcing, which specifically includes the following steps:

[0069] S101. Obtain the first task customization request of the first client, and perform a matching query in the container image library of the central server according to the first task customization request.

[0070] Specifically, in the implementation process of the embodiments of the present invention, there are three parties of participants, namely the client, the central server, and the system administrator. Among them, the client and the central server interact through the Restful-style interface in the network layer, and the system administrator is responsible for designing the federated learning task and providing customization services.

[0071] As a further optional implementation, the step of obtaining the first task customization request of the first client specifically includes

[0072] S1011: Encapsulate the first task customization request into a first yaml configuration file through the first client;

[0073] S1012: Send the first yaml configuration file to a Restful-style API interface, and forward the first yaml configuration file to the central server through the API interface;

[0074] Among them, the first task customization request includes the first container image configuration and the first modeling task information requested by the first client.

[0075] Such as Figure 2 shown is the data interaction schematic diagram between the client and the central server provided by the embodiment of the present invention. Among them, the client transmits a learning task customization request to the central server through the Restful-style API interface of the network layer, specifically a yaml configuration file and related request instructions. After receiving the customization task, the central server performs the following processing: If the same or similar customization task has been received previously, directly provide containerized customization services; if it is a new customization task, feedback the customization requirements to the system administrator, and the system administrator designs the container and feeds it back to the server, so as to provide containerized customization services for the client.

[0076] As a further optional implementation, the step of performing a matching query in the container image library of the central server according to the first task customization request specifically includes:

[0077] S1013: Determine the first container image configuration according to the first yaml configuration file;

[0078] S1014: Obtain the second container image configurations corresponding to the second container images in the container image library;

[0079] S1015: Compare the first container image configuration with each second container image configuration;

[0080] S1016: When there is at least one second container image configuration that is the same as the first container image configuration, obtain the corresponding second container image as the first container image obtained by matching.

[0081] S102: When the corresponding first container image is matched, send the first container image to the first client. Otherwise, design a container according to the task customization request to obtain the first container image, add the first container image to the container image library and send it to the first client.

[0082] It can be understood that in the embodiments of the present invention, the customization of the first container image can be completed through the above steps. Based on this first container image, the deployment of the operating environment for the federated modeling task in the first client can be completed, which is used for the subsequent execution of the federated modeling task.

[0083] Further as an optional implementation manner, the microservices-based federated learning method further includes the following steps:

[0084] S103. Perform a matching query in the model database of the central server according to the first task customization request;

[0085] S104. When a corresponding first pre-trained model is matched, send the first pre-trained model to the first client. Otherwise, design a model according to the task customization request to obtain the first pre-trained model, add the first pre-trained model to the model database, and send it to the first client.

[0086] Further as an optional implementation manner, for the step S103 of performing a matching query in the model database of the central server according to the first task customization request, it specifically includes:

[0087] S1031. Determine the first modeling task information according to the first yaml configuration file;

[0088] S1032. Obtain the second modeling task information corresponding to each second pre-trained model in the model database;

[0089] S1033. Compare the first modeling task information with each second modeling task information;

[0090] S1034. When there is at least one second modeling task information that is the same as the first modeling task information, obtain the corresponding second pre-trained model as the first pre-trained model obtained by matching.

[0091] Specifically, in the embodiments of the present invention, in addition to customizing the first container image, a pre-trained model for the federated modeling task can also be customized, and the pre-trained model is obtained through the comparison of modeling task information or designed by the system administrator.

[0092] Such as Figure 3The following is a schematic flowchart of the process for customizing container images and pre-trained models provided by an embodiment of the present invention. In an embodiment of the present invention, based on the basic principles of software design, the system architecture is split into five major parts: an interactive terminal layer, a network interface layer, a central service layer, a system data layer, and a system management layer. Among them, the interactive terminal layer includes each client, the network interface layer correspondingly adopts a Restful-style API interface system, the central service layer corresponds to the central server, the system data layer corresponds to the database located on the central server, including a container image library and a model database, and the system management layer corresponds to the system administrator, which is used to provide the federated learning customization function on the server, including container design, model design, and subsequent customization of the federated modeling task. The system data layer and the system management layer are transparent to users. The specific process of customizing container images and pre-trained models is as follows:

[0093] 1. Each client in the interactive terminal layer passes the yaml configuration file and relevant request instructions to the Restful-style API interface in the network interface layer.

[0094] 2. After the network interface layer receives the client request, it sends a notification and relevant configuration information to the central server in the central service layer.

[0095] 3. After the server in the central service layer receives the configuration information and request from the client, it queries the database in the system data layer according to the yaml configuration file uploaded by the client, specifically the container image library and the model database. If the query fails, that is, there is no container image or model data described by a similar yaml configuration file in the system data layer, it notifies each system administrator in the system management layer, and the system administrator designs the container image and the pre-trained model according to the configuration information and request of the client, and supplements them to the container image library and the model database respectively. If the query is successful, that is, there is container image or model data described by a similar yaml configuration file in the system data layer, the queried container image or model data is returned.

[0096] 4. After the system data layer successfully queries or the system administrator completes the customization and supplementation of the container image or the pre-trained model, the system data layer returns the required container image or pre-trained model to the central service layer.

[0097] 5. The central service layer returns the container image or the pre-trained model to the network interface layer.

[0098] 6. The network interface layer returns the container image or the pre-trained model to the client.

[0099] It can be understood that the customization of the container image and the pre-trained model can be completed through the foregoing steps.

[0100] Such as Figure 4The following is a schematic diagram of the environment deployment of the client and the central server provided by an embodiment of the present invention. In the embodiment of the present invention, there are three parties of participants, namely the client, the central server, and the system administrator. Among them, the client runs under the Linux operating system, supports running Docker and has a local model data storage center for the client. In the Docker environment, it can support storing and managing container groups. The number of containers in the container group (assuming there are k) is determined by factors such as the client's own configuration and task requirements; the central server should support the Linux environment and contain a container image library and a model database. The number of images contained in the container image library (assuming there are m) is jointly determined by the initially set number of images and the customized number of images, that is, the customized images of the client all have copies in the server and can be directly used by subsequent clients with similar customization requirements. The model database contains the client's pre-trained models, the global models required for federated learning, etc. The system administrator receives the required customized configuration information and is responsible for the design of the customized container images. The interaction process of the three parties of participants is as follows:

[0101] 1. The client sends the yaml configuration file and related request instructions to the central server through the Restful-style API interface.

[0102] 2. After receiving the request from the client, the central server converts the yaml configuration file and related request instructions into queries to the container image library and the model database. If the query is successful, that is, the server has a container image or pre-trained model that meets the requirements of the client, it will return the container image or pre-trained model to the client; if the query fails, the server will notify the system administrator of the query failure information.

[0103] 3. After receiving the query failure information notification from the server, the system administrator designs the container image or pre-trained model according to the configuration file and related request instructions received by the server and stores it in the container image library or the model database.

[0104] 4. After receiving the customized container image, the server notifies the client, and the client repeats operation 1 to obtain its customized service.

[0105] It can be understood that the customization of the container image and the customization of the pre-trained model are independent of each other, that is, in the specific implementation process, only the container image can be customized, or only the pre-trained model can be customized.

[0106] S105. Determine multiple second clients with the same modeling task according to the first task customization request, and send the federated modeling task to the first client and each second client through the central server.

[0107] Specifically, after customizing the container image and pre-trained model of the first client, multiple second clients with the same modeling task can be determined to jointly perform a federated modeling task with the first client. Step S105 specifically includes the following steps:

[0108] Determine the first modeling task information according to the first yaml configuration file;

[0109] Determine multiple second clients with the same modeling task according to the first modeling task information;

[0110] Obtain the second container image configurations of each second client, and determine the federated modeling task according to the first modeling task information, the first container image configuration, and each second container image configuration;

[0111] Send the federated modeling task to the first client and each second client.

[0112] Furthermore, as an optional implementation manner, the microservices-based federated learning method further includes the following steps:

[0113] S106. Receive the federated modeling task through the first client and each second client, and return a confirmation message to the central server.

[0114] Specifically, when the confirmation messages from the first client and each second client are received, it indicates that each client has responded and entered the joint modeling process, and the execution of the federated modeling task can be started.

[0115] S107. Perform local local calculations through the first client and each second client to obtain local models, and upload each local model to the central server.

[0116] S108. Aggregate the parameters of each local model through the central server, update the global model, and then send the updated global model to the first client and each second client.

[0117] Specifically, steps S107 to S108 are repeatedly executed for several rounds, and when the model performance reaches a preset value, the training can be stopped.

[0118] As Figure 5 shown is a schematic diagram of the learning process of the federated modeling task provided by the embodiment of the present invention, and the specific process is as follows:

[0119] 1. First, the central server queries the container image library, finds clients 1 to client x with the same modeling task, sends the federated modeling task to them, and integrates the requirements of each client according to the customized configuration file of each client to formulate the model requirements for federated modeling.

[0120] 2. After each client receives the federated modeling task from the server, it returns a confirmation message to the server. After all clients have confirmed, each client enters the joint modeling process.

[0121] 3. Each client first performs local calculations based on its own data locally.

[0122] 4. After the calculation is completed, the model data obtained from the local local calculation is gradient desensitized and then uploaded to the central server for the first update of the global model.

[0123] 5. After receiving the model data from multiple clients, the central server aggregates the parameters of these model data according to a certain federated learning strategy. During the aggregation process, multiple aspects such as efficiency, security, and privacy need to be considered simultaneously.

[0124] 6. The central server performs the first update of the global model according to the result of the parameter aggregation, and returns the updated model to each client participating in the modeling through the model deployment method. The client accepts the updated model and updates the local model with it, starts the next local calculation, and simultaneously evaluates the performance of the updated model. When the performance is good enough, the training terminates and the joint modeling ends. The established global model will be retained on the central server side for subsequent prediction or classification work.

[0125] As Figure 6 shown is the schematic diagram of the crowdsourcing method provided by the embodiment of the present invention. It can be understood that the crowdsourcing method of the embodiment of the present invention is reflected in that after the client transmits the customized information yaml configuration text file and related requests to the server through the network layer Restful API interface, the container image repository in the server will store the image of the client's customized task and the client's customized information. If a customized task with similar customized information is encountered during subsequent customization, the previously configured container image can be provided to the client. At the same time, clients with the same modeling task can participate in the subsequent federated learning task together to further improve the model accuracy.

[0126] As Figure 7 shown is the schematic diagram of microservices provided by the embodiment of the present invention. It can be understood that the microservices idea of the embodiment of the present invention is reflected in that the containers in the container group in the client Docker environment are isolated from each other and do not affect each other; only a single service, that is, a single main process, is customized in a single container, which specifically includes a modeling task and its dependent environment; the system administrator is only responsible for customizing the service in the container, that is, packaging the modeling task and its dependent environment.

[0127] The method steps of the embodiments of the present invention are described above. It can be understood that the embodiments of the present invention use container technology to provide customized federated learning services for client computers, adopt a crowdsourcing method to improve the container image library of the central server, and match multiple client computers with the same modeling tasks to participate in the federated modeling task, ensuring the security and privacy of data while improving the training efficiency and training effect of federated learning.

[0128] To further highlight the advantages of the crowdsourcing-oriented microservice-based federated learning method proposed in the embodiments of the present invention, the following open-source customized deployment federated learning frameworks designed by various enterprises and research teams for different application implementation scenarios in the prior art are given:

[0129] KubeFATE based on the FATE framework of WeBank. This framework is divided into two parts, Docker-Compose and Kubernetes, according to the deployment environment. The former is used as an experimental environment for quick start, and the latter is designed for the production system FATE cluster. Advanced users with custom FATE deployments can complete requirements such as custom deployment modules and adding or deleting FATE modules. However, the FATE deployment highly depends on the infrastructure platform of Kubernetes and cannot adapt well to mobile edge devices such as mobile phones. At the same time, the cluster configuration is very complicated, and a lot of work needs to be done on the user side to be compatible with third-party components. For example, Helm is a Kubernetes package manager that helps manage Kubernetes applications. However, synchronizing the status of Helm and KubeFATE is a difficult problem, and in some extreme accidental cases, the status of the two may be inconsistent.

[0130] FederatedScope released by Alibaba DAMO Academy. This framework supports large-scale and high-efficiency asynchronous training of federated learning, adopts an event-driven programming paradigm to support the asynchronous training of federated learning applications in real-world scenarios, and draws on relevant research results of distributed machine learning to integrate asynchronous training strategies to improve training efficiency. Specifically, FederatedScope regards federated learning as a process of sending and receiving messages between participants, and describes the federated learning process by defining message types and behaviors for processing messages. However, FederatedScope does not support multiple federated learning strategies and is not containerized. Developers also need to configure a series of parameters such as file paths and host IPs when using it.

[0131] In view of the above introduction, it can be seen that there are currently few open-source federated learning frameworks that support multiple edge devices and can be used for customized deployment. There are only KubeFATE of the WeBank FATE framework and FederatedScope of Alibaba DAMO Academy. In addition, KubeFATE uses the Kubernetes cluster deployment, which is not friendly to resource-constrained edge devices. Although FederatedScope supports the deployment of multiple computer operating systems such as Mac, Windows, and Linux, the overall framework is huge and not friendly to the research population that requires simple deployment. At the same time, the two mainstream frameworks are not comprehensive in terms of customization content. It can be seen that the above existing open-source federated learning frameworks do not fully consider the integrity of customization content and the difficulty of deploying customized learning tasks on different devices, and have the following disadvantages:

[0132] 1) High deployment difficulty, complex configuration, and a large amount of work needs to be done on the user side to be compatible with third-party components. For example, Helm is required as a package management for the Kubernetes cluster, and the client needs to be installed in advance. Since Helm 3 and Helm 2 are not compatible with each other, KubeFATE must be used with Helm 3 and is not compatible with Helm 2. This is likely to cause confusion in versions, and at the same time, synchronizing the status of Helm 3 and KubeFATE is a difficult problem, which increases the difficulty for researchers to get started. Therefore, the embodiment of the present invention adopts the Docker container deployment technology, which can directly provide containerized customization services by querying the container image repository of the server according to the yaml file, achieving the purpose of convenient and fast use and avoiding the problems of complex component installation and low compatibility.

[0133] 2) The deployment devices are single, and it is impossible to deploy on a variety of different edge devices. For example, the current mainstream customized federated learning framework mainly relies on the Kubernetes cluster deployment. Common Kubernetes management tools have high performance requirements for devices, but most devices do not support K8S deployment, and it is impossible to carry out smoothly when facing the customized deployment of federated learning. Therefore, the deployment solution of the federated learning for customized learning tasks proposed in the embodiment of the present invention starts from the architecture design and transmits the container configuration information through the network layer RESTful API interface supported by all devices to solve this problem.

[0134] 3) The customized content is not rich enough, and the degree of functional modularity is low. For example, the customized content lacks the customization of the compressed form of the model file, the model training environment, and the federated learning training strategy, etc., and cannot meet the rich information forms and behavior types among the participants in federated learning, and there are few applicable federated learning scenarios. Therefore, the embodiments of the present invention adopt a crowdsourcing method to enrich the server container image database and the model database, and integrate a variety of algorithm strategies and functional modules therein.

[0135] The embodiments of the present invention include common machine learning model architectures, abstract the training module, make it independent of a specific deep learning backend, and can be compatible with the operating environments of PyTorch, TensorFlow, and Paddle devices, greatly reducing the development difficulty and cost of federated learning in scientific research and practical applications. At the same time, the system can also pre-uniformly preprocess and package some benchmark data sets to help users conveniently carry out experiments. In addition, a large number of data types and corresponding model frameworks can be built in, which can well serve federated tasks in different scenarios and greatly reduce the entry threshold for developers and users.

[0136] At the same time, the embodiments of the present invention adopt the combination of federated learning of customized learning tasks and the deployment of a simple microservice architecture. On the one hand, the microservice architecture is used to effectively split the application, which can run independently in the Android mobile operating system without external dependencies, effectively reducing the coupling degree of edge devices in the edge federated learning system. On the other hand, the server can communicate with the entire system based on the RESTful microservice architecture, and virtualize and package the code and its operating environment required for processes such as local training and local computing of federated learning based on Docker container technology, realizing the simplicity of service transplantation and update. This can expand the data-driven services applied to various fields on the premise of ensuring the lightweight of the front-end software, and has more market practical value.

[0137] In summary, the embodiments of the present invention have the following advantages compared with the prior art:

[0138] 1) The crowdsourcing method can enrich the server container image database and the model database, and integrate a variety of algorithm strategies and functional modules therein. The learning task content customization module has rich deep learning models and can be compatible with different device operating environments including but not limited to PyTorch, TensorFlow, and Paddle. At the same time, the functional modules are packaged, and users can quickly and simply customize the compressed form of the model file, the model training environment, the federated learning training strategy, etc. to meet the rich information forms and behavior types among the participants in federated learning.

[0139] 2) Adopting the microservices concept, the customized modeling tasks and dependent environment configurations of the client are packaged using container images, which has good scalability and low computing resource occupancy. The container configuration information is transmitted through the RestfulAPI interface of the network layer supported by all devices, showing good compatibility. The Restful API provides a unified algorithm description and interface to meet the different application requirements of researchers and developers, reduce the migration difficulty from simulation to deployment, and narrow the deployment gap between federated learning from academic research to industrial applications.

[0140] 3) Simple and convenient access and deployment of federated learning. Based on the modeling task requirements of each client stored in the container image data, the central server can search and find clients with the same modeling tasks and send them a joint modeling request, that is, a request to participate in federated learning. Subsequently, for a client to access federated learning, it only needs to upload the configuration and receive the image through the network interface, which is overall simple and convenient.

[0141] Refer to Figure 8 , the embodiment of the present invention provides a microservices-based federated learning system for crowdsourcing, including:

[0142] A matching query module, used to obtain the first task customization request of the first client and perform a matching query in the container image library of the central server according to the first task customization request;

[0143] A first container image distribution module, used to, when the corresponding first container image is matched, distribute the first container image to the first client. Otherwise, design a container according to the task customization request to obtain the first container image, add the first container image to the container image library and distribute it to the first client;

[0144] A federated modeling request module, used to determine multiple second clients with the same modeling tasks according to the first task customization request, and send a federated modeling task to the first client and each second client through the central server;

[0145] A local computing module, used to perform local local computing respectively through the first client and each second client to obtain local models, and upload each local model to the central server;

[0146] A global update module, used to perform parameter aggregation on each local model through the central server, update the global model, and then distribute the updated global model to the first client and each second client.

[0147] The content in the above method embodiments is applicable to the system embodiments of the present invention. The functions specifically implemented by the system embodiments of the present invention are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.

[0148] Refer toFigure 9 , an embodiment of the present invention provides a microservices-based federated learning device for crowdsourcing, including:

[0149] At least one processor;

[0150] At least one memory for storing at least one program;

[0151] When the above at least one program is executed by the above at least one processor, the above at least one processor implements the above-mentioned microservices-based federated learning method for crowdsourcing.

[0152] The content in the above method embodiments is applicable to the device embodiments of the present invention. The functions specifically implemented by the device embodiments of the present invention are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.

[0153] An embodiment of the present invention also provides a computer-readable storage medium, in which a processor-executable program is stored. The processor-executable program is used to execute the above-mentioned microservices-based federated learning method for crowdsourcing when executed by a processor.

[0154] A computer-readable storage medium of an embodiment of the present invention can execute a microservices-based federated learning method provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.

[0155] An embodiment of the present invention also discloses a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 1 The method shown.

[0156] In some alternative embodiments, the functions / operations mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the functions / operations involved, two consecutive blocks shown can actually be executed substantially simultaneously, or the above blocks can sometimes be executed in the reverse order. In addition, the embodiments presented and described in the flowcharts of the present invention are provided by way of example for the purpose of providing a more comprehensive understanding of the technology. The disclosed method is not limited to the operations and logical flows presented herein. Alternative embodiments are expected, in which the order of various operations is changed and the sub-operations described as part of a larger operation are executed independently.

[0157] In addition, although the present invention has been described in the context of functional modules, it should be understood that, unless otherwise stated to the contrary, one or more of the above functions and / or features may be integrated in a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It should also be understood that a detailed discussion of the actual implementation of each module is not necessary for understanding the present invention. Rather, given the attributes, functions, and internal relationships of the various functional modules in the devices disclosed herein, the actual implementation of such modules would be understood within the ordinary skills of an engineer. Thus, those skilled in the art can implement the present invention as set forth in the claims without undue experimentation. It should also be understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0158] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the above methods in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.

[0159] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a predefined sequence of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in conjunction with such instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0160] More specific examples (nonexhaustive list) of computer-readable media include the following: an electrical connection (electronic device) having one or more wirings, a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable media can even be paper or other suitable media on which the above programs can be printed, because the above programs can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or otherwise processing as appropriate, and then storing them in a computer memory.

[0161] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), and the like.

[0162] In the foregoing description of the present specification, descriptions with reference to the terms "one embodiment / example", "another embodiment / example", or "certain embodiments / examples", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0163] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the claims and their equivalents.

[0164] The above has specifically described the preferred embodiments of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art can also make various equivalent deformations or substitutions without departing from the spirit of the present invention, and these equivalent deformations or substitutions are all included within the scope defined by the claims of this application.

Claims

1. A microservice-based federated learning method for crowdsourcing, characterized in that, It includes the following steps: Obtain the first task customization request of the first client, and perform a matching query in the container image library of the central server according to the first task customization request; When the corresponding first container image is matched, send the first container image to the first client; otherwise, design a container according to the task customization request to obtain the first container image, add the first container image to the container image library and send it to the first client; Determine multiple second clients with the same modeling task according to the first task customization request, and send a federated modeling task to the first client and each of the second clients through the central server; Perform local local calculations through the first client and each of the second clients to obtain local models, and upload each of the local models to the central server; Aggregate the parameters of each of the local models through the central server, update the global model, and then send the updated global model to the first client and each of the second clients.

2. The microservice-based federated learning method for crowdsourcing according to claim 1, wherein The step of obtaining the first task customization request of the first client specifically includes: Encapsulate the first task customization request into a first yaml configuration file through the first client; Send the first yaml configuration file to a Restful-style API interface, and forward the first yaml configuration file to the central server through the API interface; Among them, the first task customization request includes the first container image configuration and the first modeling task information requested by the first client.

3. The microservice-based federated learning method for crowdsourcing according to claim 2, characterized in that, The step of performing a matching query in the container image library of the central server according to the first task customization request specifically includes: Determine the first container image configuration according to the first yaml configuration file; Obtain the second container image configurations corresponding to each second container image in the container image library; Compare the first container image configuration with each of the second container image configurations; When there is at least one second container image configuration that is the same as the first container image configuration, obtain the corresponding second container image as the first container image obtained by matching.

4. A microservice-based federated learning method for crowdsourcing according to claim 2, characterized in that, The microservices-based federated learning method further includes the following steps: Perform a matching query in the model database of the central server according to the first task customization request; When the corresponding first pre-trained model is matched, send the first pre-trained model to the first client; otherwise, design a model according to the task customization request to obtain the first pre-trained model, add the first pre-trained model to the model database and send it to the first client.

5. A microservices-based federated learning method for crowdsourcing according to claim 4, characterized in that, The step of performing a matching query in the model database of the central server according to the first task customization request specifically includes: Determine the first modeling task information according to the first yaml configuration file; Obtain the second modeling task information corresponding to each second pre-trained model in the model database; Compare the first modeling task information with each of the second modeling task information; When there is at least one piece of the second modeling task information that is the same as the first modeling task information, obtain the corresponding second pre-trained model as the first pre-trained model obtained by matching.

6. A microservice-based federated learning method for crowdsourcing according to claim 2, characterized in that, The step of determining multiple second clients with the same modeling task according to the first task customization request and sending a federated modeling task to the first client and each of the second clients through the central server specifically includes: Determine the first modeling task information according to the first yaml configuration file; Determine multiple second clients with the same modeling task according to the first modeling task information; Obtain the second container image configurations of each of the second clients, and determine a federated modeling task according to the first modeling task information, the first container image configuration, and each of the second container image configurations; Send the federated modeling task to the first client and each of the second clients.

7. A microservice-based federated learning method for crowdsourcing according to any one of claims 1 to 6, characterized in that, The microserviced federated learning method further includes the following steps: Receive the federated modeling task through the first client and each of the second clients, and return a confirmation message to the central server.

8. A microservice-based federated learning system for crowdsourcing, characterized in that, Includes: A matching query module, configured to obtain a first task customization request of a first client, and perform a matching query in a container image library of a central server according to the first task customization request; A first container image distribution module, configured to, when a corresponding first container image is matched, distribute the first container image to the first client; otherwise, perform container design according to the task customization request to obtain the first container image, add the first container image to the container image library, and distribute the first container image to the first client; A federated modeling request module, configured to determine multiple second clients with the same modeling task according to the first task customization request, and send a federated modeling task to the first client and each of the second clients through the central server; A local calculation module, configured to perform local local calculations respectively through the first client and each of the second clients to obtain local models, and upload each of the local models to the central server; A global update module, configured to perform parameter aggregation on each of the local models through the central server, update a global model, and then distribute the updated global model to the first client and each of the second clients.

9. A microservice-based federated learning device for crowdsourcing, characterized in that, Includes: At least one processor; At least one memory, configured to store at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements a crowdsourcing-oriented microserviced federated learning method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a program executable by a processor, characterized in that, The program executable by the processor, when executed by the processor, is used to execute a crowdsourcing-oriented microserviced federated learning method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Federal learning system based on crowdsourcing mode and incentive mechanism

    CN114330742A

  • Methods and apparatus for limiting communication capabilities in mobile communication devices

    US20050101287A1