Trainer pairing method, device and electronic device in federated learning model training
By using counter components and monitoring mechanisms to realize automatic pairing of trainers in vertical federated learning, the problem of low manual pairing efficiency is solved, the pairing efficiency and model timeliness are improved, and the training data is ensured.
Patent Information
- Application Number
- CN202410704094.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2044-05-31
AI Technical Summary
In vertical federated learning, manual trainers are inefficient and time-consuming, and are prone to repeated pairing or missed pairing problems, resulting in the inability to align the training data, affecting the model timeliness and training indicators.
By obtaining its own number after the trainer is started, and using the counter component to query the other trainer number, and matching the number according to the same rules, the trainer is automatically paired, and the counter component and monitoring mechanism are used to ensure the consistency of the pairing.
It improves the pairing efficiency of the trainer, reduces the pairing time, avoids duplicate or missed pairing problems, ensures the alignment of the training data, and improves the timeliness of the model and the normality of the training indicators.
Smart Images

Figure CN118428452B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of federated learning technology, and in particular, to a trainer pairing method, device, and electronic device in federated learning model training. Background Art
[0002] Vertical federated learning is a privacy-preserving machine learning paradigm that combines data from multiple participants to perform secure machine learning training tasks. In a large-scale vertical federated learning scenario, for example, two participants will simultaneously launch a large number of trainers and need to pair them up.
[0003] In related technologies, manual pairing is often used, where a mapping table is manually created for both trainers. However, manual pairing is inefficient and time-consuming, resulting in reduced model timeliness. It is also prone to duplicate or missed pairings, which can cause misalignment of training data entering the trainer and lead to abnormal training metrics. Summary of the Invention
[0004] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, the present disclosure provides a trainer pairing method for federated learning model training, applied to a first trainer of a first participant, the method comprising:
[0006] After the first trainer is started, the first trainer obtains its own serial number from the counter component;
[0007] querying the trainer number of the second participant in the counter component, and when the trainer number of the second participant has a target number that is the same as the number of the first trainer, using the second trainer corresponding to the target number as a paired trainer of the first trainer;
[0008] The first trainer and the second trainer are used to collaboratively perform model training during the federated learning process, and the trainers started by the first participant and the second participant are numbered according to the same rule.
[0009] In a second aspect, the present disclosure provides a trainer pairing device for federated learning model training, applied to a first trainer of a first participant, the device comprising:
[0010] an acquisition module, configured to acquire the serial number of the first trainer itself from the counter component after the first trainer is started;
[0011] a pairing module, configured to query the trainer number of the second participant in the counter component, and when the trainer number of the second participant contains a target number that is the same as the number of the first trainer, use the second trainer corresponding to the target number as a paired trainer for the first trainer;
[0012] The first trainer and the second trainer are used to collaboratively perform model training during the federated learning process, and the trainers started by the first participant and the second participant are numbered according to the same rule.
[0013] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of any one of the methods described in the first aspect.
[0014] In a fourth aspect, the present disclosure provides an electronic device, comprising:
[0015] a storage device having a computer program stored thereon;
[0016] A processing device is used to execute the computer program in the storage device to implement the steps of any one of the methods described in the first aspect above.
[0017] In a fifth aspect, the present disclosure provides a computer program product, comprising a computer program, which, when executed by a processor, implements the steps of any one of the methods in the first aspect.
[0018] Through the above technical solution, after the trainer is started, the trainer's own number is obtained. The trainers of the first and second participants are numbered according to the same rules. Then, the trainers with the same number on both sides are paired as trainers. The paired trainers can collaborate on model training during the federated learning process. This achieves automatic pairing of trainers participating in federated learning model training, improves pairing efficiency, reduces pairing time, and thus improves model timeliness. It also avoids duplicate or missed pairing of trainers, ensures that the training data entering the trainer is aligned, and ensures normal training indicators.
[0019] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale. In the drawings:
[0021] Figure 1 1 is a schematic diagram illustrating a process of data alignment using vertical federated learning according to an exemplary embodiment of the present disclosure;
[0022] Figure 2 This is a flowchart of a trainer pairing method in federated learning model training according to an exemplary embodiment of the present disclosure;
[0023] Figure 3 is a schematic diagram illustrating a process of trainer pairing according to an exemplary embodiment of the present disclosure;
[0024] Figure 4 is a schematic diagram showing a coordinated control according to an exemplary embodiment of the present disclosure;
[0025] Figure 5 is a schematic diagram illustrating trainer pairing and collaborative control based on distributed collaborative components according to an exemplary embodiment of the present disclosure;
[0026] Figure 6 is a timing diagram illustrating trainer pairing and collaborative control based on distributed collaborative components according to an exemplary embodiment of the present disclosure;
[0027] Figure 7 1 is a structural block diagram of a trainer pairing device in federated learning model training according to an exemplary embodiment of the present disclosure;
[0028] Figure 8 The figure is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0029] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0030] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0031] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0032] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0033] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0035] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0036] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0037] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0038] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0039] At the same time, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.
[0040] In vertical federated learning, the features of the training data for model training are distributed among multiple participants, one of whom also holds a label. For example, Party A and Party B perform vertical federated learning on a single machine. Figure 1 As shown, the training data of parties A and B are first aligned, aligning data with the same ID identifier. For example, if party A is Company A and party B is Company B, and Company A and Company B each provide different services to users, and there is some overlap between the two companies, then the ID identifier is the user ID. Aligning the feature data of Company A and Company B is equivalent to obtaining the feature data of the overlapping users at Company A and Company B, respectively. The aligned training data is then fed into both parties' trainers for model training. During training, the trainers exchange data (forward and backpropagation of the model) through the federated connection layer. Furthermore, the training data of both parties must remain aligned throughout the training process; otherwise, the training will be distorted and the training accuracy will be abnormal.
[0041] In vertical federated learning scenarios involving two single machines, data alignment is relatively simple. However, in real-world applications, due to the extremely large amount of data and extremely long training processes, single-machine training cannot meet the actual performance and stability requirements. Therefore, distributed multi-machine parallel training is required. Furthermore, due to the high real-time requirements of the model in some scenarios, the model needs to be trained online for a long time.
[0042] Therefore, in large-scale vertical federated learning scenarios, both parties will simultaneously launch a large number of trainers, i.e., conduct model training for a two-party multi-machine vertical federated learning model. Therefore, it is necessary to pair the trainers on both sides. Once paired, training can continue as before. Related technologies often use manual pairing, where a mapping table is manually created for both trainers. Each party obtains its paired counterpart's information from the mapping table and uses this information to communicate with the other party.
[0043] However, pairing must first ensure consistency. This means duplicate pairings (a trainer cannot be paired with multiple trainers) and no missing pairs are permitted. Inconsistent pairings can cause misalignment of the training data entering the trainer, leading to abnormal training metrics. Furthermore, manual pairing is inefficient and time-consuming, reducing the timeliness of the model.
[0044] At the same time, during long-term training, it is inevitable that the trainer will exit unexpectedly, such as machine failure, migration, maintenance, etc. If one party's trainer exits unexpectedly, how to efficiently and collaboratively exit the paired trainer is also an urgent problem to be solved.
[0045] In view of this, the present disclosure provides a method, apparatus, and electronic device for pairing trainers in federated learning model training to address the aforementioned technical issues. It should be noted that the method for pairing trainers in federated learning model training provided by the present disclosure is applicable to large-scale, vertical federated learning scenarios, where each participant can be a distributed structure, i.e., each participant includes multiple trainers.
[0046] The following further explains the embodiments of the present disclosure in conjunction with the accompanying drawings. For the convenience of description, the embodiment is described by taking Party A and Party B performing model training for vertical federated learning between two parties. In practical applications, it can be applied to model training for vertical federated learning of any number of parties.
[0047] Figure 2 1 is a flow chart showing a method for pairing trainers in a federated learning model training according to an exemplary embodiment of the present disclosure. Figure 2 The method is applied to a first trainer of a first participant, comprising:
[0048] S201: After the first trainer is started, the first trainer obtains its own serial number from the counter component.
[0049] S202: query the trainer number of the second participant in the counter component. When the trainer number of the second participant has a target number that is the same as the number of the first trainer, use the second trainer corresponding to the target number as the paired trainer of the first trainer.
[0050] The first trainer and the second trainer are used to collaboratively perform model training during the federated learning process, and the trainers started by the first participant and the second participant are numbered according to the same rules.
[0051] Using this method, after the trainer is started, the trainer's own number is obtained. The trainers of the first and second participants are numbered according to the same rules. The trainers with the same number are then paired together. These paired trainers can then collaborate on model training during the federated learning process. This enables automatic pairing of trainers participating in federated learning model training, improving pairing efficiency and reducing pairing time, thereby increasing model timeliness. It also avoids duplicate or missed pairings of trainers, ensuring that the training data entering the trainers is aligned and that training metrics are normal.
[0052] In a possible embodiment, the first party and the second party activate an equal number of trainers.
[0053] In a possible manner, step S201 may include: after the first trainer is started, sending a registration request to the counter component, so that the counter component responds to the registration request and uses the registration serial number of the first trainer as the number of the first trainer; obtaining the number of the first trainer itself from the counter component.
[0054] For example, Figure 3 As shown, after the trainer is started, it obtains a count value from the counter component. The counter component can be a distributed counter, which can be determined according to specific needs, as long as it can realize the counting function. This disclosure does not limit this. It should be understood that the starting value of the count value obtained by the two trainers participating in the vertical federated learning model training is the same, and the increment rule is the same. For example, the count value starts from 0 and increases one by one. This disclosure does not limit this. It only needs to ensure that the trainers of both parties are numbered according to the same rule.
[0055] In a possible embodiment, the counter component stores a first number list including a trainer number of a first participant and a second number list including a trainer number of a second participant, wherein the trainer number of the first participant is determined by the counter component in response to a registration request of the trainer of the first participant, and the trainer number of the second participant is determined by the counter component in response to a registration request of the trainer of the second participant.
[0056] For example, the counter component can store the trainer numbers of multiple participants in response to registration requests from their trainers. Accordingly, when a trainer exits model training, it can send a withdrawal request to the counter component, which removes the trainer number from the number list. Managing trainer numbers in the number list facilitates maintenance and updates of trainer numbers across multiple participants, as well as subsequent pairing and collaborative control of trainers.
[0057] In a possible manner, querying the trainer number of the second participant in the counter component may include: querying the second number list in the counter component through a number query interface to obtain the trainer number of the second participant, where the number query interface is an interface provided by the counter component for querying the trainer number.
[0058] For example, the counter component may provide an interface for querying trainer numbers. The first trainer may then query the second number list in the counter component through the number query interface to obtain the trainer number of the second participant, and then determine its own paired trainer based on the second participant's trainer number. Correspondingly, the second trainer may also query the first number list in the counter component through the number query interface to obtain the trainer number of the first participant, and then determine its own paired trainer based on the first participant's trainer number.
[0059] Furthermore, trainers with the same count value constitute a pair of trainers, and subsequent communication between the paired trainers can be performed based on the count value. In a possible embodiment, the method further includes: determining a communication channel based on the number of the first trainer, so as to send a message to the second trainer via the communication channel.
[0060] For example, taking the execution of training task job_id_0 as an example, if trainer 2 on party A wants to send a message to the paired trainer on party B (that is, trainer 1 on party B), it can send a message to the Topic (which can be understood as a communication channel) " / job_id_0 / B / 2" of the communication component, and then trainer 1 on party B will receive the message from the Topic " / job_id_0 / B / 2" of the communication component.
[0061] It is worth noting that the pairing process of the present disclosure does not require interaction between the two parties; a simple interaction with the counter component is sufficient. The counter component can be deployed in an electronic device capable of interacting with the first and second parties, and the present disclosure does not impose any restrictions on this. Because the counter component can ensure strong consistency, the trainer pairing based on the counter component can also ensure consistency. Even when thousands of trainers are paired simultaneously, there will be no duplicate or missed pairing of trainers, thereby achieving efficient and stable trainer pairing.
[0062] In a possible embodiment, the method further includes: querying the trainer number of the second participant in the counter component, and determining to exit model training when there is no trainer number of the second participant that is the same as the number of the first trainer and there is a number that is larger than the number of the first trainer.
[0063] For example, when the trainer of the first participant obtains the number 4, if the trainer of the second participant does not have the number 4, and there is a number 5 which is larger than the number 4, it means that the second participant already has a trainer which obtained the number 4 after startup, but may have exited the model training due to a failure or other reasons before pairing, and deleted the number 4. Then the trainer of the first participant numbered 4 can collaboratively exit the model training, so that after restarting and obtaining a new number, the new paired trainer can be determined to participate in the model training, thereby realizing efficient collaborative control of the trainers of both parties.
[0064] In a possible embodiment, the method further includes: querying the trainer number of the second participant in the counter component, and when there is no number identical to the number of the first trainer among the trainer numbers of the second participant, and no number greater than the number of the first trainer, continuing to query the new number of the trainer in the second participant; and determining whether to exit model training based on the new number.
[0065] For example, when the trainer of the first participant obtains the number 4, if the trainer number of the second participant is not 4 and there is no number greater than 4, you can continue to query the new number of the trainer in the second participant and determine whether to exit model training based on the new number.
[0066] It should be understood that with the other party's authorization, the monitoring mechanism can be used to monitor the addition and deletion of the other party's trainer number, and the trainer number has nothing to do with the training data, which can ensure data privacy and security.
[0067] In a possible manner, determining whether to exit model training based on the newly added number may include: when the newly added number is the same as the number of the first trainer, using the third trainer corresponding to the newly added number as the paired trainer of the first trainer, and the first trainer and the third trainer are used to collaboratively perform model training in the federated learning process; when the newly added numbers are different from the number of the first trainer, and the newly added numbers are larger than the number of the first trainer, determining to exit model training.
[0068] For example, if the trainer of the first participant obtains the number 4 and the trainer of the second participant obtains the numbers 0, 1, 2 and 3, if the newly started trainer X of the second participant obtains the number 4, it means that when the trainer numbered 4 of the first participant obtains the number, the second participant has not yet started trainer X. The trainers numbered 4 of both parties can be regarded as a pair of trainers.
[0069] Alternatively, if the newly started trainer X of the second participant obtains the number 5, it means that the trainer in the second participant has obtained the number 4, but may have exited the model training due to a malfunction or other reasons before pairing, and deleted the number 4. In this case, the trainer numbered 4 of the first participant can collaboratively exit the model training so that after restarting and obtaining a new number, the new paired trainer can be determined to participate in the model training, thereby realizing efficient collaborative control of the trainers of both parties.
[0070] It should be understood that if a number deletion event can be monitored before pairing, for example, the trainer of the first participant obtains the number 4, and it is monitored that the trainer of the second participant numbered 4 has exited the model training, then the trainer of the first participant numbered 4 can cooperatively exit the model training.
[0071] In a possible manner, the method further includes: after using the second trainer corresponding to the target number as a paired trainer for the first trainer, querying the operation event triggered by the second trainer in the counter component through the event query interface, where the event query interface is an interface provided by the counter component for querying the trainer operation event; when a number deletion event or a session loss event triggered by the second trainer is queried, determining to exit model training.
[0072] For example, after successful pairing, with authorization from the other party, the paired trainer can monitor for number deletion events or session loss events based on the monitoring mechanism. A number deletion event indicates that the other party's trainer has exited model training, while a session loss event indicates that the other party's trainer is unresponsive. If a number deletion or session loss event is detected, the local trainer can collaboratively exit model training, achieving efficient collaborative control of both trainers.
[0073] For example, using the node monitoring mechanism, trainers can monitor each other, sense the status of each other's trainers, and achieve collaborative training of distributed trainers. Figure 4 As shown in the figure, after the trainer is successfully paired, a local node is created, and the node identification path uses its own count value, such as " / {job_id} / {role} / {count_value}". For example, for the training task job_0 and the trainer with party A's count value of 0, the node identification path of the trainer can be represented by / job_0 / A / 0.
[0074] It then monitors the node corresponding to the other paired trainer. Since trainers with the same count value are paired, it can determine the node path of the other node based on its own count value. If the trainer corresponding to its own node 0 exits model training, it deletes the node 0 it created. If it monitors the deletion event of the other party's node 0, the trainer corresponding to its own node 0 will also exit in conjunction. This way, when one node exits, the other paired node can also sense it immediately, achieving fast and stable coordinated control.
[0075] Using this method, we can implement trainer pairing for large-scale vertical federated learning model training based on a counter component. Two trainers each obtain an incremental and unique (i.e., unique within their own party) counter value from the counter component. Trainers with equal counts automatically form a paired trainer. Furthermore, a node monitoring mechanism enables coordinated control of trainers for large-scale vertical federated learning model training. Specifically, each trainer creates a node representing its own state, and local trainers achieve coordinated control by monitoring the state of their paired node.
[0076] In a possible approach, the functions of the counter component and monitoring mechanism described above can be implemented using distributed application coordination service software that features both a distributed counter and a monitoring mechanism. This is referred to below as the distributed coordination component. The distributed coordination component can create sequential nodes with an increasing and unique sequence number and monitor events such as node creation, node deletion, and child node changes. The following example illustrates trainer pairing and collaborative control for vertical federated learning based on the distributed coordination component, using trainers A and B executing training task job_0 as an example.
[0077] like Figure 5 As shown in the figure, after starting, the local trainer creates an ordered node in the distributed collaborative component and obtains the node's order value as a count value, which is the trainer's number. For ease of explanation, assume that the count value corresponding to this trainer is 0, and the order node is represented by worker_0. The local trainer can query the distributed collaborative component through the interface to see whether the worker_0 node exists in the order node created by the other party. If so, the pairing is successful.
[0078] Alternatively, if the sequential node created by the other party does not have a worker_0 node, the trainer corresponding to the other party's worker_0 node is further queried to see whether it has exited model training. If it has, the trainer corresponding to the worker_0 node of the local party is controlled to exit collaboratively, thereby achieving collaborative control before pairing.
[0079] For example, if the other party's worker_0 node does not exist and there are other nodes with higher sequence numbers, it means that the trainer corresponding to the other party's worker_0 node has exited model training, and the trainer corresponding to the local worker_0 node is controlled to exit in conjunction. Alternatively, if the other party's worker_0 node does not exist and there are no other nodes with higher sequence numbers, the distributed coordination component's monitoring mechanism monitors changes in the child nodes under / job_0 / B. If a new node is added, and the sequence number of the new node is higher than that of the worker_0 node, it means that the trainer corresponding to the other party's worker_0 node has exited model training, and the trainer corresponding to the local worker_0 node is controlled to exit in conjunction. Alternatively, if the created event of the other party's worker_0 node is monitored, the trainers corresponding to both worker_0 nodes are treated as a pair of trainers.
[0080] Furthermore, after the pairing is successful, an additional thread is started in the background to monitor the node deletion event or session loss event of the other node. If the node deletion event or session loss event is monitored, the trainer of the corresponding node on the side is controlled to exit the model training to achieve collaborative control after pairing. The dynamic interaction process of trainer pairing and collaborative control of model training based on distributed collaborative components can be referred to Figure 6 .
[0081] It is worth noting that the embodiments of the present disclosure do not limit the implementation method of the above-mentioned distributed collaborative components. The distributed counter and node monitoring mechanism can be implemented simultaneously through Zookeeper, or the distributed counter can be implemented by redis, mysql, etc., and the node monitoring mechanism can be implemented by components such as etcd and consul. The specific implementation can be determined according to needs.
[0082] Based on the same concept, the embodiment of the present disclosure also provides a trainer pairing device in the training of a federated learning model, such as Figure 7 As shown, the trainer pairing device 700 in the federated learning model training is applied to the first trainer of the first participant, including:
[0083] An acquisition module 701 is configured to acquire the serial number of the first trainer from a counter component after the first trainer is started;
[0084] a pairing module 702 configured to query the trainer number of the second participant in the counter component, and when the trainer number of the second participant contains a target number that is the same as the number of the first trainer, use the second trainer corresponding to the target number as a paired trainer for the first trainer;
[0085] The first trainer and the second trainer are used to collaboratively perform model training during the federated learning process, and the trainers started by the first participant and the second participant are numbered according to the same rule.
[0086] Using the above device, after the trainer is started, the trainer's own number is obtained. The trainers of the first and second participants are numbered according to the same rules. The trainers with the same number are then paired together. These paired trainers can then collaborate on model training during the federated learning process. This automatically pairs the trainers participating in federated learning model training, improving pairing efficiency and reducing pairing time, thereby increasing model timeliness. It also avoids duplicate or missed pairings of trainers, ensuring that the training data entering the trainers is aligned and that training metrics are normal.
[0087] Optionally, the trainer pairing device 700 in the federated learning model training further includes:
[0088] a first determining module configured to query the counter component for a trainer number of the second participant, and, when the trainer numbers of the second participant do not contain a number identical to that of the first trainer and do not contain a number greater than that of the first trainer, continue querying the second participant for a new trainer number;
[0089] The first control module is used to determine whether to exit the model training according to the newly added number.
[0090] Optionally, the first control module is configured to:
[0091] When the newly added number is the same as the number of the first trainer, the third trainer corresponding to the newly added number is used as a paired trainer of the first trainer, and the first trainer and the third trainer are used to collaboratively perform model training in a federated learning process;
[0092] When the newly added numbers are all different from the numbers of the first trainer, and the newly added numbers are greater than the numbers of the first trainer, it is determined to exit the model training.
[0093] Optionally, the trainer pairing device 700 in the federated learning model training further includes:
[0094] The second control module is used to query the trainer number of the second participant in the counter component, and when there is no trainer number of the second participant that is the same as the number of the first trainer and there is a number larger than the number of the first trainer, determine to exit the model training.
[0095] Optionally, the trainer pairing device 700 in the federated learning model training further includes:
[0096] a second determining module configured to, after the second trainer corresponding to the target number is used as a paired trainer for the first trainer, query the operation event triggered by the second trainer in the counter component through an event query interface, where the event query interface is an interface provided by the counter component for querying trainer operation events;
[0097] The third control module is used to determine to exit the model training when a number deletion event or a session loss event triggered by the second trainer is queried.
[0098] Optionally, the acquisition module 701 is used to:
[0099] After the first trainer is started, the first trainer sends a registration request to the counter component, so that the counter component responds to the registration request and uses the registration serial number of the first trainer as the number of the first trainer;
[0100] The number of the first trainer itself is obtained from the counter component.
[0101] Optionally, the counter component stores a first number list including the trainer number of the first participant and a second number list including the trainer number of the second participant, the trainer number of the first participant is determined by the counter component in response to the registration request of the trainer of the first participant, and the trainer number of the second participant is determined by the counter component in response to the registration request of the trainer of the second participant.
[0102] Optionally, the pairing module 702 is configured to:
[0103] The second number list in the counter component is queried through a number query interface to obtain the trainer number of the second participant. The number query interface is an interface provided by the counter component for querying the trainer number.
[0104] Optionally, the trainer pairing device 700 in the federated learning model training further includes:
[0105] The third determining module is configured to determine a communication channel based on the serial number of the first trainer, so as to send a message to the second trainer through the communication channel.
[0106] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0107] Based on the same concept, an embodiment of the present disclosure also provides a computer-readable medium on which a computer program is stored. When the program is executed by a processing device, the steps of the trainer pairing method in the federated learning model training are implemented.
[0108] Based on the same concept, an embodiment of the present disclosure further provides an electronic device, which may include:
[0109] a storage device having a computer program stored thereon;
[0110] A processing device is used to execute the computer program in the storage device to implement the steps of the trainer pairing method in the above-mentioned federated learning model training.
[0111] Based on the same concept, an embodiment of the present disclosure also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the trainer pairing method in the above-mentioned federated learning model training.
[0112] Reference below Figure 8 , which shows a schematic structural diagram of an electronic device 800 suitable for implementing an embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 8 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0113] like Figure 8 As shown, electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 802 or programs loaded from a storage device 808 into a random access memory (RAM) 803. RAM 803 also stores various programs and data required for the operation of electronic device 800. Processing device 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to bus 804.
[0114] Typically, the following devices may be connected to the I / O interface 805: an input device 806 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 808 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0115] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0116] It should be noted that the computer-readable medium described above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. Computer-readable storage media may include, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wire, optical cable, RF (radio frequency), or any suitable combination thereof.
[0117] In some embodiments, communications may be conducted using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.
[0118] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0119] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: after the first trainer is started, obtains the number of the first trainer itself from the counter component; queries the trainer number of the second participant in the counter component, and when there is a target number identical to the number of the first trainer among the trainer numbers of the second participant, uses the second trainer corresponding to the target number as the paired trainer of the first trainer; wherein the first trainer and the second trainer are used to collaboratively perform model training in a federated learning process, and the trainers started by the first participant and the second participant are numbered according to the same rule.
[0120] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0121] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0122] The modules described in the embodiments of the present disclosure may be implemented in software or hardware, wherein the name of a module does not necessarily limit the module itself.
[0123] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0124] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0125] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the present disclosure is not limited to technical solutions formed by specific combinations of the aforementioned technical features. It also encompasses other technical solutions formed by any combination of the aforementioned technical features or their equivalents, without departing from the scope of the above disclosure. For example, a technical solution formed by replacing the aforementioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0126] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0127] Although the subject matter has been described using language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. Regarding the apparatus in the above-described embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be elaborated upon here.
Claims
1. A trainer pairing method in federated learning model training, characterized in that: The method, applied to a first trainer of a first participant, includes: After the first trainer is started, the first trainer sends a registration request to the counter component, so that the counter component responds to the registration request and uses the registration serial number of the first trainer as the number of the first trainer; Obtain the serial number of the first trainer itself from the counter component; querying the trainer number of the second participant in the counter component, and when the trainer number of the second participant has a target number that is the same as the number of the first trainer, using the second trainer corresponding to the target number as a paired trainer of the first trainer; The first trainer and the second trainer are used to collaboratively perform model training in a federated learning process, the trainer number of the second participant is determined by the counter component in response to a registration request of the trainer of the second participant, the trainers started by the first participant and the second participant are numbered according to the same rules, and the number of trainers started by the first participant and the second participant is multiple.
2. The method according to claim 1, characterized in that The method further comprises: querying the counter component for the trainer number of the second participant, and when the trainer numbers of the second participant do not contain the same number as the first trainer number and do not contain a number greater than the first trainer number, continuing to query the trainer numbers of the second participant for new numbers; Determine whether to exit the model training based on the newly added number.
3. The method according to claim 2, characterized in that The determining whether to exit the model training according to the newly added number includes: When the newly added number is the same as the number of the first trainer, the third trainer corresponding to the newly added number is used as a paired trainer of the first trainer, and the first trainer and the third trainer are used to collaboratively perform model training in a federated learning process; When the newly added numbers are all different from the numbers of the first trainer, and the newly added numbers are greater than the numbers of the first trainer, it is determined to exit the model training.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Query the trainer number of the second participant in the counter component. When the trainer number of the second participant does not have the same number as the first trainer number and there is a number larger than the first trainer number, determine to exit the model training.
5. The method according to any one of claims 1 to 3, characterized in that The method further comprises: After the second trainer corresponding to the target number is used as a paired trainer for the first trainer, querying the operation event triggered by the second trainer in the counter component through an event query interface, where the event query interface is an interface provided by the counter component for querying trainer operation events; When a number deletion event or a session loss event triggered by the second trainer is queried, it is determined to exit the model training.
6. The method according to any one of claims 1 to 3, characterized in that The counter component stores a first number list including the trainer number of the first participant and a second number list including the trainer number of the second participant, and the trainer number of the first participant is determined by the counter component in response to a registration request of the trainer of the first participant.
7. The method according to claim 6, characterized in that The querying of the trainer number of the second participant in the counter component includes: The second number list in the counter component is queried through a number query interface to obtain the trainer number of the second participant. The number query interface is an interface provided by the counter component for querying the trainer number.
8. The method according to any one of claims 1 to 3, characterized in that The method further comprises: A communication channel is determined based on the number of the first trainer, so as to send a message to the second trainer through the communication channel.
9. A trainer pairing device in federated learning model training, characterized in that: A first training device applied to a first participant, the device comprising: an acquisition module, configured to, after the first trainer is started, send a registration request to the counter component, so that the counter component responds to the registration request and uses the registration serial number of the first trainer as the number of the first trainer; and obtain the number of the first trainer itself from the counter component; a pairing module, configured to query the trainer number of the second participant in the counter component, and when the trainer number of the second participant contains a target number that is the same as the number of the first trainer, use the second trainer corresponding to the target number as a paired trainer for the first trainer; The first trainer and the second trainer are used to collaboratively perform model training in a federated learning process, the trainer number of the second participant is determined by the counter component in response to a registration request of the trainer of the second participant, the trainers started by the first participant and the second participant are numbered according to the same rules, and the number of trainers started by the first participant and the second participant is multiple.
10. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processing device, the steps of the method according to any one of claims 1 to 8 are implemented.
11. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 8.
12. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Model construction method and device, medium and electronic equipment
CN112434818A