Federal learning optimization method based on block chain fragmentation
Through blockchain sharding and federated learning optimization methods, dynamic adjustment of the number of shards and task allocation is solved, and the problems of low resource utilization and uneven load in the home medical Internet of Things are achieved, and efficient data privacy protection and collaborative training are achieved.
Patent Information
- Application Number
- CN202510432911.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-08-01
AI Technical Summary
There are problems of low resource utilization and load balancing in the home medical Internet of Things, especially in smart medical devices with limited computing power, and it is difficult for existing technologies to efficiently protect data privacy and optimize resources.
The federated learning optimization method based on blockchain sharding is adopted, through the collaboration of adaptive sharding mechanism and blockchain smart contracts, the number of shards and task allocation is dynamically adjusted, combined with deep reinforcement learning, and optimize resource utilization, and reduce computing and communication overhead through segmented learning and D2D communication.
It improves the system throughput and response speed, enhances data privacy protection capabilities, reduces bandwidth requirements, and ensures collaborative training efficiency between devices and the accuracy of model training.
Smart Images

Figure CN120409622A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of federated learning in the home medical Internet of Things, and particularly to an optimization method for federated learning based on blockchain sharding. Background Art
[0002] With the rapid development of Internet of Things technology, the home medical Internet of Things (IoT) has become an important part of modern healthcare. The home medical IoT collects patients' health data through smart devices (such as smartwatches, blood glucose meters, heart rate monitors, etc.), and these devices usually feature low power consumption, strong real-time performance, and convenience. By connecting these devices to the network, healthcare providers can remotely monitor patients' health conditions and timely detect potential health problems. However, the home medical IoT faces several challenges, especially in terms of data privacy, device resource limitations, and data transmission. In terms of data privacy, patients' health data belongs to sensitive information and needs to be processed while ensuring privacy. Device resource limitations include restrictions on computing power, bandwidth, and storage space, which make it difficult for traditional centralized computing and data transmission solutions to operate efficiently in such an environment.
[0003] Federated Learning (FL) is a distributed machine learning method aimed at solving the problems of data privacy and data transmission. In federated learning, data does not leave the local device, but instead, the device locally trains the model and periodically uploads the model updates to be merged with the global model, thereby achieving global knowledge sharing. This method is particularly suitable for scenarios that require protecting data privacy, such as the medical and financial fields. In the home medical IoT, federated learning can help each device (such as a smart medical device) locally train the model and only upload the model parameters (instead of the original data) to the server for global aggregation. This approach not only protects patients' privacy but also reduces a large amount of data transmission and storage requirements, thus greatly improving the efficiency of the system. By training a large model in the cloud through distributed learning, the purpose of AI recognition and monitoring of users' medical conditions is achieved based on the trained large model. At the same time, the federated learning method is utilized, and local privacy data is also protected.
[0004] Split Learning (SL) is a new distributed learning method that reduces the demand for computing resources by splitting the model into multiple parts and performing computational tasks on different devices. In traditional federated learning, devices need to train the entire model, while in split learning, the model is divided into several segments, and each device is only responsible for computing a part of it. This method can effectively reduce the computational burden on devices, especially for devices with limited computing power, such as home medical devices. The application of split learning in the home medical Internet of Things can significantly reduce communication and computational overhead, enabling resource-constrained intelligent medical devices to participate in distributed machine learning, thereby improving the performance of the overall system. By splitting the model and allocating it to different devices for training, each device can cooperate to complete tasks, ensuring training accuracy while effectively saving computing resources.
[0005] Blockchain technology is a decentralized distributed ledger technology that can record data in a transparent and immutable manner. In the Internet of Medical Things, blockchain technology is used to ensure the security, transparency, and consistency of data exchange between devices. In traditional medical systems, the storage and exchange of data often rely on centralized databases, which may pose risks of data tampering and leakage. Using blockchain can effectively solve these problems, ensuring that the data generated by each device can be reliably verified and is immutable. In the application scenario of the home medical Internet of Things, blockchain can not only provide data immutability but also automatically execute tasks through the smart contract mechanism. For example, smart contracts can be used for automatic device identity verification, task allocation, and data aggregation to ensure the efficient operation of the system. In addition, the sharding technology of blockchain can divide multiple devices into different shards for parallel processing, thereby improving the overall throughput and processing capacity of the system.
[0006] Deep Reinforcement Learning (DRL) is a technology that combines deep learning and reinforcement learning, and learns the optimal decision-making strategy through interaction with the environment. DRL has been widely applied in fields such as robot control, autonomous driving, and game intelligence. In recent years, DRL has also been introduced into fields such as network management and resource optimization. In the home medical Internet of Things, the goal of the dynamic sharding mechanism is to dynamically adjust the shard number and task allocation according to the resource status of the devices, so as to optimize resource utilization and load balancing. Traditional sharding strategies are usually static, that is, the shard number and task allocation do not change during the operation of the system. By introducing deep reinforcement learning, the system can dynamically adjust the sharding configuration according to the real-time device resources and task requirements, enabling the devices to achieve optimal resource utilization and load balancing when processing tasks. Specifically, deep reinforcement learning can help the system adjust the sharding strategy according to the device resources in each shard epoch, optimize the usage efficiency of computing, storage, and bandwidth, thereby improving the throughput and response speed of the overall system.
[0007] In the process of federated learning of medical data in the prior art, there are problems of low resource utilization and load balancing, and the application and development of home medical Internet of Things technology need to solve this technical problem. Summary of the Invention
[0008] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a federated learning optimization method based on blockchain sharding, which can effectively solve the problems of resource utilization and load balancing in the distributed learning process. Through the cooperation of the adaptive sharding mechanism and the blockchain smart contract, the dynamic scheduling and efficient management of device resources are realized. The adaptive sharding mechanism automatically adjusts the shard number and task allocation based on the device resources, ensuring the load balance of the devices within each shard, and at the same time improving the throughput and response speed of the system; the blockchain smart contract is responsible for task publishing, device authentication, and transaction verification during model update, ensuring the security and transparency of the system.
[0009] To achieve the above object, the technical solution adopted by the present invention is: a federated learning optimization method based on blockchain sharding, which optimizes resource utilization and solves the problem of uneven load through the cooperation of an adaptive sharding mechanism and a blockchain smart contract. The adaptive sharding mechanism dynamically adjusts the number of shards according to the resource status of the devices, and ensures that each device can participate in model training within the limits of its resources when allocating tasks; the blockchain smart contract ensures the fairness of task allocation, the authentication of device identities, and the full traceability of model updates. The method specifically includes the following steps: registration phase, task publishing phase, dynamic sharding establishment phase based on deep reinforcement learning, in-shard model split learning phase, shard transmission phase, and model aggregation phase. By combining blockchain and federated learning and adopting a hierarchical blockchain architecture, the present invention effectively reduces communication and storage overheads, improves the scalability of the system, and at the same time ensures data privacy and security during the model training process.
[0010] The registration phase of the intelligent medical devices participating in learning on the blockchain includes:
[0011] Step 1-1: Identity authentication request: The intelligent medical device first sends an identity authentication request to the blockchain network. This request contains the basic information of the device, such as the device type (smart watch, sphygmomanometer, etc.) and the FL training resources required by the device. The network will verify the initial eligibility of the device to confirm that the device meets the basic conditions for entering the blockchain network.
[0012] Step 1-2: Generate an account and key pair: The intelligent medical device that has passed the preliminary verification will obtain a unique account address and key pair (public key and private key) assigned by the blockchain network. This key pair will be used for device identity authentication and data encryption to ensure the security of data transmission. The generation and management of the public key and private key adopt security algorithms to prevent external attacks and identity forgery.
[0013] Step 1-3: Allocate an identity authentication certificate: The network issues an identity authentication certificate to the device to prove the legality of its identity. This certificate includes the device's account address and public key, and is accompanied by the digital signature of the blockchain network. The identity authentication certificate will be used to verify the legal identity of the device when it participates in FL training and data sharing, ensuring that only authenticated devices can enter the network to execute tasks.
[0014] Step 1-4: Smart contract binding: After the device registration is completed, it will be bound to the smart contract in the blockchain so that the smart contract can manage the device's permissions and task allocation. The smart contract will mark this device as an authenticated participant, allowing it to receive tasks and report training results. The binding process can be achieved by calling the registration function of the smart contract, and the smart contract will record the relevant information and permissions of the device.
[0015] Step 1 - 5: Transaction Verification and Recording: The registered devices can conduct transaction verification. The device can confirm the legality of its actions by signing transactions, such as participating in training tasks, submitting model updates, etc. The signed transactions will be recorded on the blockchain to ensure the transparency and immutability of the transactions. The transaction records provide an audit trail for the device's actions, facilitating post - event verification and traceability.
[0016] Step 1 - 6: Preparation for Task Allocation: Once the device is registered, it will be given certain permissions to receive shard tasks. The device will obtain initial task information and training parameters according to the guidance of the smart contract. After receiving the task, the device can start local training and prepare to participate in distributed model updates.
[0017] The specific task publishing phase is as follows:
[0018] The medical device writes the training requirements into the queue through the interface provided by the smart contract. The requirements include the model, test set, shard configuration, local training epochs τ, and global communication rounds The signed transactions are broadcast to the smart medical devices on the blockchain to set up shards to execute the training tasks. The smart medical devices are divided into shards according to their account addresses on the blockchain. The signed transactions are the genesis transactions of the shards. The medical devices will sign these transactions to ensure the legality of the tasks and broadcast these signed transactions to other smart medical devices in the blockchain network. These signed transactions not only help the medical devices participate in the tasks but also provide the necessary information for the medical devices in the shards to execute the tasks. The genesis transactions write the training tasks into the shards so that the medical devices in the shards can understand and execute the tasks.
[0019] The dynamic shard establishment phase based on deep reinforcement learning includes:
[0020] Step 2 - 1: Resource Awareness. In this process, the base station obtains three hardware resources and one software resource from all medical devices, namely processing speed, data transmission rate, available memory, and dataset size, denoted as p i (1 ≤ i ≤ N) of s i 、r i and a i 、D i . s i and a i are machine - related parameters dependent on the device configuration. The data transmission rate r i depends on the bandwidth, channel coefficient, and path loss between the medical device and the base station and is estimated. The s i 、ri and a i The static information of is used to determine the number of shards k and the subsequent MSA. Therefore, we use a vector V i = [s i , r i , a i , D i to represent the various index capabilities of the intelligent medical device p participating in the training i .
[0021] Step 2-2: Determine the optimal number of shards K. In this process, the mechanism of dividing the set of N participants into k non-overlapping shards is to determine the number of shards K. When performing sharding, ensure the following points:
[0022] The resources of each shard are relatively balanced, making the load of the entire system balanced.
[0023] Ensure that the devices in each shard can cooperate efficiently in terms of processing speed, data transmission rate, and available memory, avoiding resource bottlenecks.
[0024] The number of shards K should not be too large to avoid increased complexity, nor too small to prevent too many devices in a single shard, resulting in resource competition.
[0025] Step 2-3: Adaptive sharding mechanism based on the Deep Q-Network (DQN).
[0026] The model split learning stage within the shard described above includes:
[0027] Step 3-1: Determine the device type. Distributed clients can be divided into two types: LC (FL learning client) and HC (helping clients).
[0028] Step 3-2: Develop the optimal MSA for a given sharding strategy, matching the workload after model splitting with the computing power of intelligent medical devices to ensure the maximum resource utilization rate.
[0029] The shard transmission stage described above includes:
[0030] In each shard, the device type is selected dynamically based on deep reinforcement learning (DRL). The intelligent medical device (LC) will serve as the leader device, responsible for management and data aggregation within the shard. In addition, each shard also includes multiple HC medical devices, which act as subordinate devices to cooperate with the LC device to complete the tasks within the shard. Set LC k to represent the current leader device of shard k, and LC k-1 to represent the previous round's leader device of shard k-1. In each round of communication, the leader LC of the current shardk will receive the model parameter w k-1 from the previous round leader LC k-1 . At this time, the LC device uses its own local dataset for testing and verification. By comparing the accuracy of the new model with that of the previous round model, it evaluates the applicability of the new model. If the current model meets the requirements of the learning task and its verification accuracy meets the set standard, that is, it meets the preset contract conditions for the current round then LC k will broadcast w k-1 and share it with all HC devices within the shard after signing it as the initial training parameter for this shard. In subsequent training rounds, if the LC device passes the model verification, all subordinate HC devices will perform local training and update based on the current model parameters. Under this mechanism, model updates are only broadcast on the blockchain when necessary, which significantly reduces the communication frequency and the burden on the blockchain. If in the current round, the LC device fails to pass the model verification, then LC k will not broadcast the model, but will wait for updates in subsequent rounds and provide the finally trained model parameter w k-1 to the leader device LC of the next shard k+1 as the new initial model parameter. In this way, while ensuring the model quality, the LC device significantly reduces the data transmission overhead inside and outside the shard, making the entire shard architecture more efficient and stable.
[0031] The described model aggregation stage includes:
[0032] Step 4-1: Intra-shard collaborative computing and segmented training. Inside the shard, since each device is only responsible for the calculation of a certain part of the model layers, a complete model update is not generated. Specifically, the devices achieve step-by-step collaboration for forward and backward propagation by passing intermediate activation data layer by layer. After each device completes the calculation of the layer it is responsible for, it passes the result to the next device, thus completing the overall training process of the model. Intra-shard training depends on the layer-by-layer transfer and synchronization between devices to achieve the collaborative goal of split learning, rather than traditional device aggregation.
[0033] Step 4-2: Inter-shard aggregation and global synchronization. In the framework of split learning, the devices inside the shard do not generate independent model parameters, but generate shard-level updates based on the output of collaborative training. Therefore, at the end of each shard epoch, the leader device (such as the LC device) inside the shard summarizes the partial update results obtained from collaborative training within this shard. These updates will be uploaded to the main chain of the blockchain, and the global smart contract will perform inter-shard aggregation. The global layer uses a method similar to weighted average to integrate the update results from different shards and generate global model parameters.
[0034] The advantages of this invention are as follows: 1. It utilizes a federated learning architecture based on blockchain sharding. By combining blockchain sharding technology with the federated learning framework, task allocation and model aggregation between devices are optimized. By assigning devices to different shards, blockchain sharding reduces the system's communication burden while improving the efficiency of data processing and model training. Devices within each shard independently perform local model training, and cryptographic verification and task release are performed through blockchain smart contracts, ensuring data security and transparency. This architecture significantly improves system throughput, enhances system scalability, and effectively reduces bandwidth requirements, thereby improving the system's overall performance and privacy protection capabilities.
[0035] 2. The present invention uses a strategy that combines dynamic sharding and federated learning. Through an adaptive sharding mechanism, the number of shards and task allocation are dynamically adjusted based on the device's computing resources, storage capacity, and bandwidth. Each device only participates in the tasks of its shard, and collaborative training between multiple devices is completed through federated learning. After the device completes model training locally, it only uploads the encrypted model parameters, not the original data, fundamentally preventing the leakage of user data. In this way, the system can efficiently achieve data sharing and joint modeling between devices while ensuring data privacy, improving the accuracy of model training and the effectiveness of data analysis.
[0036] 3. This invention uses federated learning to make data available but invisible. Healthcare scenarios place high demands on data privacy, and federated learning can reduce the risk of data leakage and misuse. Home medical devices have limited resources, so federated learning significantly reduces the bandwidth and storage requirements for large-scale data transmission by eliminating the need to centrally upload data to a server. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The following is a brief description of the contents and symbols in the drawings of the present invention:
[0038] Figure 1 This is a schematic diagram of the blockchain-based federated learning system architecture of the present invention;
[0039] Figure 2 This is a flow chart of the dynamic sharding process based on deep reinforcement learning in the present invention;
[0040] Figure 3 Schematic diagram of determining the optimal number K of shards in the present invention. DETAILED DESCRIPTION
[0041] The specific implementation of the present invention will be further explained in detail below by describing the best embodiment with reference to the accompanying drawings.
[0042] First, the usage scenario of this article, especially the application of medical data in the home medical Internet. In this scenario, an AI model is deployed in the cloud, and the training of the model is based on the data of various medical devices connected to the system for local training. After each device is locally trained, its training results are uploaded to the cloud for aggregation to form a global AI model. This model is then used to provide medical services to users, ensuring that data can effectively participate in model training while protecting privacy. For the training of the AI model, in order to achieve privacy protection and other issues, the optimization method of federated learning is generally used to implement the training of the AI model. However, this method is disadvantageous for the resource-constrained home medical Internet of Things environment. Limited by the data processing capabilities of its own devices, etc., devices with limited computing power cannot meet the computing burden and thus cannot perform effective local training. In order to effectively solve the problems of resource utilization and load balancing in the distributed learning process, this embodiment is used to solve the resource-constrained home medical Internet of Things environment. Through blockchain sharding technology, devices are assigned to different shards for data training, effectively improving the overall throughput of the system, enhancing the scalability and parallel processing capabilities of the system. Each shard runs stably within the shard epoch, and the model is updated through the global blockchain after the epoch ends, thus ensuring data consistency and model generality. A dynamic sharding mechanism is implemented using Deep Reinforcement Learning (DRL), which dynamically adjusts the number of shards and task allocation according to the resource situation of the devices, optimizing resource utilization and load balancing. The Split Learning (SL) technology is used within the shard to split the model into different tasks and allocate them to each device, achieving efficient cooperation through D2D communication, significantly reducing the computing and communication overheads, and enabling resource-limited medical devices to also participate in distributed learning. The specific solution is as follows:
[0043] As Figure 1 shown, a system architecture corresponding to a federated learning optimization method based on blockchain sharding includes two layers: a blockchain layer and a sharding layer.
[0044] The first layer: the blockchain layer. The blockchain layer consists of a single blockchain. Among them, Home Gateways (HGs) can collect transactions and aggregate training parameters to implement the federated learning process. The blockchain is used to record the hash values of the federated learning results to maintain security in an insecure (weak trust) environment. In addition, the blockchain accepts training logic from resource-constrained home medical devices through smart contracts and issues training tasks. Other smart home medical devices can join the blockchain to complete tasks.
[0045] Due to the limited throughput of a single blockchain (the decentralized nature of the blockchain determines that all nodes need to participate in the verification and processing of transactions, which limits the system throughput as the network scale expands. Blockchain sharding divides nodes and transactions into multiple subsets (shards), and each shard can independently process its own transactions, allowing parallel processing and significantly improving the overall system throughput), the blockchain layer can dynamically configure multiple shards with consensus, data size, and the number of shards to divide smart home medical devices into different networks in different shard epochs. Smart home medical devices from shards can train highly accurate and generalizable machine learning models to provide medical services to users.
[0046] The second layer: the sharding layer. Within each shard, smart home medical devices are responsible for collecting environmental data and forming data sets. Through the smart contracts of the blockchain, these devices receive and execute model training tasks and then complete specific training processes. Each smart medical device within a shard participates in the tasks within the shard as a "follower" and acts as a "worker" in the federated learning (FL) and split learning (SL) processes to collaboratively perform model training and data transmission tasks within the shard. Each shard is stable within a shard epoch. When the epoch ends, the training results of all shards are integrated and uploaded to the blockchain for global aggregation to ensure model updates and accuracy.
[0047] The specific process includes a registration stage, a task publishing stage, a dynamic sharding establishment stage based on deep reinforcement learning, a model split learning stage within shards, a shard transmission stage, and a model aggregation stage. The six stages of this system architecture are as follows:
[0048] 1. The registration stage of smart medical devices on the blockchain is specifically as follows:
[0049] Step 1-1: Authentication request: Smart medical devices first send an authentication request to the blockchain network. This request contains basic information about the device, such as the device type (smartwatch, sphygmomanometer, etc.) and the FL training resources required by the device. The network will verify the initial eligibility of the device to confirm whether the device meets the basic conditions for entering the blockchain network.
[0050] Step 1-2: Generate an account and key pair: The smart medical device that has passed the preliminary verification will obtain a unique account address and key pair (public key and private key) assigned by the blockchain network. This key pair will be used for device authentication and data encryption to ensure the security of data transmission. The generation and management of the public key and private key adopt security algorithms to prevent external attacks and identity forgery.
[0051] Step 1-3: Allocate identity authentication certificates: The blockchain network issues identity authentication certificates to devices to prove the legitimacy of their identities. The certificate includes the device's account address and public key, and is accompanied by the digital signature of the blockchain network. The identity authentication certificate will be used to verify the device's legal identity when it participates in FL training and data sharing, ensuring that only authenticated devices can enter the network to perform tasks. FL training is federated learning training.
[0052] Step 1-4: Bind smart contracts: After the device registration is completed, the device is bound to the smart contract in the blockchain so that the smart contract can manage the device's permissions and task allocation. The smart contract will mark the device bound with the smart contract as an authenticated participant, allowing it to receive tasks and report training results. The binding process can be achieved by calling the registration function of the smart contract, and the smart contract will record the relevant information and permissions of the device.
[0053] Step 1-5: Transaction verification and recording: The registered device can perform transaction verification. The device can confirm the legitimacy of its actions by signing transactions, such as participating in training tasks, submitting model updates, etc. The signed transactions will be recorded on the blockchain to ensure the transparency and immutability of the transactions. The transaction records provide an audit trail for the device's actions, facilitating post-event verification and traceability.
[0054] Step 1-6: Prepare for task allocation: Once the device is registered, it will be given certain permissions to receive shard tasks. The device will obtain the initial task information and training parameters according to the guidance of the smart contract. After receiving the task, the device can start local training and prepare to participate in the distributed model update.
[0055] 2. The specific task release phase is as follows:
[0056] In the case where multiple intelligent medical devices are connected to the smart contract, the initiator of the training requirement is usually issued by a certain designated device or proxy device in the system. Specifically, the training requirement is not issued by any device randomly, but is determined by the preset rules in the system or the policies in the smart contract. For example, the system may specify a certain device as the initiator of the task, usually a device with stronger resources, or select a suitable device to initiate the training task through the scheduling algorithm of the smart contract. This device submits the training requirement to the blockchain, and other devices receive and execute the tasks according to the requirement, thus jointly completing the model training process. The requirements include the model, test set, shard configuration, local training epochs τ, and global communication rounds The specific parameters in the requirements will be referenced in the reinforcement learning shard phase.
[0057] The signed transactions in the blockchain are broadcast to the intelligent medical devices in the blockchain to set up shards to execute training tasks. The intelligent medical devices are divided into shards according to their account addresses on the blockchain. The signed transactions are the genesis transactions of the shards. The medical devices will sign these transactions to ensure the legitimacy of the tasks and broadcast these signed transactions to other intelligent medical devices in the blockchain network. These signed transactions not only help the medical devices participate in the tasks but also provide the necessary information for the medical devices in the shards to execute the tasks. The genesis transactions write the training tasks into the shards so that the medical devices in the shards can understand and execute the tasks.
[0058] 3. The specific process of establishing dynamic shards based on deep reinforcement learning is as follows:
[0059] Step 2-1: Resource awareness. A mechanism that divides the set of N intelligent medical devices participating in training after registration, hereinafter collectively referred to as these intelligent treatment devices as participants, into K non-overlapping shards, that is, to determine the number of shards K. The sharding is carried out on the server (base station) to protect the resources of the medical devices. During this process, the base station obtains three kinds of hardware resources and one kind of software resource from all medical devices, namely the processing speed, data transmission rate, available memory, and dataset size, which are respectively represented as s i (1 ≤ i ≤ N) of intelligent medical device p i , r i and a i , D i . s i and a i are machine-related parameters that depend on the device configuration. The data transmission rate r i depends on the bandwidth, channel coefficient, and path loss between the medical device and the base station and is estimated. The static information of s i , r i and a i from the participants is used to determine the number of shards K and the subsequent model splitting and allocation strategy MSA. Therefore, we use a vector V i = [s i , r i , a i , D i to represent the various index capabilities of the intelligent medical device p i . The specific steps are as Figure 3 shown.
[0060] Step 2-2: Determine the optimal number K of shards. When performing sharding, ensure the following: 1) The resources of each shard are relatively balanced to achieve load balancing of the entire system. 2) Ensure that the devices in each shard can cooperate efficiently in terms of processing speed, data transmission rate, and available memory to avoid resource bottlenecks. 3) The number of shards K should not be too large to avoid increased complexity, nor too small to prevent excessive devices within a single shard, resulting in resource competition. Specific steps: First, in order to comprehensively evaluate the processing power, transmission capacity, and storage capacity of the devices, it is necessary to standardize the three resource parameters of each device. The standardization of s i is as follows. r i , a i is also standardized in the same way.
[0061]
[0062] Where: s i ′, r i ′, a i ′ are the standardized values of the processing speed, data transmission rate, and available memory of intelligent medical device i, respectively, with a range between [0, 1]. min(s), max(s), min(r), max(r), min(a), max(a) represent the minimum and maximum values of the corresponding resource parameters of all devices. Through standardization, the dimensional differences between different resource types can be eliminated, enabling medical devices to have the same weight during clustering. Based on the standardized parameters of each device, we calculate a comprehensive evaluation index C i to describe the overall resource situation of each medical device.
[0063] C i = αs i ′ + βr i ′ + γa′ i
[0064] Where: α, β, γ are weight coefficients, satisfying α + β + γ = 1. These weight coefficients can be adjusted according to actual application requirements. For example, if the data transmission rate is more critical, then β can take a higher value. Sum up the comprehensive evaluation index C i of all devices to obtain the total resource demand C total of all devices: Use the sharding threshold T (set the specific value according to the type of participating devices and the specific scenario of use) to estimate the appropriate number of shards k. In an ideal situation, the total resources of each shard should not exceed T. Therefore,
[0065] Step 2-3: Adaptive sharding mechanism based on Deep Q-Network (DQN). The execution process is asFigure 2 as shown
[0066] a) State space: The total number N of intelligent medical devices in all slices, the vector group VG of the device set = {V1, V2, … V N}, the number of slices K, and a specific global communication round Therefore, the state space can be expressed as
[0067] b) Action space: Multiple actions should be taken to adapt to the dynamic environment. It includes the specific situation of each slice, the number of devices in different slices SG = {S1, S2,....S K}, where S1 represents the number of devices in slice 1, Sk corresponds to the number of devices in slice K, the serial number of the LC device in the slice, where the LC device represents the learning device within the slice, and the data input of the federated learning model starts from this device, and the slice consensus algorithm δ. Therefore, the action space can be expressed as A t = [SG, L, δ] t , where L = l i , l i ∈ {0, 1}. When l i = 1, the medical device is selected as the LC device of the slice, otherwise l i = 0. δ = {0, 1, 2, …} represents different consensus algorithms in the slice, such as RAFT (distributed formula algorithm), PBFT (practical Byzantine fault tolerance algorithm), and VRF (verifiable random function algorithm).
[0068] c) Reward function: The slice takes actions to obtain the next state and gets the reward function according to the feedback. The reward function is used to maximize the utilization rate of the slice and can be expressed as:
[0069]
[0070]
[0071] Among them, λ1, λ2, and λ3 are weight parameters used to adjust the influence of each index on the total reward. is the comprehensive resource utilization rate, represents the degree of load balancing, represents the overall communication efficiency.
[0072] In addition, there are two maximum value limits. K max is the maximum number of slices, and M max is the maximum data size.
[0073]
[0074] If the constraints C1 and C2 are satisfied, a reward is obtained. If the constraint conditions are not met, it is 0.
[0075] d) Interaction process: An agent refers to an entity that executes a policy, interacts with the environment, and continuously learns to optimize its behavior. In this scenario: The agent is the part responsible for learning and decision-making, usually a deep neural network, such as a Q-network or a policy network. It selects an action based on the current state and receives a reward from the environment. At each time step, the agent observes the state of the environment, selects an action, and then the environment feedbacks a new state and a reward according to this action. The agent learns how to take optimal actions in different states through this interaction to maximize the cumulative reward.
[0076] In the sharding system of deep reinforcement learning, the goal of the agent is to optimize the sharding configuration according to the state information of the system (such as the number of shards, communication efficiency, etc.) to achieve higher throughput and resource utilization. The DQN agent obtains the current state at the beginning of each round, selects an action according to the exploration strategy (such as randomly selecting or selecting the optimal action according to the Q-value). After executing the action, the system returns a new state and a reward, and the agent stores this information in the experience replay pool for subsequent learning.
[0077] e) Model update: In the learning phase, randomly sample batches of samples from the experience replay pool and update the parameters of the Q-network by minimizing the loss function. The loss function is:
[0078]
[0079] where N represents the total number of samples in the dataset. y i is the true label or target value of the i-th sample. Q ω (s i , a i ) represents the predicted value calculated through the parameter set ω under the input s i and a i .
[0080] f) Repeat training: The above process is continuously repeated until the agent converges in the given environment and learns the optimal sharding configuration strategy.
[0081] 4. The specific process of the in-shard model split learning phase is as follows:
[0082] In the sharding structure, split learning technology is adopted to divide the training task of the model into multiple sub-parts and allocate them to each participating device for collaborative computing. In this way, each device only needs to process a part of the model, thus significantly reducing the computational burden. In addition, the D2D communication method allows devices to directly transmit data without relying entirely on the central node or cloud server, which helps to reduce data transmission latency and improve the network response speed. After each device completes its sub-task, it can exchange intermediate model results with adjacent devices, and finally complete the training of the global model through multiple rounds of iteration. At the same time, D2D edge collaboration can also dynamically adjust the task allocation strategy according to the resource status of the device to maximize resource utilization. In this collaborative framework, the computing and communication resources between edge devices are fully utilized, and the overall model accuracy of the system is effectively improved. In this way, we can not only relieve the computational pressure of intelligent medical devices with limited resources, but also establish a reliable model update mechanism between devices, enabling the system to maintain stable performance in resource-constrained environments. Therefore, the combination of split learning within the shard and the D2D communication method provides an efficient and low-cost solution for low-power devices, which can meet the diverse computing needs in the intelligent medical environment.
[0083] It is assumed that the D2D communication links between pairwise medical devices are mutually reachable and have the same data rate. Specifically, distributed clients can be divided into two types: LC (FL learning client) and HC (helping clients). Among them, HC devices are devices that help LC devices learn within the shard, used to complete part of the model training and transfer intermediate activation values, which depends on whether they have data available for FL model training. The LC devices within the shard are determined together based on DRL dynamic sharding, and the remaining devices are considered HC devices. HC devices help LC devices complete FL training and co-train the FL model. The model is divided into multiple model segments in the cluster, where each shard member trains one model segment.
[0084] Within each learning shard, shard members collaborate to train the FL model by splitting the complete model into model segments and allocate these segments to shard members according to the MSA algorithm. Assume that the model can be divided into at most Q model segments, with Q - 1 split points, denoted as Q = {1, 2,..., Q - 1}. Let the binary variable s k,q represent the split layer selection status of split layer q ∈ Q, where s k,q = 1 indicates that split layer q is selected, otherwise s k,q = 0. Therefore, the MSA policy profile of shard k can be represented by the vector s k = {s k,1 , s k,2 , … sk,Q-1 It is represented by. It should be noted that the applicable intra-shard model segmentation and allocation strategy, the MSA strategy, should always allocate the model segment containing the input layer to the LC, because FL training always starts from the LC.
[0085] Given a shard k with n k devices, a complete FL model should be segmented into n k model segments by selecting n k - 1 different segmentation layers under an MSA strategy s k such that each shard member should hold one and only one model segment, and the devices with corresponding computing capabilities should be matched according to the computational workload of each segmented model segment, achieving the maximum resource utilization and the lowest communication and computational costs. In this way, the shard members can be transformed into a chain in the order of the model segments. For clarity, each cluster member can only forward the output of its own model execution to its predecessor or successor in the chain.
[0086]
[0087] where s k,q represents the allocation status of the q-th cut point in the k-th shard. Q is the number of parts into which the model of each shard is cut. represents the set of all devices participating in the learning process. n k is the number of devices in the k-th shard.
[0088] If a device may not have computing resources (e.g., acting as a communication relay), then a virtual model segment with zero computational workload will be allocated to it. Assuming that the given device sharding strategy SG is determined by DRL-based dynamic sharding and is a Hamiltonian path of length n k , then the optimal MSA strategy s k is to select n k - 1 cut points from Q - 1 cut points to allocate n k model segments to the devices. Algorithm III refers to the heuristic MSA algorithm based on SG, and the algorithm is introduced as follows:
[0089] Input:
[0090] SG, {C1, C2,..., C nk}, the computational workloads of all Q layers:
[0091] Output:
[0092] Sk
[0093] 1), Initialize the last selected layer q = 0;
[0094] 2) Calculate the computing workload of each client i, with the formula as
[0095]
[0096] 3) For each client i = 1:nk, execute the following steps:
[0097] Calculate the cumulative computing workload starting from partition layer q until the following condition is met:
[0098]
[0099] 4) Update partition layer q = q`, and update s k Update s to s k ←s k , q = 1
[0100] 5) End
[0101] 5. The specific process of the shard transmission stage is as follows:
[0102] An improved scheme based on a streamlined interaction mechanism. In each shard, the type of device is dynamically selected based on deep reinforcement learning (DRL). The intelligent medical device (LC) will act as the leader device, responsible for management and data aggregation within the shard. In addition, each shard also includes multiple HC medical devices, which act as subordinate devices to cooperate with the LC device to complete the tasks within the shard. Let LC k represent the current leader device of shard k, and LC k-1 represent the previous round's leader device of shard k - 1.
[0103] In each round of communication, the current shard's leader LC k will receive the model parameter w k-1 from the previous round's leader LC k-1 . At this time, the LC device uses its own local dataset for testing and verification. By comparing the accuracy of the new model with that of the previous round's model, it evaluates the applicability of the new model. If the current model meets the requirements of the learning task and its verification accuracy meets the set standard, that is, it meets the preset contract conditions for the current round then LC k will broadcast w k-1 and share its signature with all HC devices within the shard as the initial training parameters for this shard. In subsequent training rounds, if the LC device passes the model verification, all subordinate HC devices will perform local training and update based on the current model parameters. Under this mechanism, model updates are only broadcast on the blockchain when necessary, significantly reducing the communication frequency and the burden on the blockchain. If in the current round, the LC device fails to pass the model verification, then LC kInstead of broadcasting the model, it will wait for updates in subsequent rounds and provide the finally trained model parameters w k-1 to the leader device LC of the next shard k+1 as the new initial model parameters. In this way, while ensuring the model quality, the LC device significantly reduces the data transmission overhead inside and outside the shards, making the entire sharding architecture more efficient and stable.
[0104] This dynamic selection mechanism based on streamlined interaction not only improves the data transmission efficiency between shards but also optimizes the resource allocation between devices, making the entire system more scalable and stable in actual deployment.
[0105] 6. The model aggregation phase is specifically as follows:
[0106] In a federated learning system based on sharding, model aggregation is a key step to ensure that devices within different shards form a consistent model during collaborative training. Since split learning is adopted within the shards, devices no longer train the complete model independently but are only responsible for the calculation of some layers of the model. This mechanism has a new method in model aggregation.
[0107] Step 4-1 Intra-shard collaborative calculation and segmented training. Within the shard, since each device is only responsible for the calculation of a certain part of the model layers, a complete model update is not generated. Specifically, devices collaborate step by step in forward and backward propagation by passing intermediate activation data layer by layer. After each device completes the calculation of the layer it is responsible for, it passes the result to the next device, thus completing the overall training process of the model. Intra-shard training relies on layer-by-layer transfer and synchronization between devices to achieve the collaborative goal of split learning, rather than traditional device aggregation.
[0108] Step 4-2 Inter-shard aggregation and global synchronization. Under the framework of split learning, devices within the shard do not generate independent model parameters but generate shard-level updates based on the output of collaborative training. Therefore, at the end of each shard epoch, the leader device (such as the LC device) within the shard aggregates the partial update results obtained from collaborative training within the shard. These updates will be uploaded to the main chain of the blockchain, and the global smart contract will perform inter-shard aggregation. The global layer uses a method similar to weighted average to integrate the update results from different shards to generate global model parameters:
[0109]
[0110] where K is the total number of shards, w (t+1) represents the global model parameters, is the aggregated update of shard k, and β k is the weight of the shard, which is determined according to the data volume and the quality of the model update.
[0111] The technical solution of the present invention protects data privacy during the process of federated learning based on blockchain sharding, and can effectively solve the problem of privacy leakage of data in distributed learning. Through the cooperation of the adaptive sharding mechanism and the blockchain smart contract, the present invention realizes multi-level privacy protection during the data transmission and model aggregation processes between devices. The adaptive sharding mechanism dynamically adjusts the number of shards and task allocation according to the computing power, bandwidth, and storage resources of the devices, optimizing resource utilization and reducing communication overhead. The blockchain smart contract encrypts and verifies the task execution, device authentication, and model update processes to ensure the security and transparency of all operations. This mechanism not only protects data privacy but also improves the throughput and parallel processing capabilities of the system.
[0112] This method combines blockchain sharding technology with the federated learning architecture, improving computational and communication efficiency while ensuring data privacy. By allocating devices to different shards for model training, each device only needs to upload encrypted model parameters, avoiding the leakage of raw data. The decentralized feature of the blockchain ensures the security of the data transmission process. At the same time, the data aggregation within the shards is encrypted and protected by the smart contract, further enhancing data privacy and the reliability of the system. This architecture not only improves the efficiency of multi-device collaborative learning but also effectively solves the data silo problem, enabling distributed devices to share the advantages of the model while maintaining data privacy.
[0113] Obviously, the specific implementation of the present invention is not limited by the above methods. As long as various non-substantive improvements are made using the method concept and technical solution of the present invention, they are within the protection scope of the present invention.
Claims
1. A federated learning optimization method based on blockchain sharding, characterized in that: It includes allocating devices to different shards through the blockchain sharding method for data training. Each shard operates stably within a shard epoch, and model updates are achieved through the global blockchain after the epoch ends. Dynamically adjust the number of shards and task allocation according to the resource situation of the devices. Within the shard, the model is divided into different tasks and assigned to each device for learning.
2. The federated learning optimization method based on blockchain sharding according to claim 1, characterized in that: The method includes a blockchain layer and a sharding layer. The blockchain layer consists of a single blockchain. Among them, home gateways (HGs) can collect transactions and aggregate training parameters to achieve the federated learning process. The blockchain is used to record the hash values of the federated learning results to maintain security in the environment. The blockchain accepts training logic from home medical devices with limited computing resources through smart contracts and issues training tasks. Other smart home medical devices can join the blockchain to complete tasks. Blockchain sharding divides nodes and transactions into multiple shards, and each shard can independently process its own transactions, thus allowing parallel processing. The blockchain layer can dynamically configure multiple shards with consensus, data size, and the number of shards to divide smart home medical devices into different networks during different shard epochs. Smart home medical devices from the shards train highly accurate and generalizable machine learning models to provide medical services for users. Sharding layer: Within each shard, smart home medical devices are responsible for collecting environmental data and forming a dataset. Through the smart contract of the blockchain, the devices receive and execute model training tasks, and then complete the training process. Each smart medical device within the shard participates in the tasks within the shard as a "follower" role and acts as a "worker" during the federated learning and split learning processes, collaborating on model training and data transmission tasks within the shard. Each shard is stable within a shard epoch. When the epoch ends, the training results of all shards will be integrated and uploaded to the blockchain for global aggregation to ensure model updates and accuracy.
3. A federated learning optimization method based on blockchain sharding according to claim 1, characterized in that: A dynamic sharding mechanism is implemented using deep reinforcement learning to dynamically adjust the number of shards and task allocation according to the resource situation of the devices. Split learning technology is used within the shard to divide the model into different tasks and assign them to each device.
4. A federated learning optimization method based on blockchain sharding according to any one of claims 1-3, characterized in that: When learning using the optimization method, the following steps are included: registration phase, task publishing phase, dynamic sharding establishment phase based on deep reinforcement learning, in-shard model split learning phase, shard transmission phase, and model aggregation phase.
5. An optimized federated learning method based on blockchain sharding according to claim 4, characterized in that: The registration phase of smart medical devices participating in learning on the blockchain includes: Step 1-1: Authentication request: The smart medical device first sends an authentication request to the blockchain network, and the blockchain network verifies the initial qualifications of the device to confirm that the device meets the basic conditions for entering the blockchain network. Step 1-2: Generate an account and key pair: The smart medical device that has passed the preliminary verification will obtain a unique account address and key pair assigned by the blockchain network. The key pair includes a public key and a private key. This key pair will be used for device authentication and data encryption to ensure the security of data transmission. Step 1-3: Allocate identity authentication certificates: The network issues identity authentication certificates to devices to prove the legitimacy of their identities; the certificates include the device's account address and public key, and are accompanied by the digital signature of the blockchain network; the identity authentication certificates will be used to verify the legal identities of the devices when they participate in FL training and data sharing, ensuring that only authenticated devices can enter the network to execute tasks; Step 1-4: Smart contract binding: After the device registration is completed, it will be bound to the smart contract in the blockchain so that the smart contract can manage the device's permissions and task allocation; the smart contract marks the device as an authenticated participant, allowing it to receive tasks and report training results; the binding process is achieved by calling the registration function of the smart contract, and the smart contract will record the relevant information and permissions of the device; Step 1-5: Transaction verification and recording: The registered device can perform transaction verification; the device confirms the legitimacy of its actions by signing the transaction, and the signed transaction will be recorded on the blockchain to ensure the transparency and immutability of the transaction; the transaction record provides an audit trail for the device's actions, facilitating post-event verification and traceability; Step 1-6: Prepare for task allocation: Once the device registration is completed, the device will be given the permission to receive shard tasks; the device will obtain the initial task information and training parameters according to the guidance of the smart contract; after receiving the task, the device starts local training and prepares to participate in the distributed model update.
6. The federated learning optimization method based on blockchain sharding according to claim 5, wherein: The task release phase includes: The medical device writes the training requirements into the queue through the interface provided by the smart contract; the requirements include the model, the test set, the shard configuration, the local training period τ, and the global communication rounds The signed transaction is broadcast to the smart medical devices on the blockchain to set up shards to execute the training task; the smart medical devices are divided into shards according to their account addresses on the blockchain; the signed transaction is the genesis transaction of the shard; the medical device will sign the signed transaction to ensure the legality of the task and broadcast the signed transaction to other smart medical devices in the blockchain network; the signed transaction not only helps the medical device participate in the task, but also provides the information for the medical devices in the shard to execute the task; the genesis transaction writes the training task into the shard so that the medical devices in the shard can understand and execute the task.
7. The architecture of a federated learning system based on blockchain sharding as claimed in claim 5, characterized in that, The dynamic sharding establishment phase based on deep reinforcement learning includes: Step 2-1: Resource Awareness: In this process, the base station obtains three types of hardware resources and one type of software resource from all medical devices, namely processing speed, data transmission rate, available memory, and dataset size, denoted as p i (1 ≤ i ≤ N) of s i , r i and a i , D i ; s i and a i are machine-related parameters dependent on device configuration; the data transmission rate r i depends on the bandwidth, channel coefficients, and path loss between the medical device and the base station and is estimated; the static information of s i , r i and a i from the participants is used to determine the number of shards k and the MSA; the vector V i = [s i , r i , a i , D i represents the various index capabilities of the intelligent medical device p i participating in the training; Step 2-2: Determine the optimal number K of shards; in this process, the mechanism of dividing the set of N participants into k non-overlapping shards, that is, determining the number of shards K; Step 2-3: Perform shard control based on the adaptive sharding mechanism of the deep Q-learning network.
8. The federated learning optimization method based on blockchain sharding according to claim 5, wherein: The model split learning phase within the shard includes: Step 3-1: Determine the device type; distributed clients can be divided into two types: LC and HC; Step 3-2: Develop the optimal MSA for a given sharding strategy, matching the workload after model splitting with the computing power of the intelligent medical device to ensure the maximum resource utilization rate.
9. The federated learning optimization method based on blockchain sharding according to claim 5, characterized in that: The shard transmission phase includes: In each shard, the type of the device is selected dynamically based on deep reinforcement learning for sharding. The intelligent medical device will serve as the leader device, responsible for management and data aggregation within the shard. Each shard also includes multiple HC medical devices, which, as subordinate devices, cooperate with the LC devices to complete tasks within the shard. Let LC k represent the current leader device of shard k, and LC k-1 represent the previous round's leader device of shard k - 1. In each round of communication, the leader LC k of the current shard will receive the model parameter w k-1 from the previous round's leader LC k-1 . At this time, the LC device uses its own local dataset for testing and verification. By comparing the accuracy of the new model with that of the previous round's model, it evaluates the applicability of the new model. If the current model meets the requirements of the learning task and its verification accuracy meets the set standard, that is, it meets the preset contract conditions for the current round , then LC k will broadcast w k-1 and share it with all HC devices within the shard after signing it as the initial training parameters for this shard. In subsequent training rounds, if the LC device passes the model verification, all subordinate HC devices will perform local training and update based on the current model parameters. If, in the current round, the LC device fails to pass the model verification, then LC k will not broadcast the model but will wait for updates in subsequent rounds and provide the finally trained model parameter w k-1 to the leader device LC k+1 of the next shard as the new initial model parameters.
10. A federated learning optimization method based on blockchain sharding according to claim 5, characterized in that: The model aggregation phase includes: Step 4-1: Intra-shard collaborative computing and segmented training; within the shard, devices achieve step-by-step collaboration for forward and backward propagation by passing intermediate activation data layer by layer; after each device completes the calculation of the layer it is responsible for, it passes the result to the next device, thus completing the overall training process of the model; the training within the shard depends on the layer-by-layer transmission and synchronization between devices to achieve the collaborative goal of split learning; Step 4-2: Inter-shard aggregation and global synchronization; in the framework of split learning, the devices within the shard generate shard-level updates based on the output of collaborative training; at the end of each shard epoch, the leader device within the shard summarizes the partial update results obtained from collaborative training within the shard, and the update results will be uploaded to the main chain of the blockchain, and the global smart contract will perform inter-shard aggregation; at the global level, a method similar to weighted average is used to integrate the update results from different shards to generate global model parameters.
Citation Information
Cited By
Fragmented block chain federal learning method based on large language model multi-agent
CN121413712A
Large language model multi-agent based federated learning method for sharded blockchain
CN121413712B