Decentralized machine learning method and apparatus based on adaptive neighbor selection
By using an adaptive neighbor selection method to evaluate the importance of neighbor nodes in P2P networks and generate high-quality pseudo-labels, this approach solves the problem of insufficient utilization of unlabeled data in existing technologies and improves the training performance and efficiency of decentralized learning.
Patent Information
- Application Number
- CN202211391939.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-08
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-11-08
AI Technical Summary
Existing decentralized machine learning methods fail to effectively utilize unlabeled data, and traditional semi-supervised learning methods cannot be directly applied to P2P training architectures, resulting in compromised pseudo-label quality and decreased training performance.
By using an adaptive neighbor selection method, the importance of neighboring nodes is evaluated, and neighbors with high-quality models and similar data distributions are selected for communication. High-quality pseudo-labels are generated, balancing pseudo-label quality and communication overhead, and utilizing unlabeled data in P2P networks.
It improves the training performance of decentralized learning, makes full use of unlabeled data on nodes to generate high-quality pseudo-labels, and enhances the model's generalization ability and training efficiency.
Smart Images

Figure CN116050536B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of distributed machine learning, specifically relating to a decentralized machine learning method and apparatus based on adaptive neighbor selection. Background Technology
[0002] The dominant training method in distributed machine learning is the PS (Power-Only) training architecture, where each node iteratively exchanges model parameters with the PS. In this architecture, because all nodes need to communicate with the PS simultaneously, it may exceed communication resource limitations, making the PS an inherent bottleneck and increasing the risk of single point of failure. Decentralized learning, by coordinating the training of models across nodes in a peer-to-peer (P2P) manner, can effectively avoid the PS bottleneck and improve the scalability of distributed systems.
[0003] However, existing decentralized methods only focus on supervised learning settings, assuming that each node's data has a real label, which is often difficult to achieve in real-world scenarios. For example, in the early stages of COVID-19 transmission, community hospitals typically lacked sufficient labeled data to train pathological prediction models. Labeling data is time-consuming and complex, often requiring the support of domain experts. Therefore, most local data on nodes is unlabeled.
[0004] Traditional semi-supervised learning methods are mainly designed for single-machine or PS architectures and cannot be directly applied to P2P training architectures. They do not consider the impact of neighbor selection on the training performance of semi-supervised learning. Models from neighbors may have varying degrees of positive or negative impact on the aggregated model. If all of them are aggregated, the quality of pseudo-labels generated by the aggregated model may be compromised, and a large amount of unlabeled data with low confidence labels will be unusable, thereby reducing training performance. Summary of the Invention
[0005] To address the problems in existing technologies, this invention provides a decentralized machine learning method and apparatus based on adaptive neighbor selection. The aim is to fully utilize the unlabeled data of nodes in P2P networks to improve the training performance of decentralized learning. Considering the impact of neighbor selection on pseudo-label quality and communication overhead, each node tends to communicate with more neighbors with high-quality models to help generate high-quality pseudo-labels. However, too many neighbors also generate significant communication overhead. This application introduces a neighbor score to evaluate the importance of neighbor nodes. Neighbors with high-quality models and similar data distributions will have higher scores. Based on the neighbor score, and under the constraint of communication resources, each node adaptively selects neighbor nodes to exchange models, achieving a balance between training performance and resource overhead.
[0006] In a first aspect, embodiments of the present invention provide a decentralized machine learning method based on adaptive neighbor selection, applied in a P2P network architecture, comprising the following in each training round:
[0007] S1. Each working node updates its local model parameters using local labeled data;
[0008] S2. Considering the quality of pseudo-labels and communication overhead, each node adaptively selects a target neighbor node to exchange models. After receiving the model from the target neighbor node, the model parameters are aggregated using a weight matrix to obtain an aggregated model.
[0009] S3. Each node obtains its corresponding pseudo-label dataset based on the aggregation model and local unlabeled data.
[0010] S4. Each node is trained using local unlabeled data and corresponding pseudo-labels, and the local model parameters are updated.
[0011] Optionally, in S2, each node adaptively selects a target neighbor node exchange model, including:
[0012] The sum of the development and exploration items for each neighbor node is used as the corresponding neighbor score;
[0013] Each node adaptively selects a target neighbor node exchange model based on the neighbor score.
[0014] Optionally, the development item is obtained by dividing the model's accuracy on the validation set by the weight dispersion;
[0015] The exploration term is obtained by dividing the current training round number by the number of times a node has been selected as a neighbor.
[0016] Optionally, the target neighbor node exchange model adaptively selected by each node based on the neighbor score includes:
[0017] The probability of communication between nodes is calculated based on the neighbor scores. In the formal problem, the optimization objective is to maximize the neighbor scores with the corresponding communication probabilities as weights. Communication resources are used as a constraint, and a linear programming solver is used to optimally obtain the communication probabilities between nodes.
[0018] Based on the solved communication probabilities, a neighbor selection strategy is generated. Each node arranges the neighbor nodes that may communicate in non-increasing order according to the communication probability to construct a candidate neighbor list.
[0019] Iterate through the candidate neighbor list and select the target neighbor node for communication with the corresponding probability until the communication resource limit is exceeded.
[0020] Optionally, the weight matrix in S2 is calculated using the degree of each node in the P2P topology.
[0021] Optionally, S3 includes:
[0022] Each node uses an aggregation model to calculate the predicted class distribution on the weakly augmented unlabeled data and uses the class with the highest probability as the pseudo label for the unlabeled data.
[0023] Remove the low-confidence unlabeled data to obtain the pseudo-labeled dataset.
[0024] Optionally, remove low-confidence unlabeled data to obtain a pseudo-labeled dataset, including:
[0025] Select a subset of pseudo-labels to include in the training, and retain only pseudo-labels with the highest class probability greater than the confidence threshold, thereby removing low-confidence noisy data.
[0026] Optionally, S4 includes:
[0027] Each node performs strong enhancements on its local unlabeled data;
[0028] Each node is trained using strongly augmented unlabeled data and corresponding pseudo-labels, and the local model parameters are updated.
[0029] Secondly, embodiments of the present invention also provide a decentralized machine learning device based on adaptive neighbor selection, configured on each node in a P2P network architecture, comprising:
[0030] The supervised learning module is used to update local model parameters using local labeled data;
[0031] The model exchange and aggregation phase module is used to adaptively select target neighbor nodes to exchange models, taking into account pseudo-label quality and communication overhead. After receiving the model from the target neighbor node, the model parameters are aggregated using a weight matrix to obtain an aggregated model.
[0032] The pseudo-label dataset generation module is used to obtain the pseudo-label dataset corresponding to each node based on the aggregation model and local unlabeled data.
[0033] The unsupervised learning module is used to train the local model using local unlabeled data and corresponding pseudo-labels, and to update the local model parameters.
[0034] This invention, based on a decentralized machine learning scenario, primarily focuses on improving training performance by effectively utilizing unlabeled data locally on nodes within a semi-supervised learning setup. This application differs from previous methods mainly in that it considers a more realistic semi-supervised decentralized machine learning research scenario, reveals the impact of neighbor selection on semi-supervised learning, and generates high-quality pseudo-labels for local unlabeled data through adaptive neighbor selection, thereby improving the performance of decentralized learning.
[0035] Compared with existing solutions, the advantages of this invention are:
[0036] 1. This invention breaks with the assumption in existing decentralized learning methods that all local data is labeled, and focuses on decentralized machine learning under a semi-supervised learning setting, which is more in line with real-world application scenarios.
[0037] 2. This invention discovers that neighbor selection has a crucial impact on the balance between pseudo-label quality and communication overhead. Considering the characteristics of P2P architecture, a semi-supervised training method is designed to make up for the shortcomings of existing semi-supervised learning work.
[0038] 3. The method of this invention introduces a neighbor score to evaluate the importance of a node. Based on the neighbor score, each node adaptively selects neighbors with high-quality models and similar data distributions for communication under the constraint of communication resources. This can generate high-quality pseudo-labels for local unlabeled data, thereby making full use of the large amount of unlabeled data on the node to improve training performance.
[0039] This invention discloses a method for enhancing decentralized machine learning by fully utilizing unlabeled data on nodes through adaptive neighbor selection. The scheme designs neighbor scores to reflect the importance of nodes for semi-supervised learning, and selects a neighbor-swapping model for each node considering pseudo-label quality and communication overhead. This helps nodes generate high-quality pseudo-labels, thereby improving decentralized learning performance in a semi-supervised setting. Attached Figure Description
[0040] Figure 1 A flowchart illustrating a decentralized machine learning method based on adaptive neighbor selection, provided in an embodiment of the present invention;
[0041] Figure 2 This is a schematic diagram illustrating a research scenario for semi-supervised decentralized machine learning in an embodiment of the present invention. Detailed Implementation
[0042] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures. Example
[0043] Figure 1 The flowchart illustrates a decentralized machine learning method based on adaptive neighbor selection, as provided in this embodiment of the invention. The method in this embodiment is applied to a P2P network architecture, which is a decentralized machine learning training model that can effectively avoid the bottleneck of the central server in the PS architecture.
[0044] Referring to Figure 2, the P2P network architecture used in this embodiment includes multiple working nodes. The local data of each working node includes two parts: labeled data and unlabeled data.
[0045] In this embodiment, decentralized machine learning includes multiple training rounds, each round comprising the following steps:
[0046] S1. Each working node updates its local model parameters using local labeled data.
[0047] Specifically, S1 above is the supervised learning phase, which includes:
[0048] S11. Each node performs weak enhancements on its locally labeled data, such as random horizontal flipping;
[0049] S12. Each node is trained on weakly augmented data using the cross-entropy loss function, and the local model parameters are updated.
[0050] S2. Considering the quality of pseudo-labels and communication overhead, each node adaptively selects a target neighbor node to exchange models. After receiving the model from the target neighbor node, the model parameters are aggregated using a weight matrix to obtain an aggregated model.
[0051] The above S2 is the model exchange and aggregation phase, which includes:
[0052] S21. Considering the quality of pseudo-labels and communication overhead, each node adaptively selects the neighbor switching model.
[0053] S22. After receiving the models of all neighbors, aggregate the model parameters using the weight matrix.
[0054] Specifically, the weight matrix aggregated by the above model is calculated using the degree of each node in the P2P topology.
[0055] Furthermore, neighbor selection during model training has a crucial impact on the pseudo-label quality and communication overhead of semi-supervised decentralized machine learning. On the one hand, each node tends to exchange parameters with more neighbors who have high-quality models to generate high-quality pseudo-labels. On the other hand, nodes typically have limited communication resources; exchanging models with too many neighbors incurs significant communication overhead, slowing down the training process. Therefore, considering the balance between pseudo-label quality and communication overhead, this application adaptively selects neighbors with high-quality models and similar data distributions for each node to exchange models under resource constraints, thereby leveraging unlabeled data on the node to enhance the training performance of decentralized machine learning.
[0056] Specifically, in this embodiment, adaptive neighbor selection evaluates the quality of nodes based on neighbor scores, where the neighbor score equals the development item plus the exploration item.
[0057] The development term for the neighbor score is obtained by dividing the model's accuracy on the validation set by the weight dispersion. On one hand, nodes tend to choose neighbors with high-quality models to exchange models and generate pseudo-labels with high confidence. We use the validation dataset to evaluate the accuracy of the node's model. On the other hand, due to the large differences in the distribution of nodes' local datasets, nodes tend to choose neighbors with similar data distributions. Such neighbors have a better ability to generate pseudo-labels. The difference in data distribution can be reflected by the weight dispersion of the two models. Nodes with high validation accuracy and / or low weight dispersion will have a larger development term.
[0058] The exploration term for the neighbor score is obtained by dividing the current training epoch by the number of times a node has been selected as a neighbor. If nodes consistently choose the same neighbors to communicate with, the local model is prone to overfitting to insufficient labeled data, resulting in poor generalization. Therefore, an exploration term is added to the neighbor score. If a node has not been selected as a neighbor for many epochs, its exploration term is increased, increasing its chance of being selected. The design of the exploration term ensures that every node in the network has a chance to be selected as a neighbor for communication.
[0059] Furthermore, the probability of communication between nodes is calculated based on the neighbor scores. In the formal problem, the optimization objective is to maximize the neighbor scores with the corresponding communication probabilities as weights. Communication resources are used as a constraint, and a linear programming solver can be used to optimally obtain the communication probabilities between nodes.
[0060] Based on the solved communication probabilities, a neighbor selection strategy is generated. Each node arranges its potential communication neighbors in non-increasing order according to their communication probabilities, constructing a candidate neighbor list. The candidate neighbor list is traversed, and a neighbor is selected for communication with the corresponding probability until the communication resource limit is exceeded.
[0061] S3. Each node obtains its corresponding pseudo-label dataset based on the aggregation model and local unlabeled data.
[0062] The above S3 is the pseudo-tag generation and selection stage, including:
[0063] S31. Each node uses an aggregation model to calculate the predicted class distribution on the weakly augmented unlabeled data and uses the class with the highest probability as the pseudo label of the unlabeled data.
[0064] Specifically, in S31, each node uses the aggregated model to output predictions on unlabeled data, and then uses the class with the highest probability as a pseudo-label, thereby using the unlabeled data to train the model to improve generalization ability.
[0065] S32. Remove the low-confidence unlabeled data to obtain the pseudo-labeled dataset.
[0066] Because model predictions may generate incorrect pseudo-labels, adding these incorrect pseudo-labels to training will mislead the optimization process and reduce training performance, so it is necessary to filter out pseudo-labels.
[0067] This embodiment uses a confidence threshold to filter pseudo-labels. By intelligently selecting a subset of pseudo-labels to be added to the training, only pseudo-labels with the highest class probability greater than the confidence threshold are retained, thereby removing low-confidence noise data.
[0068] Furthermore, in the pseudo-label generation and selection stage, a consistency loss function is introduced into decentralized machine learning. In this application, strong augmentation is used for unlabeled data during unsupervised learning, while the pseudo-labels used for training are obtained using weak augmentation. This form of loss function combines two semi-supervised learning techniques: pseudo-labeling and consistency regularization.
[0069] This embodiment employs both supervised loss functions (cross-entropy loss function) and unsupervised loss functions (consistency loss function), enabling the model to acquire knowledge from both labeled and unlabeled data simultaneously, thereby improving performance.
[0070] S4. Each node is trained using local unlabeled data and corresponding pseudo-labels, and the local model parameters are updated.
[0071] The above S4 is the unsupervised learning stage, which includes:
[0072] S41. Each node performs strong augmentation on its local unlabeled data, such as random augmentation (RandAugment).
[0073] S42. Each node is trained using strongly augmented unlabeled data and corresponding pseudo-labels, and the local model parameters are updated.
[0074] In this embodiment, the machine learning model is trained alternately on labeled and unlabeled data. That is, the model is first trained on labeled data, and then aggregated to generate pseudo-labels for the unlabeled data. Throughout this process, the model used to generate pseudo-labels is always trained on real labels, and this alternating training improves the stability of semi-supervised learning.
[0075] This invention is based on a decentralized machine learning scenario and is mainly dedicated to improving training performance by effectively utilizing local unlabeled data of nodes in a semi-supervised learning setting. Compared with the prior art, this application considers a more realistic semi-supervised decentralized machine learning research scenario, reveals the impact of neighbor selection on semi-supervised learning, and improves the performance of decentralized learning by generating high-quality pseudo-labels for local unlabeled data through adaptive neighbor selection.
[0076] Furthermore, embodiments of the present invention also provide a decentralized machine learning device based on adaptive neighbor selection, configured on each node in a P2P network architecture, comprising:
[0077] The supervised learning module is used to update local model parameters using local labeled data;
[0078] The model exchange and aggregation phase module is used to adaptively select target neighbor nodes to exchange models, taking into account pseudo-label quality and communication overhead. After receiving the model from the target neighbor node, the model parameters are aggregated using a weight matrix to obtain an aggregated model.
[0079] The pseudo-label dataset generation module is used to obtain the pseudo-label dataset corresponding to each node based on the aggregation model and local unlabeled data.
[0080] The unsupervised learning module is used to train the local model using local unlabeled data and corresponding pseudo-labels, and to update the local model parameters.
[0081] The model exchange and aggregation phase includes the following steps: Each node adaptively selects a target neighbor node to exchange models, specifically including:
[0082] The sum of the development and exploration items for each neighbor node is used as the corresponding neighbor score;
[0083] Each node adaptively selects a target neighbor node exchange model based on the neighbor score.
[0084] The development item is obtained by dividing the model's accuracy on the validation set by the weight dispersion;
[0085] The exploration term is obtained by dividing the current training round number by the number of times a node has been selected as a neighbor.
[0086] Specifically, the adaptive selection of target neighbor node exchange model for each node based on the neighbor score includes:
[0087] The probability of communication between nodes is calculated based on the neighbor scores. In the formal problem, the optimization objective is to maximize the neighbor scores with the corresponding communication probabilities as weights. Communication resources are used as a constraint, and a linear programming solver is used to optimally obtain the communication probabilities between nodes.
[0088] Based on the solved communication probabilities, a neighbor selection strategy is generated. Each node arranges the neighbor nodes that may communicate in non-increasing order according to the communication probability to construct a candidate neighbor list.
[0089] Iterate through the candidate neighbor list and select the target neighbor node for communication with the corresponding probability until the communication resource limit is exceeded.
[0090] Optionally, the weight matrix above can be calculated using the degree of each node in the P2P topology.
[0091] Furthermore, the pseudo-label dataset generation module is specifically used for:
[0092] Each node uses an aggregation model to calculate the predicted class distribution on the weakly augmented unlabeled data and uses the class with the highest probability as the pseudo label for the unlabeled data.
[0093] Remove the low-confidence unlabeled data to obtain the pseudo-labeled dataset.
[0094] The process involves removing low-confidence unlabeled data to obtain a pseudo-labeled dataset, which includes:
[0095] Select a subset of pseudo-labels to include in the training, and retain only pseudo-labels with the highest class probability greater than the confidence threshold, thereby removing low-confidence noisy data.
[0096] Specifically, the unsupervised learning module includes:
[0097] Each node performs strong enhancements on its local unlabeled data;
[0098] Each node is trained using strongly augmented unlabeled data and corresponding pseudo-labels, and the local model parameters are updated.
[0099] The decentralized machine learning device based on adaptive neighbor selection provided in this embodiment of the invention can execute the decentralized machine learning method based on adaptive neighbor selection provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method, which will not be described in detail here.
[0100] The above examples are only for illustrating the technical concept and features of the present invention, and are intended to enable those skilled in the art to understand the content of the present invention and implement it accordingly. They should not be used to limit the scope of protection of the present invention. All equivalent changes or modifications made in accordance with the spirit and essence of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A decentralized machine learning method based on adaptive neighbor selection, applied to a P2P network architecture, characterized in that, Each training round includes: S1. Each working node updates its local model parameters using local labeled data; S2. Considering the quality of pseudo-labels and communication overhead, each node adaptively selects a target neighbor node to exchange models. After receiving the model from the target neighbor node, the model parameters are aggregated using a weight matrix to obtain an aggregated model. S3. Each node obtains its corresponding pseudo-label dataset based on the aggregation model and local unlabeled data. S4. Each node is trained using local unlabeled data and corresponding pseudo-labels, and the local model parameters are updated. The adaptive selection of target neighbor node exchange model for each node in S2 includes: The sum of the development and exploration items for each neighbor node is used as the corresponding neighbor score; Each node adaptively selects a target neighbor node exchange model based on the neighbor scores. Each node adaptively selects a target neighbor node exchange model based on the neighbor scores, including: The probability of communication between nodes is calculated based on the neighbor scores. In the formal problem, the optimization objective is to maximize the neighbor scores with the corresponding communication probabilities as weights. Communication resources are used as a constraint, and a linear programming solver is used to optimally obtain the communication probabilities between nodes. Based on the solved communication probabilities, a neighbor selection strategy is generated. Each node arranges the neighbor nodes that may communicate in non-increasing order according to the communication probability to construct a candidate neighbor list. Iterate through the candidate neighbor list and select the target neighbor node for communication with the corresponding probability until the communication resource limit is exceeded.
2. The method according to claim 1, characterized in that, The development items are obtained by dividing the model's accuracy on the validation set by the weight dispersion. The exploration term is obtained by dividing the current training round number by the number of times a node has been selected as a neighbor.
3. The method according to claim 1, characterized in that, The weight matrix in S2 is calculated using the degree of each node in the P2P topology.
4. The method according to claim 1, characterized in that, S3 includes: Each node uses an aggregation model to calculate the predicted class distribution on the weakly augmented unlabeled data and uses the class with the highest probability as the pseudo label for the unlabeled data. Remove the low-confidence unlabeled data to obtain the pseudo-labeled dataset.
5. The method according to claim 4, characterized in that, After removing low-confidence unlabeled data, a pseudo-labeled dataset is obtained, including: Select a subset of pseudo-labels to include in the training, and retain only pseudo-labels with the highest class probability greater than the confidence threshold, thereby removing low-confidence noisy data.
6. The method according to claim 1, characterized in that, S4 includes: Each node performs strong enhancements on its local unlabeled data; Each node is trained using strongly augmented unlabeled data and corresponding pseudo-labels, and the local model parameters are updated.
7. A decentralized machine learning device based on adaptive neighbor selection, configured on each node in a P2P network architecture, characterized in that, include: The supervised learning module is used to update local model parameters using local labeled data; The model exchange and aggregation phase module is used to adaptively select target neighbor nodes to exchange models, taking into account pseudo-label quality and communication overhead. After receiving the model from the target neighbor node, the model parameters are aggregated using a weight matrix to obtain an aggregated model. Each node adaptively selects a target neighbor node for the exchange model, including: The sum of the development and exploration items for each neighbor node is used as the corresponding neighbor score; Each node adaptively selects a target neighbor node exchange model based on the neighbor scores. Each node adaptively selects a target neighbor node exchange model based on the neighbor scores, including: The probability of communication between nodes is calculated based on the neighbor scores. In the formal problem, the optimization objective is to maximize the neighbor scores with the corresponding communication probabilities as weights. Communication resources are used as a constraint, and a linear programming solver is used to optimally obtain the communication probabilities between nodes. Based on the solved communication probabilities, a neighbor selection strategy is generated. Each node arranges the neighbor nodes that may communicate in non-increasing order according to the communication probability to construct a candidate neighbor list. Iterate through the candidate neighbor list and select the target neighbor node for communication with the corresponding probability until the communication resource limit is exceeded; The pseudo-label dataset generation module is used to obtain the pseudo-label dataset corresponding to each node based on the aggregation model and local unlabeled data. The unsupervised learning module is used to train the local model using local unlabeled data and corresponding pseudo-labels, and to update the local model parameters.