Data processing method, device, equipment, and storage medium
By optimizing the topological structure of data nodes, the problem of long data processing time in traditional federated learning is solved, and more efficient data transmission and processing is achieved.
Patent Information
- Application Number
- CN202111647971.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-12-29
AI Technical Summary
Traditional centralized machine learning faces challenges such as insufficient uplink bandwidth, insufficient computing power and synchronization problems when processing large amounts of data generated at the edge, resulting in longer processing time for federated learning-related data.
By acquiring multiple data nodes and determining the target topology based on their computing power and bandwidth, the data transmission path between data nodes is optimized, thereby generating an optimal topology and reducing data processing time.
A better topological structure is achieved under smaller overhead, reducing overall data processing time and reducing network delay.
Smart Images

Figure CN114298331B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a data processing method and apparatus, device, and storage medium. Background Art
[0002] With the surge in terminal devices such as smartphones, wearable sensors, and drones, a large amount of data is generated at the edge of the network. However, due to limited wireless communication resources and privacy restrictions, it is not feasible to transmit a large amount of training data from edge devices to servers, which makes traditional centralized machine learning face many difficulties. Therefore, a new branch of machine learning models, namely federated learning, has emerged from the intersection of artificial intelligence and edge computing. Federated learning has inherent advantages in using edge computing to process data, but there are also many challenges, such as the large amount of uplink bandwidth required for terminals to upload training structures, insufficient computing power of terminals, synchronization problems of various terminals, etc., which leads to a long time for data processing related to a round of federated learning. Summary of the invention
[0003] In order to solve the above technical problems, the embodiments of the present application provide a data processing method and device, an electronic device, and a computer-readable storage medium, which aim to solve the problem that it takes a long time to process data related to federated learning.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a data processing method is provided, including:
[0006] Acquire multiple data nodes, and determine the number of data nodes at each level that matches the target topology structure to be generated according to the multiple data nodes;
[0007] Obtaining first times required for the multiple data nodes to perform local training, and determining data nodes corresponding to each level according to each first time and the number of data nodes at each level;
[0008] Acquire a second time required for data transmission between the multiple data nodes, and determine data nodes of a next level adjacent to the multiple data nodes according to the first time and the second time;
[0009] Generate the target topology structure according to the data nodes corresponding to each level and the data nodes of the next level adjacent to the multiple data nodes;
[0010] The data transmission between the multiple data nodes is controlled according to the target topology structure.
[0011] According to one aspect of an embodiment of the present application, there is provided a data processing device, including:
[0012] A first acquisition module is configured to acquire a plurality of data nodes, and determine the number of data nodes at each level that matches the target topology structure to be generated according to the plurality of data nodes;
[0013] A second acquisition module is configured to acquire the first time required for the multiple data nodes to perform local training, and determine the data nodes corresponding to each level according to each first time and the number of data nodes at each level;
[0014] A third acquisition module is configured to acquire a second time required for data transmission between the multiple data nodes, and determine the data nodes of the next level adjacent to the multiple data nodes according to the first time and the second time;
[0015] A generating module, configured to generate the target topological structure according to the data nodes corresponding to each level and the data nodes of the next level adjacent to the plurality of data nodes;
[0016] The control module is configured to control data transmission between the multiple data nodes according to the target topology structure.
[0017] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the data processing method as described above.
[0018] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the data processing method as described above.
[0019] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data processing method provided in the above various optional embodiments.
[0020] In the technical solution provided in the embodiments of the present application, the first time of each data node is the time spent on local training based on computing power, and the second time is obtained based on the second time of the real-time bandwidth between each data node. The target topology structure to be generated is determined according to the number of data nodes to be processed, and then the data nodes are placed in appropriate positions of the target topology structure to be generated based on the first time and the second time. In this way, a better topology structure can be obtained with less overhead, and subsequent data transmission between data nodes is performed based on the generated target topology structure, so that an overall round of data processing takes less time, thereby reducing the overall network latency.
[0021] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0023] Figure 1 is a schematic diagram of a saturated topology structure involved in the present application;
[0024] Figure 2 is a schematic diagram of another saturated topology structure involved in an embodiment of the present application;
[0025] Figure 3 is a flow chart of a data processing method involved in the present application;
[0026] Figure 4 is a schematic diagram of a data node at the first time involved in an embodiment of the present application;
[0027] Figure 5 is a schematic diagram of a second time between data nodes involved in an embodiment of the present application;
[0028] Figure 6 is a schematic diagram of a target topology structure involved in an embodiment of the present application;
[0029] Figure 7 is a block diagram of a data processing device involved in the present application;
[0030] Figure 8 It is a structural diagram of a computer system suitable for implementing an electronic device of an embodiment of the present application. DETAILED DESCRIPTION
[0031] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0032] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0033] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0034] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.
[0035] The data processing method provided in this application can be applied to federated machine learning, also known as federated learning, joint learning, and alliance learning. Federated machine learning is a machine learning framework that can effectively help multiple institutions use data and conduct machine learning modeling while meeting the requirements of user privacy protection, data security, and government regulations. As a distributed machine learning paradigm, federated learning can effectively solve the problem of data silos, allowing participants to jointly model without sharing data, which can technically break data silos and achieve AI collaboration.
[0036] Federated learning defines a machine learning framework, under which virtual models are designed to solve the problem of different data owners collaborating without exchanging data. The virtual model is the optimal model for all parties to aggregate data together, and each region serves local goals based on the model. Federated learning requires that the modeling result should be infinitely close to the traditional model, that is, the result of bringing together data from multiple data owners in one place for modeling. Under the federation mechanism, the identity and status of each participant are the same, and a shared data strategy can be established. Since the data is not transferred, it will not leak user privacy or affect data specifications. In order to protect data privacy and meet legal and compliance requirements. Under the federated learning system, each data source performs data preprocessing, jointly establishes its learning model, and feeds the output results back to the user.
[0037] See also Figure 1 , Figure 1 Schematic diagram of a saturated topology structure involved in this application. In the saturated topology structure, if a node p has m child nodes, then the m child nodes of p have 0, 1, ..., m-1 child nodes respectively. Figure 1 As shown, from left to right (1), (2), (3), and (4) are saturated topological structures with 1, 2, 4, and 8 nodes respectively. Figure 1 The number in each node represents the number of child nodes that the node has. If the root node has n child nodes, there are 2 n saturated nodes. The root node is the topmost node in the saturated topology, and the leaf node is the bottommost node in the saturated topology. The leaf node has no child nodes. In each saturated topology, among the child nodes of the root node, each child node is used as a root node, so that the saturated sub-topology formed (such as the structure framed by the 2 rectangular boxes in the figure) also meets the definition of the saturated topology. When several saturated sub-topologies in a saturated topology are deleted, the remaining topology can be called a sub-saturated topology.
[0038] The saturated topology or sub-saturated topology provided by the present application is obtained by analysis when the computing power of each node is equal and the bandwidth between each node is equal. In practice, generally speaking, the computing power and bandwidth between nodes will not differ greatly. Based on these special structures, the present application can quickly find an approximate optimal solution for each node of federated learning. Since the upstream and downstream bandwidths between nodes are not symmetrical, and since which node is the root node directly affects the overall completion time, the traditional minimum spanning tree algorithm is not applicable. More importantly, each data node must complete its own training task and receive the data of the child node while satisfying that the upper-level node is in an idle state before it can start transmitting data. Therefore, in a fixed topology structure, the time required to calculate needs to be calculated from the leaf node layer by layer upward, and there are a lot of judgments, and it is difficult to obtain a closed-form solution. From the Caylay formula, it is known that the free spanning tree of a fully connected graph with n different nodes has n n-2 If we consider the different root nodes, there are n n-1 As the number of nodes increases, the number of possible topological structures will increase dramatically, and it is obvious that the exhaustive method is not feasible.
[0039] Figure 3 is a flow chart of a data processing method according to an exemplary embodiment. The data processing method may include steps S310 to S350, which are described in detail as follows:
[0040] Step S310, obtaining a plurality of data nodes, and determining the number of data nodes at each level that matches the target topological structure to be generated according to the plurality of data nodes;
[0041] Step S320, obtaining the first time required for the multiple data nodes to perform local training, and determining the data nodes corresponding to each level according to each first time and the number of data nodes at each level;
[0042] Step S330, obtaining a second time required for data transmission between the multiple data nodes, and determining the data nodes of the next level adjacent to the multiple data nodes according to the first time and the second time;
[0043] Step S340, generating a target topology structure according to the data nodes corresponding to each level and the data nodes of the next level adjacent to the multiple data nodes;
[0044] Step S350: Controlling data transmission between multiple data nodes according to the target topology structure.
[0045] In this embodiment, as in step S310, multiple data nodes are obtained, and the data nodes may be various data sources that need to be federated learning; the target topology to be generated may be a saturated topology structure or a sub-saturated topology structure. For the saturated topology structure, the number of nodes at each level can be determined, but the sub-saturated topology structure needs to be determined based on the specific number of data nodes. Therefore, the number of data nodes at each level of the target topology structure to be generated is determined based on multiple data nodes. Each level of the target topology structure can be named as the first level, the second level, . . . , and the Nth level. Each level includes corresponding data nodes. The first level includes all leaf nodes, the second level includes nodes of the previous level of each leaf node, and the Nth level includes the root node. In a topology structure, there is only one root node.
[0046] As in step S320 above, the first time refers to the time required for the data node to complete model training locally, which can be represented by the n×1 matrix local-t. Depending on the application scenario, the first time here may refer to the time required to complete training on data node i, or it may be the time required for the mobile terminal of data node i to perform local training and upload the training results to data node i for processing. The first time is estimated based on the computing power of the data node itself, and local_t[i] is used to represent the first time of data node i. The data nodes corresponding to each level can be determined by the first time of each data node and the number of data nodes at each level.
[0047] As shown in step S330 above, in a certain application scenario, the model adopted by federated learning is certain, so the amount of data that each data node needs to transmit is certain, and the second time is calculated based on the bandwidth between each data node. Assuming that there are n data nodes, the second time required for data transmission between each data node is represented by an n×n matrix trans-t, where trans-t[i][j] represents the second time required for data from data node i to be transmitted to data node j.
[0048] In the topological structure, some data nodes between adjacent levels have a superior-subordinate relationship, that is, in two adjacent levels, a data node in the next level can be used as a child node of a data node in the previous level, such as a data node in the second level can be used as a child node of a data node in the third level. The data nodes in the next level with which the data nodes have a superior-subordinate relationship are calculated based on the first time and the second time.
[0049] As in the above steps S340-S350, when the relationship between each data node is determined, the entire target topology structure can be known, and subsequent data processing operations can be performed based on the target topology structure, such as federated learning. When performing federated learning through the target topology structure provided by this application, there is no need to transmit data between all data nodes.
[0050] In this embodiment, the first time of each data node is the time spent on local training based on computing power, and the second time is obtained based on the second time of the real-time bandwidth between each data node. The target topology structure to be generated is determined according to the number of data nodes to be processed, and then the data nodes are placed at appropriate positions in the target topology structure to be generated based on the first time and the second time. In this way, a better topology structure can be obtained with less overhead, and subsequent data transmission between data nodes is performed based on the generated target topology structure, so that an overall round of data processing takes less time, thereby reducing the overall network latency.
[0051] In an exemplary embodiment, determining the number of data nodes at each level that matches the target topology structure to be generated according to the plurality of data nodes includes:
[0052] Obtaining the number of multiple data nodes and the number of saturated nodes of the corresponding preset saturated topology structure;
[0053] Check whether the number of multiple data nodes matches the number of saturated nodes;
[0054] If there is no match, the difference between the number of saturated nodes and the number of data nodes is calculated, and the saturated nodes corresponding to the difference are deleted from the saturated topology structure according to the difference, so as to obtain the number of data nodes at each level that matches the target topology structure to be generated;
[0055] If they match, the number of saturated nodes at each level of the saturated topology structure is used as the number of data nodes at each level that matches the target topology structure to be generated.
[0056] In this embodiment, Figure 1 As shown, the saturated topology has 2 n The corresponding saturated topology is determined according to the number of data nodes. For example, if the number of data nodes is 11, the saturated topology is determined by 2 n-1 <11<2 n It can be seen that when n is 4, the preset saturated topology corresponding to 11 data nodes is as follows: Figure 2 The root node shown has a saturated topology of 4 child nodes.
[0057] Compare the number of data nodes with the number of saturated nodes of the corresponding saturated topology. When the two do not match, calculate the difference between the two, that is, 16-4=5. According to the difference, delete the saturated nodes corresponding to the difference in the saturated topology, and you can know the framework of the target topology to be generated. From this, you can know the number of data nodes at each level.
[0058] When the number of data nodes is the same as the number of saturated nodes of the corresponding saturated topological structure, the preset saturated topological structure is directly used as the framework of the target topological structure to be generated.
[0059] In this embodiment, by detecting whether the number of multiple data nodes matches the number of saturated nodes, the number of data nodes at each level that matches the target topology structure to be generated can be quickly and accurately obtained based on the matching situation, providing support for the subsequent generation of the target topology structure.
[0060] In an exemplary embodiment, according to the difference, a saturated node corresponding to the difference is deleted from the saturated topology structure to obtain the number of data nodes at each level matched by the target topology structure to be generated, including:
[0061] Get the number of saturated nodes in the saturated sub-topology structure corresponding to the child nodes of the root node in the saturated topology structure;
[0062] Determine a target saturated sub-topology structure according to the difference and the number of each saturated node; wherein the sum of the number of saturated nodes of the target saturated sub-topology structure is equal to the difference;
[0063] In the saturated topology, the target saturated sub-topology is deleted to obtain the number of data nodes at each level that matches the target topology to be generated.
[0064] In this embodiment, when the number of data nodes is different from the number of saturated nodes of the corresponding saturated topology structure, that is, the target topology structure to be generated does not conform to the saturated topology structure, therefore, the number of saturated nodes of the saturated subtopology structure corresponding to the child node of the root node is obtained, such as Figure 2 As shown, the root node has 4 child nodes, that is, it has 4 saturated sub-topological structures. The number of saturated nodes corresponding to each saturated sub-topological structure is 8, 4, 2, and 1 from left to right. The target saturated sub-topological structure is determined according to the number of saturated nodes and the difference. There is at least one target saturated sub-topological structure. For example, if the difference is 5, 1+4=5, then the target saturated sub-topological structure is the saturated sub-topological structure corresponding to the number of saturated nodes 1 and 4, that is, Figure 2The structure framed by the rectangular frame; if the difference is 7, 1+2+4=7, then the target saturated sub-topology structure is the saturated sub-topology structure corresponding to the saturated node numbers of 1, 2, and 4. By deleting the target saturated sub-topology structure in the saturated topology structure, the framework of the target topology structure to be generated can be obtained, so that the number of data nodes at each level can be obtained, such as Figure 6 As shown, in the target topology structure generated by 11 data nodes, the numbers of data nodes from the first level to the fifth level are 5, 3, 1, 1, and 1 respectively.
[0065] In an exemplary embodiment, determining the data nodes corresponding to each level according to each first time and the number of data nodes at each level includes:
[0066] Arrange the multiple data nodes in ascending order according to the first time, to obtain a sorted sequence of the multiple data nodes;
[0067] According to the ascending order of each level of the target topology structure, data nodes having the same number as the data nodes of each level are determined from the sorting sequence as the data nodes corresponding to each level.
[0068] In this embodiment, multiple data nodes are arranged in ascending order according to the first time, such as Figure 4 The table shown records the first time of each data node 0-10, and the 11 data nodes are arranged in ascending order according to the first time to obtain a sorted sequence, specifically 7, 3, 4, 2, 1, 5, 0, 6, 10, 9, 8. According to the sorted sequence, the data nodes corresponding to each level are determined in turn. As mentioned above, the number of data nodes from the first level to the fifth level is 5, 3, 1, 1, 1, respectively. Therefore, it can be seen that the data nodes corresponding to the first level are 7, 3, 4, 2, 1, the data nodes corresponding to the second level are 5, 0, 6, and the data nodes corresponding to the third level to the fifth level are 10, 9, 8, respectively.
[0069] In an exemplary embodiment, determining the data nodes of the next level adjacent to the plurality of data nodes according to the first time and the second time includes:
[0070] Calculate a third time of each data node and each corresponding target data node according to the first time and the second time; wherein the level of the data node is higher than the level of the target data node corresponding to the data node;
[0071] The data nodes of the next level adjacent to the plurality of data nodes are determined according to the third time.
[0072] In this embodiment, the third time is calculated based on the first time and the second time, and the third time is used as the basis for determining the data nodes of the next level adjacent to each data node. For each data node of the first level, each data node of this level is a leaf node, and there is no need to calculate the data nodes of the next level adjacent to each data node. For two adjacent levels, the data node of the previous level has a data node of the next level as a child node. Therefore, each data node of the second level has a corresponding data node of the first level as a child node. Therefore, the child nodes of each data node of the second level can be determined from the first level; each data node of the third level has a corresponding data node of the second level as a child node, and the subsequent levels are deduced in the same way until the data nodes of the next level adjacent to the data nodes of each level are determined.
[0073] Specifically, as mentioned above, the data nodes corresponding to the first level are 7, 3, 4, 2, 1, the data nodes corresponding to the second level are 5, 0, 6, and the data nodes corresponding to the third to fifth levels are 10, 9, 8 respectively. Then, the target data nodes of each data node in the second level are each data node in the first level, the target data nodes of each data node in the third level are each data node in the first level and the second level, and the target data nodes of each data node in the fourth level are each data node in the first level, the second level and the third level. When determining the data nodes of the next level adjacent to the data nodes of each level, the data node 5 of the second level is respectively calculated with the data nodes 7, 3, 4, 2, 1 of the first level to obtain 5 third times, and a corresponding data node is determined according to the 5 third times as the child node of the data node 5; when calculating the third time of the data node 0, since there is a data node in the data nodes 7, 3, 4, 2, 1 that has been used as the child node of the data node 5, when calculating the third time corresponding to the data node 0, the child node of the data node 5 can be taken out from 7, 3, 4, 2, 1, and then the third time of the data node 0 is calculated, and then a corresponding data node is determined according to the 4 third times as the child node of the data node 0, and the child node of the data node 6 is calculated in the same way.
[0074] For the corresponding data node 10, the third time is calculated with the remaining data nodes after taking out the child nodes of data nodes 5, 0, and 6 from the data nodes of the first level. At the same time, the third time is calculated with the data nodes 5, 0, and 6 of the second level to obtain 5 third times. The data nodes corresponding to the next level are determined according to the 5 third times.
[0075] For data node 9, the third time is calculated with the data nodes in each level that are not used as child nodes, and the corresponding data node of the next level is determined according to the calculated third time. The corresponding data nodes of the next level can be obtained by analogy.
[0076] In an exemplary embodiment, determining the data nodes of the next level adjacent to the plurality of data nodes according to the third time includes:
[0077] In the levels of each target data node, the target data node with the shortest third time is selected as the data node of the next level adjacent to the corresponding data node.
[0078] In this embodiment, according to the third time calculated by each data node, in each level, the data node with the shortest third time is used as the data node of the next level adjacent to the corresponding data node. Specifically, as mentioned above, for the corresponding data node 10, the third time is calculated with the remaining data nodes after taking out the child nodes of data nodes 5, 0, and 6 from the data nodes of the first level, and the third time is calculated with the data nodes 5, 0, and 6 of the second level at the same time, to obtain 5 third times. Among these 5 third times, two third times belong to the first level and three third times belong to the second level. The data node corresponding to the third time with the shortest third time is selected from the two third times of the first level as the child node of data node 10, and the data node corresponding to the third time with the shortest third time is selected from the three third times of the second level as the child node of data node 10.
[0079] In an exemplary embodiment, calculating the third time of each data node and each corresponding target data node according to the first time and the second time includes:
[0080] Compare the first time of each data node with the first time of the corresponding target data node;
[0081] If the first time of the data node is greater than or equal to the first time of the corresponding target data node, then the first time of the data node and the second time of the corresponding target data node are added together to obtain a third time between the data node and the corresponding target data node;
[0082] If the first time of the data node is less than the first time of the corresponding target data node, the second time of the data node and the first time of the corresponding target data node are added together to obtain a third time between the data node and the corresponding target data node.
[0083] In this embodiment, when calculating the third time of each data node and the corresponding target data node, the first time of the data node is compared with the first time of the target data node. If the first time of the data node is greater than or equal to the first time of the target data node, the first time of the data node plus the second time of the target data node is used as the third time. The second time at this time is the time required for the target data node to transmit data to the data node; if the first time of the data node is less than the first time of the target data node, the first time of the target node plus the second time of the target data node is used as the third time. The second time at this time is also the time required for the target data node to transmit data to the data node.
[0084] In an exemplary embodiment, multiple data nodes are 0-10, and are sorted according to their respective first times as 7, 3, 4, 2, 1, 5, 0, 6, 10, 9, and 8. According to the sorting, the numbers of data nodes from the first level to the fifth level are 5, 3, 1, 1, and 1, respectively. Therefore, it can be seen that the data nodes corresponding to the first level are 7, 3, 4, 2, and 1, the data nodes corresponding to the second level are 5, 0, and 6, and the data nodes corresponding to the third level to the fifth level are 10, 9, and 8, respectively.
[0085] Calculate the data nodes of the next level adjacent to data node 5: traverse the first level and calculate the third time respectively. The first time of data node 5 is 30.8014, which is larger than the first time of data nodes 7, 3, 4, 2, and 1. Therefore, the third times calculated are: 51.2148, 43.5455, 43.2434, 44.5244, and 55.7857. Among them, the third time of data node 4 is the shortest, which is 43.2434. Therefore, data node 4 is selected as the data node of the next level of the adjacent level of data node 5, that is, the child node.
[0086] Calculate the data nodes of the next level adjacent to data node 0: Take data node 4 from the first level, calculate the third time of the remaining 7, 3, 2, 1, and at the same time, the first time of data node 0 is greater than the first time of data nodes 7, 3, 2, 1, so the third times calculated are: 57.7386, 56.099, 47.8025, 53.2974. Among them, the third time of data node 2 is the shortest, which is 47.8025, so data node 2 is selected as the child node of data node 0.
[0087] Calculate the data nodes of the next level adjacent to data node 6: Take data nodes 4 and 2 from the first level, calculate the third time of the remaining data nodes 7, 3, and 1, and calculate the third time of each data node: 63.0461, 62.6936, 58.8192. Among them, the third time of data node 1 is the shortest, which is 58.8192, so data node 1 is selected as the child node of data node 6.
[0088] Calculate the data nodes of the next level adjacent to data node 10: Take data nodes 4, 2, and 1 from the first level, and calculate the third time between data node 10 and data nodes 7 and 3, respectively: 63.8501, 58.3834. Among them, the third time of data node 3 is the shortest, which is 58.3834, so data node 3 is selected as the child node of data node 10. Calculate the third time between data node 10 and data nodes 5, 0, and 6 of the second level, respectively, and calculate the third times to be: 68.5311, 78.6213, 67.6646. Among them, the third time of data node 6 is the shortest, which is 67.6646, so data node 6 is selected as the child node of data node 10.
[0089] Calculate the data nodes of the next level adjacent to data node 9: Take data nodes 4, 2, 1, and 3 from the first level. Since there is only data node 7 in the first level, data node 7 is directly used as the child node of data node 9. Take data node 6 from the second level, and calculate the third time between data node 9 and data nodes 5 and 0 of the second level, respectively. The third times calculated are: 77.8851 and 87.6884. Among them, the third time of data node 5 is the shortest, which is 77.8851. Therefore, data node 5 is selected as the child node of data node 9. In the third level, there is only data node 10, so data node 10 is directly selected as the child node of data node 9.
[0090] Due to the determination of the child nodes of each data node above, there are no data nodes in the first and third levels that can be used as child nodes. In the second level, there is data node 0, and in the fourth level, there is data node 9. Therefore, data node 0 and data node 9 are used as child nodes of data node 8. Figure 6 The target topology is shown.
[0091] See also Figure 7 An exemplary embodiment of the present application provides a data processing device, including:
[0092] A first acquisition module 710 is configured to acquire a plurality of data nodes, and determine the number of data nodes at each level that matches the target topology structure to be generated according to the plurality of data nodes;
[0093] The second acquisition module 720 is configured to acquire the first time required for the multiple data nodes to perform local training, and determine the data nodes corresponding to each level according to each first time and the number of data nodes at each level;
[0094] The third acquisition module 730 is configured to acquire a second time required for data transmission between the multiple data nodes, and determine the data nodes of the next level adjacent to the multiple data nodes according to the first time and the second time;
[0095] A generating module 740 is configured to generate a target topology structure according to the data nodes corresponding to each level and the data nodes of the next level adjacent to the plurality of data nodes;
[0096] The control module 750 is configured to control data transmission between multiple data nodes according to the target topology structure.
[0097] In an exemplary embodiment, the first acquisition module 710 includes:
[0098] An acquisition submodule configured to acquire the number of multiple data nodes and the number of saturated nodes of a corresponding preset saturated topology structure;
[0099] A detection submodule, configured to detect whether the number of the plurality of data nodes matches the number of saturated nodes;
[0100] The first calculation submodule is configured to calculate the difference between the number of saturated nodes and the number of data nodes if there is no match, and delete the saturated nodes corresponding to the difference from the saturated topological structure according to the difference, so as to obtain the number of data nodes at each level that matches the target topological structure to be generated;
[0101] As a submodule, it is configured to use the number of saturated nodes at each level of the saturated topology structure as the number of data nodes at each level that matches the target topology structure to be generated if a match is found.
[0102] In an exemplary embodiment, the computing submodule includes:
[0103] An acquisition unit configured to acquire the number of saturated nodes of a saturated sub-topology structure corresponding to a child node of a root node in the saturated topology structure;
[0104] A determination unit configured to determine a target saturated sub-topology structure according to the difference value and the number of each saturated node; wherein the sum of the number of saturated nodes of the target saturated sub-topology structure is equal to the difference value;
[0105] The deletion unit is configured to delete the target saturated sub-topology structure in the saturated topology structure to obtain the number of data nodes at each level matched by the target topology structure to be generated.
[0106] In an exemplary embodiment, the second acquisition module 720 includes:
[0107] an arrangement submodule, configured to arrange the multiple data nodes in the order of all first times from small to large, to obtain an arrangement sequence of the multiple data nodes;
[0108] The first determination submodule is configured to determine, from the sorting sequence, data nodes having the same number as the data nodes at each level as the data nodes corresponding to each level.
[0109] In an exemplary embodiment, the third acquisition module 730 includes:
[0110] A second calculation submodule is configured to calculate a third time of each data node and each corresponding target data node according to the first time and the second time; wherein the level of the data node is higher than the level of the target data node corresponding to the data node;
[0111] The second determining submodule is configured to determine the data nodes of the next level adjacent to the multiple data nodes according to each third time.
[0112] In an exemplary embodiment, the second determining submodule includes:
[0113] The selection unit is configured to select the target data node with the shortest third time in the level of each target data node as the data node of the next level adjacent to the corresponding data node.
[0114] In an exemplary embodiment, the second computing submodule includes:
[0115] a comparison unit configured to compare the first time of each data node with the first time of the corresponding target data node;
[0116] The first operation unit is configured to, if the first time of the data node is greater than or equal to the first time of the corresponding target data node, sum the first time of the data node and the second time of the corresponding target data node to obtain a third time between the data node and the corresponding target data node;
[0117] The second operation unit is configured to sum the second time of the data node and the first time of the corresponding target data node to obtain a third time between the data node and the corresponding target data node if the first time of the data node is less than the first time of the corresponding target data node.
[0118] It should be noted that the device provided in the above embodiment and the data processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here.
[0119] An embodiment of the present application also provides an electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the data processing method provided in the above-mentioned embodiments.
[0120] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0121] It should be noted that Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0122] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803, such as executing the method in the above embodiment. In RAM 803, various programs and data required for system operation are also stored. CPU 801, ROM 802 and RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0123] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0124] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present application are executed.
[0125] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with 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), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0126] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the 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 from the order 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 or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0127] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0128] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0129] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in each of the above embodiments.
[0130] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A data processing method for distributed federated learning with privacy protection, characterized in that: The method comprises: Acquire multiple data nodes, and determine the number of data nodes at each level that matches the target topology structure to be generated according to the multiple data nodes; Obtaining first times required for the multiple data nodes to perform local training, and determining data nodes corresponding to each level according to each first time and the number of data nodes at each level; Acquire a second time required for data transmission between the multiple data nodes, and determine data nodes of a next level adjacent to the multiple data nodes according to the first time and the second time; Generate the target topology structure according to the data nodes corresponding to each level and the data nodes of the next level adjacent to the multiple data nodes; The data transmission between the multiple data nodes is controlled according to the target topology structure.
2. The method according to claim 1, characterized in that The determining, according to the plurality of data nodes, the number of data nodes at each level that matches the target topology structure to be generated includes: Obtaining the number of the plurality of data nodes and the number of saturated nodes of the corresponding preset saturated topology structure; Detecting whether the number of the plurality of data nodes matches the number of the saturated nodes; If there is no match, the difference between the number of the saturated nodes and the number of the data nodes is calculated, and the saturated nodes corresponding to the difference are deleted from the saturated topology according to the difference, so as to obtain the number of data nodes at each level that matches the target topology to be generated; wherein, if the root node has n child nodes, there are a total of 2 in the saturated topology. n saturated nodes, and the saturated sub-topology formed by the child nodes of the root node as the root node also meets the definition of the saturated topology structure; If they match, the number of saturated nodes at each level of the saturated topology structure is used as the number of data nodes at each level that matches the target topology structure to be generated.
3. The method according to claim 2, characterized in that The deleting the saturated nodes corresponding to the difference from the saturated topological structure according to the difference to obtain the number of data nodes at each level matching the target topological structure to be generated includes: Get the number of saturated nodes in the saturated sub-topology structure corresponding to the child nodes of the root node in the saturated topology structure; Determine a target saturated sub-topology structure according to the difference and the number of each saturated node; wherein the sum of the number of saturated nodes of the target saturated sub-topology structure is equal to the difference; In the saturated topology structure, the target saturated sub-topology structure is deleted to obtain the number of data nodes at each level matched by the target topology structure to be generated.
4. The method according to claim 1, characterized in that Determining the data nodes corresponding to each level according to each first time and the number of data nodes at each level includes: Arrange the multiple data nodes in ascending order according to all the first times to obtain a sorted sequence of the multiple data nodes; Data nodes having the same number as the data nodes at each level are determined from the sorted sequence as the data nodes corresponding to each level.
5. The method according to claim 1, characterized in that The determining, according to the first time and the second time, data nodes of the next level adjacent to the plurality of data nodes includes: Calculate a third time of each data node and each corresponding target data node according to the first time and the second time; wherein the level of the data node is higher than the level of the target data node corresponding to the data node; The data nodes of the next level adjacent to the multiple data nodes are determined according to each third time.
6. The method according to claim 5, characterized in that The step of determining the data nodes of the next level adjacent to the plurality of data nodes according to the third time includes: In the levels of each target data node, the target data node with the shortest third time is selected as the data node of the next level adjacent to the corresponding data node.
7. The method according to claim 5, characterized in that The calculating, according to the first time and the second time, a third time of each data node and each corresponding target data node includes: Compare the first time of each of the data nodes with the first time of the corresponding target data node; If the first time of the data node is greater than or equal to the first time of the corresponding target data node, then summing the first time of the data node and the second time of the corresponding target data node to obtain a third time between the data node and the corresponding target data node; If the first time of the data node is less than the first time of the corresponding target data node, the second time of the data node and the first time of the corresponding target data node are summed to obtain a third time between the data node and the corresponding target data node.
8. A data processing device for distributed federated learning with privacy protection, characterized in that: include: A first acquisition module is configured to acquire a plurality of data nodes, and determine the number of data nodes at each level that matches the target topology structure to be generated according to the plurality of data nodes; A second acquisition module is configured to acquire the first time required for the multiple data nodes to perform local training, and determine the data nodes corresponding to each level according to each first time and the number of data nodes at each level; A third acquisition module is configured to acquire a second time required for data transmission between the multiple data nodes, and determine the data nodes of the next level adjacent to the multiple data nodes according to the first time and the second time; A generating module, configured to generate the target topological structure according to the data nodes corresponding to each level and the data nodes of the next level adjacent to the plurality of data nodes; The control module is configured to control data transmission between the multiple data nodes according to the target topology structure.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the data processing method for distributed federated learning for privacy protection as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the data processing method for distributed federated learning for privacy protection as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Federated learning method and device based on tree topological structure
CN110728376A
Longitudinal federation learning calculation method and device, equipment and medium
CN112132293A