A personalized federated learning method and device based on super network and blockchain
By using hypernetwork and blockchain technologies to generate personalized federated learning methods, this approach addresses the issues of insufficient model personalization and security in federated learning, improves prediction accuracy and reliability, and reduces the risk of data leakage.
Patent Information
- Application Number
- CN202211335052.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-10-28
AI Technical Summary
Federated learning suffers from problems such as insufficient model personalization capabilities, decreased prediction performance, performance degradation when new labels are added, high risk of data leakage, and insufficient trust between nodes.
We employ a personalized federated learning approach based on hypernetworks and blockchain. We obtain encrypted label vectors through the blockchain network to generate personalized local models. We optimize model allocation using Fisher information matrix and VCG auction process to improve the personalization capability and security of the models.
It improves the model's prediction accuracy under local dataset distribution conditions, enhances the model's continuous learning performance and reliability, and reduces the risk of data leakage.
Smart Images

Figure CN115545223B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of federated learning methods, and particularly relates to a personalized federated learning method and device based on a super network and a blockchain. BACKGROUND
[0002] Federated learning (FL) is a method of distributed neural network training, which enables multiple terminals to collaboratively train a shared neural network model while ensuring that the training data exists on the terminals. In the federated learning process, there is a problem of insufficient individualization of the model for edge nodes, and the prediction performance greatly decreases when encountering new labels. Meanwhile, in the federated learning, the model is vulnerable to attacks in the network transmission process, and the model is stolen by the thief, thereby causing data leakage. Moreover, in the federated learning process, each node lacks trust in other nodes and is unwilling to provide data for training model sharing. SUMMARY
[0003] To solve the problems in the background art, the first aspect of the application provides a personalized federated learning method based on a super network and a blockchain, which is applied to a scene of a federated center node and K federated edge computing nodes. Each edge computing node is connected to the federated center node. The method comprises the following steps:
[0004] Step 1: The federated edge computing node receives the super model HNet initialized by the federated center node, and starts the federated learning process.
[0005] Step 2: The federated edge computing node initializes a node identification vector V, and obtains a label encryption vector of the node through a blockchain network.
[0006] Step 3: The federated edge computing node inputs the node identification vector and the label encryption vector into the super model issued by the federated center node, to generate a local model LocalNet.
[0007] Step 4: The federated edge computing node trains the local model LocalNet by using a local data set D, to obtain a gradient change Δθ after training.
[0008] Step 5: The federated edge computing node calculates a gradient change Δφ of the super model according to the gradient change Δθ of the local model, and sends the gradient change to the federated center node.
[0009] Step 6: The federated edge computing node sends the gradient change Δφ of the super model to the federated center node. The federated center node averages all the gradient changes, and updates the averaged gradient change of the super model to the super model HNet by using the gradient descent method.
[0010] Step 7, the federal edge computing node receives the updated super model sent by the federal center node, and repeats steps 2 to 6 until the specified round is reached;
[0011] Step 8, the federal edge computing node generates a node model using the super model finally generated in step 7, evaluates the Fisher information matrix, submits its Fisher information matrix through a blockchain smart contract, evaluates the model value, and finally obtains personalized layer parameters matched with itself, and integrates the obtained personalized layer parameters into the personalized layer of the local model.
[0012] Preferably, the label encryption vector of the node is obtained through the network of the blockchain in step 2, and the encryption vector is obtained through the blockchain network before training and includes the following process:
[0013] S21, using SIBFT consensus algorithm in the blockchain, dividing the consensus network into multiple subnets, and electing subnet leader nodes SLL and subnet candidate leader nodes SCL in each subnet;
[0014] S22, using the label vector Label vector received from the node by the receiving label function in the smart contract, the subnet leader node SLL verifies whether the node contains data with the label to ensure the authenticity of the information;
[0015] S23, after verification, the encryption label function in the smart contract generates a public key using the RSA encryption algorithm, asymmetrically encrypts Label vector using the public key, and distributes it to the federal edge computing node with the Label.
[0016] Preferably, the specific process of generating the local model LocalNet in step 3 is:
[0017] S31, input the node identification vector V and the label encryption vector e into the Embedding module of the super network HNet;
[0018] S32, the Embedding module of the super network HNet generates an intermediate quantity Embed recognized by the parameter module;
[0019] S33, input the generated Embed into the generated parameter module composed of a multi-layer automatic perception machine to generate the parameter feature Features of the model;
[0020] S34, input the parameter feature Features into the parameter storage module to generate the weight and bias of each layer network of the main body of the local model LocalNet;
[0021] S35, fill in the model class according to the generated local model LocalNet main body layer weight and bias, load into the model available for training and use.
[0022] Preferably, the local model LocalNet contains a layer of localization layer, as follows:
[0023] Each federal edge computing node contains a local model belonging to the node, and the local model contains a model main body and a layer of fully connected layer for localization;
[0024] Wherein the model main body is generated by the super network HNet before each training, and the localization layer is initialized by the local before the first training, and the remaining rounds are retained after the previous training at the local node;
[0025] When the federal edge node uses local data for training, the data is first input to the model main body, the output of the model main body is used as the input of the individualization layer, and the output of the individualization layer is used as the output of the whole model. Each part is respectively subjected to gradient descent to update the model parameters.
[0026] Preferably, the super network HNet outputs different models according to the input label encryption vector, which has the function of model encryption, and the encryption specific method is as follows:
[0027] When the correct label encryption vector is input to the super network HNet, the output model can correctly predict the label of the local data, and when the wrong or illegal label vector is input, the model output by the super network HNet cannot correctly predict the label of the local data.
[0028] Preferably, the specific process of step 8 is as follows:
[0029] S81, each federal edge node modifies the node identification vector, and inputs the modified node identification vector and its own label encryption vector into the super model HNet to obtain the model of each node model relative to its own label distribution;
[0030] S82, calculate the Fisher information matrix according to the generated models and the local model LocalNet, and obtain the Fisher information value, which identifies the correlation between the models of other nodes and the local model of the node;
[0031] S83, submit the obtained Fisher information matrix to the blockchain through the smart contract of the blockchain;
[0032] S84, the blockchain collects the Fisher information matrix submitted by each federal edge node, and calculates the actual value of each node model and the optimal model distribution mode of global benefit through the VCG auction process;
[0033] S85, each node obtains a local personalized layer from the corresponding node according to the model allocated by the blockchain, and performs average federation of the local personalized layers to obtain a federated local personalized layer.
[0034] Preferably, the specific process of calculating the actual value of each node model and the optimal model allocation mode of global benefits through the VCG auction process is as follows:
[0035] S841, a two-dimensional array with accuracy N*N calculated by the Fisher information matrix is taken as the input of the VCG mechanism calculation, and the Fisher value of each node to other node models can be regarded as the bid of the node to other models;
[0036] S842, the global maximum value MaxValue and the model allocation mode under the condition of obtaining the global maximum value, and the global maximum value after removing each node are calculated by using the KM algorithm;
[0037] S843, then the actual value RealCost of each node model is calculated by subtracting N times;
[0038] S844, the actual value of each model and the model allocation mode with the maximum global value are taken as the output and output.
[0039] Preferably, the super model HNet includes an Embedding module, a generated parameter module and a parameter storage module;
[0040] The Embedding module is used to convert the input node identification vector V into an intermediate quantity Embed which can be identified by the generated parameter module;
[0041] The generated parameter module is a multi-layer automatic perception machine, which is used to generate parameter features Features according to the input intermediate quantity Embed;
[0042] The parameter storage module generates the weight and bias quantity of the target network layer according to the target network structure to be generated, and each target network layer corresponds to two linear layers of the parameter storage module.
[0043] The second aspect of the present application also provides a personalized federated learning device based on a super network and a blockchain, which comprises at least one processor and at least one memory, and the processor and the memory are coupled; the memory stores a computer execution program; when the processor executes the computer execution program stored in the memory, the device executes the personalized federated learning method based on the super network and the blockchain as described in the first aspect.
[0044] The third aspect of the present application also provides a computer-readable storage medium, which stores programs or instructions and data, and the programs or instructions are executed by a processor to make a computer execute the personalized federated learning method based on a super network and a blockchain as described in the first aspect.
[0045] Compared with the prior art, the present application has the following advantages and beneficial effects:
[0046] Personalization capability. The super model can generate different models for each federated edge node according to the label distribution of each federated edge node, while in the traditional algorithm, the entire network uses the same model. This can make the generated model more suitable for the local data set distribution, improving the accuracy of model prediction. On the other hand, through the Fisher matrix calculation and VCG auction process of the blockchain, the node can find similar nodes for personalized layer federation, which can improve the accuracy of the local model.
[0047] Security performance. This method requires the use of correct label encryption vectors to enable the super model to generate correct models. If the input is an incorrect label encryption vector, the generated model cannot accurately predict.
[0048] Continuous learning performance. By inputting the label encryption vector of the new label to be predicted into the super network, a model for a label that has not been trained by the federated edge node can be generated, which also has good prediction effect. When the federated edge node encounters a new label, the continuous learning performance of the model can be improved.
[0049] Trustworthiness. This method can improve the trustworthiness of each federated edge node participating in training by passing the label encryption vector and performing VCG auction through the blockchain consensus. BRIEF DESCRIPTION OF DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the following description is only one embodiment of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0051] Figure 1 The flowchart of the personalized federated learning method based on a super network and a blockchain from the perspective of a federated edge computing node.
[0052] Figure 2 The flowchart of generating a local model using a super network and a blockchain.
[0053] Figure 3The flowchart of the contribution degree calculation based on the blockchain generated encryption label and the VCG auction mechanism of the application.
[0054] Figure 4 The simple block diagram of the structure of the personalized federated learning device based on the super network and the blockchain provided by the application. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments of the application, all other embodiments obtained by those skilled in the art without creative work are within the scope of the application.
[0056] Embodiment 1
[0057] In this embodiment, the personalized federated learning method based on the super network and the blockchain is further described by taking the federated learning training of the LeNet model on the Cifar10 dataset as an example.
[0058] Step 1: The federated center node initializes the super model HNet, sends the initialized super model HNet to each federated edge computing node, and starts the federated learning process.
[0059] The specific steps of initializing the super model HNet are as follows:
[0060] The federated center node generates an Embedding layer, an automatic perception machine including three fully connected networks, and a parameter storage module including eight fully connected networks, and assembles them into the super model HNet.
[0061] Step 2: The federated edge computing node initializes the node identification vector V. The label encryption vector of the node is obtained through the blockchain network.
[0062] In this step, the node completes the dataset initialization process, and the specific steps are as follows:
[0063] 1. The node reads the local Cifar10 dataset and loads it into a trainable data loader (DataLoader).
[0064] 2. The label of the dataset is read using the numpy.unique() function to obtain the label situation of the local dataset.
[0065] The specific steps of obtaining the label encryption vector of the node through the blockchain network are as follows:
[0066] 1. In the blockchain, the SIBFT consensus algorithm is used to divide the consensus network into multiple subnets, and subnet leader nodes SubLabel-leader (SLL) and subnet candidate leader nodes SubCandidate-leader (SCL) are elected in each subnet.
[0067] 2. The ReceiveLabel() function in the smart contract is used to receive the label vector Label vector from the node, and the subnet SLL verifies whether the node contains the label data to ensure the authenticity of the information.
[0068] 3. After verification, the EncryptLabel() function in the smart contract uses the RSA encryption algorithm to generate a public key and uses the public key to asymmetrically encrypt the Label vector.
[0069] 4. Each node obtains the label encryption vector corresponding to its own label through the GetLabelVector() function of the smart contract according to its own label.
[0070] Initialize the node identification vector V, the specific steps are as follows:
[0071] 1. The central node assigns node IDs to each federal edge node according to the order of the federal edge nodes.
[0072] 2. After each federal node obtains the node ID, a 1*1 array is generated, which contains the node ID in the array, that is, the node identification vector.
[0073] Step 3, the federal edge computing node inputs the node identification vector and the label encryption vector into the super model issued by the federal center node to generate the local LeNet model LocalNet.
[0074] The method for generating the local model LocalNet by the super model HNet is as follows:
[0075] 1. Each federal edge node inputs the node identification vector V and the label encryption vector e into the Embedding module of the super network HNet.
[0076] 2. The Embedding module of the super network HNet generates the intermediate quantity Embed identified by the parameter module.
[0077] 3. Input the generated Embed into a generated parameter module composed of a multi-layer automatic perception machine to generate the parameter features Features of the model.
[0078] 4. The parameter feature Features is input into the parameter storage module to generate the weight and bias of the 2-layer convolution layer and the 2-layer fully connected layer of the local LeNet model, respectively.
[0079] 5. An empty 2-layer convolution layer and a 2-layer fully connected layer are generated, and the weight and bias generated in step 4 are filled in. The local LeNet model is organized in the manner of a first-layer convolution layer, a pooling layer, a second-layer convolution layer, a pooling layer, a flattening layer, a first-layer fully connected layer, and a second-layer fully connected layer, and the activation function is selected as ReLu, to generate a local model LocalNet that can be trained and used.
[0080] Among them, each federal edge node inputs the node identification vector V and the label encryption vector e into the super network HNet, and if an incorrect label encryption vector e is input, the super network will not output correct model parameters.
[0081] Step 4: The federal edge computing node uses the processed Cifar10 dataset in step 2 to train the local model LocalNet, and obtains the gradient change Δθ after training.
[0082] The specific process of generating the gradient change using the local dataset is as follows:
[0083] 1. Each node saves the parameters before training.
[0084] 2. Each node uses the local model to update the model parameters in the gradient descent manner, and trains one round using the local dataset.
[0085] 3. The model parameters after training are subtracted from the model parameters before training to obtain the gradient change Δθ.
[0086] Step 5: According to the gradient change of the local model, the gradient change Δφ of the super model is calculated. The gradient change is sent to the federal center node.
[0087] Step 6: After receiving the gradient change Δφ of the super model from each federal edge computing node, the federal center node averages all the gradient changes, and updates the averaged super model gradient change to the super model HNet in the gradient descent manner.
[0088] Step 7: The federal center node sends the updated super model to each federal edge computing node, and repeats steps 2 to 6 until the specified number of rounds is reached.
[0089] In the eighth step, each federal edge computing node evaluates the Fisher information matrix according to the trained super model, submits the Fisher information matrix of itself through the smart contract of the blockchain, evaluates the model value, finally obtains the personalized layer parameters matched with itself, and integrates the obtained personalized layer parameters into the personalized layer of the local model.
[0090] The specific process of this step is as follows:
[0091] 1. Each federal edge node modifies the node identification vector, and inputs the modified node identification vector and the label encryption vector of itself into the super model HNet to obtain the model of each node model relative to the label distribution of itself.
[0092] 2. According to the generated models and the local model LocalNet, the Fisher information matrix is calculated to obtain the Fisher information value, which identifies the correlation between the models of other nodes and the local model of the node.
[0093] 3. The obtained Fisher information matrix is submitted to the blockchain through the smart contract of the blockchain.
[0094] 4. The blockchain collects the Fisher information matrix submitted by each federal edge node.
[0095] 5. The Fisher information matrix submitted by each node is regarded as the bid of each node to other models.
[0096] 6. The Kuhn-Munkras algorithm is used to calculate the global maximum value MaxValue and the model allocation method under the condition of obtaining the global maximum value, and the global maximum value after removing each node.
[0097] 7. The global maximum value MaxValue under the condition of the global maximum value is subtracted from the global maximum value under the condition of removing the bid of the node to all models to obtain the actual value of the model of the node.
[0098] 8. The actual value of each model is used as the model allocation method.
[0099] 9. Each node obtains the local personalized layer from the corresponding node according to the model allocated by the blockchain, and performs the average federation of the local personalized layer to obtain the local personalized layer after the federation.
[0100] 10. The local model subject and the local personalized layer of each federal edge node are organized. The organization mode is a series connection relationship. Data is first input to the model subject, the output of the model subject is input to the personalized layer, and the output of the personalized layer is used as the output of the model as a whole.
[0101] Embodiment 2:
[0102] As Figure 4 shown, the application also provides a personalized federated learning device based on a super network and a blockchain. The device includes at least one processor and at least one memory, and also includes a communication interface and an internal bus. The memory stores a computer execution program. When the processor executes the execution program stored in the memory, the device executes the personalized federated learning method based on the super network and the blockchain as described in Embodiment 1. The internal bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application does not limit to only one bus or one type of bus. The memory can include a high-speed RAM memory, and can also include a non-volatile storage NVM, such as at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0103] The device can be provided as a terminal, a server or other forms of devices.
[0104] Figure 4 is a block diagram of a device shown for example. The device can include one or more of the following components: a processing component, a memory, a power supply component, a multimedia component, an audio component, an input / output (I / O) interface, a sensor component, and a communication component. The processing component usually controls the overall operation of the electronic device, such as operations associated with displaying, making phone calls, data communications, camera operations and recording operations. The processing component can include one or more processors to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component can include one or more modules to facilitate the interaction between the processing component and other components. For example, the processing component can include a multimedia module to facilitate the interaction between the multimedia component and the processing component.
[0105] The memory is configured to store various types of data to support the operation of the electronic device. Examples of such data include instructions for any application programs or methods operating on the electronic device, contact data, phonebook data, messages, pictures, videos, and the like. The memory can be implemented by any type of volatile or non-volatile memory devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic memory, flash memory, magnetic disc or optical disc.
[0106] The power component provides power to various components of the electronic device. The power component can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device. The multimedia component includes a screen providing an output interface between the electronic device and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swiping, and gestures on the touch panel. The touch sensors can not only sense a boundary of a touching or swiping action, but also detect duration and pressure related to the touching or swiping action. In some embodiments, the multimedia component includes a front camera and / or a rear camera. The front camera and / or the rear camera can receive external multimedia data when the electronic device is in an operating mode, such as a shooting mode or a video mode. Each of the front and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0107] The audio component is configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory or transmitted via the communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0108] The sensor assembly includes one or more sensors to provide the electronic device with state assessments in various aspects. For example, the sensor assembly can detect the open / closed state of the electronic device, relative positioning of components, such as a display and a keypad of the electronic device, changes in position of the electronic device or a component of the electronic device, the presence or absence of user contact with the electronic device, the electronic device's orientation or acceleration / deceleration, and a temperature change of the electronic device. The sensor assembly can include a proximity sensor configured to detect presence of a nearby object without any physical contact. The sensor assembly can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0109] The communication component is configured to facilitate wired or wireless communication between the electronic device and another device. The electronic device can access a wireless network based on a corresponding communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an example embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra-WideBand (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0110] In an example embodiment, the electronic device can be implemented using one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic elements to perform the above-described methods.
[0111] Embodiment 3:
[0112] The application also provides a non-volatile computer readable storage medium, wherein the computer readable storage medium stores a program or instructions, and the program or instructions, when executed by a processor, cause the computer to perform the personalized federated learning method based on a super network and a blockchain as described in Embodiment 1.
[0113] In particular, a system, apparatus or device can be provided with a readable storage medium on which software program codes for implementing the functions of any of the above embodiments are stored, and a computer or processor of the system, apparatus or device is caused to read and execute the instructions stored in the readable storage medium. In this case, the program codes read from the readable medium can implement the functions of any of the above embodiments by themselves, and thus the machine readable codes and the readable storage medium storing the machine readable codes constitute a part of the present application.
[0114] The storage medium described above can be realized by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk (such as CD-ROM, CD-R, CD-RW, DVD-20ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tape, etc. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0115] It should be understood that the processor described above can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the application can be directly embodied as hardware processor execution, or executed by a combination of hardware and software modules in the processor.
[0116] It should be understood that the storage medium is coupled to the processor, so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in the terminal or server.
[0117] The computer readable program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0118] Computer readable program instructions for carrying out operations of the present disclosure can be assembly instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or any combination of source code or object code in any combination of one or more programming languages including an object oriented programming language such as Smalltalk, C++ or the like and conventional procedural programming languages such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.
[0119] The specific implementation described above is merely an example of the application and is not intended to limit the scope of the application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the application shall be included in the protection scope of the application.
[0120] The above has described the specific embodiments of the application, but is not intended to limit the protection scope of the application. It should be understood by those skilled in the art that various modifications or changes can be made to the technical solutions of the application without creative labor, and still fall within the protection scope of the application.
Claims
1. A personalized federated learning method based on super network and blockchain, characterized in that, The method is applied to a scene of a federal center node and K federal edge computing nodes, each of which is connected with the federal center node, and the method comprises the following steps: Step 1, the federal edge computing node receives the hypernetwork HNet initialized by the federal center node, and starts the federal learning process; Step 2, the federal edge computing node initializes a node identification vector V, and obtains a label encryption vector of the node through a blockchain network; Step 3, the federal edge computing node inputs the node identification vector and the label encryption vector into the hypermodel issued by the federal center node to generate a local model LocalNet; Step 4, the federal edge computing node trains the local model LocalNet using a local data set D to obtain a gradient change Δθ after training; Step 5, the federal edge computing node calculates the gradient change Δφ of the hypermodel according to the gradient change Δθ of the local model, and sends the gradient change to the federal center node; Step 6, the federal edge computing node sends the gradient change Δφ of the hypermodel to the federal center node, the federal center node averages all the gradient changes, and updates the averaged hypermodel gradient change to the hypernetwork HNet by using gradient descent; Step 7, the federal edge computing node receives the updated hypermodel sent by the federal center node, and repeats steps 2 to 6 until a specified round is reached; Step 8, the federal edge computing node uses the hypermodel finally generated in step 7 to generate a node model, evaluates a Fisher information matrix, and submits the Fisher information matrix of itself through a blockchain smart contract to evaluate the value of the model, and finally obtains personalized layer parameters matched with itself, and integrates the obtained personalized layer parameters into the personalized layer of the local model; the specific process is as follows: S81, each federal edge node modifies the node identification vector, and inputs the modified node identification vector and the label encryption vector of itself into the hypernetwork HNet to obtain a model of each node model relative to the label distribution of itself; S82, calculate the Fisher information matrix according to the generated model and the local model LocalNet, and obtain the Fisher information value, which identifies the correlation between the model of other nodes and the local model of the node; S83, submit the obtained Fisher information matrix to the blockchain through the smart contract of the blockchain; S84, the blockchain collects the Fisher information matrix submitted by each federal edge node, and calculates the actual value of each node model and the model distribution mode optimal for the global benefit through a VCG auction process, and the specific process is as follows: S841, a two-dimensional array with an accuracy of N*N calculated through the Fisher information matrix is used as the input of the VCG mechanism calculation, and the Fisher value of each node to other node models can be considered as the bid of the node to other models; S842, the global maximum value MaxValue and the model distribution mode under the condition of obtaining the global maximum value, and the global maximum value after removing each node are calculated by using the KM algorithm; S843, then calculate the actual value RealCost of each node model by N times of subtraction; S844, output the actual value of each model and the model allocation mode with the maximum global value as output; S85, each node obtains the local personalized layer according to the model allocated by the blockchain, and performs average federation of the local personalized layer to obtain the federated local personalized layer.
2. The personalized federated learning method based on super network and blockchain of claim 1, wherein, The label encryption vector of the node is obtained through the blockchain network in step 2, and the encryption vector is obtained through the blockchain network before training and includes the following process: S21, using SIBFT consensus algorithm in the blockchain, the consensus network is divided into multiple subnets, and subnet leader nodes SLL and subnet candidate leader nodes SCL are elected in each subnet; S22, using the label vector Label vector received from the node by the receiving label function in the smart contract, the subnet leader node SLL verifies whether the node contains the label data to ensure the authenticity of the information; S23, after verification, the encryption label function in the smart contract generates a public key using RSA encryption algorithm, and uses the public key to asymmetrically encrypt Label vector and distribute it to the federated edge computing node with the Label.
3. The method of claim 1, wherein, The specific process of generating the local model LocalNet in step 3 is as follows: S31, input the node identification vector V and the label encryption vector e into the Embedding module of the hypernetwork HNet; S32, the Embedding module of the hypernetwork HNet generates the intermediate quantity Embed identified by the parameter module; S33, input the generated Embed into the generated parameter module composed of a multi-layer automatic perception machine to generate the parameter features Features of the model; S34, input the parameter features Features into the parameter storage module to generate the weight and bias of each layer network of the local model LocalNet main body respectively; S35, fill in the model class according to the weight and bias of each layer of the local model LocalNet main body, and load it into a model that can be trained and used.
4. The method of claim 1, wherein, The local model LocalNet contains a local layer, which is as follows: Each federated edge computing node contains a local model belonging to the node, and the local model includes a model main body and a local full connection layer; The model main body is generated by the hypernetwork HNet before each training, and the local layer is initialized by the local node before the first training, and is retained after the previous training in the local node in the remaining rounds; When the federated edge node uses local data for training, the data is first input to the model main body, the output of the model main body is used as the input of the personalized layer, and the output of the personalized layer is used as the output of the entire model. Each part is subjected to gradient descent to update the model parameters.
5. The method of claim 1, wherein, The hypernetwork HNet outputs different models according to the input label encryption vector, which has a model encryption function, and the encryption method is as follows: When the correct label encryption vector is input to the hypernetwork HNet, the output model can correctly predict the label of the local data, and when an incorrect or illegal label vector is input, the output model of the hypernetwork HNet cannot correctly predict the label of the local data.
6. The method of claim 1, wherein: The hypernetwork HNet comprises an Embedding module, a generated parameter module and a parameter storage module; The Embedding module is used for converting the input node identification vector V into an intermediate quantity Embed that can be recognized by the generated parameter module; The generated parameter module is a multi-layer automatic perception machine, and the function is to generate parameter features Features according to the input intermediate quantity Embed; The parameter storage module generates the weight and bias quantity of the target network layer according to the target network structure to be generated, and each target network layer corresponds to two linear layers of the parameter storage module.
7. A super network and blockchain based personalized federated learning device, characterized in that: The device comprises at least one processor and at least one memory, and the processor and the memory are coupled; the memory stores a computer execution program; when the processor executes the computer execution program stored in the memory, the device executes the personalized federated learning method based on the hypernetwork and the block chain as claimed in any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that: The computer readable storage medium stores programs or instructions and data, and when the programs or instructions are executed by the processor, the computer executes the personalized federated learning method based on the hypernetwork and the block chain as claimed in any one of claims 1 to 6.
Citation Information
Patent Citations
Federal learning method and device, equipment and storage medium
CN112784995A
Decision model training method and device based on federated learning and federated learning system
CN114897067A