Model updating method and device, computer readable storage medium and electronic device
By dynamically determining the set of mobile devices and aggregating model parameters on the server side, the problem of unstable device numbers in federated learning is solved, communication and distributed environment are optimized, and the efficiency and accuracy of model training are improved.
Patent Information
- Application Number
- CN202210581679.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2042-05-26
AI Technical Summary
In federated learning, due to the instability of device and network conditions, existing solutions struggle to dynamically adjust the number of participating devices, resulting in poor model training performance. Furthermore, existing solutions fail to effectively address issues in cluster and distributed environments, such as the consistency and low communication efficiency of distributed services.
The system sends public key upload and download commands to mobile devices from the server, records the set of mobile devices that have uploaded and downloaded, dynamically determines the third set of mobile devices, aggregates and updates model parameters, optimizes communication using the WebSocket protocol, and improves system performance and efficiency using a distributed architecture.
It enables dynamic adjustment of the number of participating devices, improves the system processing efficiency of federated learning model training, optimizes device performance and network bandwidth consumption, and enhances the accuracy and efficiency of model training.
Smart Images

Figure CN115001692B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of artificial intelligence, in particular to a model updating method, a model updating apparatus, a computer readable storage medium and an electronic device. BACKGROUND
[0002] With the development of artificial intelligence technology, its great value in various industries has gradually been embodied. The development of artificial intelligence technology cannot be separated from the support of massive data. In recent years, data privacy protection and data compliance have been increasingly valued. For the purpose of protecting data, data cannot be interchanged, resulting in the phenomenon of data silos. The phenomenon of data silos hinders the development of data potential. In order to solve this problem, federated learning emerges as the times require. Federated learning can enable the data of multiple participating devices to be modeled together without leaving the local, ensuring data privacy while stimulating the data potential of each participating device.
[0003] For federated learning, the number of participating devices is often specified before the start of model training, and the number is used to determine whether to enter the next stage during training. However, due to the instability of devices and network states, the number of parameter devices may change. If the training is still determined according to the specified number, it may affect the normal progress of the model training process. SUMMARY
[0004] The present disclosure provides a model updating method, a model updating apparatus, a computer readable storage medium and an electronic device, thereby at least partially overcoming the problem of poor model training effect in the process of federated learning.
[0005] According to a first aspect of the present disclosure, a model updating method is provided, applied to a server, the model updating method comprising: sending a public key uploading instruction to each mobile terminal in a first mobile terminal set, recording the mobile terminals that have uploaded the public key, to obtain a second mobile terminal set; wherein each mobile terminal in the first mobile terminal set is a mobile terminal that has uploaded device information; sending a public key downloading instruction to each mobile terminal in the second mobile terminal set, recording the mobile terminals that have downloaded the public keys of all mobile terminals in the second mobile terminal set except themselves, to obtain a third mobile terminal set; sending a model parameter uploading instruction to each mobile terminal in the third mobile terminal set, in the case of receiving the model parameters uploaded by each mobile terminal in the third mobile terminal set, aggregating the model parameters to obtain target model parameters; and sending the target model parameters to each mobile terminal in the third mobile terminal set, so that each mobile terminal in the third mobile terminal set updates a local model using the target model parameters respectively.
[0006] According to a second aspect of the present disclosure, a model updating method applied to a mobile terminal is provided, which comprises: in response to a public key uploading instruction, sending a public key to a server; in response to a public key downloading instruction, downloading public keys of mobile terminals other than the mobile terminal from the server; in response to a model parameter uploading instruction, uploading model parameters to the server, so that the server aggregates the model parameters and model parameters obtained from the other mobile terminals to calculate target model parameters; receiving the target model parameters and updating a local model using the target model parameters.
[0007] According to a third aspect of the present disclosure, a model updating device applied to a server is provided, which comprises: a first recording module configured to send a public key uploading instruction to each mobile terminal in a first mobile terminal set, record mobile terminals that have uploaded public keys, and obtain a second mobile terminal set; wherein each mobile terminal in the first mobile terminal set is a mobile terminal that has uploaded device information; a second recording module configured to send a public key downloading instruction to each mobile terminal in the second mobile terminal set, record mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves, and obtain a third mobile terminal set; a parameter calculation module configured to send a model parameter uploading instruction to each mobile terminal in the third mobile terminal set, aggregate model parameters in the case of receiving model parameters uploaded by each mobile terminal in the third mobile terminal set, and obtain target model parameters; and a parameter sending module configured to send the target model parameters to each mobile terminal in the third mobile terminal set, so that each mobile terminal in the third mobile terminal set respectively updates a local model using the target model parameters.
[0008] According to a fourth aspect of the present disclosure, a model updating device applied to a mobile terminal is provided, which comprises: a public key sending module configured to send a public key to a server in response to a public key uploading instruction; a public key downloading module configured to download public keys of mobile terminals other than the mobile terminal from the server in response to a public key downloading instruction; a parameter uploading module configured to upload calculated model parameters to the server in response to a model parameter uploading instruction, so that the server aggregates the model parameters and model parameters obtained from the other mobile terminals to calculate target model parameters; and a parameter application module configured to receive the target model parameters and update a local model using the target model parameters.
[0009] According to a fifth aspect of the present disclosure, a computer readable storage medium having a computer program stored thereon is provided, the program being executed by a processor to implement the model updating method described above.
[0010] According to a sixth aspect of the present disclosure, an electronic device is provided, which comprises a processor and a memory configured to store one or more programs, the one or more programs being executed by the processor to implement the model updating method described above.
[0011] In the technical solution provided by some embodiments of the present disclosure, the server sends a public key uploading instruction to each mobile terminal in the first mobile terminal set, records the mobile terminals that have uploaded the public key, to obtain a second mobile terminal set, the server sends a public key downloading instruction to each mobile terminal in the second mobile terminal set, records the mobile terminals that have downloaded the public key of all the mobile terminals in the second mobile terminal set except itself, to obtain a third mobile terminal set, the server sends a model parameter uploading instruction to each mobile terminal in the third mobile terminal set, in the case of receiving the model parameters uploaded by each mobile terminal in the third mobile terminal set, aggregates the model parameters to obtain target model parameters, and sends the target model parameters to each mobile terminal in the third mobile terminal set, so that the mobile terminal updates the local model by using the target model parameters, and then can execute the federated learning prediction task by using the updated local model. Thus, based on the solution of the present disclosure, the mobile terminals participating in model training can be dynamically determined, so that the federated learning model training task can be better matched to the mobile terminals, which helps the smooth progress of the model training process and improves the system processing efficiency of the model training process in federated learning.
[0012] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained from these drawings without creative labor for those skilled in the art. In the drawings:
[0014] Figure 1 A system schematic diagram of an exemplary implementation of the model updating process of the present disclosure is shown;
[0015] Figure 2 An architecture diagram of the model updating system of the embodiment of the present disclosure is shown;
[0016] Figure 3 A flowchart of the model updating method applied to the server according to the exemplary implementation of the present disclosure is schematically shown;
[0017] Figure 4 A schematic diagram of the process of determining the first mobile terminal set of the embodiment of the present disclosure is schematically shown;
[0018] Figure 5 A schematic diagram of the process of determining the second mobile terminal set of the embodiment of the present disclosure is schematically shown;
[0019] Figure 6A schematic diagram illustrating a process of determining a third mobile terminal set according to an embodiment of the present disclosure is shown;
[0020] Figure 7 A flowchart illustrating a model updating method applied to a mobile terminal according to an exemplary embodiment of the present disclosure is shown;
[0021] Figure 8 An interaction flowchart illustrating a processing process of a model training scheme according to an embodiment of the present disclosure is shown;
[0022] Figure 9 A block diagram illustrating a model updating apparatus applied to a server according to an exemplary embodiment of the present disclosure is shown;
[0023] Figure 10 A block diagram illustrating another model updating apparatus applied to a server according to an exemplary embodiment of the present disclosure is shown;
[0024] Figure 11 A block diagram illustrating still another model updating apparatus applied to a server according to an exemplary embodiment of the present disclosure is shown;
[0025] Figure 12 A block diagram illustrating a model updating apparatus applied to a mobile terminal according to an exemplary embodiment of the present disclosure is shown;
[0026] Figure 13 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0027] Example implementations will now be described more fully with reference to the accompanying drawings. Example implementations may, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and will fully convey the scope of example implementations to those skilled in the art. The described features, structures, or characteristics can be combined in one or more implementations. In the following description, numerous specific details are provided to give a thorough understanding of example implementations. One skilled in relevant art will recognize, however, that the implementations can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures have not been described in detail to avoid obscuring the aspects of the disclosure. The reader will recognize many modifications and alternatives.
[0028] Further, the accompanying drawings are included to provide a thorough understanding of the present disclosure and are not intended to be exhaustive or to limit the present disclosure to the precise outline described herein. Identical reference numerals in different drawings represent the same or similar elements.
[0029] The flowcharts shown in the drawings are only illustrative and do not necessarily include all the steps. For example, some steps can be further divided, and some steps can be combined or partially combined, so the actual execution order can be changed according to the actual situation. In addition, all the terms "first", "second", "third", "fourth" and the like below are only for the purpose of distinction and should not be regarded as a limitation of the present disclosure.
[0030] Artificial Intelligence (AI) is the use of digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0031] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0032] Machine Learning (ML) is a multi-disciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is a subject that studies how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structure to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent, and its applications are widespread in various fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0033] With the research and progress of artificial intelligence technology, artificial intelligence technology is researched and applied in many fields, such as common smart home, smart wearable device, virtual assistant, smart speaker, smart marketing, unmanned vehicle, autonomous vehicle, unmanned aerial vehicle, robot, smart medical treatment, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0034] Federated learning, also known as joint learning, can realize the "availability but invisibility" of data under the premise of protecting user privacy and data security, that is, the training task of the machine learning model is completed through the cooperation of multiple parties, and in addition, the inference service of the machine learning model can be provided.
[0035] In the era of artificial intelligence, the acquisition of machine learning, especially deep learning model, requires a large amount of training data as a prerequisite. However, in many business scenarios, the training data of the model is often scattered in different business teams, departments, or even different companies. Due to the need to ensure user privacy and data security, different data sources cannot directly exchange data, forming so-called "data islands", which hinders data cooperation and the acquisition of large data required for the model. In the past two years, federated learning technology (Federated Learning) has developed rapidly. Federated learning can train machine learning models by fully utilizing the data of multiple data sources while protecting user privacy and data security. By using multiple and complementary data sources, the performance of machine learning models can be improved, such as improving the accuracy of image recognition models, event prediction models, and advertising recommendation models.
[0036] Unlike traditional centralized machine learning, in the federated learning process, two or more participants collaborate to train one or more machine learning models. From a classification point of view, based on the distribution characteristics of data, federated learning can be divided into horizontal federated learning, vertical federated learning, and federated transfer learning. Among them, horizontal federated learning, also known as sample-based federated learning, is suitable for the case where sample sets share the same feature space but have different sample spaces; vertical federated learning, also known as feature-based federated learning, is suitable for the case where sample sets share the same sample space but have different feature spaces; federated transfer learning is suitable for the case where sample sets not only differ in sample space but also differ in feature space.
[0037] FATE (Federated AI Technology Enabler) is the world's first open-source framework for federated learning initiated by the AI department of Pingpong Bank. It enables enterprises and institutions to collaborate on data while protecting data security and privacy. The FATE project uses multi-party secure computation (MPC) and homomorphic encryption (HE) technology to build underlying secure computing protocols, supporting secure computation of various machine learning algorithms, including logistic regression, tree-based algorithms, deep learning, and transfer learning.
[0038] FATE is the current mainstream solution for federated learning, but it mainly addresses the scenario of federated learning between enterprises and does not involve interactions between mobile devices and the cloud. Meanwhile, the FATE framework loads and predicts gradient models on the fate-serving side and does not distribute trained models to the end side.
[0039] In terms of communication between mobile devices and the server, existing solutions mostly use the mobile device to poll the server interface, which consumes mobile device performance and server network bandwidth.
[0040] Some technical solutions specify the number of participating devices before training, and each node in the training determines whether it can enter the next stage based on this number. However, in reality, the number of participating devices cannot be artificially determined, and devices that want to join during the training process also need to be handled.
[0041] In addition, few solutions address the problem of clusters and distributed environments. When the server uses a cluster and distributed architecture, issues such as consistency, inter-service communication, and load balancing of distributed services need to be addressed.
[0042] In view of this, the disclosed embodiments provide a new model updating scheme for federated learning to improve the accuracy and efficiency of computer hardware systems in executing model processing.
[0043] The disclosed embodiments do not limit the application scenarios of the trained model. For example, the model can be applied to audio / video or image analysis scenarios, the model can be applied to event prediction scenarios, the model can be applied to product recommendation scenarios, and so on.
[0044] In addition, the mobile device in the disclosed embodiments can also be referred to as a terminal, a mobile terminal, a mobile device, etc., including but not limited to smartphones, tablet computers, personal computers, etc. The server can also be referred to as a cloud, a cloud system, a server, a cloud server, a server system, etc. The disclosed embodiments do not limit the types of hardware included in the mobile device and the server.
[0045] Figure 1A schematic diagram of a model updating system according to an example implementation of the present disclosure is shown. The model updating system according to an example implementation of the present disclosure can include a mobile terminal set 1001 composed of a plurality of mobile terminals and a server 1002.
[0046] In an example implementation of the present disclosure, the server 1002 can establish a communication connection with each mobile terminal in the mobile terminal set 1001 through a Websocket protocol. Using the Websocket protocol, the mobile terminal and the server only need to complete a handshake, and a persistent connection can be directly created between the two, and bidirectional data transmission can be performed, greatly reducing the consumption of device performance and network bandwidth caused by polling.
[0047] In the model updating process according to an example implementation of the present disclosure, first, each mobile terminal in the mobile terminal set 1001 can access the server 1002 through a Websocket interface and send Ready information to the server 1002. In addition, each mobile terminal can upload its own device information to the server 1002 through the interface. The server 1002 can select mobile terminals with device states meeting the requirements from the mobile terminal set 1001 according to the device information, and the selected mobile terminals can form a mobile terminal set, denoted as a first mobile terminal set u1.
[0048] Next, the server 1002 can send a public key upload instruction to each mobile terminal in the first mobile terminal set u1, and the mobile terminal can upload its own public key to the server 1002 after receiving the public key upload instruction. Due to recording time, network, and other reasons, the number of public keys received by the server 1002 can be less than the number of mobile terminals in the first mobile terminal set u1. The server 1002 can record the mobile terminals that have uploaded the public keys, and these mobile terminals can form a mobile terminal set, denoted as a second mobile terminal set u2.
[0049] Then, the server 1002 can send a public key download instruction to each mobile terminal in the second mobile terminal set u2, and the mobile terminal can download the public keys of all mobile terminals in the second mobile terminal set u2 except itself from the server 1002 after receiving the public key download instruction. Due to recording time, network, and other reasons of the server 1002, the number of mobile terminals determined by the server 1002 to download the public keys can be less than the number of mobile terminals in the second mobile terminal set u2. The server 1002 can record the mobile terminals that have downloaded the public keys, and these mobile terminals can form a mobile terminal set, denoted as a third mobile terminal set u3.
[0050] Subsequently, the server 1002 can send a model parameter upload instruction to each mobile terminal in the third mobile terminal set u3, and the mobile terminal receiving the model parameter upload instruction can upload the model parameters to the server 1002 after calculating the local model. The model parameters are calculated according to the initial model and the local data.
[0051] If the service end 1002 receives the model parameters uploaded by all mobile ends in the third mobile end set u3, the service end 1002 aggregates the model parameters, calculates the target model parameters, and sends the target model parameters to each mobile end in the third mobile end set u3, so that each mobile end in the third mobile end set u3 can update the local model of the mobile end based on the target model parameters, and then perform the federated learning prediction task and feed back the prediction result to the service end 1002 for saving.
[0052] After the mobile ends all feed back the prediction results, the service end 1002 can send a message that the current round of model training is completed to all devices, and clear the cache data, so as to perform the next round of model training process. Wherein, the all devices can be all mobile ends in the original mobile end set 1001.
[0053] Figure 2 A schematic diagram showing a specific implementation of the model updating system of the embodiments of the present disclosure is shown.
[0054] Reference Figure 2 The master service cluster, Nginx service, Websocket service and RocketMQ service can constitute the service end of the embodiments of the present disclosure. The mobile end in the figure can refer to the application client installed on the mobile end and executing the federated learning model training process.
[0055] Multiple instance hosts (such as instance 1, instance 2, instance 3, …, instance n in FIG. 1) can be used to run the master service, and Nginx can be used for load balancing and routing forwarding. Figure 2 The multiple servers form a cluster, and since the programs running on each machine are the same, when one of them is down, the system can still run normally. The master service uses a cluster architecture, which also improves the concurrency and reliability.
[0056] In the embodiments of the present disclosure, the master service and the Websocket service are separated by using a distributed architecture, which improves the performance of the Websocket service and also makes the master service more focused on high-concurrency scenarios and business logic processing.
[0057] Since the main service and the websocket service adopt a distributed architecture, when it comes to inter-service communication, RocketMQ message middleware needs to be used. A message producer module and a message consumer module can be added to the main service and the websocket service, and the producer and the consumer subscribe to the same TOPIC (transport intermediary) at the same time. When the main service needs to send a notification, it can push the message to the TOPIC through the message sending method of the message producer module. The websocket service subscribed to the TOPIC will listen to the message queue, and when a message is generated, the consumer model can be used to process the message.
[0058] In terms of data, Redis can be used to store temporary data (such as device information, temporary model parameters, etc.), and MySQL can be used to store persistent data (such as target model parameters calculated by aggregation). Redis can adopt a "three-master three-slave" cluster architecture, and each node can exchange information with other nodes. When the master node is down, the slave node automatically switches to the master node, improving the availability and stability of the Redis service. MySQL adopts a master-slave replication architecture, which can improve reliability.
[0059] In addition, the configuration of Redis and MySQL improves the data access speed, and the cluster mode adopted by both of them ensures the reliability of data access.
[0060] In the exemplary scheme of the present disclosure, the main program of the server can be deployed in a cluster composed of virtual machines, and each virtual machine can deploy a main program.
[0061] However, in order to further optimize the utilization of virtual machines and solve the problem that it is not easy to manage and maintain the process of configuring virtual machine environment, packaging programs, and deployment when expanding, the adjustment can be made to a containerization scheme, docker and kubernetes are installed in the virtual machine, which helps to create and manage containers. At this time, the server main program runs in the container, and each virtual machine can run multiple containers, thereby greatly improving the utilization of resources. When expansion is needed, change the resource manifest of kubernetes to arrange containers, and the service can be increased.
[0062] Specifically, a docker private image repository and a Kubernetes cluster management project are built on the server. After the project development is completed, it is packaged into an image and uploaded to the private repository. The kubernetes resource manifest is used to pull the image and arrange the service, which can reduce the cost of service deployment and migration. At the same time, containerization can significantly reduce the number of virtual machines started and managed, eliminate the need for each application to run a virtual machine, and reduce the overall overhead of the project.
[0063] The model updating method of the embodiments of the present disclosure will be described below.
[0064] Figure 3 A flowchart of the model updating method applied to the server of the exemplary embodiments of the present disclosure is schematically shown. Referring to Figure 3 The model updating method applied to the server can include the following steps:
[0065] S32. Sending a public key uploading instruction to each mobile terminal in the first mobile terminal set, and recording the mobile terminals that have uploaded the public key to obtain a second mobile terminal set; wherein each mobile terminal in the first mobile terminal set is a mobile terminal that has uploaded the device information.
[0066] Each mobile terminal of the embodiments of the present disclosure can establish a communication connection with the server through the Websocket protocol. The device information of the mobile terminal can include device identification information and device state information, and the device state information can include but is not limited to the current power, the remaining memory, the APP version number involved in the scheme, etc. of the mobile terminal.
[0067] After each mobile terminal accesses the server through the Websocket interface, it can send its own device information to the server. The server can record a plurality of mobile terminals whose device state information meets the state requirement from the mobile terminals that have uploaded the device information to obtain the first mobile terminal set. That is, the server can establish a communication connection with each mobile terminal in the first mobile terminal set through the Websocket protocol.
[0068] In the case of paying attention to the power, the state requirement can include that the current power of the mobile terminal is greater than a power threshold, and the present disclosure does not limit the specific value of the power threshold; in the case of paying attention to the remaining memory, the state requirement can include that the remaining memory of the mobile terminal is greater than a memory threshold, and the present disclosure does not limit the specific value of the memory threshold; in the case of paying attention to the APP version number, the state requirement can include that the version number of the installed APP of the mobile terminal meets the version number requirement, and the present disclosure does not limit the corresponding version number of the version number requirement, which can be the latest version number or other specified version number.
[0069] It should be understood that the state requirement can also include a combination of two or more of the above-mentioned state requirements for power, state requirements for remaining memory, and state requirements for APP version number, and the present disclosure does not limit the specific content of the state requirement.
[0070] For the process of determining the first mobile terminal set by the server, the server can record all mobile terminals that meet the state requirement within a first time threshold after first receiving the device information to obtain the first mobile terminal set. The present disclosure does not limit the specific value of the first time threshold, for example, 10 seconds.
[0071] Specifically, the server starts timing when it first receives the device information sent by a mobile terminal, such as starting a timer. After the first time threshold is experienced, the timer ends, and all mobile terminals that meet the state requirements during the recording are recorded as the first mobile terminal set.
[0072] The embodiments of the present disclosure use a timer to replace the scheme of specifying the number of participating devices. Before the timer ends, any device that meets the requirements can participate in training.
[0073] For example, there are currently 1000 mobile terminals, but due to network, permission and other factors, only 990 mobile terminals successfully send device information, and the remaining 10 mobile terminals cannot establish a connection with the server or cannot send device information to the server. Therefore, the server does not need to wait all the time, but controls the first mobile terminal set used in the next step through timing.
[0074] In addition, the specific value of the first time threshold can also be related to the total number of current mobile terminals. For example, if there are currently 2000 mobile terminals, the first time threshold can be set to 15 seconds. It should be understood that the longer the time threshold is set, the slower the entire model training process is. In addition to the total number of current mobile terminals, the time threshold can also be determined according to the respective situations of the participating members of the federated learning and the requirements of the model training.
[0075] Figure 4 The process of determining the first mobile terminal set by the server is exemplarily shown. Referring to Figure 4 , mobile terminal 1, mobile terminal 2, mobile terminal 3, mobile terminal 4, …, mobile terminal n can respectively send their own device information to the server. The server can determine whether the device state information in the device information meets the state requirements, and determine the first mobile set in combination with the constraint of the above-mentioned first time threshold. For example, only a part of the mobile terminals that send device information meet the state requirements, such as mobile terminal 2 that does not meet the state requirements. In this case, mobile terminal 1, mobile terminal 3, mobile terminal 4, …, mobile terminal n that meet the state requirements can be recorded as the mobile terminals in the first mobile terminal set.
[0076] In addition, in some other embodiments of the present disclosure, the server records all mobile terminals that upload device information within the first time threshold after first receiving the device information, and determines these mobile terminals as the first mobile terminal set. In these embodiments, it is assumed that the state information of each mobile terminal meets the requirements or does not concern the state information of each mobile terminal, so only the time factor is considered,
[0077] After the service end determines the first mobile end set, if there is still a mobile end uploading device information, the service end can send waiting information to the mobile end to inform the mobile end to wait for the next round to join the training again.
[0078] For the first mobile end set, the service end can send a public key uploading instruction to each mobile end in the first mobile end set, and the mobile end can respond to the public key uploading instruction to upload its own public key to the service end.
[0079] The service end can record the mobile end that has uploaded the public key to obtain a second mobile end set.
[0080] Specifically, the service end can record the mobile end that has uploaded the public key, and if the number of mobile ends that have uploaded the public key is equal to the number of mobile ends in the first mobile end set within a second time threshold after the first reception of the public key, the second mobile end set is constructed by using all the recorded mobile ends that have uploaded the public key when the number of mobile ends that have uploaded the public key is equal to the number of mobile ends in the first mobile end set.
[0081] Similar to the above description of the first time threshold, the specific value of the second time threshold is not limited in the present disclosure.
[0082] Specifically, the service end starts timing when the first reception of the public key occurs, such as starting a timer, and the service end continuously receives the public key sent by different mobile ends during the second time threshold. If the number of mobile ends that have uploaded the public key is equal to the number of mobile ends in the first mobile end set, the second mobile end set is determined according to the recorded situation.
[0083] Taking the number of mobile ends in the first mobile end set as 1000 and the second time threshold as 10 seconds as an example, the service end starts timing when the first reception of the public key occurs. If the number of received public keys is equal to 1000 at the 7th second, the timing stops, and the second mobile end set is determined as the first mobile end set, that is, the second mobile end set contains the same mobile ends as the first mobile end set.
[0084] In addition, when the first reception of the public key reaches the second time threshold, it means that the number of mobile ends that upload the public key cannot reach the number of mobile ends contained in the first mobile end set within the second time threshold. In this case, the timing ends, and the second mobile end set is constructed by using all the recorded mobile ends that have uploaded the public key within the second time threshold.
[0085] For example, when the service end first receives the public key, timing is started. If a second time threshold (10 seconds) is experienced, the service end determines that the number of mobile ends uploading the public key is 980 (less than the number of mobile ends in the first mobile end set, 1000), and the service end can determine the 980 mobile ends as the mobile ends included in the second mobile end set.
[0086] It should be understood that the second mobile end set can be the first mobile end set or a subset of the first mobile end set.
[0087] It can be seen that, through the setting of the second time threshold, the second mobile end set can be determined without waiting for all mobile ends in the first mobile end set to upload the public key, thereby shortening the overall time consumption of model training and making the training time relatively controllable.
[0088] Figure 5 An exemplary process for the service end to determine the second mobile end set is shown. Referring to Figure 5 , first, the service end sends a public key upload instruction to each mobile end in the first mobile end set. Corresponding to Figure 4 the determined first mobile end set, the service end can send a public key upload instruction to mobile end 1, mobile end 3, mobile end 4, …, and mobile end n.
[0089] Next, due to network or other reasons, the mobile ends that feed back the public key can be less than the number of mobile ends in the first mobile end set. As shown in the figure, the service end can receive the public keys sent by mobile end 1, mobile end 3, …, and mobile end n. Thus, the mobile ends sending the public keys can be recorded as the mobile ends in the second mobile end set.
[0090] S34. Send a public key download instruction to each mobile end in the second mobile end set, record the mobile end that has downloaded the public keys of all mobile ends in the second mobile end set except itself, to obtain a third mobile end set.
[0091] In the case where the second mobile end set is determined in step S32, the service end can send a public key download instruction to each mobile end in the second mobile end set, and determine a third mobile end set according to the public key download situation of the mobile end.
[0092] The service end can record the mobile end that has downloaded the public keys of all mobile ends in the second mobile end set except itself, to obtain a third mobile end set.
[0093] Specifically, if the number of mobile terminals that have downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself is equal to the number of mobile terminals in the second mobile terminal set within the third time threshold after the mobile terminal that has downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself is determined for the first time, the third mobile terminal set is constructed by using the recorded mobile terminals that have downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself.
[0094] Similar to the description of the first time threshold, the third time threshold is not limited in the present disclosure.
[0095] Specifically, the server starts timing when the mobile terminal that has downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself is determined for the first time, such as starting a timer. During the third time threshold, the server continuously determines the mobile terminals that have downloaded the public keys. If the number of mobile terminals that have downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself is equal to the number of mobile terminals in the second mobile terminal set, the third mobile terminal set is determined according to the recorded conditions.
[0096] Taking the number of mobile terminals in the second mobile terminal set as 900 and the third time threshold as 10 seconds as an example, the server starts timing when the mobile terminal that has downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself is determined for the first time. If the number of mobile terminals that have downloaded the public keys is equal to 900 at the 6th second, the timing stops, and the third mobile terminal set is determined as the second mobile terminal set, that is, the third mobile terminal set contains the same mobile terminals as the second mobile terminal set.
[0097] In addition, when the third time threshold is reached after the mobile terminal that has downloaded the public keys of all the mobile terminals in the second mobile terminal set except for itself is determined for the first time, it indicates that the number of mobile terminals that have downloaded the public keys fails to reach the number of mobile terminals contained in the second mobile terminal set within the third time threshold. In this case, the timing ends, and the third mobile terminal set is constructed by using all the mobile terminals that have downloaded the public keys recorded within the third time threshold.
[0098] For example, the server starts timing when the mobile terminal that has downloaded the public keys is determined for the first time. If the third time threshold (10 seconds) is experienced, the server determines that the number of mobile terminals that have downloaded the public keys is 860 (less than the number of mobile terminals in the second mobile terminal set, which is 900). The server can determine the 860 mobile terminals as the mobile terminals contained in the third mobile terminal set.
[0099] Similarly, it should be understood that the third mobile terminal set can be the second mobile terminal set or a subset of the second mobile terminal set.
[0100] It can be seen that by setting the third time threshold, the third mobile terminal set can be determined without waiting for all mobile terminals in the second mobile terminal set to download the public keys of other mobile terminals, thereby shortening the overall time consumption of model training and making the training time relatively controllable.
[0101] Figure 6 The process of determining the third mobile terminal set by the server is exemplarily shown, and reference is made to Figure 6 First, the server sends a public key download instruction to each mobile terminal in the second mobile terminal set. Corresponding to Figure 5 The determined second mobile terminal set, the server can send a public key download instruction to mobile terminal 1, mobile terminal 3, …, mobile terminal n.
[0102] Next, the server can determine the mobile terminals that have downloaded the public keys as the mobile terminals in the third mobile terminal set.
[0103] S36. Send a model parameter upload instruction to each mobile terminal in the third mobile terminal set, and aggregate the model parameters received from each mobile terminal in the third mobile terminal set to obtain target model parameters.
[0104] In the case where the third mobile terminal set is determined in step S34, the server can send a model parameter upload instruction to each mobile terminal in the third mobile terminal set. The mobile terminal receiving the model parameter upload instruction can upload the model parameters to the server after calculating the local model. The model parameters can also be referred to as gradient data, which are parameter data calculated based on the initial model and the local data.
[0105] In the case where the third mobile terminal set is determined in step S34, the server can send a model parameter upload instruction to each mobile terminal in the third mobile terminal set. The mobile terminal receiving the model parameter upload instruction can upload the model parameters to the server after calculating the local model. The model parameters can also be referred to as gradient data, which are parameter data calculated based on the initial model and the local data.
[0106] Specifically, the model parameters usually include multiple sub-parameters. For each sub-parameter in the model parameters, the server calculates the mean value and reconstructs based on the calculation result of each item, i.e., obtains the target model parameters. It should be understood that the specific process of aggregation calculation is not limited by the present disclosure, and other statistical methods can be used to calculate the target model parameters in addition to taking the mean value.
[0107] When the fourth time threshold is reached after the model parameters uploaded by the mobile terminal are first received, if the service end has not received the model parameters uploaded by all mobile terminals in the third mobile terminal set, the disconnection processing or the re-performing of the current round of model training is performed. It can be understood that the re-performing of the current round of model training is to re-execute the above process from the uploading of the device information of the mobile terminal.
[0108] S38. The target model parameters are sent to each mobile terminal in the third mobile terminal set, so that each mobile terminal in the third mobile terminal set updates the local model using the target model parameters.
[0109] After the target model parameters are calculated, the service end can send the target model parameters to each mobile terminal in the third mobile terminal set, and each of these mobile terminals updates the local model using the target model parameters. It can be understood that each of these mobile terminals corresponds to a local model, and after the target model parameters are obtained by the mobile terminal, the model parameters of the local model can be updated using the target model parameters.
[0110] In addition, the updated local model can perform federated learning prediction tasks in combination with the public keys of other mobile terminals downloaded. For example, the mobile terminals can realize the transmission and exchange of federated learning model related information by means of the downloaded public keys of each other, so as to ensure that any party cannot speculate the original local data of the other party.
[0111] It should be understood that the federated learning prediction tasks performed by the mobile terminals are usually different from each other.
[0112] After each mobile terminal in the third mobile terminal set performs the prediction task, the service end can receive the prediction results fed back by these mobile terminals and save them.
[0113] After receiving the prediction results fed back by all mobile terminals in the third mobile terminal set, the service end can send the end of the current round of model training information (Finish information) to each mobile terminal in the third mobile terminal set and clear the cache data, such as clearing the recorded first mobile terminal set, second mobile terminal set, third mobile terminal set, etc., to release resources, so as to perform the next round of model training process. In addition, in addition to each mobile terminal in the third mobile terminal set, the service end can also send the end of the current round of model training information to other mobile terminals, so that other mobile terminals that meet the conditions can also access the next round of model training process.
[0114] Further, the present disclosure also provides a model updating method applied to a mobile terminal. Referring to Figure 7 , the model updating method applied to the mobile terminal can include the following steps:
[0115] S70. In response to the public key uploading instruction, the public key is sent to the service end;
[0116] S72. In response to the public key download instruction, downloading the public key of the mobile terminal other than the mobile terminal from the server;
[0117] S74. In response to the model parameter upload instruction, uploading the calculated model parameter to the server, so that the server aggregates the model parameter and the model parameter obtained from other mobile terminals to calculate the target model parameter;
[0118] S76. Receiving the target model parameter and updating the local model using the target model parameter.
[0119] The processing procedures of steps S70 to S76 have been described in steps S32 to S38 of the server as described above, and will not be described again.
[0120] The interaction process of the model training scheme of the embodiment of the present disclosure will be described below. Figure 8 In step S802, the mobile terminal uploads the device information to the server.
[0121] In step S804, the server selects the mobile terminal based on the state information in the device information, and determines the first mobile terminal set.
[0122] In step S806, the server can record the information of the first mobile terminal set to the database. The information saved by the database includes but is not limited to the identification information of each mobile terminal in the first mobile terminal set.
[0123] In step S808, the server sends a public key upload instruction to the mobile terminal.
[0124] In step S810, the mobile terminal uploads the public key in response to the public key upload instruction.
[0125] In step S812, the server determines the second mobile terminal set according to the situation of the mobile terminal uploading the public key, and records the information of the second mobile terminal set to the database.
[0126] In step S814, the server sends a public key download instruction to the mobile terminal.
[0127] In step S816, the mobile terminal downloads the public key of the mobile terminal other than itself in the second mobile terminal set in response to the public key download instruction.
[0128]
[0129] In step S818, the server determines the third mobile terminal set according to the downloading of the public key by the mobile terminal and in combination with the timing means, and records the information of the third mobile terminal set to the database. The server judges the downloading of the public key by the mobile terminal in a manner of counting the mobile terminal downloading the public key, for example, counting plus 1 each time the mobile terminal downloading the public key appears.
[0130] In step S820, the server sends the model parameter uploading instruction to the mobile terminal.
[0131] In step S822, the mobile terminal uploads the model parameter in the case of calculating the model parameter based on the local data and the initial model in response to the model parameter uploading instruction.
[0132] In step S824, the server performs the aggregate calculation on the received model parameter to obtain the target model parameter. The aggregate calculation includes but is not limited to the model parameter taking the mean value.
[0133] In step S826, the server stores the target model parameter to the database.
[0134] In step S828, the server notifies the mobile terminal to download the target model parameter.
[0135] In step S830, the mobile terminal downloads the target model parameter from the server.
[0136] In step S832, the mobile terminal performs the prediction task of the federated learning by using the target model parameter and in combination with the public key of other mobile terminals.
[0137] In step S834, the mobile terminal uploads the prediction result.
[0138] In step S836, the server stores the prediction result to the database.
[0139] In step S838, the server notifies the mobile terminal that the current round of training is completed and releases the resources to perform the next round of model training process.
[0140] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired result. In addition or alternatively, some steps can be omitted, a plurality of steps can be combined into one step, and / or one step can be divided into a plurality of steps, etc.
[0141] Further, the present example embodiment also provides a model updating device applied to the server.
[0142] Figure 9A block diagram of a model updating apparatus applied to a service end of an exemplary embodiment of the present disclosure is shown schematically. Referring to Figure 9 The model updating apparatus 9 applied to a service end according to an exemplary embodiment of the present disclosure can include a first recording module 91, a second recording module 93, a parameter calculation module 95, and a parameter sending module 97.
[0143] Specifically, the first recording module 91 can be configured to send a public key uploading instruction to each mobile end in a first mobile end set, record the mobile ends that have uploaded the public keys, and obtain a second mobile end set; each mobile end in the first mobile end set is a mobile end that has uploaded the device information; the second recording module 93 can be configured to send a public key downloading instruction to each mobile end in the second mobile end set, record the mobile ends that have downloaded the public keys of all the mobile ends in the second mobile end set except for itself, and obtain a third mobile end set; the parameter calculation module 95 can be configured to send a model parameter uploading instruction to each mobile end in the third mobile end set, aggregate the model parameters uploaded by each mobile end in the third mobile end set upon receiving the model parameters, and obtain target model parameters; and the parameter sending module 97 can be configured to send the target model parameters to each mobile end in the third mobile end set, so that each mobile end in the third mobile end set updates a local model by using the target model parameters.
[0144] According to an exemplary embodiment of the present disclosure, the device information includes device state information of the mobile end. In this case, the first recording module 91 can be further configured to record a plurality of mobile ends whose device state information meets a state requirement, and obtain the first mobile end set.
[0145] According to an exemplary embodiment of the present disclosure, the first recording module 91 can be further configured to record all the mobile ends that meet the state requirement within a first time threshold after the device information is first received, and obtain the first mobile end set.
[0146] According to an exemplary embodiment of the present disclosure, the first recording module 91 can be further configured to record all the mobile ends that have uploaded the device information within a first time threshold after the device information is first received, and obtain the first mobile end set.
[0147] According to an exemplary embodiment of the present disclosure, the first recording module 91 can be further configured to establish a communication connection with each mobile end in the first mobile end set through a Websocket protocol.
[0148] According to the exemplary embodiments of the present disclosure, the process in which the first recording module 91 obtains the second mobile terminal set can be configured to perform: recording mobile terminals that have uploaded public keys; within a second time threshold after the first time of receiving a public key, when the number of mobile terminals that have uploaded public keys is equal to the number of mobile terminals in the first mobile terminal set, constructing the second mobile terminal set using all recorded mobile terminals that have uploaded public keys; when the second time threshold is reached after the first time of receiving a public key, constructing the second mobile terminal set using all recorded mobile terminals that have uploaded public keys.
[0149] According to the exemplary embodiments of the present disclosure, the process in which the second recording module 93 obtains the third mobile terminal set can be configured to perform: recording mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves; within a third time threshold after the first time of determining mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves, when the number of mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves is equal to the number of mobile terminals in the second mobile terminal set, constructing the third mobile terminal set using all recorded mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves; when the third time threshold is reached after the first time of determining mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves, constructing the third mobile terminal set using all recorded mobile terminals that have downloaded public keys of all mobile terminals in the second mobile terminal set except for themselves.
[0150] According to the exemplary embodiments of the present disclosure, with reference to Figure 10 , compared with the model updating apparatus 9, the model updating apparatus 10 can further include an exception handling module 101.
[0151] Specifically, the exception handling module 101 can be configured to perform: when the fourth time threshold is reached after the first time of receiving the model parameters uploaded by the mobile terminals, if the model parameters uploaded by all mobile terminals in the third mobile terminal set are not received, performing a drop-off process or re-performing the current round of model training.
[0152] According to the exemplary embodiments of the present disclosure, the process in which the parameter calculation module 95 obtains the target model parameters can be configured to perform: for each sub-parameter in the model parameters, calculating the mean value to obtain the target model parameters.
[0153] According to the exemplary embodiments of the present disclosure, with reference to Figure 11 , compared with the model updating apparatus 9, the model updating apparatus 11 can further include a prediction processing module 111.
[0154] Specifically, the prediction processing module 111 can be configured to perform: after each mobile terminal in the third mobile terminal set performs a federated learning prediction task using the updated local model, receiving and saving the prediction results fed back by each mobile terminal in the third mobile terminal set.
[0155] According to the example embodiments of the present disclosure, the prediction processing module 111 can be further configured to perform: after receiving the prediction results of all mobile terminals in the third mobile terminal set, sending a model training end message of the current round to each mobile terminal in the third mobile terminal set, and clearing the cache data, so as to perform the next round of model training process.
[0156] Further, the example embodiments of the present disclosure also provide a model updating device applied to a mobile terminal.
[0157] Figure 12 The block diagram of the model updating device applied to a mobile terminal of the example embodiments of the present disclosure is schematically shown. Referring to Figure 12 According to the example embodiments of the present disclosure, the model updating device 12 applied to a mobile terminal can include a public key sending module 121, a public key downloading module 123, a parameter uploading module 125, and a parameter applying module 127.
[0158] Specifically, the public key sending module 121 can be configured to send the public key to the server in response to a public key uploading instruction; the public key downloading module 123 can be configured to download the public keys of other mobile terminals except the mobile terminal from the server in response to a public key downloading instruction; the parameter uploading module 125 can be configured to upload the calculated model parameters to the server in response to a model parameter uploading instruction, so that the server aggregates the model parameters and the model parameters obtained from other mobile terminals to calculate the target model parameters; and the parameter applying module 127 can be configured to receive the target model parameters and update the local model using the target model parameters.
[0159] According to the example embodiments of the present disclosure, the public key sending module 121 can be further configured to perform: establishing a communication connection with the server through a Websocket protocol.
[0160] According to the example embodiments of the present disclosure, the parameter applying module 127 can be further configured to perform: uploading the prediction results obtained after performing the prediction task to the server; and receiving the model training end message of the current round sent by the server.
[0161] Since the various functional modules of the model updating device of the embodiments of the present disclosure are the same as those in the above method embodiments, they will not be described here again.
[0162] Figure 13 The structural schematic diagram of a computer system suitable for implementing the electronic device of the example embodiments of the present disclosure is shown. The server and / or the mobile terminal of the embodiments of the present disclosure can be configured in the form as shown in Figure 13 It should be noted that, Figure 13The computer system 1300 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0163] The electronic device disclosed herein includes at least a processor and a memory, the memory being used to store one or more programs, which, when executed by the processor, enable the processor to implement the model update method of the exemplary embodiments of this disclosure.
[0164] like Figure 13 As shown, the computer system 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1302 or programs loaded from storage portion 1308 into random access memory (RAM) 1303. The RAM 1303 also stores various programs and data required for system operation. The CPU 1301, ROM 1302, and RAM 1303 are interconnected via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.
[0165] The following components are connected to I / O interface 1305: an input section 1306 including a keyboard, mouse, etc.; an output section 1307 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN card, modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to I / O interface 1305 as needed. Removable media 1311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1310 as needed so that computer programs read from them can be installed into storage section 1308 as needed.
[0166] This disclosure also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device.
[0167] Computer readable storage media can take many forms, but can generally be classified as either volatile or non-volatile media, removable or non-removable media, or as memory or storage media. Examples of computer readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information in a form readable by a computing device. In some embodiments, computer readable storage media can include a tangible medium such as, but not limited to, portable or fixed storage devices, optical storage devices, and similar storage means. In some embodiments, computer readable storage media can not include communication media, such as modulated data signals transmitted through a wired or wireless network or a carrier wave.
[0168] Computer readable storage media can take many forms, but can generally be classified as either volatile or non-volatile media, removable or non-removable media, or as memory or storage media. Examples of computer readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information in a form readable by a computing device. In some embodiments, computer readable storage media can include a tangible medium such as, but not limited to, portable or fixed storage devices, optical storage devices, and similar storage means. In some embodiments, computer readable storage media can not include communication media, such as modulated data signals transmitted through a wired or wireless network or a carrier wave.
[0169] Computer readable storage media can take many forms, but can generally be classified as either volatile or non-volatile media, removable or non-removable media, or as memory or storage media. Examples of computer readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information in a form readable by a computing device. In some embodiments, computer readable storage media can include a tangible medium such as, but not limited to, portable or fixed storage devices, optical storage devices, and similar storage means. In some embodiments, computer readable storage media can not include communication media, such as modulated data signals transmitted through a wired or wireless network or a carrier wave.
[0170] The flow diagrams and block diagrams in the drawings are illustrative of possible architectures, functions, and operations for systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams or block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0171] The units described in the embodiments of the present disclosure can be implemented by software, or by hardware, or be implemented in combination with hardware and software. The names of the units described in the embodiments of the present disclosure do not constitute a limitation to the units themselves in some cases.
[0172] Further, the above-described diagrams are merely schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended for limiting purposes. It is readily understood that the processes shown in the above-described diagrams do not indicate or limit the time sequence of the processes. In addition, it is also readily understood that the processes can be executed, for example, synchronously or asynchronously in a plurality of modules.
[0173] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, such a division is not mandatory. Indeed, according to embodiments of the present disclosure, the features and functionalities of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functionalities of one module or unit described above can be further divided into embodied by a plurality of modules or units.
[0174] Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practice of the disclosure herein. The present application is intended to cover any variations, uses or adaptive changes of this disclosure that follow the general principles thereof and include common general knowledge or customary technical practices in the art not specifically disclosed herein. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0175] It is to be understood that the present disclosure is not limited to the precise construction described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims appended hereto.
Claims
1. A model updating method applied to a server, characterized in that, The model updating method comprises: Within a first time threshold after first receiving the device information, record all mobile terminals that upload the device information to obtain a first mobile terminal set, or record all mobile terminals whose device state information meets a state requirement to obtain the first mobile terminal set; wherein each mobile terminal in the first mobile terminal set is a mobile terminal that has uploaded the device information, and the device information comprises device state information of the mobile terminal; Send a public key uploading instruction to each mobile terminal in the first mobile terminal set, and record mobile terminals that have uploaded the public key to obtain a second mobile terminal set; Send a public key downloading instruction to each mobile terminal in the second mobile terminal set, and record mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves to obtain a third mobile terminal set; Send a model parameter uploading instruction to each mobile terminal in the third mobile terminal set, and in the case of receiving the model parameter uploaded by each mobile terminal in the third mobile terminal set, aggregate the model parameters to obtain target model parameters; Send the target model parameters to each mobile terminal in the third mobile terminal set, so that each mobile terminal in the third mobile terminal set updates a local model by using the target model parameters.
2. The model update method according to claim 1, characterized by, The model updating method further comprises: Establish a communication connection with each mobile terminal in the first mobile terminal set through a Websocket protocol.
3. The model update method according to claim 1, characterized by, Recording mobile terminals that have uploaded the public key to obtain a second mobile terminal set comprises: Recording mobile terminals that have uploaded the public key; Within a second time threshold after first receiving the public key, when the number of mobile terminals that have uploaded the public key is equal to the number of mobile terminals in the first mobile terminal set, constructing the second mobile terminal set by using all recorded mobile terminals that have uploaded the public key; When the second time threshold is reached after first receiving the public key, constructing the second mobile terminal set by using all recorded mobile terminals that have uploaded the public key.
4. The model update method according to claim 1, characterized by, Recording mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves to obtain a third mobile terminal set comprises: Recording mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves; Within a third time threshold after first determining mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves, when the number of mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves is equal to the number of mobile terminals in the second mobile terminal set, constructing the third mobile terminal set by using all recorded mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves; When the third time threshold is reached after first determining mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves, constructing the third mobile terminal set by using all recorded mobile terminals that have downloaded the public key of all mobile terminals in the second mobile terminal set except themselves.
5. The model update method according to claim 1, characterized by, The model updating method further comprises: When a fourth time threshold is reached after the model parameters uploaded by the mobile terminal are first received, if the model parameters uploaded by all mobile terminals in the third mobile terminal set are not received, a disconnection process is performed or the current round of model training is re-performed.
6. The model update method according to claim 1, characterized by, The model parameters are aggregated to obtain target model parameters, including: For each sub-parameter in the model parameters, the mean value is calculated to obtain the target model parameters.
7. The model update method according to any one of claims 1 to 6, characterized by, The model training method further includes: After each mobile terminal in the third mobile terminal set performs federated learning prediction tasks using the updated local model, the prediction results fed back by each mobile terminal in the third mobile terminal set are received and saved.
8. The model updating method according to claim 7, characterized by, The model updating method further includes: After receiving the prediction results fed back by all mobile terminals in the third mobile terminal set, a message indicating the end of the current round of model training is sent to each mobile terminal in the third mobile terminal set, and the cached data is cleared to facilitate the next round of model training process. 9.A model updating method applied to a mobile terminal, characterized in that, The mobile terminal is a mobile terminal that uploads device information to the server within a first time threshold after the server first receives the device information, or a mobile terminal that uploads device information to the server within a first time threshold after the server first receives the device information and whose device state information meets the state requirement, the device information including the device state information of the mobile terminal; wherein the model updating method includes: In response to a public key upload instruction, the public key is sent to the server; In response to a public key download instruction, the public keys of other mobile terminals except the mobile terminal are downloaded from the server; In response to a model parameter upload instruction, the calculated model parameters are uploaded to the server, so that the server aggregates the model parameters and the model parameters obtained from other mobile terminals to calculate target model parameters; The target model parameters are received and used to update the local model.
10. The model updating method according to claim 9, characterized by, The model updating method further includes: A communication connection with the server is established through a Websocket protocol.
11. The model updating method according to claim 9, characterized by, The model updating method further includes: The prediction results obtained after performing federated learning prediction tasks are uploaded to the server; and The message indicating the end of the current round of model training sent by the server is received. 12.A model updating apparatus, applied to a server, and characterized in that, The model updating device includes: A first recording module for recording all mobile terminals that upload device information within a first time threshold after the device information is first received to obtain a first mobile terminal set, or recording all mobile terminals whose device state information meets the state requirement to obtain a first mobile terminal set; wherein each mobile terminal in the first mobile terminal set is a mobile terminal that has uploaded device information, and the device information includes the device state information of the mobile terminal; a public key upload instruction is sent to each mobile terminal in the first mobile terminal set, and the mobile terminals that have uploaded the public key are recorded to obtain a second mobile terminal set; wherein each mobile terminal in the first mobile terminal set is a mobile terminal that has uploaded device information, and the device information includes the device state information of the mobile terminal; The second recording module is configured to send a public key download instruction to each mobile terminal in the second mobile terminal set, record a mobile terminal that has downloaded public keys of all mobile terminals in the second mobile terminal set except itself, and obtain a third mobile terminal set. The parameter calculation module is configured to send a model parameter upload instruction to each mobile terminal in the third mobile terminal set, aggregate model parameters uploaded by each mobile terminal in the third mobile terminal set upon receiving the model parameters, and obtain target model parameters. The parameter sending module is configured to send the target model parameters to each mobile terminal in the third mobile terminal set, so that each mobile terminal in the third mobile terminal set updates a local model by using the target model parameters. 13.A model updating apparatus, applied to a mobile terminal, characterized in that, The mobile terminal is a mobile terminal that uploads device information to the server within a first time threshold after the server first receives the device information, or a mobile terminal that uploads device information to the server within the first time threshold after the server first receives the device information and device state information meets a state requirement, and the device information includes device state information of the mobile terminal; and the model updating apparatus includes: The public key sending module is configured to send a public key to the server in response to a public key upload instruction. The public key downloading module is configured to download public keys of mobile terminals other than the mobile terminal from the server in response to a public key download instruction. The parameter uploading module is configured to upload calculated model parameters to the server in response to a model parameter upload instruction, so that the server aggregates the model parameters and model parameters obtained from other mobile terminals to calculate target model parameters. The parameter application module is configured to receive the target model parameters and update a local model by using the target model parameters.
14. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the model updating method in any one of claims 1 to 11.
15. An electronic device, comprising: The apparatus includes: a processor; a memory configured to store one or more programs, which, when executed by the processor, cause the processor to implement the model updating method in any one of claims 1 to 11.
Citation Information
Patent Citations
Federated learning training method and device for high-delay network environment robustness
CN112001502A
Model training method and device based on federated learning and storage medium
CN112712182A